sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
f0ed56dd835e824a12a7d6b8666d8443642c6b8f589a0939c9f5a4653b86f1f9
Python
46,279
1,045
from dataset import GaborDatasetOrientation, Digit from torch.utils.data import DataLoader import torch import torch.nn.functional as F from dataset.utils import NoisyDataset, OcclusionDataset import numpy as np from sklearn.linear_model import LogisticRegression from sklearn import svm from sklearn.metrics import acc...
41623163d34f548d7170597adcb15bac14d08596257f9af76fa4e9bae35dad2b
Python
46,343
2,034
import sys import mne import numpy as np import scipy as sp from sklearn.base import BaseEstimator, TransformerMixin from sklearn.pipeline import make_pipeline from pyriemann.estimation import Shrinkage from pyriemann.tangentspace import TangentSpace from preproc.utils.transformer import PFD, HFD, Hurst from pyriema...
b02746475d0ca6afb342286a0cf8d42b884e3679d49a176a12c12732bf8b02d0
Python
46,574
1,285
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2020 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ Implements support for high-level dataset ac...
cb0a5b8beabcc589bfd9ed133c27b3a8d8b8019f5205ba60e7c33dfe7a86b27e
Python
46,593
1,062
""" Approximate a 3D curve with a B-Spline curve from either a set of data points or a set of control points If a set of data points is given, it generates a B-spline that either approximates the curve in the least square sense or interpolates the curve. It also computes the derivative of the 3D curve. getCourbe3D() r...
05426c3824b4bc2eea4730c16907ea03c658e889c1448a5c7199b5b7b2df2de6
Python
46,693
1,293
# Cell detection methods # Author: David Young, 2017, 2024 """Detects features within a 3D image stack. Prunes duplicates and verifies detections against truth sets. Attributes: CONFIRMATION: Dictionary of blob confirmation flags. OVERLAP_FACTOR: Pixel number multiplier for overlaps between adjacent ROIs. ""...
924a861c3a4bbc2c04a5c36b02b8fc2b0e60356bc8f66f7a8bd1d2cd16e4312a
Python
46,949
1,153
import os import pathlib import shutil from unittest import TestCase import numpy as np import pandas as pd from pyalfe.data_structure import ( DefaultALFEDataDir, PatientDicomDataDir, Modality, Orientation, Tissue, ) from pyalfe.image_processing import Convert3DProcessor from pyalfe.image_registr...
aff3e40f0e44a819ab199619e12a315495bfc6ca0e44f7c62e7d650ad2d5b420
Python
46,965
1,135
import contextlib import glob import inspect import logging import logging.config import math import os import platform import random import re import signal import sys import time import urllib from copy import deepcopy from datetime import datetime from itertools import repeat from multiprocessing.pool import ThreadP...
552d7b719cce1950e652dea915b5ba1cba497595a60078bbc13a6815a5a92b30
Python
46,983
1,381
import importlib import os from os.path import dirname, abspath from sys import stdout from multiprocessing import Pool from typing import List, Tuple, Optional, Dict, Set, Union import yaml from kgx.validator import Validator from kgx.sink import Sink from kgx.transformer import Transformer, SOURCE_MAP, SINK_MAP fr...
69a46b44e8625f509791352bd09beaafe589cd7d872721384e63d37f9fdc6e41
Python
46,983
909
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import torch.distributed import torch.nn.functional as F from torch.nn.init import trunc_normal_ from sam2....
e00ac78686e40eabc69180925e5985038ea7dcbb7d9db05f73e8169d59bbc871
Python
47,038
1,248
from typing import List from urllib.parse import urlencode import requests import logging from medperf.enums import Status import medperf.config as config from medperf.comms.interface import Comms from medperf.utils import sanitize_json, log_response_error, format_errors_dict from medperf.exceptions import ( Commu...
8badacca0d0870aadce2ee6311eae3f0651081bc253d5039c65967567c070c37
Python
47,119
1,187
# -*- coding: utf-8 -*- import copy import datetime import json import pytz from itertools import chain from django.db import connection from catmaid.models import Connector from catmaid.tests.apis.common import CatmaidApiTestCase from catmaid.control import stats from catmaid.control.common import get_relation_to_i...
b4c19ce6fead25d58351a099f2c27be7e99b875258757f72bf879cae966c2c92
Python
47,209
35
import numpy as np from model.Source import Source class Pipeline(): def getPipeline(self): return [None] class DataManager(): def getCurrentPipeline(self): return Pipeline() class Plot(): def clear(self): pass def setData(self, *args): pass cell_me...
6962c095256370cde24a4c55f3dd8c5cbec09b2b9acb61ce2787cdd630b77d24
Python
47,260
1,016
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import math from utils import map_activation_str_to_layer, batch_convert_len_to_mask, mask_seq_by_len, extend_dimensions, gather_indices_by_lens _INF = -1e30 def get_multi_head_attn_vec(head_q, head_k, head_v, attn_mask=Non...
1c8eba60a5ddc11dbbee7fbcc5a5184c2b76362bd277544ca1516170e2428c58
Python
47,294
1,197
from PyQt5.QtWidgets import (QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QLineEdit, QHBoxLayout, QWidget, QCheckBox, QGridLayout, QFrame, QGraphicsView, QGraphicsScene, QPushButton, QComboBox, QMainWindow, QSpacerItem, QBoxLayout, QSizePolicy, QFileDialog) fr...
03ef0ac5b0d17cbcc5b9d60fe27358687cfbcaa9efdc174826b290b7f930a6e2
Python
47,306
1,248
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 13 15:25:24 2022 @author: george """ #%matplotlib qt #%gui qt import warnings warnings.simplefilter(action='ignore', category=Warning) import numba import numpy as np import pandas as pd from tqdm import tqdm import os, glob import json, code...
be5b01e688e95edd694d139194f598b3df5dadb38111c21badc696aabac353d8
Python
47,384
1,435
# src/zndraw_joblib/router.py import asyncio import json import logging import random import re from datetime import UTC, datetime from typing import Annotated from uuid import UUID from fastapi import APIRouter, Depends, Header, Query, Request, Response, status from sqlalchemy import and_, func, update from sqlalchem...
10fbd30b4a64fb627c8bd85cd95a3f58b93f18a2f8c0bfc46b2b542ad351ae5c
Python
47,468
867
import logging import pickle import scipy.io import freesurfer as fs import sys from .utilities import Specification from .BiasField import BiasField from .ProbabilisticAtlas import ProbabilisticAtlas from .GMM import GMM from .Affine import Affine from .SamsegUtility import * from .merge_alphas import kvlMergeAlphas,...
e3f31f4c90cad4997d5d2a91dcc7e5af1df8908263e3c10f4635e52f73ace020
Python
47,496
1,334
from collections import defaultdict from itertools import chain import json from typing import Any, DefaultDict, Dict, List, Optional, Tuple from django.db import connection from django.http import HttpRequest, JsonResponse from django.utils.decorators import method_decorator from catmaid.control.authentication impor...
1d861c245079012202f58c523bbb8448bb2ddd487667c934de0ca1dccd80ba87
Python
47,512
1,290
"""Callbacks: utilities called at certain points during model training. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import csv import six import numpy as np import time import json import warnings import io from collections import deque f...
f0a78fe2877ebd033a7e5a22428950d2793ef715857119b83db7e780bab6eaaf
Python
47,519
973
#!/usr/bin/env python """ 1. Unlock scans_tsv and update it based on runtype metadata 2. Harmonize discrepancy between nifti and behavioral data 3. Starting from Line 242, Behavioral data conversion to BIDS valid format Same format occurs for pain, vicarious, cognitive data convert behavioral file into event lists and ...
e915e920fe1cb1d7dd2e0b5dd5fe4e48c20b54465e160915e21042feb935eac3
Python
47,533
1,052
#!/usr/bin/env python # # Copyright 2016, Daehwan Kim <infphilo@gmail.com> # # This file is part of HISAT 2. # # HISAT 2 is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (...
a643cd4db70b3794cef74688fcf8404ed12a3f00ef6fb0bca6d18e75987751e4
Python
47,555
863
#!/usr/bin/python """ This file will hold all the classes for a specific case which is SFS. This should taken as example how to use ABC-DLS rather than only way to use it """ import itertools import os import sys from multiprocessing import Pool as ThreadPool # type hint for readability from typing import Optional, Uni...
9d55b14994da521189197e319f2c1c4a62638238a7c59a24cc992839757fcedc
Python
47,738
1,236
""" Module to define interface, workflow and CLI for the review of functional MRI data. """ import argparse import sys import textwrap import warnings from abc import ABC from os.path import basename, join as pjoin, realpath from textwrap import wrap import nibabel as nib import numpy as np from matplotlib import py...
adbdd4f3f4681771a969607a0ba8718a2fe1b18563df436e5957504849512a0a
Python
47,945
1,271
# ############################# # # Copyright (C) 2018 # Jennifer Dreiling (dreiling@gfz-potsdam.de) # # # ############################# import os import glob import logging import numpy as np import os.path as op import matplotlib.cm as cm import matplotlib.pyplot as plt from collections import OrderedDict from Ba...
2cec7770fd5b153995bb2fdea79960cf210dcf71e5ed886b448c10cfe6d91e0f
Python
47,972
1,034
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import math from utils import map_activation_str_to_layer, batch_convert_len_to_mask, mask_seq_by_len, extend_dimensions, gather_indices_by_lens _INF = -1e30 def get_multi_head_attn_vec(head_q, head_k, head_v, attn_mask=Non...
fda0c1db08e14b69d33486ed60bac589fc4ea840d37c0d1787c272741d8258a2
Python
48,288
1,165
# This document holds the functions used as part of # the poro-mechanical modelling of living tissues # according to the theory in ./Theoretical_Developments.pdf # # Author: Thomas Lavigne # Date: 18/09/2024 def readme_CL(): print('This document holds the functions used as part of the poro-mechanical modelling of l...
eba79c1ab5d81d14d106df25dbfddb9297646ef933d75c218ad75b1518b57407
Python
48,522
1,147
import contextlib import copy import json import logging import threading import time import numpy as np from . import config, constants, features, log, utils from .pipeline import ( _ERROR, _SENTINEL, AsyncWriter, PipelineCancelled, PrefetchBuffer, ) __all__ = [ "Featurizer", ] logger = log...
e5c74a5d4e21c3013722c8e58c144623c0c606c64bc4abf999e5325651b44248
Python
48,537
957
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://w...
675c85686fc5786180757471ca91aaa6341e70ec7e9bf4f67c993d84b874afc2
Python
48,582
1,330
# Author: Huaxu Yu # A module to summarize the premade data processing workflows. # Import modules import os from copy import deepcopy from importlib.metadata import version import multiprocessing import pickle import time from joblib import Parallel, delayed import pandas as pd import numpy as np from tqdm import t...
16273a220d4ddcd45165e4bea20d87dffb6617d8d9bc3444859bbaba620bcdae
Python
48,741
1,239
# Computer vision library functions for n-dimensions. # Author: David Young, 2018, 2019 """Computer vision library functions for n-dimensions. """ from typing import List, Optional, Sequence, Tuple, Union import numpy as np from scipy import interpolate from scipy import ndimage from skimage import filters from skima...
6f1d2977ca48ec988a42e204f80459f9c5c678d7d28469fdd8e010565700c7a9
Python
48,757
1,476
# -*- coding: utf-8 -*- # This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ Group test module. ...
f4e1313e5ce5ed7f0dae4a0130e91d3404dbee612b09cf7e571ecaeac4023297
Python
49,069
1,236
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jun 2 14:59:21 2023 @author: george """ import pyqtgraph as pg from qtpy.QtCore import * from qtpy.QtGui import * from qtpy.QtWidgets import * from distutils.version import StrictVersion import os, shutil, subprocess import errno import flika from fl...
14798eebd8404850f8485031e3c52769e9842599e46e4fc40269edb7fcce3388
Python
49,156
1,207
""" Freesurfer QC module to rate the anatomical accuracy of pial and white surfaces """ import argparse import subprocess import sys import textwrap import time import traceback from abc import ABC from os import makedirs from pathlib import Path from subprocess import check_output from warnings import catch_warning...
ffca2efebd97cdb307a390c13a65b243635aceea28bb24cd553720f5bdc31dcd
Python
49,212
1,221
from seqUtil import * from bamUtil import * from nanoUtil import * from nntUtil import * import matplotlib.pyplot as plt import matplotlib.patches as mplpatches import numpy as np from sklearn.cluster import KMeans from sklearn.impute import SimpleImputer from collections import defaultdict from sklearn.metrics import ...
22773066051704c93a759cb72eb7243cc2f6f5f4d24b872adee948f79c8be6d9
Python
49,240
1,372
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging from typing import Dict, Optional, Union import numpy as np import torch from torch_scatter import segment_coo from ocpmodels...
d7ad4256d489af23dbddccf2e200da1cb0fce5db8157a886b1eaa01ba5f5549f
Python
49,340
1,097
# -*- coding: utf-8 -*- """Convolutional-recurrent layers. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from .. import backend as K from .. import activations from .. import initializers from .. import regularizers from .. import constraints from .rec...
043d7cea15cf97d76d91972bce8966712a8ffe71025b358ceacfe225a7f7f0ef
Python
49,428
898
#!/usr/bin/env python """convert behavioral file into event lists and singletrial format This code acknowledges frractional tasks as standalone subtasks. The file names take the format fractionaltomspunt, fractionaltomsaxe, fractionalmemory, and fractionalposner - regressor of interest per task - duration of epoch - r...
fca4d2df6f05682baa318d46821d8fcff0bb83a44ff2ab7d79b79c15f12e357b
Python
49,437
1,400
# -*- coding: utf-8 -*- # encodermap/plotting/dashboard.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade # # Encodermap is free softw...
9ed0b49f798628f17775dac757d0c31f2f0085762ecacb93690bed43c1829ff9
Python
49,470
1,245
"""Generate tutorial screenshots for the GuPPy documentation. Run with: uv run --group test python docs/take_screenshots.py Screenshots are saved to docs/_static/images/ and should be committed to the repository. Re-run this script whenever the GUI changes. Playwright browser binaries must be installed: uv r...
dd86bee277e83e51a1cc385c344661f0379d7a5971e9666a847c038431c2d558
Python
49,618
1,388
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging from typing import Dict, Optional, Union import numpy as np import torch from torch_scatter import segment_coo from ocpmodels...
079fc0bf5d78fe5b5a7c0c4cf61c7cfab6178a3c2a2eb3aec20ea83e31473fa3
Python
49,697
1,362
"""Module to sample electrical model parameter space with MCMC.""" # Copyright (c) 2022 EPFL-BBP, All rights reserved. # # THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS'' # AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A ...
7dbb3f230cfb431f394dc425a6675ae6714cc1a095816141b5ef42cbc2b129fc
Python
50,095
1,622
"""Utility functions for brainbuilder.""" import ast import contextlib import json import logging import multiprocessing import os import re from collections.abc import Iterable from subprocess import PIPE, STDOUT, Popen from typing import List, Optional, Tuple, Union import ants import imageio import nibabel import ...
8d94747301f94663a629903091916b0ad3d2af3f7e0b9dde8b4b54e2a12fa643
Python
50,517
1,058
# New matplotlib colormaps by Nathaniel J. Smith, Stefan van der Walt, # and (in the case of viridis) Eric Firing. # # This file and the colormaps in it are released under the CC0 license / # public domain dedication. We would appreciate credit if you use or # redistribute these colormaps, but do not impose any legal r...
b1a092f7def0a09ecae77b0ff6b1cfd36eba6dee9bec7a81718a882164f5bc49
Python
50,568
1,297
import os.path import torch from torch.utils.data import DataLoader, Dataset import pytorch_lightning as pl import numpy as np import h5py import logging import yaml from typing import NamedTuple import nibabel as nib import glob from medutils.mri import ifft2c, rss, fft2c from scipy.ndimage import binary_erosion from ...
f2be9a5daa222bc5ca6834761766e282d66679a03a33b2dfa5f4344252bf80d5
Python
50,680
1,316
""" This code started out as a PyTorch port of Ho et al's diffusion models: https://github.com/hojonathanho/diffusion/blob/1e0dceb3b3495bbe19116a5e1b3596cd0706c543/diffusion_tf/diffusion_utils_2.py Docstrings have been added, as well as DDIM sampling and a new collection of beta schedules. """ import enum import math...
0da3c93973ba3b076a65ccacf0886b474e27f6e3e5e01cd518629f8f4ae04997
Python
50,715
1,182
# -*- coding: utf-8 -*- import django.utils.timezone from django.conf import settings import django.contrib.postgres.fields.jsonb from django.db import migrations, models import django.db.models.deletion forward = """ -- Create table that represents a 3D grid in project space. CREATE TABLE node_grid_cache ( ...
170b7fe172ca3d43fe400e652199760d3dc7f5d80e0742b13ff0f5d4896cbe25
Python
50,730
1,360
# -*- coding: utf-8 -*- import copy import json import logging from datetime import datetime, timedelta from collections import defaultdict from typing import Any, DefaultDict, Dict, List, Tuple, Union from django.db import connection from django.db.models import Count from django.shortcuts import get_object_or_404...
ab16c45823aadb25b0027573966e3a71724d88e533112b6b996d6cf5718c5a84
Python
50,737
1,425
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging from typing import Dict, Optional, Union import numpy as np import torch from torch_scatter import segment_coo from ocpmodels...
e881d3ed96bc3f36a25328a6ff876a81c6e93fbd679ea00a5f2d8fc11f674dda
Python
50,741
1,425
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging from typing import Dict, Optional, Union import numpy as np import torch from torch_scatter import segment_coo from ocpmodels...
26101fc165f393ef51505a2cb7df10db72fcdfb4f02e8e79d4c161380e13e1eb
Python
50,743
1,189
# -*- coding: utf-8 -*- from itertools import chain import json import logging from timeit import default_timer as timer from typing import Any, Dict, List from celery import shared_task from celery.utils.log import get_task_logger from django.contrib.gis.db import models as spatial_models from django.db import conne...
96bf0f9b7c06c6c79e1fe242954a386ceb2a2ff90caabc885fb2cae8727ba889
Python
50,782
1,330
import os import re import copy import inspect import functools import collections.abc from itertools import chain from textwrap import indent, dedent from collections.abc import Iterable, Collection import numpy as np import pandas as pd from ..utils import ensure_list_args, ensure_list_attrs, IsNull, NotNull, cyphe...
8d3a04b34a8ea157108f74cb9c8b1e7e03642743c990678e0ddf34d6cd430263
Python
51,400
1,423
import os import re import numpy as np import pandas as pd import gzip import pickle from auditory_cortex import opt_inputs_dir, results_dir, cache_dir, normalizers_dir, saved_corr_dir from auditory_cortex import valid_model_names from memory_profiler import profile import logging logger = logging.getLogger(__name__) ...
2f59c94a5cae9cc4a7a58eba61fe2e18ebcb183445a6ddc5da00fe6384760f77
Python
51,409
1,123
# Copyright DST Group. Licensed under the MIT license. import gym from gym.utils.seeding import RandomNumberGenerator from typing import Dict, List, Tuple from CybORG.Shared import Scenario from CybORG.Shared import Enums from CybORG.Shared.AgentInterface import AgentInterface from CybORG.Shared.Enums import DecoyType...
bfa808ad7d58bb90671dcce9c235c3e17179f90a3b976e2d912ab8d780e61e25
Python
51,482
1,546
import json import os import pickle import re import tempfile import warnings from typing import Optional import numpy as np import pytest from sklearn.utils.estimator_checks import parametrize_with_checks import xgboost as xgb from xgboost import testing as tm from xgboost.testing.ranking import run_ranking_categori...
a5482df63fda4d9b1ed0fb84a864d4ba1497eb143b149c14dbf1541e75e381eb
Python
51,651
1,766
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # reference: https://bids-specification.readthedocs.io/en/stable/06-longitudinal-and-multi-site-studies.html#sessions-file import os import pandas as pd project_name = 'zoo-bids' path_root = os.getcwd().split(project_name)[0] + project_name class Session: def __ini...
f1cf8c723522c35fda88895f3056e7888a2701539263f3d233f4eb011b7ee020
Python
51,858
1,146
import torch import numpy as np from tqdm import tqdm import sys import matplotlib.pyplot as plt from ..models.constants import ConsensusInitializationMode, RegularizationMode from ..models.losses import GeometricLoss, denoisloss from ..utils.utils_new import frc, fourier_loss, power_spec2, count_interior_points def...
93459e50116d9e209c95ec393a5ea09311fb2b208f33230139fba3696bd23ca1
Python
51,907
1,092
import time from PyQt5 import QtWidgets, QtCore import numpy as np from copy import deepcopy from features.AdjustFrequency import AdjustFrequency from features.EventDetection import SpikeDetection, BurstDetection from model.Object import Object from util.conf import af_params, cs_roi_params class DataManage...
28d0eec436fc6645be39d7e7cc6b819502336cab564384fc5135b02d940237cd
Python
52,065
1,521
# -*- coding: utf-8 -*- from itertools import chain import io import logging import json import os import re import struct import sys import trimesh import numpy as np from typing import Any, Callable, Dict, List, Sequence, Tuple, Union from xml.etree import ElementTree as ET from django.conf import settings from dja...
87115481a063356fa49372cb44e3a1e7d06f17d57d45987435439584e68d3512
Python
52,326
1,358
""" Beware, this file is long and horrid. Bespoke plotting functions to derive each mRS distribution. To do, pep-8 this """ import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from outcome_utilities.dist_plot import draw_horizontal_bar, \ draw_connections, draw_horizontal...
f608dae38378d64e0f38cbb0682394574a76c0e7586676be0d21f636c611509a
Python
52,350
1,597
""" Adapter finding and trimming classes The ...Adapter classes are responsible for finding adapters. The ...Match classes trim the reads. """ import logging from enum import IntFlag from collections import defaultdict from typing import Optional, Any, Union from collections.abc import Sequence from abc import ABC, a...
c573f8b9aac0bd29f2b954a299b9198600802023a9126d6fb53a6fb0a1bac9e4
Python
52,468
1,289
import freesurfer as fs import numpy as np import sys,os import voxelmorph_sandbox as vxms import voxelmorph as vxm import nibabel as nib from tensorflow import keras import tensorflow as tf from tensorflow.keras import layers as KL from tqdm import tqdm import copy def build_atlas(model, wt_fname, sphere_gen, target...
54671ff0c78297a11799e489fe60788de4c75ac9c339b80455002c493a5eee5f
Python
52,741
1,193
import logging import math import re from collections.abc import Callable from io import BytesIO from pathlib import Path from typing import ClassVar import datashader as ds import holoviews as hv import matplotlib.pyplot as plt import numpy as np import pandas as pd import panel as pn import param import selenium fro...
361b2a2999caa9bcf9e49f5bb022c6f7a99fb07863beaea6c17d8c2cb25c1781
Python
52,812
1,524
#!/usr/bin/env python3 import numpy as np from collections import defaultdict import scipy.sparse as sp import sys g_verbose = False g_reuse_multigridop = True def get_shift_csr(dw, nw, zeropad=True, mod=None, dtype=None): ''' Returns a shift matrix on a grid of size `nw`. Acting on a field, the matrix ...
57e5d3c273fa0298971bdab22fba285efc7229d503f718b2014dd6c19171bbdb
Python
52,859
1,386
""" Tuning module for Ewald summation parameters. This tuning module is refactored from: https://github.com/lab-cosmo/torch-pme/tree/main/src/torchpme/tuning """ from jax.ops import segment_sum from mlff.masking.mask import safe_scale, safe_mask from mlff.nn.observable.observable_sparse import mixing_rules, gamma_cubi...
3ff9009d8bfce06630e434eb8d87b1238bccdb2708edd93edf115c5ef55c0e75
Python
53,317
1,325
# -*- coding: utf-8 -*- from collections import defaultdict import itertools import math import networkx as nx import re from typing import Any, DefaultDict, Dict, List, Union from django.db import connection from django.http import HttpRequest, JsonResponse from django.shortcuts import get_object_or_404 from rest_f...
a6067d72d57f3d2cf0a24490261a102afdb98aaf872d4899bf0c7301e45214bc
Python
53,389
1,383
from __future__ import print_function from __future__ import division # from builtins import str from builtins import range import os import numpy import sciunit import hippounit.capabilities as cap from quantities import ms,mV,Hz from neuron import h import multiprocessing import zipfile import collections import co...
a223522e454daec082be064a5c2d785805f9d6796651e4645001aee0b3d9aa01
Python
53,449
1,356
#!/usr/bin/env python # Command line parsing and setup # Author: David Young, 2017, 2020 """Command line parser and and environment setup for MagellanMapper. This module can be run either as a script to work in headless mode or loaded and initialized by calling main(). Note on dimensions order: User-defined dimensi...
25d00a4c0469e2e960c7d7d184e388c8752e4f58e3c7f68fcac33dcc5fa3d5b5
Python
53,686
1,182
from typing import Tuple, Optional, List import torch import torch.nn import torch.nn.functional as F from torch import nn as nn from tqdm import tqdm import sys import mrcfile from dynamight.models.blocks import LinearBlock from dynamight.models.utils import positional_encoding, initialize_points_from_volume from dyn...
d8b67e2c6115ecfd8a8896d8d5e95821bdc22ebefd4dcdff85a77e197054cd3b
Python
53,854
795
# This document holds the functions used as part of # the poro-mechanical modelling of living tissues # according to the theory in ./Theoretical_Developments.pdf # # Author: Thomas Lavigne # Date: 18/09/2024 def readme_VF(): print('This document holds the functions used as part of the poro-mechanical modelling of l...
665ef0506201f61bf62f9d406af8cc7831c06e41935ef03c5dc8f8efa7e53b92
Python
54,111
795
# This document holds the functions used as part of # the poro-mechanical modelling of living tissues # according to the theory in ./Theoretical_Developments.pdf # # Author: Thomas Lavigne # Date: 18/09/2024 def readme_VFNH(): print('This document holds the functions used as part of the poro-mechanical modelling of...
7904b45533f513d73527072e170de0de08ab9160a472160806f26112939c8222
Python
54,259
1,501
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Aug 5 12:24:45 2021 @author: schwab """ from pathlib import Path from typing import Sequence, Optional import numpy as np import matplotlib import matplotlib.pyplot as plt import torch import torch.nn as nn import torch.fft from sklearn.decomposition ...
025016c07f4f76e6bb69b8c461d10d82fa6928bd4af7b1a5892e16c79e1eac66
Python
54,304
1,154
import numpy as np from skimage.transform import resize import os import tkinter as tk from tkinter import filedialog from tifffile import imread,imwrite from tkinter import ttk import tkinter as tk from tkinter import ttk, PhotoImage from read_imagej_rois import imagej_rois import matplotlib.pyplot as plt f...
d0b147eadd4e2094c0116199d6ddd4214c553341ae742f402a8c7dc8177be32e
Python
54,487
1,335
"""Model saving utilities. """ from __future__ import print_function from __future__ import absolute_import from __future__ import division import os import json import yaml import inspect import warnings import tempfile from six.moves import zip from six import string_types from functools import wraps import numpy a...
7b0f6f517ddaa894efb5e00a6145bb8d7decd4a7dc8b7931676e9cc1c8413205
Python
54,495
1,233
import ast import contextlib import json import math import platform import warnings import zipfile from collections import OrderedDict, namedtuple from copy import copy from pathlib import Path from urllib.parse import urlparse from typing import Optional import cv2 import numpy as np import pandas as pd import requ...
74e72f6ee5df2faa513868000b33d9415c9ea0edc61d3830baedd1244ab80867
Python
54,948
1,085
# coding: utf-8 # Copyright 2019 Sinovation Ventures AI Institute # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
057558b6baf859cb651629cd78de33db3dec6146e2c4a43716dd881404c89ae2
Python
55,073
1,604
from lapy import TetMesh, TriaMesh, Solver from lapy.diffgeo import compute_geodesic_f import warnings import subprocess import tempfile import os import nibabel as nib import numpy as np from scipy.spatial import Delaunay, KDTree from scipy.spatial.distance import squareform, pdist from brainspace import mesh as me ...
27e134832d21b29964da1a2396ed75dbb682409043d2008917bf4fc294b4bbf2
Python
55,156
1,198
import os import copy import threading import warnings from concurrent.futures import ThreadPoolExecutor from textwrap import indent, dedent import ujson import pandas as pd from ..client import inject_client, NeuprintTimeoutError, _deepcopy_no_register from ..utils import ensure_list_args, tqdm from .neuroncriteria ...
c5d61dfd91816103649490b57f280d10bbce148191d09ec7e5103b9964199454
Python
55,355
1,408
# # Copyright (c) 2010 Marcel Martin <marcel.martin@scilifelab.se> and contributors # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rig...
106d73ce7f21c4d9402a1cce685a59e446ff14c032f6ac57275c69064033638c
Python
55,417
1,801
# pylint: disable=too-many-arguments, too-many-branches, too-many-lines # pylint: disable=too-many-return-statements """Data dispatching for DMatrix.""" import ctypes import functools import json import os import warnings from typing import ( TYPE_CHECKING, Any, Callable, Dict, List, Optional, ...
ce56950d310964473c5e7f3947a3e3e6c7027aedcea19b42edfd2838ae25b3d8
Python
55,466
1,434
"""Classes and methods relevant for all CWL Process types.""" import abc import copy import functools import hashlib import json import logging import math import os import shutil import stat import textwrap import urllib.parse import uuid from collections.abc import ( Callable, Iterable, Iterator, Map...
bb71287879b2de71cf6df2b5e80f4bec08ff213a4e8389b417c10eeabcacc3da
Python
55,489
1,065
import io from collections import defaultdict from os import path import src.datahandlers.doid as doid import src.datahandlers.efo as efo import src.datahandlers.mesh as mesh import src.datahandlers.obo as obo import src.datahandlers.umls as umls from src.babel_utils import ( get_prefixes, glom, read_badxr...
cd5e7a89028deeaf294fa61c1a5bbe03ebd0574f376c9187958fe98f80d1b859
Python
55,688
1,498
#!/usr/bin/env python3 # PYTHON_ARGCOMPLETE_OK """Entry point for cwltool.""" import argparse import copy import functools import io import logging import os import signal import subprocess # nosec import sys import time import urllib import warnings from codecs import getwriter from collections.abc import Callable, ...
11a98ed6feab46874b20edd763ec6b1feff80db17784de397afc72f4b13aa8a5
Python
55,769
1,248
import os import json import math import torch import random import numpy as np from prompts import * from itertools import permutations, product from torch.utils.data import Dataset, DataLoader from torch.nn.utils.rnn import pad_sequence from transformers import LlamaTokenizer class GridTask: def __init__(self,...
e60ba1ab3918d188f8e667eea81bf202189851449de433458ba799b26c2d0666
Python
55,822
1,356
# -*- coding: utf-8 -*- import time from django.db import connection, transaction, InternalError from django.test import TestCase, TransactionTestCase from guardian.shortcuts import assign_perm from catmaid import history from catmaid.models import Class, Project, User class HistoryTableTests(TransactionTestCase): ...
98a98efaf83b2c7b3d1496e46a469de9f36a0195c57c509cc3db1230f0c5b272
Python
56,164
1,359
import os import matplotlib.pyplot as plt import matplotlib.patches as mplpatches import matplotlib.colors as colors import matplotlib as mpl mpl.rcParams['pdf.fonttype'] = 42 mpl.rcParams['font.size'] = 12 import numpy as np import pysam from bisect import bisect_left from tqdm import tqdm from sklearn.cluster import ...
54187c784af11cfbe832901eff1f61ddac0a6d8431b7b19fd54af130bcca123e
Python
56,724
1,625
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging import torch.nn as nn # from typing import Dict, Optional, Union from typing import Callable, Dict, Optional, Tuple, Union fro...
d81d04d79f2e130481cd5ee9529a2246dae0f577553859e0cce639454d874b4e
Python
56,887
1,363
# coding=utf-8 # Copyright 2018 Google AI, Google Brain and the HuggingFace Inc. team. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # U...
3ecd2d34aa53b6d2309361407cb68b309518e0afefe1429e85ce251cdcff9baa
Python
57,071
1,636
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging import torch.nn as nn # from typing import Dict, Optional, Union from typing import Callable, Dict, Optional, Tuple, Union fro...
bc92f119398c30901b84b730984e4e86487461e60c298f26134260f2c12ca7ab
Python
57,108
1,168
import os, copy, torch, random, time, datetime import numpy as np import pandas as pd from torch import nn import torch.nn.functional as F from torch.utils.data import Dataset from torch.utils.data import DataLoader from sklearn import metrics from sklearn.feature_selection import mutual_info_classif from sklearn.model...
856ee0f0b9590ac0cf5ee2907910eb9f67852163d4faf6133fbe2e4f4a6d023e
Python
57,205
1,637
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging import torch.nn as nn # from typing import Dict, Optional, Union from typing import Callable, Dict, Optional, Tuple, Union fro...
a829e1654622ff4a3fb4cc94b8b9c9c006073e721830ab87618d73b1cf6d7ca5
Python
57,372
1,647
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import logging import torch.nn as nn # from typing import Dict, Optional, Union from typing import Callable, Dict, Optional, Tuple, Union fro...
c6f2bd7a57a22921c043832da90c53ff833cbb0e645f1927cd4d3dfc1768a372
Python
57,462
1,121
# -*- coding: utf-8 -*- """ Created on Thu Apr 25 14:41:11 2024 @author: guill """ import numpy as np import scipy.sparse as sparse import scipy.stats as stats from numba import jit class SpikingNetwork(): def __init__(self, N_pyr=500, N_mit=1000, N_fbi=0, v_reset=-0.065, v_rest=-0.065, v_t...
c6bed2593f8982ceeee38e898de585d34d4875f4d892444fc2bdfafc59222e5d
Python
57,565
1,257
# Spatial distribution analysis from PyQt5.QtCore import pyqtSignal from PyQt5.QtWidgets import QMessageBox import numpy as np import xarray as xr from .pop_up_messages import print_error from matplotlib import cm from typing import List, Optional from pyvistaqt import QtInteractor import pyvista as pv import colorcet ...
8e04507c5e910dcf326b72b44dc246198126015124b10797b08a08a5832b83ba
Python
57,728
1,373
# Regional volume and density management # Author: David Young, 2018, 2019 """Measure volumes and densities by regions. Intended to be higher-level, relatively atlas-agnostic measurements. """ from enum import Enum from time import time from typing import Callable, Dict, List, Optional, Sequence, Tuple, Union import...
f793fb712620118cffdd7011c6879bffbb11664b79de9176b35ea5d6cb4810eb
Python
58,150
1,036
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 22 05:56:04 2020 @author: takeiyuuichi """ #setting############################################## n_jobs=16 #並列処理の数 t_n_jobs=16 PARAMETER_DIR='/Volumes/Siena/CP/parameter/' #n_jobs=40 #並列処理の数 #t_n_jobs='cuda' #PARAMETER_DIR='/home/takeiyuuichi/Dr...
09a60687b73d0e759c1ade8a0e8203c3644ead0d67c8d2f8d5bc7dc620cd4a8b
Python
58,202
1,124
from __future__ import print_function, division import os from functools import partial import time from glob import glob from collections import OrderedDict import json import math import numpy as np import tensorflow as tf from keras import backend from keras.models import Input, Model, load_model from keras.optim...
05ab0cd72e17233ace804eeba2204dc240dbae243db1af2d6b46e654427be3f4
Python
58,258
1,530
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Eigenmode resampling on the cortex """ from .utils import ( _get_eigengroups, eigen_decomposition, transform_to_spheroid, transform_to_ellipsoid, normalize_data, ) import os from .geometry import (calc_surface_eigenmodes, ...
54041cb1f4be265b3f061b8c64ca04e19c89576f9e59668cfd5290f35a9806c8
Python
58,408
1,161
# find isoforms in longread data from math import inf import pysam # from BCBio import GFF # never stop running. is there a bug? # from: https://techoverflow.net/2013/11/30/a-simple-gff3-parser-in-python/ from collections import namedtuple, Counter import gzip from urllib.parse import urlparse import os import numpy a...
1f3b157f71f2f616aa8873121852bf75514f81b70990d1d1159b11e7afe8e576
Python
58,526
1,543
""" Module to define interface, workflow and CLI for the review of diffusion MRI data. """ import argparse import asyncio import sys import textwrap import time import warnings from abc import ABC from os.path import basename, join as pjoin, exists as pexists from textwrap import wrap import nibabel as nib import nu...
e0c054112f21bfa63620f2026c8bb2e0f4e284b138d09426a08d39f2e882c3f2
Python
58,777
1,172
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import warnings from collections import OrderedDict import torch from tqdm import tqdm from sam2.modeling.sam2_base imp...