sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
6c4e77b00d6291a825445eea60772534897a5b80d4813f64f0b02f087b707eb2
Python
6,456
231
"""Functions to process data.""" from typing import Optional import mne import numpy as np from scipy import signal from osl_dynamics.utils import array_ops def standardize(x: np.ndarray, axis: int = 0, create_copy: bool = True) -> np.ndarray: """Standardizes a time series. Returns a time series with zero...
9b59c8239e416c6163b3d8b6948b4b42d473cf25206c3e030d643c89958a4319
Python
6,456
140
import os.path import glob import argparse parser = argparse.ArgumentParser(description='Make Molgenis Compute samplesheet for ENA.') parser.add_argument('samplesheet', help='CMC samplesheet from synapse') parser.add_argument('cram_dir', help='path to cram file dir for input') parser.add_argument('fastq_dir', help='pa...
cd0f99b1fb99b2bbe8f23baac0920e958f499d4f3cfac5b5955f2edc0db5a8ae
Python
6,457
220
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 law or agreed to ...
fc0a8553034def7002d42a2082e069b642c48d834690199f8d194d895d8dd8ec
Python
6,457
149
"""Dual-valence MB model — Bennett 2021 MV formulation, ported to the larval Drosophila connectome. This is the Phase 3i upgrade from the single-valence dual-DAN model. It implements the canonical Bennett-MV equations with parallel appetitive and aversive memory traces, modulated by cross-valence DAN feedback: m+...
3c4df3a1bb749aacab7c0cc6832a20b86173f3d301e73b020eef563a21f2fbd2
Python
6,461
172
""" Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import torch import torch.nn as nn class InstanceNorm(nn.Module): def __init__(self, epsilon=1e-8): """ @notice: avoid...
b0234eef31629ba10d98e2bc36d0c0df1449bca1dde559c31c5175c6fe38ee49
Python
6,461
146
import torch from .basic_model import BasicModel from . import networks from . import losses class VaeBasicModel(BasicModel): """ This is the basic VAE model class, called by all other VAE son classes. """ def __init__(self, param): """ Initialize the VAE basic class. """ ...
94b18c3b01461c7df3824726ee3511c592d49646b5e50fc65a574c40f121a49f
Python
6,463
166
import glob import sys from timeit import default_timer as timer from datetime import timedelta from pathlib import Path path = str(Path(Path(__file__).parent.absolute()).parent.absolute()) sys.path.insert(0, path) from random import randrange import pyslow5 import numpy as np import click import tensorflow as tf from...
a8439687e8521aa645242921cd40a86beee6874b1177fea02c9bcfa69c2f5e91
Python
6,463
155
import urllib import requests import logging from dataclasses import dataclass, field from typing import Any, List, Dict, Union, Iterator, Iterable, Tuple from oaklib.datamodels import oxo from oaklib.datamodels.oxo import ScopeEnum from oaklib.datamodels.text_annotator import TextAnnotation from oaklib.datamodels.vo...
3d5d50c492d02c12db576403e3066b70c42fcf9f8683509f5ff1feba0fc93aec
Python
6,464
186
import time, warnings warnings.filterwarnings("ignore") from tqdm import tqdm import numpy as np import torch import torch.nn.parallel import torch.optim import torch.utils.data from torch.cuda.amp import autocast, GradScaler from utils.metrics import ( AverageMeter, dice_coefficient, dice_per_region, ) ...
233c5a53ab7f842351fd67ab654122fdc20979d532d703fd63967cd607fb302c
Python
6,465
160
import kgcl_schema.grammar.parser as kgcl_parser import pytest from kgcl_schema.datamodel import kgcl from linkml_runtime.dumpers import yaml_dumper from oaklib import BasicOntologyInterface, get_adapter from oaklib.implementations.tabular.robot_template_implementation import ( template_modify, template_slice,...
841b3bc47893c1b9f00fd3c230ce03f83685f090433fc9a9ca9c47afc0ac4fc7
Python
6,465
159
# %% import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt import re from pymaid_creds import url, name, password, token from data_settings import data_date, pairs_path import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) from contools import Celltype, Celltype_...
dd9c7844587d4febfc71443934bf8691a3e3f055d9b40652126222de11ebbe73
Python
6,468
188
"""Graph encoders.""" import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import manifolds from layers.att_layers import GraphAttentionLayer import layers.hyp_layers as hyp_layers from layers.layers import GraphConvolution, Linear, get_dim_act import utils.math_utils as pmath device ...
5ddc54cac5735def6e77354c98b9dc88493ad0ce67a02d8403364aa7b21dc9bc
Python
6,469
145
# basic imports import os import numpy as np import pickle import pyqtgraph as qg # framework imports from cobel.agents.sfma import SFMAAgent from cobel.interfaces.gridworld import InterfaceGridworld from cobel.misc.gridworld_tools import make_gridworld # store experiment directory cwd = os.getcwd() # shall the system...
c5f97ab1b78f15092fbd733f868bf42aec03b47fd3b193a237258aaa4273389f
Python
6,469
154
import mne import numpy as np import matplotlib.pyplot as plt import os #import config_protoPPmusic_ConvolutionEGI as cfg ## logging info ### import logging from datetime import datetime logname = './logs/' + datetime.now().strftime('log_%Y-%m-%d.log') logging.basicConfig(filename=logname,level=logging.I...
f042867dd9c7829930f83e6331145f903821616e1706485168d79642e14ed98f
Python
6,469
143
# config.py import os.path from .config_util import get_min_max_size, get_kmeans_wh_size, get_kmeans_area_size, size_index, conv4_3_size # gets home dir cross platform HOME = os.path.expanduser("~") # for making bounding boxes pretty COLORS = ((255, 0, 0, 128), (0, 255, 0, 128), (0, 0, 255, 128), (0, 255, 2...
3afcda77d36e28b63db691425f9d714e2261b78c1850c2fe3d594958c7979678
Python
6,471
164
import functools from inspect import getfullargspec import torch from .utils import cast_tensor_type def auto_fp16(apply_to=None, out_fp32=False): """Decorator to enable fp16 training automatically. This decorator is useful when you write custom modules and want to support mixed precision training. If ...
af5fced183b1501c558e572f76dd66588740b5211a95949dd4f64c2f86e6bc16
Python
6,473
177
"""The shipped models and the inference pipeline, against what 0.1.12 gave with the same weights. reference_0_1_12.json was recorded by running pyoxynet 0.1.12's own test_pyoxynet on the bundled example tests (see "recorded_with" in the file). """ import json import pkgutil import random from io import StringIO from p...
200bc11de973fc78dec4f34b691e1a5621367ad85de8bf436408b65354141a99
Python
6,477
147
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 law or agreed to...
2199663e844b93c01988906ecd757cb0444419450e363e7a069e5f42f7caa1f9
Python
6,481
177
import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler from sklearn.model_selection import RepeatedKFold,\ RepeatedStratifiedKFold,LeaveOneGroupOut, GridSearchCV, LeaveOneGroupOut from sklearn.svm import SVC from sklearn import metrics from tqdm.auto import tqdm def prepare_features( ...
e698510805c4bf2dd7966f4d1a56da63d2192fbd39bed8049cdf8ce40f21b794
Python
6,485
224
import argparse import json import os.path as op from glob import glob import matplotlib.pyplot as plt import pandas as pd import ptitprince as pt import seaborn as sns from kneed import KneeLocator from numpy import mean def _get_parser(): parser = argparse.ArgumentParser(description="Perform QCFC analyses") ...
8a892231823ea0ce2b49b19b15a5943ce09ccf14e8c3a7b1af23715068705c00
Python
6,487
186
""" DeepCT architecture (TODO: Add our names). """ import numpy as np import torch import torch.nn as nn from torch.utils.tensorboard import SummaryWriter class DeepCT(nn.Module): def __init__( self, sequence_length, n_cell_types, sequence_embedding_length, cell_type_embedd...
d153101b830920c3f951186ddd87853aeb0a2d02ad561f9a3438bf1ca38355a7
Python
6,487
176
#%% import os try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/') print(os.getcwd()) except: pass # %% import matplotlib.pyplot as plt import seaborn as sns from graspy.plot import gridplot, heatmap from graspy.utils import binarize, pass_to_ranks from src.data import load_metagraph ...
f03d651041aa6a4650b33be23da1d64e1bb81930f68138d4f278ea0bd512be8b
Python
6,490
178
# Copyright 2021-2022 Huawei Technologies Co., Ltd # # 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 law or agre...
d0f3cae3f3be77d65bdecab48049fe48e3119c45ebde7626c2ba6a47ea029da5
Python
6,494
155
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ Regression test for https://github.com/carla-simulator/carla/issues/9898: sensor.camera.rt_lens'...
221b5b325c067290bbaf42cfc3c221c7a659194cbe615ba585ef93a2f03369a2
Python
6,496
206
import numpy as np from skimage.feature import blob_log import faulthandler import dask import dask.array as da from dask.diagnostics import ProgressBar from params import nC, sigma faulthandler.enable() from functools import reduce import operator from scipy.spatial.distance import cdist import gc import math from i...
f54904bc8655789f14a43b9d8cd3dbdb06eeda029889f3a762704ac1c1569005
Python
6,497
159
# Copyright 2020-2022 Huawei Technologies Co., Ltd # # 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 law or agre...
a6ba0f503806222c089a09b1624db11bd27952ed60c468b2f9b496e343f2f76c
Python
6,498
200
#!/usr/bin/env python # Read a fasta file of reads, and a fasta file of primers. Find # multiple occurrences of primers at the end of reads, and chop them # off. Write a new fasta file. # Some reads are so scrambled that it isn't obvious what to trim, or # that they contain any useful sequence at all. A conservative ...
68d1aff3e6e1992626cb440182dde7f780939939ad6aeb06645637b3a3440443
Python
6,499
185
#!/usr/bin/env python3 import glob import itertools import os import pytz import click import matplotlib.pyplot as plt import numpy as np import pandas as pd import scipy.signal as sg from sklearn.linear_model import LinearRegression # Input/Output Directories SRC_DATA_DIR = "./AlanaDISData" DEST_DATA_DIR = "./Alan...
2abd2118c5173b9c84ab0d6fceed360ab79a1719526bb577429a1c3b698ad69e
Python
6,502
185
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 law or agreed to...
fb6e0699e9ab1d0a726c8ec5f9f8c0220e296e2722a7d60325ff75862afcf468
Python
6,506
211
import torch import torch.nn as nn from torch.autograd import Function from torch.autograd.function import once_differentiable from ..utils import ext_loader ext_module = ext_loader.load_ext('_ext', [ 'sigmoid_focal_loss_forward', 'sigmoid_focal_loss_backward', 'softmax_focal_loss_forward', 'softmax_focal_los...
5116e357a396ed5cbde6cfc6c87ed1644ed4bce832ccf22ae3ca8426217d983e
Python
6,510
194
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Module containing functions used for registration with cross-correlation. For more details, see: Manuel Guizar-Sicairos, Samuel T. Thurman, and James R. Fienup, "Efficient subpixel image registration algorithms," Opt. Lett. 33, 156-158 (2008). Created on Mon Oct 29 ...
fa9a39d8789edf0511272d15699d0066d4a5c66cd3d1b925b5a2d3ae00b21665
Python
6,510
127
#!/usr/bin/env python3.9 # -*- coding: utf-8 -*- """ Run a model simulation from the arguments given in the command. """ import numpy as np from iEEG_STC import utils import models import os import sys import time import ast import pandas as pd t0 = time.perf_counter() # Default parameters params = {'N': 400, # Netwo...
4199c06ebd79e60f4d553ac1e51f6cfac7da465294ec8c6d180df40485198b24
Python
6,524
167
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma de # Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. from . import SyncSmokeTest import array import carla import time class TestV2X(SyncSmokeTest): ...
2da859c3988d076393e4b2a6b8a44f3fabe908a9464e24829d9caef754adc752
Python
6,527
181
import torch.nn as nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from ..utils import deprecated_api_warning, ext_loader ext_module = ext_loader.load_ext('_ext', ['roi_align_forward', 'roi_align_b...
62c7725643166bf0f690309766ca4fd25dc09935b82978887d8d5c284923ae65
Python
6,527
188
# coding=utf-8 # Copyright 2020 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...
b4822f582fc1c31a098a0df8c860dd656aff529b7d9870524695b9fd94707da6
Python
6,527
150
import numpy as np import torch from mmdet.core import bbox2roi from mmdet.models.losses import SmoothL1Loss from ..builder import HEADS from .standard_roi_head import StandardRoIHead @HEADS.register_module() class DynamicRoIHead(StandardRoIHead): """RoI head for `Dynamic R-CNN <https://arxiv.org/abs/2004.06002>...
08454bd6436c8ac8229875df9247e53a34a21b0fd0fa7871ed847baa308371e3
Python
6,533
181
from collections import namedtuple import torch from torchvision import models as tv from IPython import embed class squeezenet(torch.nn.Module): def __init__(self, requires_grad=False, pretrained=True): super(squeezenet, self).__init__() pretrained_features = tv.squeezenet1_1(pretrained=pretrained...
95bbc2ec10695d8e0eb5ae98bd448eb607f9cae286a8655e94d12206e739342d
Python
6,539
204
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import numpy as np import torch from torch import nn import torch.nn.functional as F from maskrcnn_benchmark.structures.bounding_box import BoxList # TODO check if want to return a single BoxList or a composite # object class MaskPostProcessor(n...
619e79563db4b0643ef651303fc57dbbdb8024b8bbaa3217457f236d49868d74
Python
6,540
161
import argparse import math from pathlib import Path import numpy as np import pandas as pd from tqdm import tqdm from pytransform3d.urdf import UrdfTransformManager from pytransform3d import rotations as pr from pytransform3d import transformations as pt from dataloading.model import Camera SKIP = -1 def parse_a...
8df0cc8c10db0445309ba6fd86ebb2698179f8fc507fb52bd02a91e86db02d9f
Python
6,540
156
import pdb import torch import torch.nn as nn from torchvision import models class MRNet(nn.Module): def __init__(self): super().__init__() self.model = models.alexnet(pretrained=True) self.gap = nn.AdaptiveAvgPool2d(1) self.classifier = nn.Linear(256, 1) def forward(self, x):...
ca48e54c0db09cc7eb948087d6b4f7d127fedb56878d2c36b7616f0698e90e15
Python
6,544
197
# Copyright (c) 2015-present, Facebook, Inc. # All rights reserved. import torch import torch.nn as nn from functools import partial from timm.models.vision_transformer import Mlp, PatchEmbed , _cfg from timm.models.registry import register_model from timm.models.layers import trunc_normal_, DropPath __all__ = [ ...
ccd1456226d642af6857a24a8144d5bc339829c82626691660f67a479b908e9d
Python
6,547
216
"""CTF Rest Dataset: TDE-HMM for Dynamic Network Analysis. In this script we train a Time-Delay Embedded Hidden Markov Model (TDE-HMM) on source reconstructed resting-state MEG data. The examples/toolbox_paper/ctf_rest/get_data.py script can be used to download the training data. Functions listed in the config are d...
8928c2f37811d472e791e0c39b38e6a53724877cd942a123844f982df73d3929
Python
6,555
188
import torch # transpose FLIP_LEFT_RIGHT = 0 FLIP_TOP_BOTTOM = 1 class Keypoints(object): def __init__(self, keypoints, size, mode=None): # FIXME remove check once we have better integration with device # in my version this would consistently return a CPU tensor device = keypoints.device ...
badf643a96b1cff858f5a9df6db1e7da215ce67bd96f4509a49c3ef3dc2e8f2a
Python
6,555
168
import numpy as np import pyshtools as pysh import torch import plotly.graph_objects as go from cv2 import getGaussianKernel from plotly.subplots import make_subplots def plot_pc(pc, second_pc=None, s=4, o=0.6): fig = make_subplots(rows=1, cols=2, specs=[[{"type": "scene"}, {"type": "scene"}]],) fig.a...
d9a90c9eea8f9aa47707f0ca00b535fe0cbafe466f4ac1c9e92ec1081fbcc03a
Python
6,556
173
import numpy as np from pathlib import Path from configparser import ConfigParser import imageio import shutil from flexdata import display from flexdata import data from flextomo import projector from flexcalc import process from flexcalc import analyze import cupy import cupyx.scipy.ndimage import skimage import scip...
ae80b172e9eedad3c7d0b99b1e40906e58ce5dc46522b3785d28f2007a6c04ca
Python
6,561
212
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import Tuple import pandas as pd from tmkit.contact.Evaluator import evaluator from tmkit.contact.Reader import Reader as rrcre...
90b18844086196fab4d233cad81ad3e1901137093ce9ed08c2a5a91151b4e043
Python
6,567
137
__author__ = 'duarte' import sys from preset import * import numpy as np """ spike_noise_input - standard network setup, driven with noisy, Poissonian input - quantify and set population state - run with noise_driven_dynamics in computations - debug with noise_driven_dynamics script """ run = 'local' data_label = 'ex...
269b201f944626c3944ebd43a871a941d53adefe4c66bdb1d084083ef0bf6c0b
Python
6,568
131
import os import shutil from dash_extensions.enrich import Serverside, Output, Input, State, callback, clientside_callback from dash.exceptions import PreventUpdate from RV.callbacks.utils.annotation_utils import get_annotation_label_radioitem from RV.callbacks.utils.channel_selection_utils import get_channel_topogra...
3d993c748ee7a7d76b4cb60fe9740630e22c7f64950185ac7eea25a3a261edf2
Python
6,570
179
import pytest import torch from tltorch import FactorizedTensor from ..spectral_convolution import SpectralConv, ConditionalSpectralConv @pytest.mark.parametrize("factorization", ["Dense", "CP", "Tucker", "TT"]) @pytest.mark.parametrize("implementation", ["factorized", "reconstructed"]) @pytest.mark.parametrize("sepa...
99929da5bd54f5659dd0ff2e44dd0f12de68a4aeb17b87398fe11a4f981a2729
Python
6,570
201
import pytest import torch from torch.nn.modules.batchnorm import _BatchNorm from mmdet.models.necks import FPN def test_fpn(): """Tests fpn.""" s = 64 in_channels = [8, 16, 32, 64] feat_sizes = [s // 2**i for i in range(4)] # [64, 32, 16, 8] out_channels = 8 # `num_outs` is not equal to len...
7edfaf68fb6bde1c72e396c5c229f2ef74c5a6ac189a8c1b006c7fec2cc12a3d
Python
6,571
152
from torch import nn import torch import numpy as np from torch_geometric.data import DataLoader from .train_utils import EarlyStopping, evaluate_score, data2iter, multitask_mse, multitask_print, save_results def seed_all(): np.random.seed(123) torch.manual_seed(123) torch.cuda.manual_seed_all...
a50489bd949b046bf6a1683ce539b4a621911fcf61613f6f3cc618f19950e677
Python
6,575
167
import logging import tarfile import tempfile import time from dataclasses import dataclass, field from typing import ClassVar, Dict, List, Optional from urllib.parse import urlparse from urllib.request import urlretrieve import requests from defusedxml.ElementTree import fromstring from oaklib.utilities.publication_...
3e9ec125a09a0e506be81a24cd3e9b6b76902ed3b7ab89cfbe15fba7cdaf3713
Python
6,577
213
""" Training script for Darcy flow equation using neural operators. This script trains a neural operator on the 2D Darcy flow equation, which models fluid flow through porous media. The script supports distributed training and multi-grid patching for high-resolution data. """ from pathlib import Path import sys impo...
68b1640819b3fd0b87135a917af03a2012b59d85f8b2844580b0d3b5a6ff8e7e
Python
6,577
184
__author__ = 'duarte' import sys from preset import * import numpy as np """ spike_pattern_input - main spike_input stimulus processing """ run = 'local' data_label = 'example4' # ###################################################################################################################### # PARAMETER RANGE ...
9acd3cb72a39dd2904c2e8c582c1dd86bec0af92b9b2a889a897baa9dcecabdf
Python
6,577
239
#%% import os import time import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from tqdm import tqdm from graspy import __version__ as graspologic_version from graspy.match import GraphMatch from src.data import load_metagraph from src.graph import MetaGraph from src.io import ...
eeb3bb9e48cf87d57685d4c88183003a07487ba243bc079d06b7221748091be5
Python
6,577
184
"""VOC Dataset Classes Original author: Francisco Massa https://github.com/fmassa/vision/blob/voc_dataset/torchvision/datasets/voc.py Updated by: Ellis Brown, Max deGroot """ from .config import HOME import os.path as osp import sys import torch import torch.utils.data as data import cv2 import numpy as np if sys.ver...
4ec717391723d62be5b2e422d63521a4d8cfcd9b210abef89d677a88494b0116
Python
6,579
136
''' collection of chemisorption models. newns_anderson: ''' import torch import numpy as np class Chemisorption: def __init__(self, model_name, **kwargs): # Initialize the class if model_name == 'gnn': self.model_num_input = 2 if model_name == 'newns_anderson_semi': ...
f60428683ffdbdf56012a0592d36d312f0c3c4782c9f493d85b66c98b7c9c922
Python
6,579
136
''' collection of chemisorption models. newns_anderson: ''' import torch import numpy as np class Chemisorption: def __init__(self, model_name, **kwargs): # Initialize the class if model_name == 'gnn': self.model_num_input = 1 if model_name == 'newns_anderson_semi': ...
4f7f43018eb84a310ce42e54ba6c3c087b383505ac13d9012a32692f5a57c568
Python
6,580
136
import os, torch,json from collections import defaultdict def qual_analysis_gossipcop(): doc_embeds_file_text = os.path.join(os.getcwd(), '..', 'data', 'complete_data', 'gossipcop', 'cached_embeds', 'doc_embeds_roberta_lr_test.pt') node2id_file = os.path.join(os.getcwd(), '..', 'data', 'complete_data'...
ec174ca748324d706bb89edc8b07c2b3cc21dc9e085241f29a2ff9b8345e9595
Python
6,580
230
# %% import os from pathlib import Path import colorcet as cc import matplotlib.pyplot as plt import numpy as np import pandas as pd import pymaid import seaborn as sns from matplotlib.collections import LineCollection from matplotlib.lines import Line2D from sklearn.decomposition import PCA from umap import UMAP fro...
971a0af5ef76ce265759e6ce99f82563ea381f773be88026a5b7c463e2462e47
Python
6,581
165
import torch from ..builder import BBOX_CODERS from .base_bbox_coder import BaseBBoxCoder @BBOX_CODERS.register_module() class TBLRBBoxCoder(BaseBBoxCoder): """TBLR BBox coder. Following the practice in `FSAF <https://arxiv.org/abs/1903.00621>`_, this coder encodes gt bboxes (x1, y1, x2, y2) into (top, ...
4d763396b8473467077ae5cbf73acd0dfdae106e5075aefcd0dba21d5b50b5a4
Python
6,582
164
import torch from mmdet.core import bbox2result, bbox2roi from ..builder import HEADS, build_head, build_roi_extractor from .standard_roi_head import StandardRoIHead @HEADS.register_module() class GridRoIHead(StandardRoIHead): """Grid roi head for Grid R-CNN. https://arxiv.org/abs/1811.12030 """ de...
5332eef735d55589b901c246c4c929ec43159715b1ea390563d3cef6bb45fb64
Python
6,590
161
import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from matplotlib.lines import Line2D import numpy as np from ddmr.utils.visualization import add_axes_arrows_3d, remove_tick_labels, set_axes_size import os def _plot_graph(graph, ax, nodes_colour='C3', edges_colour='C1', plot_nodes=True, plot_edg...
48b0d4ed2cedcf29c5b352130dd0cfd1f042d82448fe13bad47b697585a63023
Python
6,591
148
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """ Cluster-based permutation t-test ================================ .. currentmodule:: eelbrain A cluster-based permutation test for a simple design (two conditions). The example uses simulated data meant to vaguely resemble data from an N400 experiment, but ...
9c7e0747290819b6b4493e3deab79c388bfd6d742ad857ce4120ce6e470f67dd
Python
6,594
176
import numpy as np from PIL import Image class Signal : Text_array = { 'a':0,'b':1,'c':2,'d':3,'e':4,'f':5,'g':6, 'h':7,'i':8,'j':9,'k':10,'l':11,'m':12,'n':13, 'o':14,'p':15,'q':16,'r':17,'s':18,'t':19,'u':20, 'v':21,'w':22,'x':23,'y':24,'z':25 } def __init__ ( self, Name, Path, P...
535db7fbcf8d9625f2a5b71ab4bfc7e4677ffa2757b0115527e39c7631083c8a
Python
6,595
230
# %% [markdown] # ## import os from pprint import pprint import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from mpl_toolkits.axes_grid1 import make_axes_locatable from giskard.utils import powerset from src.data import load_metagraph from src.io import savefig FNAME = os.pa...
8196bc04b57ffd904a60d6e984e4ddc8538d177cbecf8ba0b7279366b8192934
Python
6,598
156
### reference code from https://github.com/quark0/darts/tree/master/cnn --- Differentiable Architecture Search import torch import torch.nn as nn from .conv_ws import ConvAWS2d from .registry import CONV_LAYERS import torch.nn.functional as F #from torch.autograd import Variable class Identity(nn.Module): d...
fc35f175087777d2a4b3e7a0ce0949cea3ce93aebb222bf6cb03b7148cdd5574
Python
6,598
181
"""Test the matching of Kaldi CTMs and segments to the transcript statements.""" from unittest.mock import MagicMock import numpy as np import pandas as pd import pytest from _pytest.fixtures import SubRequest from pytest_mock.plugin import MockerFixture # type: ignore from fi_parliament_tools.segmentFiltering impor...
0edd1282207f49d963a922e6e77f4b92416c784db553cfd1d9b5a1c7461b6cf6
Python
6,599
148
"""Paper Figure 1: substrate, compartment recovery, and the four-architecture lineup. Layout (2 x 2): A — Substrate composition (MB subgraph cell counts) B — DAN x MBON shared-KC Jaccard heatmap (hierarchical reorder) C — Top canonical pairs with subtype labels (DAN-i1 <-> MBON-i1, etc.) D — Architecture schem...
4b11cf2cc981a9a0c3849f50fc653d8d2241fe5752e0d8a763466a34ab0cb4b5
Python
6,600
215
from __future__ import print_function from __future__ import division from __future__ import absolute_import import numpy as np import argparse import pandas as pd from keras.models import Sequential from keras import layers import os from keras.optimizers import SGD from keras.callbacks import ( CSVLo...
835ea4fcab18e4a9e50c6294c3bb89ddfc7038a7a0e4e74ac2ebed8e6ca1ccd3
Python
6,603
158
# Copyright 2022 Huawei Technologies Co., Ltd # # 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 law or agreed to...
94937f45e7302609c663554be08ac0086871111c2440cd41526bca5832d59150
Python
6,604
167
#%% import numpy as np import pandas as pd from contools import Promat from pymaid_creds import url, name, password, token from data_settings import data_date, pairs_path import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) # datasets generated from https://github.com/clbarnes/brain_completion/blob/m...
73b34f232722c35ca5458694b387ce40793d01bd76bc0fe9c8b603604e30bff4
Python
6,605
235
from typing import List, Literal, Optional, Any from zencfg import ConfigBase class ModelConfig(ConfigBase): model_arch: str data_channels: int out_channels: int class FNOConfig(ModelConfig): model_arch: str = "fno" data_channels: int out_channels: int n_modes: List[int] hidden_chann...
c6d730ba339b207c9024199ec8015486a377895ad5e13fca4d9e7a7745dff0d7
Python
6,605
138
# Copyright 2022 Huawei Technologies Co., Ltd # # 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 law or agreed to...
2c9ed5cff4b7c420da30e404cf81386fd31e27c4d9f0f6c549ccb05b482f60e0
Python
6,608
170
""" This package serves as the master index for all implementations. """ from functools import cache from class_resolver import ClassResolver from oaklib.implementations.aggregator.aggregator_implementation import ( AggregatorImplementation, ) from oaklib.implementations.agrkb.agrkb_implementation import AGRKBIm...
8c1d0905cec211132d320e530454dbdcb02cac0533a9a8baaf446012173c6977
Python
6,610
120
__author__ = 'duarte' from modules.parameters import ParameterSet, ParameterSpace, extract_nestvalid_dict from modules.input_architect import EncodingLayer, InputNoise from modules.net_architect import Network from modules.io import set_storage_locations from modules.signals import iterate_obj_list from modules.visuali...
855c782ede832bc5dfe41eff2aa56685ee2faa563352d024456817b4387822d3
Python
6,611
224
""" ipyleaflet map for validating candidate TPA sites """ import geopandas as gpd import ipyleaflet as ipyl import ipywidgets as ipyw # define XYZ tile layers to add to map tile_layers = { "google": "http://www.google.cn/maps/vt?lyrs=s@189&gl=cn&x={x}&y={y}&z={z}", "esri": "https://server.arcgisonline.com/Ar...
217cc6861e65cab997a59001cfd5670aa347bf805d161a95d2a028ae29ef9003
Python
6,614
227
import contextlib import warnings import torch from torch import autograd from torch.nn import functional as F enabled = True weight_gradients_disabled = False @contextlib.contextmanager def no_weight_gradients(): global weight_gradients_disabled old = weight_gradients_disabled weight_g...
6a74fd989896cd820769c5fd3b97642d84eb7dd9fae361e7729e5e48d8328247
Python
6,615
162
import torch.nn as nn from mmcv.cnn import ConvModule, caffe2_xavier_init from mmcv.ops.merge_cells import GlobalPoolingCell, SumCell from ..builder import NECKS @NECKS.register_module() class NASFPN(nn.Module): """NAS-FPN. Implementation of `NAS-FPN: Learning Scalable Feature Pyramid Architecture for O...
dd58715cb7d80bdc82d6a97dcd167c2a7395319813510bc09f74333b2f8b1954
Python
6,616
140
from functions import * import matplotlib import matplotlib.pyplot as plt import numpy as np import copy from datetime import datetime import pickle starttime = datetime.now() pickledump = True #Should results of this run be saved (True), else load previously stored results (False) #Load dictionaries from pkl files t...
49166d4dd653f8708d991f7f919b1a395f5332584ad9593ff6ea2d562b4a606a
Python
6,620
205
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Sep 8 16:13:47 2021 @author: user """ fdir = __file__ from IPython import get_ipython from copy import deepcopy, copy get_ipython().magic('reset -sf') #get_ipython().magic('cls') import os current_path = os.path.dirname(__file__) os.chdir(current_pa...
ed2eeee154fb5866c8c96ce957519e7bcd32dc617f534f85f8282663bda01d97
Python
6,626
190
import argparse import ast from datetime import datetime import json import logging import os import shutil import sys import re crg2_dir = "/srv/shared/pipelines/crg2" def replace_str(filename, target, replacement): # pythonized sed with open(filename, "r") as file: lines = file.readlines() with...
e4662e65ffa492c1b710820a4fd305570e563860b4f61e7889a4ef9d2bc08468
Python
6,627
191
from functools import partial import numpy as np import torch import torch.nn as nn from pg_modules.blocks import DownBlock, DownBlockPatch, conv2d from pg_modules.projector import F_RandomProj from pg_modules.diffaug import DiffAugment class SingleDisc(nn.Module): def __init__(self, nc=None, ndf=None, start_sz=...
8a76b3f2281ea9f3a591488885e3076e45b70614397a6c56daf46ab5cb4067b5
Python
6,628
202
from builtins import object # Unit tests for sima/imaging.py # Tests follow conventions for NumPy/SciPy avialble at # https://github.com/numpy/numpy/blob/master/doc/TESTS.rst.txt # use assert_() and related functions over the built in assert to ensure tests # run properly, regaurdless of how python is started. from nu...
f636f2e3f3dd21ebe849bc9262b7d645fe0b17c6ad1fe4a2a5d5331532231153
Python
6,631
193
from __future__ import print_function, division import torch import torch.nn as nn import torch.nn.functional as F class ConvLayer(nn.Module): """ Convolutional operation on graphs """ def __init__(self, atom_fea_len, nbr_fea_len): """ Initialize ConvLayer. Parameters ...
4c9e5da0f16f2a92d81a363e8ec499ba127a6312b3bf34c7551fc6f1e9d6aafd
Python
6,633
154
import math import torch import torch.nn as nn import torch.nn.functional as F class ConvBlock(nn.Module): def __init__(self, in_planes, out_planes, stride=1): super(ConvBlock, self).__init__() self.conv = nn.Conv2d(in_planes, out_planes, 3, stride=stride, padding=1, bias=False) self.bn = n...
9c642d9f54989aafa4d1335c1c1d1222161799c9ffd43a4bc0d8d8399f4f8433
Python
6,633
175
import argparse def check_odd_integer(value): ivalue = int(value) if not (ivalue % 2): raise argparse.ArgumentTypeError(f"{ivalue} is not a valid odd integer") return ivalue # PARSER CREATION FUNCTION def create_parser(): parser = argparse.ArgumentParser( description='HRpQCT Segmenta...
7485724fe48f19b9fbadd70774f6c41d5289520a36d0e3416a1356e37bc08c8e
Python
6,639
191
#################################################################################################### # Copyright (c) 2021, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program i...
f69c8b455800d9fef35d14602fb08b9f7e5cbd3a962fb7ea7b207d84ec5b08c2
Python
6,640
227
from zarr import load from argparse import ArgumentParser from glob import glob import os # import random from params import * from image_manipulation import image_mip, image_read, image_warp import pandas as pd import napari from matplotlib.cm import get_cmap from matplotlib.colors import rgb2hex from scipy.ndi...
397b88e7af91b4b9e7f35a8cc8402d41c7309639569ba119bd731735d9fa164b
Python
6,644
165
# Copyright 2021 Huawei Technologies Co., Ltd # # 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 law or agreed to...
88519e18dd655a75620828f1e86459a812286cb35048171f953a54f3b464c3bc
Python
6,646
199
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import Any, Dict, List, Tuple, Union from functools import wraps import pandas as pd class Writer: """ A class that p...
bf1652ac5a51daccf6ac6853fc5617435645a96ec9fee0760f3d8c8fb5a3240b
Python
6,651
175
import cv2 import numpy as np # import time import torch from torch.nn import functional as F import torch.nn as nn def encode_segmentation_rgb(segmentation, no_neck=True): parse = segmentation face_part_ids = [1, 2, 3, 4, 5, 6, 10, 12, 13] if no_neck else [1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 13, 14] mouth_...
7874e4977211ceadcbff0293df6c59e7f97e888ae431b334ce7f564a0927a726
Python
6,653
130
######################################## # UNCLASSIFIED # ######################################## """ This lat_lon_xy_utils.py file is used to get a pixel location within an image based on latitude and longitude coordinates. """ import warnings import numpy as np from haversine import...
a6944ee42d7e8fdfc795186b3459a2d9b764b25d697348a95c2e97768e88b950
Python
6,653
183
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
e1cfe3d12688d248e96b9fda6d553b52c5f29b89ecf5c876ba2226783466764a
Python
6,654
282
# %% [markdown] # # THE MIND OF A MAGGOT # %% [markdown] # ## Imports import os import time import warnings import colorcet as cc import matplotlib as mpl import matplotlib.pyplot as plt import matplotlib.transforms as transforms import numpy as np import pandas as pd import seaborn as sns from anytree import LevelOr...
e4fdeb164bb712b5f8ae2a4a22a970367e774905344342794b75b16df822552e
Python
6,658
220
import copy import random from functools import wraps import torch from torch import nn import torch.nn.functional as F import numpy as np from torchvision import transforms as T from torchvision import models from net.models.modeling import VisionTransformer, CONFIGS # helper functions def default(val, def_val): ...
019059506521c59508e340e892ea435f667de5ef5810bddaa778500ceee51742
Python
6,659
162
#!/usr/bin/env python3 """ File: preprocess_mds_file.py Created: 2020/10/26 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo 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 F...
a5e3c27426e2687a23b543fbda655b9a645c8f3b331e6ebfd0d3cb2ba4cd4d76
Python
6,659
141
#!/usr/bin/env python3 """ File: export_to_excel.py Created: 2022/04/06 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo 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 Founda...
f4d23b7a98f0258595ec1197f665d313e5e15f34f6db4436a0649c5d149e36d1
Python
6,659
210
# -------------------------------------------------------- # Fast/er R-CNN # Licensed under The MIT License [see LICENSE for details] # Written by Bharath Hariharan # -------------------------------------------------------- from __future__ import absolute_import from __future__ import division from __future__ import pr...
532a7092a7a1a2817b087469743a2ab88467809a7eb5de81975f72937f57a76f
Python
6,660
185
# Copyright 2021-2022 Huawei Technologies Co., Ltd # # 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 law or agre...