sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7aca12775d181aa332261a1020950d2aa8adf741fd04890601b887b4faab8233
Python
23,122
547
import os import random import numpy as np import torch from PIL import Image from torchvision import transforms from .loader import get_image_loader, get_video_loader from .masking_generator import ( RunningCellMaskingGenerator, TubeMaskingGenerator, ) from .transforms import ( GroupMultiScaleCrop, G...
09c09cae76c7dc31a97bf72639e6921d44131ba1de5ca48c4373d2f60e8d0e5d
Python
23,140
645
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
e3a9ffb7330dda6c40d584ca42d153f71882f0db00b9efca69ce19adeeba9cc6
Python
23,146
435
# -*- coding: utf-8 -*- """ Created on Tue May 31 10:09:38 2022 @author: Dalton """ import numpy as np import pandas as pd import matplotlib.pyplot as plt import pickle import dill import os import glob import math import re import seaborn as sns from sklearn.decomposition import PCA from sklearn.pr...
124ee23eb7d1f0a7a1901810f93ee7b679fcac9b7c84e83887657377d5d84a24
Python
23,157
584
import copy import math import torch from torch import nn from torch.nn import functional as F from torch_scatter import scatter_min from torchdrug import core, tasks, layers from torchdrug.data import constant from torchdrug.layers import functional from torchdrug.core import Registry as R @R.register("tasks.EdgeP...
664106ff33dcf9d31a600575ca7c126008630fcbe936994b229ff119afe1f707
Python
23,159
684
#!/usr/bin/env python """ Makes layers in a given region starting from one or between two specified boundaries. Then it analyzes ovelap of given segments with the layers and determines the position of gegment centers in repect to the layers. Important notes: - In order to make setting up multiple scripts easier...
e72d12ffaacaa057039e21162b2043a9f28b9a0ba925464c805075e083c94296
Python
23,161
491
import os import numpy as np import pandas as pd import anndata as ad import scanpy as sc import simba as si #from util.utils_B import set_seed from time import time from memory_profiler import profile import shutil from scipy.sparse import csr_matrix os.environ['PYTHONHASHSEED'] = '0' #os.environ["HDF5_...
1a017bbe02c30a5b636bae47aecdc66af857a23fb6029073446ee20ea19bc981
Python
23,166
579
# Adapted from https://github.com/LINCellularNeuroscience/VAME # Under GPL 3.0 License import yaml import numpy as np import pickle import os import shutil from BEBE.models.model_superclass import BehaviorModel from BEBE.models.preprocess import whitener_standalone import torch import torch.nn as nn from torch.utils.d...
3d70c568f1191de1be1ff9b98ea3a3ecbb703eb9b48c3b149dad3d16421a251b
Python
23,189
580
import logging import time import math import numpy as np import torch import torch.nn as nn from torch_scatter import scatter_mean from pyexpat.model import XML_CQUANT_OPT from ocpmodels.common.registry import registry from ocpmodels.common.utils import conditional_grad from ocpmodels.models.base import BaseModel fro...
5dd583d08b59856b2cfe9e24add706130dec4cc65f5775cdb15e98bdb5e1de86
Python
23,189
539
import warnings from typing import Any, Dict, List, Tuple import pytorch_lightning as pl import torch import torch.nn as nn import torchmetrics from torch.utils.data import DataLoader from torchmetrics.image.inception import InceptionScore from .utils import FrechetInceptionDistance _EVALUATE_OUTPUT = List[Dict[str,...
e4428ada862974f6f9bb715a619a5f1e57bd6508d07bb8e66fd03d6abf8f0495
Python
23,194
629
"""A single parenthesized HED string.""" from __future__ import annotations import copy from collections import deque from collections.abc import Iterable from hed.models.hed_tag import HedTag from hed.models.model_constants import DefTagNames class HedGroup: """A single parenthesized HED string.""" def _...
bb88ded8a9548bc038fc459959d05098d4c451de845b0ec57ddfeafeb1f00cb2
Python
23,196
677
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains th...
78bef540cddefb40e16422d9231ff5b5cb7a592fe0879c2cf26e50b69e116381
Python
23,198
618
from __future__ import annotations import re import sys import numpy as np import pytest from scipy.optimize import NonlinearConstraint from scipy.spatial.distance import pdist from sklearn.gaussian_process import GaussianProcessRegressor from bayes_opt import BayesianOptimization, acquisition, exception from bayes_...
566226b5f34322d3ee521d417be26d656226c5ea8913d069738a6df9a2fd272a
Python
23,201
663
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
3ffa0d837ebde837e4c2b5c627187f7dc32a481cc76f5f135e714ceb4b16332c
Python
23,209
566
import numpy as np import os import os.path as op import mne import pandas as pd import matplotlib.pyplot as plt from pickle import dump from sklearn.pipeline import make_pipeline from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression, LinearRegression from sklearn.feature_...
ac0282d0ab41e8ef983562779614f093e1749fe857389c7c9c1398ad14d0aae9
Python
23,213
573
from datetime import datetime as dt import json import os import time import nibabel as nib import numpy as np import pandas as pd import argparse import csv '''ROI Labels from FreeSurferColorLUT.txt''' ''' 10 Left-Thalamus 0 118 14 0 49 Right-Thalamus 0 118 14...
6699ff134b8698315c0009310a9f615973781569c9e4a116029a8038f06bdc3c
Python
23,227
591
#!/bin/env python3 """ Filaments --------- Filaments are the (instantaneous) rotation centres of rotors in 3D. They are also called "tip lines". In 2D, we call them "tip" or "filament point". The class :py:class:`Filament` describes a filament as a collection of points. .. note:: A :py:class:`Filament` might not...
2824a8c115e1956ed9b1307eb80bfd5b8dd7173195537a6be4afa7c070f863d7
Python
23,239
780
"""""" import cv2 import numpy as np import pandas as pd import xarray as xr from pupil_recording_interface import BaseReader def _iter_wrapper(it, **kwargs): """ Dummy iter wrapper. """ return it class VideoReader(BaseReader): """ Reader for video data. """ def __init__( self, fol...
ca8e2d05b9d53770e0a5294de8142e47d7f6ef3120948ba0ea9e8eef68463d0c
Python
23,241
600
import json import os import pickle import subprocess from misc_utils import hg19_chromsize, overlap_length import pybedtools import pandas as pd from collections import defaultdict import numpy as np from pybedtools import BedTool import matplotlib.pyplot as plt from scipy.signal import savgol_filter from multiprocess...
5450f1d3a6db660b13197e211c04de05c0de601b2f3e464c22543eee94ee0084
Python
23,248
630
#!/usr/bin/env python # -*- coding: utf-8 -*- """Copyright (C) 2012 Computational Neuroscience Group, NMBU. This program 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 (at you...
8905e72fc6ad4726f9c5c1a89fd108a062962454c2ce0b10d0bb981201eae60a
Python
23,255
354
##################################### ######## Paper Draft Cartoon ######## ##################################### #%%# Catalyzer import os import sys path = os.path.dirname(os.path.realpath(__file__)) + '/../Resources' sys.path.append(path) path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(path) impo...
fbcef7633265eace770dd821418125bea18b5b06c5a3b6941c092e65941d2445
Python
23,274
458
""" Authored by: Neel Kanwal (neel.kanwal0@gmail.com)""" # This file provides training code for binary vision transformer models mentioned in the paper. # Update paths to processed datasets if __name__ == "__main__": import warnings warnings.simplefilter(action='ignore', category=FutureWarning) ...
cc44f7ad67268b44b7e77661557dc1525eccd8180f9f11285395ec522504de34
Python
23,276
718
import copy import os import numpy as np import pandas as pd import tensorflow as tf import tensorflow_addons as tfa import tensorflow_probability as tfp import tensorflow.keras.backend as K from scipy.stats import spearmanr from sklearn.utils import class_weight def seq_to_one_hot( seq, model_unknown=False...
ae0dd0d788acc635a468c245c5f8dc08f770e53788a0a9ea39ed23e643641813
Python
23,290
599
""" This module, 'phonons.py', contains recipes for performing phonon calculations using the ph.x binary from Quantum ESPRESSO via the quacc library. The recipes provided in this module are jobs and flows that can be used to perform phonon calculations in different fashion. """ from __future__ import annotations fro...
438ddc181aeebb5d755a11cdca60870408f774579f9498bf195c52d7e76c015f
Python
23,295
672
# -*- coding: utf-8 -*- import os import yaml import numpy as np import pandas as pd from copy import deepcopy from dicthash import dicthash class Network(): """ Gathers and prepares all data that is needed for setting up the NEST simulation. Parameters ---------- NN : NeuronNumbers C...
b1ce39d10a2a2578b284880233e33a82aaa120e2f0d52af01658e11c7c86e5b6
Python
23,299
577
""" Performs Bivariate 2nd order analysis to a SetListTomograms object by tomograms Input: - A STAR file with a ListTomoParticles pickle (SetListTomograms object input) used as reference - A STAR file with a set of ListTomoParticles pickles (SetListTomograms object input) to analyze Output: ...
437ab56d09d64a291c77ea6132c2279f09022cd69d3bade07dd6de27406ebbbb
Python
23,309
843
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
840f08753a7f973525bc9c6768a934ec3d8e8b32c7aa894bcfd0ba2868d33e26
Python
23,310
504
import torch import numba import numpy as np from scipy.linalg import expm from torch_geometric.utils import add_self_loops, is_undirected, to_dense_adj from torch_sparse import coalesce from torch_scatter import scatter_add def jit(): def decorator(func): try: return numba.jit(cache=True)(fun...
c4c90b06562ea6091ca37ca5617d4a772b0bf7b6779126075d7020db4e0683cd
Python
23,310
671
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Hybrid LFP scheme example script, applying the methodology with the model of: Potjans, T. and Diesmann, M. "The Cell-Type Specific Cortical Microcircuit: Relating Structure and Activity in a Full-Scale Spiking Network Model". Cereb. Cortex (2014) 24 (3): 785-806. doi: ...
a534a450b1d28b3943770d1f28cb663e882d6444b8ee60683ae02f1954643371
Python
23,320
594
from typing import Union import numpy as np from numpy.typing import NDArray from scipy.linalg import svd, eigh, LinAlgError from sklearn.base import BaseEstimator, TransformerMixin from sklearn.utils.validation import check_is_fitted from pyntbci.utilities import covariance, pinv def _ill_conditioned_message(name:...
4dfa62de0faba07795b7286299062778126ae49463f65dbe9ce03a9a43e5b2ef
Python
23,324
672
#!/usr/bin/env python # -*- coding: utf-8 -*- ''' Hybrid LFP scheme example script, applying the methodology with the model of: Potjans, T. and Diesmann, M. "The Cell-Type Specific Cortical Microcircuit: Relating Structure and Activity in a Full-Scale Spiking Network Model". Cereb. Cortex (2014) 24 (3): 785-806. doi: ...
bfdcfd845065996727f2a20d53e77492a94a62a23f3aa60a4b9a932f80130cfe
Python
23,326
549
""" Set of specific utilities for retrieving a filaments from a tomogram # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 15.09.15 """ __author__ = 'Antonio Martinez-Sanchez' import pyseg as ps import csv import vtk import graph_tool.all as gt from pyseg.globals.variables import * f...
71a14083d40137dccaa9b7ef2daad14e0447d89fdb06fb0c9244b6f033c328c7
Python
23,352
644
# coding=utf-8 # Copyright 2018 The Google AI Language Team Authors and The HuggingFace Inc. team. # Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved. # # 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 cop...
38903feda7d71dc6cc9039818e08ed40f90676f2f65d1d4844e09df85fdf0101
Python
23,353
625
import warnings import numpy as np from tqdm import tqdm import matplotlib.pyplot as plt from scipy.optimize import linear_sum_assignment import sys class DummySorter: # Barebones sorter just for Comparison def __init__(self, spike_times, name="Sorter"): self.spike_times = spike_times self.na...
47e64462cdc6ccb9185ba2c152f715240b0f8c9f2b05ee6150382dd70fe75709
Python
23,363
563
import os import math import random import logging import warnings from tqdm import tqdm import numpy as np import pandas as pd import scipy import torch from torch.utils import data as torch_data from torch.utils.data import IterableDataset from torchdrug import data, utils, core, datasets from torchdrug.layers imp...
d97fd649cd090219a6438eac67c5c80d18f168e6d05832a83b3d0e9d1c37f6dd
Python
23,375
685
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
53e423bcd5c03b2653afc4c09009aba2306dd388101467fd53bdae72a11b3232
Python
23,383
599
""" Performs Univariate 2nd order analysis to a SetListTomograms object by tomograms Input: - A STAR file with a set of ListTomoParticles pickles (SetListTomograms object input) Output: - Plots by tomograms: + Number of particles by list + Particles densities by list ...
246faa1b98e949a5f1b5d5ddc7033a5ca9742809658d914e9883486b97a8a178
Python
23,391
599
""" Performs Univariate 2nd order analysis to a SetListTomograms object by tomograms (Translocon version) Input: - A STAR file with a set of ListTomoParticles pickles (SetListTomograms object input) Output: - Plots by tomograms: + Number of particles by list + Particles d...
b1ba7ccd0eaf75484b1bab3ad259b1e2fe4ac251b99d0dccc1fd9cbcc3445fa2
Python
23,401
610
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
e449f76382bdbcd87fb2bc73f70e948bf2776beef8efb6c48126c342707322f0
Python
23,405
548
import logging import warnings from typing import Any, Dict, List, Tuple import pytorch_lightning as pl import torch import torch.nn as nn import torchmetrics from torch.utils.data import DataLoader from torchmetrics.image.inception import InceptionScore from .utils import FrechetInceptionDistance _EVALUATE_OUTPUT =...
69e7dc24de40cd32f8d3970452609ec1f4c1de5097f0c530651c6f8a93c2b24b
Python
23,410
547
import os import time from pathlib import Path import matplotlib.pyplot as plt import numpy as np import openturns as ot import seaborn as sns ot.Log.Show(ot.Log.NONE) import pandas as pd from sklearn import datasets from sklearn.datasets import make_regression from sklearn.metrics import r2_score from ...
578fc43c6a99334c5ef290c226fee9e521c1558198a28751ea200f1ebfe0d205
Python
23,422
413
# Class definitions for the cardiac cellular models from warnings import warn import numpy as np from matplotlib import pyplot as plt from scipy.integrate import odeint from io_functions import read_pandas from utils import get_pandas_from_value, get_row_id_name, get_nan_value, change_resolution class CellularModelE...
353799f910dab70e135ecaca493c44d96c908e5e6e1f7aa03d31cc3a0d5c6079
Python
23,426
748
"""Module to control DCAM on the console. This imports dcamapi4 and implements functions and classes Dcamapi and Dcam to make DCAM easier to use. Dcamapi initializes DCAM only. The declarations of classes and functions in this file are subject to change without notice. """ __date__ = '2021-06-30' __copyright__ = 'Co...
6d01a3409b5f5e5a5003efe218c984819008e728481f409674c1a8657fd8d88b
Python
23,428
468
"""Control window for continuous sliding-window generation ("Infinite Nekrasov"). Besides run parameters it offers live operator injection, an optional external neural cue, and a runtime leak-rate control. Every control acts on the running system through the engine worker; the text colors only display recorded token p...
ca7cd0cb4ebd2c4bf7b8154a276cf9c45d8c8a9d750fb19539863d0afe4251f7
Python
23,432
523
from __future__ import print_function import torch import torch.nn as nn from torch.nn.parameter import Parameter from torch.autograd import Variable import torch.nn.functional as F import copy def choose(matrix, idxs): if type(idxs) is Variable: idxs = idxs.data assert(matrix.ndimension()==2) unrolled_i...
ab95d2526a9af10767556d70809dc2c38d88fdca51f08423989ddd4198148b80
Python
23,435
596
## # \file reconstruct_volume.py # \brief Script to reconstruct an isotropic, high-resolution volume from # multiple stacks of low-resolution 2D slices including # motion-correction. # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date March 2017 # import os import nump...
b8914c6ada37d3731e46c072d9a8fd91801172b4326c3bc52afefbecbce42346
Python
23,462
491
import time from collections import Counter, Sequence from pddlstream.algorithms.common import INTERNAL_EVALUATION, add_fact from pddlstream.algorithms.downward import make_axiom from pddlstream.language.constants import AND, get_prefix, get_args, is_parameter, Fact, concatenate, StreamAction from pddlstream.language....
ecfd4e27b5543e4363ea58b46510eefba90ea55122b2b92d8894e2773403655d
Python
23,466
629
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 26 13:05:23 2021 @author: joaquin """ import matplotlib.pyplot as plt import numpy as np import scipy.io import pandas as pd import os from scipy import signal from scipy import stats #%% load experiment data for thy recordings names = ['150610'...
21afa926f56a94bfb20085d1422dd6e698c0b197f0f9d2ccefd67f3afcc66e49
Python
23,468
522
#!/usr/bin/env python # -*- encoding: utf-8 -*- """ This is a helper module for scripts that auto-generate bindings for different languages. Usage: import bindings as b b.init(language="C#", output_dir="CSharp") for schema in b.schemas(): name = schema["name"] b.write_to_file("schemas/%s.cs...
d58528802a103c3fe1bab8adbe94f13bdbc6ba3b5707ee7e6afd1bb1ff8fd95f
Python
23,470
587
""" Performs Univariate 2nd order analysis to a SetListTomograms object by tomograms Input: - A STAR file with a set of ListTomoParticles pickles (SetListTomograms object input) - Analysis settings Output: - Plots by tomograms: + Number of particles by list + ...
0022cf5d2b90ff6ae11a2e9d56aadb188e973a4a5855cbb084f8338d5552b869
Python
23,474
569
# Modified version of resnet from from https://github.com/tensorflow/models.git # Copyright 2017 The TensorFlow Authors. All Rights Reserved. # # 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...
c333457ff8a4f2dbcf1e09d953806521b7195500bdc777845cfd89ab46dec87f
Python
23,474
645
# -------------------------------------------------------- # BAE-ViT Model Architecture # -------------------------------------------------------- import itertools import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as checkpoint from timm.models.layers import DropPath as T...
5938c7da24276c22eba89ff1b6b6ffa75628b4e46061ed8d64ff91b4a042537f
Python
23,475
592
#!/usr/bin/env python # -*- coding: utf-8 -*- '''Copyright (C) 2020 Computational Neuroscience Group, NMBU. This program 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 (at you...
dd9374bf8fdb20fa0363b4bd21411c0d22a0f6bb453c81b520ffe4d8daf3e71e
Python
23,488
441
# MEGIT batch process (video based) functions import copy import json import h5py as h5 import numpy as np from shapely.geometry import Point, Polygon from .fio import hml_read, cjsh_read from .data import (get_lbl_det, conv_hm2js_blob, conv_hm2js_max, arr_raw_jsl, get_proc_rng, pad_nan, sel_mtp, ...
6d714b386f060fa08fd629737c1a9319aa4606dbf9e3b7c69867b90d4923d222
Python
23,495
380
from hed import load_schema_version from hed.models.hed_tag import HedTag from hed.schema import HedKey, from_string from tests.schema import util_create_schemas from tests.validator.test_tag_validator_base import TestHedBase # Load the schema once, globally hed_schema_global = load_schema_version("8.4.0") class Tes...
fe616e98a4586c93d704e4f20636484d8396afd1a843d29448d609b97dc373bb
Python
23,497
746
from __future__ import print_function from builtins import range import numpy as np import numba as nb from tqdm import trange import sys def validate_seq(x, a, n_clones=None): """Validate an input sequence of observations x and actions a""" assert len(x) == len(a) > 0 assert len(x.shape) == len(a.shape) ...
586fff2f201ad86c2603aa92a0426dbc913c4440352d9a5b4a2cf2f16be124b9
Python
23,513
739
# -*- coding: utf-8 -*- # # Copyright (C) 2012-2017 The Python Software Foundation. # See LICENSE.txt and CONTRIBUTORS.txt. # """ Implementation of a flexible versioning scheme providing support for PEP-440, setuptools-compatible and semantic versioning. """ import logging import re from .compat import string_types f...
248bad36e77a755c45fc48f51177579fdb40487ea89ebf99c9f5c4273de8efac
Python
23,538
472
######## Name ######## BiochemSimulSwift ######## Requires ######## {Modules} import numpy as np import numba class BiochemSimulSwift: """Class 'BiochemSimul' Illustration! It is an essential part of the 'BiochemAnalysis' class! ######## Attributes ######## Methods ...
d8eaa17ac5f4b902b894a4b864aa100df96104b5de4ec424d725d8109aefb4db
Python
23,540
404
""" ERROR_OR_STRUCTURE.py written 2026-09-22. "One voice or a choir?" Pre-registration: 04-NOTES/PREREG-2026-09-22c-ONE-VOICE-OR-A-CHOIR.md (written before this ran). Within a neuron, two synapses' transmitter votes agree more the closer they are, over tens of microns (RHOBAR_CI.py, arm D). Is that ERROR (noisy co...
d5b1c5c6b07f9e3b65efa95483b98826554148ba5af8a0815f8f8153676eac39
Python
23,543
705
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 26 13:05:23 2021 @author: joaquin """ import matplotlib.pyplot as plt import seaborn as sns import numpy as np import scipy.io import pandas as pd import os import h5py import mat73 from scipy import signal from scipy import stats from sklearn.dec...
56eb3d5320ee3424ff3df663c2edb9df02f4bf93e243d9a288c666748ae8e703
Python
23,577
692
"""distutils.msvccompiler Contains MSVCCompiler, an implementation of the abstract CCompiler class for the Microsoft Visual Studio. """ # Written by Perry Stoll # hacked by Robin Becker and Thomas Heller to do a better job of # finding DevStudio (through the registry) import sys import os import warnings from .err...
98f1173dbe9d0f20d3c389b56b4773afc433d3ec2d9d763687e4dcba8c950c0f
Python
23,580
658
## # \file DataReader.py # \brief Reads data and returns Stack objects # # \author Michael Ebner (michael.ebner.14@ucl.ac.uk) # \date July 2017 # import os import re import six import natsort import numpy as np import nibabel as nib import SimpleITK as sitk from abc import ABCMeta, abstractmethod impo...
3d9c174464c3e2037e69e22bec8b51da8e417d5b0b6a0ef1cc92a3c48f8980a9
Python
23,581
525
# Nucleus 2022.04 # Tiago Rito, The Francis Crick Institute # # # general functions to predict images: predictor, stitching, overlay with COCO import numpy as np import matplotlib.pylab as plt import cv2 import torch from pycocotools.coco import COCO from matplotlib.patches import Polygon from matplotlib.collections im...
52e40c3bfbcdbe5c24a996569d98fd3cbf8371975648834b5a6fadf34feb248c
Python
23,597
480
import math import torch from torch import nn import torch.nn.functional as F import timm class latentTFBackbone(nn.Module): """ Multi-scale Fusion Transformer for image + pos_embedding feature fusion image_architecture: Architecture used in the image branch. ResNet, RegNet and ConvNext are supported ...
c187d9d17d5822625a32568d53bd8fbf8553e3732edfe5d0af327e8acc31a662
Python
23,608
498
""" This code is ported from following implementation: https://github.com/Luolc/AdaBound Following is the original license of the code: Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS...
a8b2c27dbcf60184845cc5aa4cac905412d61e71405fd64f739bb7cf19ae8bf8
Python
23,613
708
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 26 13:05:23 2021 @author: joaquin """ import matplotlib.pyplot as plt import seaborn as sns import numpy as np import scipy.io import pandas as pd import os import h5py import mat73 from scipy import signal # define functions def eegfilt(data,sr...
b70dd61c66432a5bf92dd8f416c83605e610e793b495a243f302d81eb3a30e0e
Python
23,614
596
#!/bin/env python3 """ Filaments --------- Filaments are the (instantaneous) rotation centres of rotors in 3D. They are also called "tip lines". In 2D, we call them "tip" or "filament point". The class :py:class:`Filament` describes a filament as a collection of points. .. note:: A :py:class:`Filament` might not...
d409629d8d22f4802342997933ded3f5f160249a380370cbb76340530325c106
Python
23,625
658
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
6f6398996ed1d4186a780577e0b905edc570d1c36760abb5713054bf2d4dff85
Python
23,627
561
# coding=utf-8 # Copyright 2020-present 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 # # Unless required by ap...
dbd8dfcb9eccecaae9762a942cf64ed66363a5b03b159891fbd3e386da84c6ce
Python
23,629
544
""" Classes for building proper SkelGraphs objects for structures attached to biological membranes # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 08.09.14 """ __author__ = 'martinez' __version__ = "$Revision: 002 $" try: import disperse_io except: import pyseg.disperse_io ...
3c31b2f12a8ea9a75a72d7644332b3ee0b51db6fca5da8941fd09a80f5fab90d
Python
23,640
579
""" Classes with additional functionality for applying the spatial analysis on stacks of images # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 12.04.16 """ __author__ = 'martinez' import os # import cv2 import math import numpy as np from pyorg import pexceptions from .sparse impo...
5fe045658e55ba287a9f2d22f05206ea1aa069d26660dd7b988b54e8ced3fa15
Python
23,643
517
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
18c3b9aea980da6d226d20822baf16b16f0ea30ed593cbd37c31e47bc03f5def
Python
23,649
521
"""Consumer-level coverage for the CRITICAL frame-conversion fix, plus the 2-D path's grid guard (Important 3) and run-side plane-threading capture (Important 1). ``regtools/tests/test_hemisphere_frames.py`` (Task 11) already pins ``MidsagittalPlane.reoriented_to`` itself, hard: 2304 round-trip frame pairs, per-...
123a6093327ae8af4b1d9b569ae95f921e79d332a82810c057d2256aa09fda77
Python
23,661
570
#!/usr/bin/env python3 import os,sys os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' os.environ['CUDA_VISIBLE_DEVICES']="" import tensorflow as tf import tensorflow.keras.mixed_precision as mixed_precision import tensorflow_probability as tfp import copy import numpy as np import matplotlib.pyplot as plt import time i...
0cce8ce7e50da9c36df085658d04a8e3080a35ab7134c51649ce54b58391244c
Python
23,678
621
""" A collection of objects and helper methods for defining objective functions used in topology optimization. """ import abc from collections import namedtuple from typing import Callable, List, Optional import numpy as np from meep.simulation import py_v3_to_vec, FluxData, NearToFarData import meep as mp from .fil...
e2f95f4c49472f415a7532f17eb3972393845721703417c93c236192f5d38297
Python
23,684
935
"""Various functions used for the GUI. """ from ast import literal_eval from logging import getLogger from math import ceil, floor from numpy import arange, nan from os.path import dirname, join, realpath from PyQt5.QtCore import QRectF, QSettings, Qt from PyQt5.QtGui import (QBrush, QPen, ...
6f2c58269f609e355eca1465677513320a3f2e191787569fbcdf30241b4071cf
Python
23,685
668
""" pygments.cmdline ~~~~~~~~~~~~~~~~ Command line interface. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import os import sys import shutil import argparse from textwrap import dedent from pip._vendor.pygments import __version__...
ab6575524e2b10830b62349ed0200b5a5bd25a2f33e612ea18d6f33d1b5ab3ee
Python
23,689
656
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
50c49a4f3bd6f6d47ad343b25a0e9ca5085e08a766c87c74278d6f341f2cd9b7
Python
23,690
579
""" Classes with additional functionality for applying the spatial analysis on stacks of images # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 12.04.16 """ __author__ = 'martinez' import os # import cv2 import math import numpy as np import pyseg as ps from pyseg.spatial.sparse im...
d408bfa3da3dd023611acfd036a68f6c099d17c434db0a8129eb339bf3c64f89
Python
23,696
493
import pytorch_lightning as pl from torch.utils import data import pandas as pd from utils.logger import get_logger from utils.util import check_cache_files import numpy as np from torch import from_numpy import dgl import torch import shutil from torch.utils.data import DataLoader, TensorDataset, RandomSampler, Weight...
7b6a4029c19d8c8d507f9d5cfa7e0e7797e5f2aaa8dd154f9eb077466dd8afa2
Python
23,697
502
#!/usr/bin/env python3 """ Copyright (C) 2018-2020 Intel Corporation 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 applic...
c578c0b03b808152b20892b4753069a8722f33491e2bfea4fe4b6f8e49e9b251
Python
23,697
487
import csv import io import os import shutil import socket import unittest import numpy as np import pandas as pd from hed import schema from hed.errors.error_types import ErrorContext, ValidationErrors from hed.errors.exceptions import HedFileError from hed.models.base_input import BaseInput from hed.models.column_m...
3313f47cdf01b00c760631c52223f618afa2921a2791f36417ca57a4a9aaee39
Python
23,705
540
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Sep 3 07:39:59 2023 @author: daltonm """ # -*- coding: utf-8 -*- """ Created on Tue May 31 10:09:38 2022 @author: Dalton """ import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import ListedColormap import p...
e0fe551822a1bf3fa7b313fcd04342960228d4e2b4551f461519f298b8bae19d
Python
23,714
618
"""Python function to run SLM with user-defined template data directory (as fetch_template_surface set to default in the original function) Modified from BrainStat toolbox https://brainstat.readthedocs.io/en/master/_modules/brainstat/stats/SLM.html#SLM © Copyright 2021, MICA Lab, CNG Lab Revision 1f3068fb V...
26884d2fb7b2d6d16351fb586bf5abe2f66eaee8329eb809dd712fd30b5686a5
Python
23,718
689
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
6698526b194d1cb556c9cd15ad7f9bfed7622005a682ef067c9351fe9a9b521d
Python
23,721
659
# This file helps to compute a version number in source trees obtained from # git-archive tarball (such as those provided by githubs download-from-tag # feature). Distribution tarballs (built by setup.py sdist) and build # directories (produced by setup.py build) will contain a much shorter file # that just contains t...
3c69f36524c7edf9616b0683d794ece03641b2fff2cf233c0c6a4cc6344bb7c6
Python
23,731
561
from dreamcoder.domains.tower.towerPrimitives import ttower, executeTower, _empty_tower, TowerState from dreamcoder.domains.tower.tower_common import renderPlan from dreamcoder.task import * class SupervisedTower(Task): def __init__(self, name, program, mustTrain=False): if isinstance(program,str): ...
2f24d5636740371fa2fd3124e58afd61cc14b62cb41ce10508042ad45ff8e9ca
Python
23,737
733
"""Exceptions used throughout package. This module MUST NOT try to import from anything within `pip._internal` to operate. This is expected to be importable from any/all files within the subpackage and, thus, should not depend on them. """ import configparser import contextlib import locale import logging import path...
7e4fd9755e8a505778cc98730fee109dd6d0ec3cf82c6a6e3c37f6f8f12c0698
Python
23,739
629
import torch import warnings import numpy as np import networkx as nx from torch_geometric.data import Data from .edge import Edge from .node import Node from .element_look_up_table import ElementLookUpTable class Graph: """Class for representing chemical graphs with all necessary information.""" def __ini...
113b90c456159f5207268e953c0232f0d9a195f6125ad072dce1e1e0b15f9497
Python
23,742
463
# 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 # # ht...
32725dec53234493bcb1c25725ad9e74ebc90294ed6d9b36d3fbaea1be12059c
Python
23,749
442
##################################### ######## Paper Draft Cartoon ######## ##################################### #%%# Catalyzer import os import sys path = os.path.dirname(os.path.realpath(__file__)) + '/../Resources' sys.path.append(path) path = os.path.dirname(os.path.realpath(__file__)) sys.path.append(path) impo...
6381477ea430ca865dcf9561aa21d946121394e4888292cfbdf2b4e7086bdcd3
Python
23,758
567
#!/usr/bin/env python # Copyright (c) 2019 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module provides Challenge routes as standalone scenarios """ from __future__ import print_function import math import xml.etree...
7dc11d040bf45c84bb98c2d0a73136d047ca20fde04b57c86c788037a3f22943
Python
23,767
628
import os import os.path as op import numpy as np import matplotlib.pyplot as plt from functools import reduce import mne import mne_bids import pandas as pd from autoreject import get_rejection_threshold from params import BIDS_ROOT as bids_root from params import PLOT_DIR as plot_dir from params import FREQUENCIES ...
e0ca7c8aa3b2aeea4db0f7e7173ac173013492366d050c6cbb33c7ee3049c66d
Python
23,774
556
import json import os import shutil import tempfile import unittest from hed.tools.bids.bids_util import get_schema_from_description, group_by_suffix, parse_bids_filename class TestGetSchemaFromDescription(unittest.TestCase): def setUp(self): """Set up temporary directory for test files""" self.t...
3ff3ca3b96b7818e58cc5012cf0ece7fa45ad8f763358d4524b6e495afe15f7b
Python
23,780
602
from atom3d.filters import filters import os import torch import numpy as np import pandas as pd import random import torch import torch_geometric as tg # import e3nn.point.data_helpers as dh from transformers import BertTokenizer, BertForMaskedLM import os from eudockscore.utils.interface import get_pair_interface_...
a6a6ddbf91800d1c34497f35a6bf5022b373a2324e3766d1838373521f06fec6
Python
23,821
475
# 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...
279b8da6b41f1d211c15c608dd9ca7d82625d6ff7def61217fd1bc8478814281
Python
23,832
522
# coding=utf-8 # Copyright 2020 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 # # Unless required by applicable ...
55d603877e1755e0153dea1a2557a98eac5780bcbd7afff337284a0a5d72979c
Python
23,848
561
import numpy as np import pandas as pd import os, torch import importlib filepath = os.path.dirname(os.path.abspath(__file__)) model_typology = pd.read_csv(filepath + '/model_typology.csv') model_typology['model_name'] = model_typology['model'] def subset_typology(model_source): return model_typology[model_typol...
f33c0bb39e6df9be6c0fcc2f24d06020fbe359ac199e34d0e7377ea3d0e85088
Python
23,854
610
from collections import namedtuple from typing import Callable, List, Union, Optional, Tuple import numpy as np from autograd import grad, jacobian import meep as mp from . import LDOS, DesignRegion, utils, ObjectiveQuantity class OptimizationProblem: """Top-level class in the Meep adjoint module. Intende...
3ea45ae601c89b0fb5905139db49f34c073985a28b9e47be9b21b219cca84c42
Python
23,881
625
# pylint: skip-file import math import numpy as np import tensorflow as tf # from spe_tf import * from einops import rearrange, repeat from functools import partial #from util import * import src.layers.util as util BIG_CONSTANT = 1e8 def create_projection_matrix(m, d, seed=0, scaling=0, struct_mode=False): r""...
cbd34fc4b5aa3b9fc3cfbf93f4a311584edd599fdd1cf7dcfea9a47e10ecee25
Python
23,885
466
""" Created on Wed Apr 27 09:01:02 2022 This script is writen to load a HMM model and used it to summirize the output of a basecalled dataset. @author: Haotian Teng """ import os import time import toml import torch import itertools import numpy as np from scipy.stats import binom from tqdm import tqdm from matplotlib...