sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
121320c6d909c43f79393ba64bd5ea5af6cc44a1d8f2f1e7d127c8a5574e7cff
Python
8,643
162
import logging import tensorflow as tf import numpy as np from .encoder import TransformerEncoder, GATEncoder from .decoder import TransformerDecoder, SingleLayerDecoder, BilinearDecoder, NTNDecoder from .critic import Critic # Tensor summaries for TensorBoard visualization def variable_summaries(name, var, with_max...
22ae401bc9a3024fe979b13781726c4bc03475a0499c8f43df2bb7f34a4e12be
Python
8,643
187
import sys import numpy as np import torch import time import pickle from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingSynapse from sns_toolbox.networks import Network # Personal stuff to send an email once data collection is finished sys.path.extend(['/home/will']) from e...
2a767913bd31faf3314821f8c904f8856905fea6939c0ed32627d1e20b1a811f
Python
8,647
316
#!/usr/bin/env python import click from click_option_group import optgroup import json import numpy as np import os import pandas as pd import re from sklearn.metrics import average_precision_score, roc_auc_score import sys sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), ...
8cfcb8de280bb55ba252fdf0b29defdc98834e118c2de7905c47e0a89c88f815
Python
8,652
332
import random import torch import torch.nn as nn import torch.nn.functional as F import torchvision.transforms as TvT from torch.autograd import Variable from spikingjelly.clock_driven import functional from spikingjelly.clock_driven import neuron from poolingNet_cat_1res_mvsec import NeuronPool_Separ...
c6505ddb98bcd481d7d27cd0673b9bd0f514ba6aba8831fb48b58b4ff0243410
Python
8,652
200
''' contains methods used in varipus components .. codeauthor:: Nicholas Browning ''' from __future__ import division from builtins import str from builtins import range from past.utils import old_div import math import numpy element2mass = {'Ru': 101.904348, 'Re': 186.955744, 'Rf': 261.10869, 'Ra': 226.025403, ...
e87aac47bc8fcfe522f7d2cee1e82db440c0e33b491a301408d11b4c99073056
Python
8,654
213
# -*- coding: utf-8 -*- # # Copyright © 2013 Charles E. Vejnar # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at https://www.mozilla.org/MPL/2.0/. # """UCSC track hub.""" import os class Node(ob...
e3538aa155ed64e8b8836597f980cdb3e2be6c75be915c17c3fe7d9aa4e83e8b
Python
8,655
213
from typing import Iterator, List, Dict import torch import torch.optim as optim from allennlp.data import Instance from allennlp.data.fields import TextField, SequenceLabelField from allennlp.data.dataset_readers import DatasetReader from allennlp.common.file_utils import cached_path from allennlp.data.token_indexers ...
c9b616b3b89e7f2da8a905b72166e6373a3c079bd028804ba015906d33b88ee7
Python
8,657
207
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
790f828559d4f3ca5dc42ca3f68d9fd806c7a5f8ff7e1fc79ab897719720f5e4
Python
8,659
261
#!/usr/bin/python -u import os import math import numpy import random import pandas import matplotlib.pyplot as plt from sklearn import * # if __name__ == '__main__': numpy.random.seed(1) random.seed(1) predmatrix = pandas.read_csv("./tmp/prediction_matrix.tsv", sep="\t", ...
81d0b80ee64d0321dd78cc9d4daf080e426263c995cd560c0ffab9456e3329f3
Python
8,661
250
"""Time series Kvisibility.""" __author__ = ["seigpe"] import numpy as np import pandas as pd from sklearn.cluster import KMeans from sktime.clustering.base import BaseClusterer class TimeSeriesKvisibility(BaseClusterer): """Kvisibility for time series clustering. kvisibility is a time series clustering t...
8ec92485d5525b4744dad9a2015c75f17fc87946fd9b9fbed5364083e4f2f7a0
Python
8,661
261
# Copyright 2026 DeepMind Technologies Limited # # 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 agr...
365454b2cf1b3c0de2f39b31975c5efb6cc1b3e3cf232f51738b0d2d37b20843
Python
8,668
245
# -*- coding: utf-8 -*- """ Created on Tue May 31 11:11:16 2022 @author: tiagolab """ import matplotlib #matplotlib.use('Qt5Agg') from matplotlib import pyplot as plt import os import numpy as np import glob #from scipy import signal #from scipy.signal import lfilter #from scipy import stats #import...
e60d445dc8a70909ea2a6a847d1a8a20cf64da594979624e2fff66340c8723f0
Python
8,672
193
""" Neurons are the computational nodes of an SNS, and can be either spiking or non-spiking. """ """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% IMPORTS """ from typing import Dict, Any import warnings import numbers from sns_toolbox.color_...
c39a68e40327be3db5eae9fc66e0f03f32591dcff87356253552b0527defc2a7
Python
8,676
214
from __future__ import annotations from dataclasses import dataclass from typing import Any, Callable import numpy as np from numpy import ndarray import pandas as pd from pandas import DataFrame try: from scipy.stats import gaussian_kde _no_scipy = False except ImportError: from seaborn.external.kde impor...
6212044026ed8e38e60a149ab664869125903b73723e3ec9f70397e7ec1a0ce5
Python
8,678
183
import sys import numpy as np import torch import time import pickle from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingSynapse from sns_toolbox.networks import Network # Personal stuff to send an email once data collection is finished # sys.path.extend(['/home/will']) # fr...
19a0ecb9034d2d7518e62ce93ad5653041c5af5070f32c312b9b00e0dfa6a8c2
Python
8,696
236
# Copyright 2026 DeepMind Technologies Limited # # 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 agr...
ab9787a11234a4963591d045bafbdbd43b7d0d8dd58f72163ca99af13cb59257
Python
8,696
274
import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib import cm import seaborn as sns from scipy.spatial import Voronoi, voronoi_plot_2d from sklearn.preprocessing import StandardScaler from sklearn.cluster import KMeans, AgglomerativeClustering from sklearn.metrics import silhouette_...
76bddd21169dd35932f74fabbe6b1b85efb2e724a0dba0b22bc0a712fd52f45f
Python
8,705
211
__author__ = ["chrisholder", "TonyBagnall"] from typing import Any import numpy as np from sktime.dists_kernels._numba_distances.base import ( DistanceAlignmentPathCallable, DistanceCallable, NumbaDistance, ) class _EdrDistance(NumbaDistance): """Edit distance for real sequences (EDR) between two t...
d57d6272963e2fd24e84b83af12baf9eeb23018b82e8b6264a6ed86b896d3602
Python
8,706
312
"""Machine type converters for Table scitype. Exports conversion and mtype dictionary for Table scitype: convert_dict: dict indexed by triples of str 1st element = convert from - str 2nd element = convert to - str 3rd element = considered as this scitype - str elements are conversion functions of machine type (...
fbac3d441e02f5fdd4fe420d2e419cf99b97c8b91c6908d4ff6444eeae1dd32a
Python
8,709
197
# Copyright 2007 Zachary Pincus # This file is part of CellTool. # # CellTool is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. """Tools for reading and writing delimited data files. Files with v...
d6e364dbca9ea447edc51d03ff8d8cc14db62043096d024b6ef82dcaea575509
Python
8,718
272
#!/usr/bin/env python # Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import argparse import glob import os import re import subprocess from textwrap import dedent from typing import TYPE_CHECKING if TYPE_CHECKING: from collections.abc import I...
c4b0e76561ad2e8aa18137973a9873cbd73b7ddd698387f113ff298fc0f9448c
Python
8,720
263
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Sep 3 12:03:23 2021 Run gridsearch to fit SHJ @author: robert.mok """ import os import sys import numpy as np import torch import itertools as it import time from scipy import stats import pickle location = 'cluster' # 'mbp' or 'cluster' (cbu clust...
74cc5022dad93d71d0a23faf18417c1f91a2732245ffffc25178f40d49b48116
Python
8,725
211
#!/usr/bin/env python # blasr 0.0.1 test suite # Generated by dx-app-wizard. import os import unittest import time import json from uuid import uuid4 import dxpy import dxpy.app_builder from dxpy.exceptions import DXAPIError src_dir = os.path.join(os.path.dirname(__file__), "..") test_resources_dir = os.path.join(sr...
49851c892eeddf9e42173495930b9de52399fac97cdf8144b0bcc0b90d6b3ca4
Python
8,728
302
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import matplotlib.pyplot as plt import cv2 as cv import numpy as np from dataclasses import dataclass import os import random from numba import njit, jit from sklearn.utils import shuffle import shutil # In[2]: ## Read EMBED dataset metadata file...
f2c894eb19517f73033f8340896fdac2f1f496114a189a9bdf03aa725de452c7
Python
8,731
192
""" Compare the simulation speed of the different backends William Nourse September 9 2021 The correct term is Babes, sir """ import numpy as np import torch import time import pickle from sns_toolbox.neurons import SpikingNeuron from sns_toolbox.connections import SpikingSynapse from sns_toolbox.networks import Netw...
b4b7f5d6a15c16e507bd3cc0ba6cc8e08471b0e464b030dd572dccb41a229b7a
Python
8,736
250
# Copyright 2019 DeepMind Technologies Limited # # 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 agr...
ddfbfbbac43facae07069347c64ed84feab716d989e7c22e39341c78eb926a5f
Python
8,738
196
from numba import jit, prange import numpy as np import numpy.typing as npt from scipy.cluster.vq import kmeans2 from .run_gw import DistanceMatrix, Distribution, Matrix, gw from scipy.spatial.distance import squareform, pdist @jit(nopython=True, parallel=True) def deformation( A: npt.NDArray[np.flo...
a47eeb7fb2be7feeb6e6dfbddee448d6a11d3db8282e63fd4b5f65e73997c03d
Python
8,739
254
#!/usr/bin/env python # encoding: utf-8 """ remap_hoc.py Created by Paul Manis on 2013-01-04. Copyright (c) 2013 Paul B. Manis, Ph.D.. All rights reserved. This function remaps a hoc file from 'axon[x]' to whatever is in the sectionLists. It turns sections only found in the "section list" and replaces axon[k] with a...
25afcb5e781ee2909aed2430fd2f11def47879a18bce931d62e845d91ab519a7
Python
8,740
220
"""BaseEstimator interface to sktime edit distances in distances module.""" __author__ = ["fkiraly"] import numpy as np from sktime.dists_kernels._numba_distances import pairwise_distance from sktime.dists_kernels.base import BasePairwiseTransformerPanel class EditDist(BasePairwiseTransformerPanel): r"""Inter...
f0cdaafb32073ce0ef85ec2e27298b90d7948ea2aa0b763b17248e26e3640ba5
Python
8,740
248
"""Random Interval Classifier. Pipeline classifier using summary statistics extracted from random intervals and an estimator. """ __author__ = ["MatthewMiddlehurst"] __all__ = ["RandomIntervalClassifier"] import numpy as np from sktime.base._base import _clone_estimator from sktime.classification.base import BaseCl...
5ec30e1e45ee1eafef6ca88f893e9924dbf6491abe804923a7dd23aad8b76d7e
Python
8,742
158
"""Perform GNN ensemble model training.""" import argparse from os.path import exists, isdir from os import mkdir from copy import deepcopy import time import sys sys.path.insert(0, "../src") import random import torch import toml from torch_geometric.loader import DataLoader from gnn_eads.functions import create_l...
a4296ba9434be38a1a3d0d12e14d4e0ba4325b4253dffbf8584f2ff1df28ec2b
Python
8,743
204
#!/usr/bin/env python import os import sys import stat from os.path import join as pjoin, exists as pexists, realpath import numpy as np """#---------------------------------#---------------------------------#--------------------------------- The following script helps you generating job files for processing the lar...
8efbf2533a7574c48ea1a13b990d42153f87e7b32f4cdf059c7caa5722eb37ae
Python
8,745
251
import copy import os from PIL import Image import torch import torch.utils.data import torchvision from pycocotools import mask as coco_mask from pycocotools.coco import COCO import custom_utils.transforms as T class FilterAndRemapCocoCategories(object): def __init__(self, categories, remap=True): sel...
53f0f455089a2e6b8d7cdde0ae6ef1ea4ca2de2cf26d38108be1d0c29573f1b0
Python
8,747
208
from copy import deepcopy from pprint import pformat import rdflib import networkx as nx # FIXME probably break this out into its own project to avoid scipy dep for deployment from rdflib.extras import external_graph_libs as egl from pyontutils.core import OntGraph, Edge from pyontutils.utils import listIn, makeSimple...
a76e1bc3a905dd6514b1a992f97efe55128d6f58ea515fcb82e71d9c1429bddb
Python
8,751
233
# Copyright (c) OpenMMLab. All rights reserved. import warnings from abc import ABCMeta, abstractmethod from collections import OrderedDict from typing import Sequence import mmcv import torch import torch.distributed as dist from mmcv.runner import BaseModule from mmcls.core.visualization import imshow_infos # TODO...
245168c08d527bde09f584f9f2bc143e64c7dd5b3fe7e59ae88d0a29445a027f
Python
8,759
244
# -*-coding:utf-8-*- # from __future__ import absolute_import import torch import torch.nn as nn import torch.nn.functional as F import math def conv1x1 (in_planes, out_planes, stride=1): return nn.Conv2d(in_planes, out_planes, kernel_size=1, stride=stride, bias=False) def conv3x3 (in_planes, out_planes, stri...
e71c345cbeeb15ade8549b1ee1b109c100d5d20883c6d9521462eca947574abc
Python
8,761
187
import sys import numpy as np import torch import time import pickle from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingSynapse from sns_toolbox.networks import Network # Personal stuff to send an email once data collection is finished # sys.path.extend(['/home/will']) # fr...
f14c3dffe1bff7043afb386500419d51c6fd399bb9f212ffb7761c36435a6b95
Python
8,768
187
import sys import numpy as np import torch import time import pickle from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingSynapse from sns_toolbox.networks import Network # Personal stuff to send an email once data collection is finished # sys.path.extend(['/home/will']) # fr...
30c0cf1548e8bed3b6daa4b644efcc06c7ee4b2f401e72aeae2802424008429a
Python
8,772
274
#!/usr/bin/env python import click from click_option_group import optgroup import json import numpy as np import os import pandas as pd import shutil import sys sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), os.pardir)) import time import torch from expl...
4789051719eb2571bd019d9c584da287ab3e828d126d47001fdbf4370afad132
Python
8,774
207
from os import listdir from os.path import isdir, isfile, join from pathlib import Path from shutil import copy from typing import Dict, List, Union import numpy as np import pandas as pd import pydub.audio_segment from pydub import AudioSegment def code_with_extension(base_folder: str, code: str, extension: str) ->...
f56bb72a507b37d769b5d5489507b7132f4bf8731c19cede13ca40b42f21f6c9
Python
8,774
350
#!/usr/bin/env python3 -u # copyright: sktime developers, BSD-3-Clause License (see LICENSE file) """Do-nothing script for making a release. This idea comes from here: - https://blog.danslimmon.com/2019/07/15/do-nothing-scripting-the-key-to -gradual-automation/ The script is adapted from: - https://github.com/alan-tu...
4f1dc66fb4ea718c396c009a66c104e5a9a549b84b3fab499eea888e5896f777
Python
8,775
187
import sys import numpy as np import torch import time import pickle from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingSynapse from sns_toolbox.networks import Network # Personal stuff to send an email once data collection is finished # sys.path.extend(['/home/will']) # fr...
dc4fff97032e9e27f3e1ef7f4bda5fdd7d6d88358fb7b192efab09b1de7dafc8
Python
8,780
174
import numpy as np import torch import random from tqdm import tqdm from vp_suite.base import VPModel from vp_suite.model_blocks.enc import DCGANEncoder, DCGANDecoder from vp_suite.model_blocks.phydnet import K2M, DecoderSplit, EncoderSplit, PhyCell, SingleStepConvLSTM class PhyDNet(VPModel): r""" This clas...
63ad6dfd8511983d077260a5405aea65146dea7ea38594437db6afcf18bccf83
Python
8,781
219
# -*- coding: utf-8 -*- """ Created on Thu December 10 11:41:02 2022 @author: Pawan Panwar, Quanpeng Yang, Ashlie Martini PyL3dMD: Python LAMMPS 3D Molecular Dynamics/Descriptors Copyright (C) 2022 Pawan Panwar, Quanpeng Yang, Ashlie Martini This file is part of PyL3dMD. PyL3dMD is free software: you ...
f0f91348fa5252df507f32a63334846172ed47a8f9f88857071aa0af9d40440e
Python
8,789
284
#!/usr/bin/env python # -*- coding: utf-8 -*- # # face_recognition documentation build configuration file, created by # sphinx-quickstart on Tue Jul 9 22:26:36 2013. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in t...
5e49a016a326af3c557d7ce53eaf0602142a103aa19108738853cee1f5f4b2db
Python
8,792
205
import copy from functools import partial from pathlib import Path import pandas as pd import numpy as np def create_binary_diagnoses_df( abcd_data_path: Path ): subindicators_table = pd.read_csv(abcd_data_path / 'subindicators_table.csv') # aggregate diagnoses via OR rule and remove '_or_rule' suffix ...
c900551ffab657bf1a104921097322b65d5247757d1495f3386b029778400db8
Python
8,793
186
import torch import torch.nn as nn class BANet(nn.Module): def __init__(self, in_channels=4, out_channels=1, init_features=8): super(BANet, self).__init__() # Common self.activation = nn.ReLU(inplace=True) scale = 2 # ENCODER # Layer 1 in_features_1 = in_c...
0c073071bcb3874b0f0a2bc6a06dfbf378a28df12b4817bb5ebea796477df540
Python
8,795
245
# SPDX-License-Identifier: LGPL-3.0-or-later """Exercise magnetic-force conventions through the registered LAMMPS adapter. Generate the CPU graph fixture with ``source/tests/infer/gen_dpa4c_spin_lmp.py``. PyTorch-enabled LAMMPS CI sets DPA4SPIN_LMP_REQUIRED=1 so missing fixtures, Python bindings, or plugin registratio...
1632bc2cabb14b2562fc69e977059fa298f796682e7d103021d676493e7c08e3
Python
8,798
229
""" This script will upload data to the designated VGP upload bucket in AWS and create a link to a corresponding file object in DNAnexus. The directory structure created in S3 will be as follows: s3://bucketname/ |--species | |-- <species_name> | | |-- <species_id> | | | |-- genomic_data | | | | |...
499b79b141c843bc2ea3d371dd87ee7880e0a9b934c3cf636a1a04d1646f5f34
Python
8,798
231
import torch from torch import nn torch.cuda.empty_cache() import datasets import transformers from transformers import activations import pandas as pd import numpy as np from transformers import DistilBertTokenizer, \ DistilBertForSequenceClassification, DistilBertModel, DistilBertPreTrainedModel, Trainer, TrainingArg...
b484bb65c869a908eb9eb0ace7858687a8a28a9cf49efaaec5272185511c3df8
Python
8,798
185
import sys import numpy as np import torch import time import pickle from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingSynapse from sns_toolbox.networks import Network # # Personal stuff to send an email once data collection is finished # sys.path.extend(['/home/will']) # ...
2ab16030618ea2a7e27eaa5aa7986b7e74098aeca8361fec1805b6e9e018fe54
Python
8,808
220
# Copyright 2019-2021 The ASReview 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 # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by appl...
590dfad665be8d5f911474ed1ce8151bc3b4da562b1ec1dd1cbd61f3a3d93c41
Python
8,809
257
# Copyright 2026 DeepMind Technologies Limited # # 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 agr...
8b3271018ed2fd542c72b29976fae772053625b402c575a11b768dfd67649987
Python
8,810
358
#%% import pandas as pd filename = "bgm/data/elife-24838-fig1-figsupp4-data1-v1.csv" adj_df = pd.read_csv(filename, index_col=0) adj_df # %% from graspologic.plot import heatmap heatmap(adj_df.values, transform="binarize") #%% heatmap(adj_df.values[5:, 5:], transform="binarize") #%% orn_adj_df = adj_df.iloc[5:, 5:]...
97cbb591fefb423f822022ab158a81412bd4db0e1a4b47da6b4afa546051372b
Python
8,816
329
#%% [markdown] # # Connectome data #%% import datetime import time import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from pkg.data import load_split_connectome from pkg.io import OUT_PATH from pkg.io import glue as default_glue from pkg.io import sa...
128cb21fe187aedeb551ccde398a06ee0f6290f3c3a6802fc2ad254a7848da73
Python
8,823
304
import random import torch import torch.nn as nn import torchvision.transforms as TvT from spikingjelly.clock_driven import functional from spikingjelly.clock_driven import neuron from network_3d.poolingNet_cat_1res import NeuronPool_Separable_Pool3d from tqdm import tqdm from data.dsec_dataset_lite...
48489c04b71cb6e1ab626173349aa0e4cf0c40a8ff75e0470b64fa5a54f80dc4
Python
8,824
232
import dolfin as df class Solver(): """ Class for solving the zero-flow model used in Sætra et al. 2023 with unknowns w = (k_r, phi_r) where: k_r - concentration of ion species k in compartment r phi_r - potential in compartment r """ def __init__(self, model, dt_value, Tstop):...
40a73321328a8f1a20cc357b3bdd1b65df902db8be63f4f1eb5515cb87f650ad
Python
8,827
273
import os import torch import torch.nn as nn from torch.utils.data import Dataset, DataLoader import sys import shutil from train import train import time import math from read_input_data import * device=torch.device('cuda:0') # torch.cuda.set_device(device) torch.backends.cuda.matmul.allow_tf32 = False torch.backends...
1e221c8e579590c2403fff48bffc0dd9e6b5f923fa2e0697db1579a9f006f36a
Python
8,831
212
#import re, sys, string import regex as re, sys, string ########################### #Generic_G4_g = re.compile(r'G{3,}([ATCG]{1,3}G{3,}){3,}', re.I) #Generic_G4_c = re.compile(r'C{3,}([ATCG]{1,3}C{3,}){3,}', re.I) Generic_G4_g = re.compile(r'(?=(G{3,}[ATCG]{1,7}?G{3,}[ATCG]{1,7}?G{3,}[ATCG]{1,7}?G{3,}))', re.I) Gener...
de97ecc231d216635b1b92a5da0fcb5bc8eca8035c4ee2b3b32896a3a33e59e8
Python
8,831
240
# Copyright 2026 DeepMind Technologies Limited # # 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 agr...
5010f1372ee1d58cfecc6db79bb727d43f95a3f46c63d0b00584d40bf466dcc4
Python
8,834
204
# SAFE TEAM # # # distributed under license: CC BY-NC-SA 4.0 (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt) # # import tensorflow as tf # structure2vec # DE-MF : discriminative embedding using Mean Field class NetworkLSTM: def __init__(self, features_size, e...
233b77c37d6c2ca05edd4f53ef709adaa9af39d8b420e57e7ce44416b6887b2e
Python
8,837
258
"""Residual Network (ResNet) for classification.""" __all__ = ["ResNetClassifier"] from copy import deepcopy from sklearn.utils import check_random_state from sktime.classification.deep_learning.base import BaseDeepClassifier from sktime.networks.resnet import ResNetNetwork class ResNetClassifier(BaseDeepClassifi...
9d5624a941829ae3ae1745b86052f1f4e535dde5fa757bffbaf3bf59b3b3ef19
Python
8,842
228
#!/usr/bin/env python # coding: utf-8 import os from scipy import sparse import argparse import logging import pandas as pd import numpy as np import anndata from robustlink import utils from robustlink import enhancer_gene_utils logger = utils.create_logger() def pipe_corr_analysis_atac( common_modx_cells,...
a2dead361675aa26a6e1bee4a235bcf76071a97c83b28b2c3c1b743e5e0cb102
Python
8,845
285
from __future__ import annotations from dataclasses import dataclass from typing import ClassVar import numpy as np import matplotlib as mpl from seaborn._marks.base import ( Mark, Mappable, MappableFloat, MappableString, MappableColor, resolve_properties, resolve_color, document_prope...
7a602808b2c4719c872cc42afdb658b2d55985076f2715fe5cf4a7041ccf023a
Python
8,847
271
import os import sys import numpy as np from sklearn.cluster import KMeans import numpy as np from sklearn.cluster import KMeans import glob from torch_geometric.data import InMemoryDataset, DataLoader from torch_geometric import data as DATA import torch from rdkit import Chem from rdkit.Chem import MolFromSmiles imp...
0be83256838735a5346f1b2b8c4ec93770a6caa17e7c48ef9c8bbbb48dc86b9a
Python
8,848
272
import os import sys import numpy as np from sklearn.cluster import KMeans import numpy as np from sklearn.cluster import KMeans import glob from torch_geometric.data import InMemoryDataset, DataLoader from torch_geometric import data as DATA import torch from rdkit import Chem from rdkit.Chem import MolFromSmiles imp...
1590ac0d0377352ee7cf71f285339f8e5a76acfceb3046fbab190641f6fe1434
Python
8,851
191
#------------------------------------------------------------------------------ # elftools tests # # Maxim Akhmedov (max42@yandex-team.ru) # This code is in the public domain #------------------------------------------------------------------------------ import os import unittest from elftools.elf.elffile import ELFFi...
f923c1c531965c34bb2b9b76b71240ef28b88cbad3202bf416e258d4a5e38be2
Python
8,852
220
# Copyright (c) OpenMMLab. All rights reserved. import copy import warnings from ..builder import CLASSIFIERS, build_backbone, build_head, build_neck from ..heads import MultiLabelClsHead from ..utils.augment import Augments from .base import BaseClassifier warnings.simplefilter('once') @CLASSIFIERS.register_module...
6c09503604d7130045cfb3997890ad482bfe9a46609b9e66aab6e4a1a1e4cca3
Python
8,853
216
# Copyright 2022 DeepMind Technologies Limited # # 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 agr...
b6c2917ed88150c09ed18bceef61d77a4b19a2681e459e7f86abe4fbe868f26c
Python
8,855
193
""" @file: dataset_loader.py Created on 22.10.18 @project: crazy_ara_refactor @author: queensgambit Please describe what the content of this file is about """ import glob import logging import numpy as np import zarr from DeepCrazyhouse.configs.main_config import main_config from DeepCrazyhouse.src.domain.util import ...
7c2b0c6a4429b678f34f3b803ec4087828bdb54de96ca501e2d3e461990d571b
Python
8,859
231
# ------------------------------------------------------------------------------- # elftools: ehabi/ehabiinfo.py # # Decoder for ARM exception handler bytecode. # # LeadroyaL (leadroyal@qq.com) # This code is in the public domain # ------------------------------------------------------------------------------- from __f...
fe412fec7d4585f584f6605f959fd7985905eddf3763aaf6cde827fba004f971
Python
8,862
193
""" Compare the simulation speed of the different backends William Nourse September 9 2021 The correct term is Babes, sir """ import numpy as np import torch import time import pickle from sns_toolbox.neurons import SpikingNeuron from sns_toolbox.connections import SpikingSynapse from sns_toolbox.networks import Netw...
73c66b158c074050fe294ed245f3c90edc0aace98614c5d61450085fcd30d869
Python
8,864
202
#Plot BoostMEC trees #This code is modified from the lightgbm source code for plotting/create_tree_digraph() #https://lightgbm.readthedocs.io/en/latest/pythonapi/lightgbm.create_tree_digraph.html #https://lightgbm.readthedocs.io/en/latest/_modules/lightgbm/plotting.html import os import matplotlib import pydot ...
7d9fe8f104e0850389d0b9f9c2fbe895eca4ca6f1291ac25f495d959650b13a6
Python
8,864
190
""" Compare the simulation speed of the different backends William Nourse September 9 2021 The correct term is Babes, sir """ import numpy as np import torch import time import pickle from sns_toolbox.neurons import SpikingNeuron from sns_toolbox.connections import SpikingSynapse from sns_toolbox.networks import Netw...
0335b80656f89d82d145aa8ff288f14847454009db3f9bdcde866c57528d05df
Python
8,865
260
import os import redis import pickle from sys import platform from pciSeq.src.viewer.utils import get_pciSeq_install_dir import pciSeq.src.diagnostics.config as config import getpass import subprocess as sp import logging du_logger = logging.getLogger(__name__) class RedisDB: def __init__(self, flush=False): ...
c8e8aaf7af6df0ac6d11195873364a3b8b252f7a7e5c0498c43e5f3002f9016d
Python
8,866
239
import os import pickle import subprocess from pathlib import Path from typing import Union import numpy as np import SimpleITK as sitk from evalutils import SegmentationAlgorithm from evalutils.validators import (UniqueImagesValidator, UniquePathIndicesValidator) from picai_baseline....
067edb9fee46918c49446914a8b749b0372d3a80ea61f788287c6a0f9c828f52
Python
8,867
257
"""Machine type checkers for Alignment scitype. Exports checkers for Alignment scitype: check_dict: dict indexed by pairs of str 1st element = mtype - str 2nd element = scitype - str elements are checker/validation functions for mtype Function signature of all elements check_dict[(mtype, scitype)] Parameters --...
7839d92329fb8023a2d7bce6e52e71670e5339b68679c8a86a2e11f392acca8e
Python
8,867
316
"""Tests for source/odp_polarity_plot.py. The polarity plotter is mostly rendering code, so these tests use tiny in-memory-style TSV fixtures and inspect the matplotlib objects it adds. """ from __future__ import annotations import math import pandas as pd import pytest @pytest.fixture(scope="module") def pp(sourc...
969161cb8a8fd71930e55d35fd9e13880b56f039112da560f6f771f6e9d0bfe9
Python
8,868
238
from typing import Any, Optional import pytest import flair from flair.data import Dictionary, Sentence from flair.embeddings import TransformerEmbeddings from flair.models import FewshotClassifier from flair.nn import Model from flair.trainers import ModelTrainer class BaseModelTest: model_cls: type[Model] ...
9b8e1d00174a66727864baf40964c6f3da5d4e3a72858f0ee34589990b14e9dc
Python
8,868
264
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations from typing import Any import numpy as np import onnx from onnx import NodeProto from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class TfIdfVectorizerHelp...
a84240f7c1f7d6c2fd1a9644952a632226b1ce8c35c881b7f5b19804ef4d95cc
Python
8,869
193
""" Compare the simulation speed of the different backends William Nourse September 9 2021 The correct term is Babes, sir """ import numpy as np import torch import time import pickle from sns_toolbox.neurons import SpikingNeuron from sns_toolbox.connections import SpikingSynapse from sns_toolbox.networks import Netw...
6dce1a3878f0185377ea79f7efba002049b8886db9cdfb374714f4c48e6cba53
Python
8,879
159
"""Recover shared splice chains before intersecting study-specific identifiers. This creates a separate data version; it never modifies the original benchmark. No target-domain count is consulted when constructing the shared catalogue. The catalogue still uses both studies' released annotations (closed catalogue, not ...
05b314656e1035730db643342e279957cce8988428614dac1797f8affddbd1c5
Python
8,880
193
""" Compare the simulation speed of the different backends William Nourse September 9 2021 The correct term is Babes, sir """ import numpy as np import torch import time import pickle from sns_toolbox.neurons import SpikingNeuron from sns_toolbox.connections import SpikingSynapse from sns_toolbox.networks import Netw...
b57f5f717496a1dcca67601d52471249593424c114b01a05097297d8abf9a245
Python
8,890
232
import torch import torch.nn as nn import math #from math import round import torch.utils.model_zoo as model_zoo def conv3x3(in_planes, out_planes, stride=1): "3x3 convolution with padding" return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=False) clas...
104f1470c5768e78b0ff7744a9bd4bbcc7fe40cbcc04ba4935f24f71b9ecc823
Python
8,894
277
""" Test and compare different cross-correlation methods. We test our "local" calculation in reverse_correlation.py with a reference package in elephant. The Brian package (in spikestatistics.py) makes different assumptions, and is not comparable. This module is part of *vcnmodel*. Support:: NIH grants: DC R...
6b553b064daacbb810a77490a22737d563d53f8ee41d2a2d6a52178e7db01b77
Python
8,897
248
# Copyright (c) OpenMMLab. All rights reserved. from typing import Sequence import torch.nn as nn from mmcv.cnn import build_norm_layer from mmcv.cnn.bricks.transformer import FFN from mmcv.runner.base_module import BaseModule, ModuleList from ..builder import BACKBONES from ..utils import PatchEmbed, to_2tuple from ...
e60214c7e3b77c2bbd0b5bcf6d1795eb4b14f43b9e2e2799573cc02551fce7ce
Python
8,897
291
# Mocapy: A parallelized Dynamic Bayesian Network toolkit # # Copyright (C) 2004 Thomas Hamelryck # # This library 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...
dedd9bacdf39e7268db17d46c5237cd1cb16844ab6e49a538d879415fd32754c
Python
8,898
167
#!/usr/bin/env python """ This takes in a list of RBH files from multiple species and constructs a rbh database file. This is useful in the case where we have limited .rbh files that only have a few columns. The reason for writing this script was to accommodate alternative ways of introducing homologous loci into var...
b02fc28717d42954f15dad87277894d7a2f7cc6af7b80b2dfac827d0c1903d35
Python
8,901
280
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # PyFilterbank documentation build configuration file, created by # sphinx-quickstart on Sun Jun 1 13:01:31 2014. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this...
fbc2ed7ae81b05f87ce2f45603bf6185eddc3f796819adef2f083bb2df976a87
Python
8,909
200
import os import numpy as np import matplotlib.pyplot as plt from PIL import Image from numpy.lib.function_base import flip import pandas as pd from math import * import pandas as pd import torch import torchvision.transforms.functional as TF from skimage.segmentation import disk_level_set torch.cuda.e...
a3906a41b1f38ba536ba32fe34b0bd024257a2395a5fb2d578b8be1fbc97f11f
Python
8,920
225
import json from multiprocessing import Queue import networkx as nx from networkx import json_graph import numpy as np from scipy import sparse import sqlite3 from threading import Thread from binary_similarity.utils import __padAndFilterLSTM as padAndFilterLSTM from binary_similarity.utils import __padAndFilter as pad...
15f762f6f070d87a3206afe75c535ba02f30f5f62ee9a2ef0fa57596cebc9038
Python
8,922
289
""" iterio from werkzug.contrib since it was deprecated and remove ideally we can get rid of this in idlib werkzug@2b2c4c3dd3cf7389e9f4aa06371b7332257c6289 """ def _mixed_join(iterable, sentinel): """concatenate any string type in an intelligent way.""" iterator = iter(iterable) first_item = next(iterator...
5b9d53b6383ba365ebd5bda4576565942208b50795d87c645d508a0a1e1cc1ab
Python
8,923
230
""" @file: lr_schedules.py Created on 30.09.18 @project: crazy_ara_refactor @author: queensgambit This file contains the description of the common Advanced Learning rates. Code is based on: https://mxnet.incubator.apache.org/tutorials/gluon/learning_rate_schedules_advanced.html """ import copy import math import matp...
5747b8a4db4eb86656f67399544d5434963bf9ba6f273a00cad5d7ea59017569
Python
8,926
268
#!/usr/bin/env python import click from click_option_group import optgroup import json import numpy as np import os import pandas as pd import shutil import sys sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), os.pardir)) sys.path.insert(0, os.path.join(os....
3d650b9964cdba83c58246304e0331932ec83bdf834240ae814cb4e292ce3fba
Python
8,927
268
#!/usr/bin/env python import click from click_option_group import optgroup import json import numpy as np import os import pandas as pd import shutil import sys sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])), os.pardir)) import time import torch from expl...
1776656a36ee2642d22105328123ac145b386d04fa9f0260329a13e6e5d9b4e4
Python
8,928
196
import tensorflow as tf from tensorflow.contrib.rnn import LSTMCell, GRUCell, MultiRNNCell, DropoutWrapper from tensorflow.contrib import distributions as distr from .encoder import Attentive_encoder # RNN decoder for pointer network class Pointer_decoder(object): def __init__(self, encoder_output, config): ...
8a68da44056d41a869e3b0033e64e719089c23bb32afac93950caacf2ece38da
Python
8,928
215
import glob import os import numpy as np import torch from nn_common_modules import losses as additional_losses from torch.optim import lr_scheduler import utils.common_utils as common_utils from utils.log_utils import LogWriter CHECKPOINT_DIR = 'checkpoints' CHECKPOINT_EXTENSION = 'pth.tar' class Solver(object): ...
60849740595e2467cccafb444cdc0164d341437b7001615a544921ede2054629
Python
8,938
269
# Copyright 2026 DeepMind Technologies Limited # # 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 agr...
45518bcb4da8f7eaac0dc9e1973dd838dd2ea7e216b37d4a63977d1bb1f0ea30
Python
8,940
266
#%% [markdown] # # Maggot connectome subset #%% import datetime import logging import time import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import pymaid import seaborn as sns from graspologic.plot import adjplot from pkg.data import DATA_PATH from pkg.io import glue as defa...
6c9f21d4cafb084a1ec237c1955d67d067effa185d771344abca9085a1d916e6
Python
8,950
249
"""Checks that the GIFT-Eval evaluation script runs off a safetensors snapshot. ``benchmarks/forecasting/gift_eval/evaluate.py`` is a script rather than an importable package, so it is loaded here by path. Its ``build_model`` is the whole checkpoint-facing surface: it resolves ``--pretrain_ckpt``, wraps the backbone ...