sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8767e97666dcd0e4161422e72bd2d5b21fc3a912c897070a17a3afd871c8f874
Python
2,912
86
""" @file: input_representation.py Created on 20.06.18 @project: jc39qevo-deep-learning-project @author: queensgambit Input representation for the Crazyhouse board state which is passed to the neural network """ import DeepCrazyhouse.src.domain.variants.input_representation as variants from DeepCrazyhouse.src.domain....
e22dfd5d9df3a99296813ec64659e81162c897fff5988a12ac958bb6adeb2006
Python
2,912
65
# 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. """Plot the shape modes of a given PCA shape model. This tool gener...
883a993ffcf381f6abdbc0338ef7f1d85932f9b7f8446e1c396dfcbff39cc294
Python
2,913
90
import unittest import os import shutil import numpy as np from ddt import ddt from SPHARM.classes.spectrum import Spectrum from SPHARM.classes.time_spectrum import TimeSpectrum @ddt class TestTimeSpectrumClass(unittest.TestCase): def test_add_spectrum_and_plotting(self): tsp = TimeSpectrum() ...
a5c609757633c8b42479e38ade849bfb325116c864856b7f7e16c035f4bd0f95
Python
2,914
99
from netplotbrain import plot as npbplot import pytest import pandas as pd import matplotlib.pyplot as plt # Example node and edges dataframes included with package nodes = pd.read_csv('./examples/example_nodes.tsv', sep='\t', index_col=0) edges = pd.read_csv('./examples/example_edges.tsv', sep='\t', index_col=0) # S...
c069c1f0191d05c57087636525ddf7582c8f3e367d85d692f16a9ee91c164f49
Python
2,914
82
import scanpy as sc from anndata import AnnData import numpy as np import pytest from scipy.sparse import csr_matrix from palantir.utils import run_local_variability # Mock data for dense matrix def mock_anndata_dense(n_cells, n_genes, layer_keys, obsp_keys): rng = np.random.default_rng() ad = AnnData(rng.ra...
70d79fde77e718408deaad587f0c2eafbc2bd31ed053bf7545d7c3935c2fb53e
Python
2,915
72
import torch.nn as nn import torch import torch.nn.functional as F from torch.distributions import Bernoulli from torch.autograd import Variable from scipy.special import gamma import numpy as np import math import pdb from .ResNetFeat import create_feature_extractor class FeatureNet(nn.Module): def __init__(sel...
c0c6b710405152289cf92772a5dc115514c15ee4b65c0b1249ff78db00b093fa
Python
2,915
94
import pytest import torch from torch.nn.modules import GroupNorm from torch.nn.modules.batchnorm import _BatchNorm from mmcls.models.utils import SELayer def is_norm(modules): """Check if is one of the norms.""" if isinstance(modules, (GroupNorm, _BatchNorm)): return True return False def test...
ed2e73c413978cdb6bfb9ffd16f6822266e6ec94361f75c452eb26e571847d50
Python
2,915
60
import scanpy as sc import numpy as np import pandas as pd import sys def format_DEGs(adata): keys = ["names","scores","logfoldchanges","pvals","pvals_adj","pts"] for i,key in enumerate(keys): a = pd.DataFrame(adata.uns["rank_genes_groups"][key]) # transfer to data frame b = pd.DataFrame(a.v...
d5209f3a4f90c4764af81025316d36e547332de4d1b4b654443f62735613849c
Python
2,917
99
# 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...
2f57b97dfeeb28a4ed3dce347b7caa9fb4d194c6051f879879dcfe503e110827
Python
2,920
85
import scanpy as sc import numpy as np import pytest from scipy.sparse import csr_matrix from palantir.utils import run_local_variability # Mock data for dense matrix def mock_anndata_dense(n_cells, n_genes, layer_keys, obsp_keys): rng = np.random.default_rng() ad = sc.AnnData(rng.random((n_cells, n_genes)))...
b451e48ac7e2e9e20ae3ca16699939a26231c2180dbe70cc88a8af05366b94d4
Python
2,920
87
import numpy as np import pyqtgraph as pg class ColorBar(pg.GraphicsObject): def __init__(self, cmap, width, height, ticks=None, tick_labels=None, label=None): pg.GraphicsObject.__init__(self) # handle args label = label or '' w, h = width, height stops, colors = cmap.get...
0ca2c3e5d4add31d1b4b15e11e4a80d1c7c245dd75d2ac6055377d1bd4ef1c07
Python
2,921
81
from pathlib import PosixPath from typing import Optional import ants import numpy as np from ants.core import ANTsImage from rich import print def get_coords(x: np.ndarray, margin: list = [8, 8, 8], offset: list = [0, 0, 0]) -> list: """Get coordinates of a given ROI, and apply a m...
a90d66609178c2ef58085e46dee973b1bd48976ac2038de213ac4659806e52c4
Python
2,921
80
#Copyright (C) 2021. Huawei Technologies Co., Ltd. All rights reserved. #This program is free software; #you can redistribute it and/or modify #it under the terms of the MIT License. #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHA...
fd27161ce2efbe4141466861ee17170f07ed4634091a6c229278b73b6d398a3a
Python
2,921
102
# 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...
1756ec1e081c274da1c64dd33645136c38c8a10c387ba817f99dd8dc4825a9d8
Python
2,926
91
# 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...
d4df01b59229ac366c2c9acac0822f6665cdcd71a475d42497edac4e175b5bcc
Python
2,928
74
import unittest import numpy as np from q2_matchmaker._stan import _case_control_sim, _case_control_full from q2_matchmaker._stan import _case_control_data, _case_control_single from skbio.stats.composition import alr_inv, clr # class TestCaseControl(unittest.TestCase): # # def setUp(self): # np.random.se...
1a2a086b847c340fca2e941d3119f346238eb0045f97ec463606c96088d89bfe
Python
2,931
89
""" Base default handler to load torchscript or eager mode [state_dict] models Also, provides handle method per torch serve custom model specification """ import abc import logging import os import json import torch logger = logging.getLogger(__name__) class BaseHandler(abc.ABC): def __init__(self): s...
54450fb5ff00fdd03012a6447e495ca3186193ff850d7df74c7a34b8558ca065
Python
2,931
97
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import ml_dtypes import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class Celu(Base): @staticmethod def export() -> Non...
6e571fbe2d0d01bddf8b29e7555c24b237a9e18b3b846a47293bbf5b8a973de6
Python
2,931
97
""" Params.py A classs to create parameter structures First version: Paul Manis on 2014-01-31. Distributed under MIT/X11 license. See license.txt for more infofmation. This code is deprecated for future use - use the built-in Python @dataclass instead. It is included here because past simulations may have had Params...
8863e41273a8597ba8fdacc1cf05f16d1b161ec1b85b6f02236d23a83dd61989
Python
2,931
64
""" Explore the range of pre-built functional subnetworks William Nourse December 3rd 2021 """ from sns_toolbox.networks import Network #, AdditionNetwork (This would import the code that we remake here from sns_toolbox.neurons import NonSpikingNeuron from sns_toolbox.connections import NonSpikingTransmissionSynapse f...
e50168977a8b7febefc8bb832c9a892d1a61fc00f42d5eb192f0ddc7fff428a5
Python
2,932
95
# Copyright 2019-2021 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # ###############################################################################...
046b64e14bff8c2b5afe4fb7cbf3eb71c267df91f9a66d5a33eae4f5c2c1e8c6
Python
2,935
62
# Copyright 2019-2020 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...
48e21546241b1d0d954eaac8804e80c796beb15f8864392843aaea6d39509565
Python
2,935
74
# Copyright 2019-2026 The AmpliGraph Authors. All Rights Reserved. # # This file is Licensed under the Apache License, Version 2.0. # A copy of the Licence is available in LICENCE, or at: # # http://www.apache.org/licenses/LICENSE-2.0 # from ampligraph.datasets.data_indexer import DataIndexer import numpy as np imp...
1125fd61046d71366f5630d24b7a9b41aeb6576cc31170dff285d71acd90c857
Python
2,936
68
import matplotlib.pyplot as plt import numpy as np import pickle data = pickle.load(open('dataBackendTimesNonspikingDense.p', 'rb')) numNeurons = data['shape'] npRawTimes = data['numpy'] npAvgTimes = np.mean(npRawTimes,axis=1)*1000 npVar = np.std(npRawTimes,axis=1)*1000 torchCPURawTimes = data['torchCPU'] torchCPUAv...
a322b8b7a253bec774182da00a60a24a3c339d5aba3d2b84dffe42511a4c8065
Python
2,939
84
""" Test the embedded auditory nerve model with a set of tone pips. (Zilany et al. 2014; requires MATLAB) This demonstrates the lowest-level access to the auditory nerve model that is available in the cnmodel API. For higher-level tools, see test_sound_stim.py (which uses an_model.get_spiketrain) and test_sgc_input.p...
c8228e70c837321e0401d2a3336936df5a14cafae8641505db85ac6a5531e69e
Python
2,939
89
# Copyright 2019 DeepMind Technologies Ltd. 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...
7d8502b458ea2c00c2cb021e924f67e0f136bedf70b60d9456993f5df856efbc
Python
2,940
85
#!/usr/bin/env python # -*- coding: utf-8 -*- # 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 your option) any later version. # This prog...
befacb2cedfb5487a86719dc5cfcb855b6f3dc59bdfa81d1c8b0d56d21e182d1
Python
2,942
75
import numpy as np from scipy.io import loadmat from os.path import join as pjoin, isdir, realpath, dirname, basename """ Details on the origins of these parcellation could be found in loadPrecomputedAtlasCorticalParcellation.m in src repo from Raamana's PhD. The internal structure of those Matlab structs contains...
4a928eb939a5923d4e582a41e38407b30540cbc1b7583cb9a9e975dd87d8ef0c
Python
2,943
80
#======================================================================================================================= # Copyright (C) 2021 Matvey Safroshkin, Grigory Arutyunov, Patrick Mueller # Computer Vision Studio # Friedrich Miescher Laboratory of the Max Planck Society # Systems Biology of Development, Univer...
2d18f05651ba3130fd5f9c68c612db552e0289214087cf8fbf2518c0216ac995
Python
2,944
63
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import anndata as ad import scanpy as sc from matplotlib.colors import ListedColormap sns.set_context("poster") sns.set_palette("colorblind") sc.settings.figdir = "./figures/" def main(): seed = 1029 # set randomness for dim. reduction and c...
3a731dd7fb8f1e199e1ae166b2f337db58aa9143c86ed378c6c7b879fde242dc
Python
2,945
86
# 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...
62dd610556a93fd49d54cbbddcdb9ade172ffe1f299a681e3fa988f5588801e4
Python
2,948
94
import sys from matplotlib import pyplot as plt import seaborn as sns sns.set_style("white") import pandas as pd colors = sns.color_palette("RdYlBu", 13) colors = sns.cubehelix_palette(7, start=2, rot=0, dark=0.05, light=.95, reverse=False) colors = sns.color_palette("Set1", 13) df_exome = pd.read_csv(sys.argv[1],...
c862425884d5a38e2773967e0e9bb482c5b0848c11580aa3228d944caf16e0e4
Python
2,948
85
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from ..builder import HEADS from .multi_label_head import MultiLabelClsHead @HEADS.register_module() class MultiLabelLinearClsHead(MultiLabelClsHead): """Linear classification head for multilabel task. Args: num_class...
83a3f8f16f6dd14927dcb83f58e06bddd079d88decb9dc8808048873875efa6d
Python
2,950
96
# -*- coding: utf-8 -*- # # Copyright © 2023 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/. # import logging import os import subprocess fro...
004f028f503819c5a5541c67d1013e6c407fee88ba3975a4c53060d756cd8324
Python
2,951
71
from __future__ import division import os import sys import pandas as pd import numpy as np from SPHARM.classes.surface import Surface from SPHARM.classes.image_stack import ImageStack from helper_lib import filelib from mayavi import mlab ################################# args = sys.argv[1:] if len(args) > 0: p...
4b5a90b9fd853aadb970b0f61af55470481467fbd5c0aaac73a32b615d0664f8
Python
2,951
57
"""Shared fixed-mask proportion metrics, including honest constant-map handling.""" import numpy as np from scipy import sparse from scipy.spatial import cKDTree from .coverage_retrain import evaluate_sparse from .metrics import _safe_spearman def moran(values, neighbors): values = np.asarray(values, dtype=np.flo...
deb787b85538905331da625c5f6c49d7cdf76be04241237955db19cfe8bd1f4d
Python
2,951
74
# SPDX-License-Identifier: LGPL-3.0-or-later """Backend-neutral training cursor and selection-RNG checkpoint contract.""" import unittest from deepmd.dpmodel.train.data_progress import ( collect_training_data_progress, preserve_training_data_progress, restore_training_data_progress, ) from deepmd.utils im...
6eae9bad131cb17df0bf7dc6fa86134e56a634f6d60e4e209b734fa7b0c90f5e
Python
2,954
96
# 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...
dc712500d4a3057c28cc258d6558c228a07de2b17eefcf96a3a439a6522e3bff
Python
2,966
85
# -*- 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 ...
45ef3d954490bef3c6adbc13c485abda62475942c7d756445aa1553b60bcf9ca
Python
2,967
85
# 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...
da6a65527eb40568cd0c4db6d4e0d12b54baac635a9c30dd3ddf18226e23107b
Python
2,967
107
import numpy as np from ANNarchy import * # import matplotlib.pyplot as plt import time import pickle # Personal stuff to send an email once data collection is finished import sys sys.path.extend(['/home/will']) from email_utils import send_email """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
e42fb3344ef188462345b9683da03faaa5892d7786fec704d4f516d359b5d89e
Python
2,967
116
import sys, os import numpy as np import json def main(*args): source_file = args[0] target_folder = args[1] if len(args) > 2: print("Too many args") print( "USAGE: python3 mot_to_absolute path_to_source_file path_to_target_dir --include_confidence" ) sys.exit(0...
814b417246044ff521357dfceb16a0e949f9ca514cf62480f5a9ed1d14b62484
Python
2,968
93
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun def softmaxcrossentropy( x, target, weight=None, reduction="mean", ignore_index=None, get_log_prob=None ): input_shape = x.shape ...
9e600e89beeab8ce1fdb0027bda42f1a922c5ebc4fca33295fa97c5afecabe85
Python
2,969
125
CONTRACTION_MAP = { "ain't": "is not", "aren't": "are not", "can't": "cannot", "can't've": "cannot have", "'cause": "because", "could've": "could have", "couldn't": "could not", "couldn't've": "could not have", "didn't": "did not", "doesn't": "does not", "don't": "do not", "hadn't": "had not", "hadn't've": "had not hav...
0145aa0e678714b5240cd018c84a8f006c2a6a3e74741c6663d539668a6e7595
Python
2,970
82
#! /usr/bin/env python # # Copyright (C) 2012-2018 Michael Waskom DESCRIPTION = "seaborn: statistical data visualization" LONG_DESCRIPTION = """\ Seaborn is a library for making statistical graphics in Python. It is built on top of `matplotlib <https://matplotlib.org/>`_ and closely integrated with `pandas <https://pa...
29f7c131ba5a08df6cdbb80cd4336e8f6563d9e0baca57010dfe59d1c152e536
Python
2,970
88
""" estimate_weights.py Provides crude weight estimation for cue configurations from Shaverdian et al. (2022). We assume cue inputs can be described by vectors pointing towards the true position of the cue. This script then attempts to find a combination of magnitudes in order to minimise the difference between the su...
f279eace5e5bc22b662f78ae6f798805c570591a06515b04b20400af3ea58ce5
Python
2,970
87
# 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...
a7ceece5d71f6a3a1bdaea2cedb25886fd5fcce4eb2397d29c110773e12608ae
Python
2,971
111
# -*- coding: utf-8 -*- """ sync.py @author: derricw Provides some classes useful for synchronization and data alignment. """ from psychopy import visual from camstim.experiment import EObject class SyncPulse(EObject): """ Digital IO pulse that can occur at various times in the experiment. args ---...
fb7df4188b8c5c39226a1fb73f955ffdbb9b3f8e4744b560413cbc0e21975555
Python
2,971
69
import logging import gc # PyTorch modules import torch from torch.utils.data import DataLoader # Cormorant modules and functions from cormorant.engine import Engine from cormorant.engine import init_logger, init_cuda from cormorant.engine import init_optimizer, init_scheduler from cormorant.models.autotest import corm...
22ed8ebe7751785127c010235409a13fac7ce295c7f92914fba81c3c38d0d45a
Python
2,973
91
import psutil from pyontutils.utils import makeSimpleLogger log = makeSimpleLogger('nifstd-tools') logd = log.getChild('data') def memoryCheck(vms_max_kb): """ Lookup vms_max using getCurrentVMSKb """ safety_factor = 1.2 vms_max = vms_max_kb vms_gigs = vms_max / 1024 ** 2 buffer = safety_factor *...
9a96965f4b017cf2a1a95f06abee9ad4ec85d241573dfecec2c62456941e8bea
Python
2,973
93
from __future__ import print_function import numpy as np from .augment import Augment from .warping import warping from .geometry.box import Box class Warp(Augment): """Warping by combining 5 types of linear transformations: 1. Continuous rotation 2. Shear 3. Twist 4. Scale ...
69b470a610489baeaba78242f9cd88500b0758d58f0f2b89fd62b5b317af2ce7
Python
2,974
112
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import ml_dtypes import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class ReverseSequence(Base): @staticmethod def expo...
cec633cebed47ddaefc13b9e23eba88ab624c1bb4b88fce2dd727754db15b0c4
Python
2,974
94
# Copyright 2019 DeepMind Technologies Ltd. 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...
c27d95f06f11cd484e77c69f6498549b6d0d25c7445295e6b6ea17a8401fb329
Python
2,975
89
# Copyright 2019 DeepMind Technologies Ltd. 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...
19f08a908bcc3c4c80927ebba5c3d954fa56fffb1b4e340e87dea0d8d6bbf0de
Python
2,976
70
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Created on Sun Mar 6 13:50:08 2016 @author: tpisano """ import os, sys, shutil from xvfbwrapper import Xvfb; vdisplay = Xvfb(); vdisplay.start() from tools.imageprocessing import preprocessing from tools.registration.register import elastix_wrapper from tools.utils.d...
dee1a2e0f5f9016a77baf8e39d5a2669a8a5a77624b2fb8d030ea386e2cc7288
Python
2,976
100
# Copyright 2019-2020 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...
60051adfd31d9a4ccb8d11687e6e8b1f43aa18640c7d2c9ae227976701d48b6c
Python
2,977
139
import json config = {} config['Source'] = {} config['Algorithm'] = {} config['ResultRepresenter'] = [] config['classes'] = [] config['classes'].append( { "id":0, "name":"BMP", "color": [255,0,0], }) config['classes'].append( { "id":1, "name":"NODAL", "color": [0,0,255], }) config['classes']....
216c32dba32207e3106a3db7c1309f63a775411487c850b63b06131f5eecc147
Python
2,978
94
""" Parse a hoc file generated by swc_to_hoc (in the neurovis package), producing the reverse map from hoc sections back to the swc elements. This will be done with a "hocx" file, which has the extended information about which swc segment is associated with each hoc pt3dadd call. The result is a text file that looks...
923d79700115632d4a159a62dc77299a36fc87eb42fd15d847965073f8ea92e1
Python
2,978
79
# Copyright 2019 DeepMind Technologies Ltd. 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...
f9c376a9af7416f58326dd7924e3147bf435a3586c511bc3a16322dee2672276
Python
2,979
96
# Copyright (c) ONNX Project Contributors # # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np import onnx from onnx.backend.test.case.base import Base from onnx.backend.test.case.node import expect class MaxUnpool(Base): @staticmethod def export_1d() -> None: ...
a932a9e8b6512cbcb47026cdf0c6599582c9d0468064f5535e4c9d1d341255de
Python
2,980
96
# 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...
16cf098969137d8ce35894d8532e2cc7b5b7ef5689f57e3db49520d5f42f9c81
Python
2,983
93
"""data definitions that are widely used """ from typing import List, Union # all the best "grade A" cells gradeACells = [2, 5, 6, 9, 10, 11, 13, 17, 18, 30] MixedMode = [9, 11, 17, 18] # according to Figure 2, supplemental figure 2 Coincidence = [2, 5, 6, 10, 13, 30] # according to figure 2, supplemental figure 3 ...
e40f236eff987af434e3991fe8aa095919956cb9ef015a412f276154eda4f423
Python
2,984
79
""" Reused utilties that depend on packages outside the python standard library. """ import hashlib from urllib.parse import quote as url_quote import rdflib rdflib.plugin.register('librdfxml', rdflib.parser.Parser, 'pyontutils.librdf', 'libRdfxmlParser') rdflib.plugin.register('libttl', rd...
10e297a18092fe7294c577cb249715dcba55aa43bb7be2671acde3fd312a24e9
Python
2,985
101
""" """ import logging import numpy as np import pandas as pd import os def logcpm(counts): """ Args: - gene-cell matrix (pandas DataFrame) """ cov = counts.sum(axis=0) logcpm = np.log10(counts.divide(cov, axis=1)*1000000 + 1) return logcpm def logtpm(counts, gene_lengths): """ ...
cb07e4378609e484ae922b7c1b55c7df476ce539bf028aa9ec77ad38b5b50063
Python
2,985
97
# SPDX-License-Identifier: LGPL-3.0-or-later from typing import ( Any, ) import torch from deepmd.dpmodel.atomic_model import ( DPUniMolAtomicModel, ) from deepmd.dpmodel.model.dp_model import ( DPModelCommon, ) from deepmd.dpmodel.output_def import ( OutputVariableDef, ) from .make_model import ( ...
b1c5aa3a451e20236f99cf2cebb683ac5caa50a290d8d0864d5d1546ac172587
Python
2,988
107
import numpy as np from ANNarchy import * # import matplotlib.pyplot as plt import time import pickle # Personal stuff to send an email once data collection is finished import sys sys.path.extend(['/home/will']) from email_utils import send_email """ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%...
695adaef83f45cfc7be5df471a2b30ff487ebdd1017ba966dd3a52ffd027febe
Python
2,989
74
# Copyright (c) OpenMMLab. All rights reserved. import mmcv import torch.nn as nn from mmcv.cnn import ConvModule from mmcv.runner import BaseModule from .make_divisible import make_divisible class SELayer(BaseModule): """Squeeze-and-Excitation Module. Args: channels (int): The input (and output) ch...
3aef2d765d3af73811dac89624d324aa42659c9cbac03adfc9fcf2b1e2fe206d
Python
2,990
102
# Copyright 2019-2020 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...
d3fbdd6f9b0f44dc2a30db39fcd0467cf48c85ded4f4810ea149242da8200334
Python
2,990
71
import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import matplotlib as mpl mpl.rcParams['pdf.fonttype'] = 42 mpl.rcParams['ps.fonttype'] = 42 mpl.rcParams['font.family'] = 'Arial' # settings cellclass_ordered_v2 = ["Cycling Dorsal NEC", "Cycling Ventral NEC", "Cycling NE...
ef634a1c60b466796e2a3718b0135ef032873a2865ac40364f20a5cd9ae6b595
Python
2,991
105
import json from sqlalchemy import create_engine, inspect, Table, Column import pandas as pd from ilxutils.args_reader import read_args from ilxutils.scicrunch_client import scicrunch import sys import time from ilxutils.interlex_sql import interlex_sql import re from collections import defaultdict import requests as r...
da71e08a94e6aeadb861452bcf7d530a71cf9744cef4e19494e07d8cb5c8433e
Python
2,993
90
#!/usr/bin/env python from __future__ import print_function import sys,os import argparse import logging import tempfile import subprocess import time desc = 'Removing javareconf from conda activation' epi = """DESCRIPTION: The script will search within the conda env directory for the file: activate-r-base.sh It wil...
e7d7f29cf89e2be248d3a7cee66ac3e83587919e49107003182f5ae95925f08e
Python
2,993
75
from flair.data import Sentence def test_sentence_context(): # make a sentence and some right context sentence = Sentence("George Washington ging nach Washington.") sentence._next_sentence = Sentence("Das ist eine schöne Stadt.") assert sentence.right_context(1) == [sentence._next_sentence[0]] as...
3e4caf313274a3b75fd4159f81d0818a22f855439c16585c06f80f333e672bde
Python
2,994
101
# -*- encoding: utf-8 -*- from neuron import h import pyqtgraph as pg import cnmodel.util as util from .protocol import Protocol from .. import cells class SimpleSynapseTest(Protocol): def reset(self): super(SimpleSynapseTest, self).reset() def run(self, pre_sec, post_sec, temp=34.0, dt=0.025, ...
522d498c8102bfe5d8410a2a5385c3523939964db1277527d0ab4067321f54aa
Python
2,995
101
# 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...
47d1fa0c7defcda74163eb117334aae5724848ee55f2db4dcdb7573315d480bf
Python
2,996
109
#!/usr/bin/env python from Bio import SeqIO from Bio.Seq import Seq from Bio.SeqRecord import SeqRecord import click import importlib import math import random import sys lib = importlib.import_module("match-seqs-by-gc") CONTEXT_SETTINGS = { "help_option_names": ["-h", "--help"], } @click.command(no_args_is_hel...
6bac0ca17e7185468a824646b2a658d21124264beb203b192e1a40abcb679c9d
Python
2,996
86
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Sequential, Linear, ReLU from torch_geometric.nn import GINConv, global_add_pool from torch_geometric.nn import global_mean_pool as gap, global_max_pool as gmp # GINConv model class GINConvNet(torch.nn.Module): def __init__(sel...
ff3c3d17b8b7806816438e5bba251d2eecf53bb706eaafe3d3c47aee9db51dc5
Python
2,998
102
# Copyright 2019 DeepMind Technologies Ltd. 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...
7ce13c5751f324e590e1fc7bc9bd71ec78fe7ed771fba46e394e2b72d72ef88e
Python
3,001
108
#!/usr/bin/env python3 from neurondm.sheets import Sheet from neurondm import OntId, OntTerm, Config, NeuronEBM, Neuron from pyontutils.utils import byCol, relative_path from pyontutils.namespaces import ilxtr from pyontutils.closed_namespaces import rdfs class APIN(Sheet): name = 'apinatomy-to-npo' sheet_na...
19d5f7240f8c0338c4af5a7a9b35a33d98c8f5afbe7a2f926a906206ba3a3a19
Python
3,002
69
import logging import gc # PyTorch modules import torch from torch.utils.data import DataLoader # Cormorant modules and functions from cormorant.engine import Engine from cormorant.engine import init_logger, init_cuda from cormorant.engine import init_optimizer, init_scheduler from cormorant.models.autotest import corm...
d244dc4b7d72a23e4d9eff6656eb801d863bfdc702085eb8b667ce5c9b8edbb6
Python
3,003
84
# Copyright 2019 DeepMind Technologies Ltd. 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...
9d9bc1e500a88da1d2c17764df3380a2dfefe0d07deba9e5a6d69b12f0194ced
Python
3,004
89
"""Dummy distances/kernels.""" __author__ = ["fkiraly"] import numpy as np from sktime.dists_kernels.base import BasePairwiseTransformerPanel SUPPORTED_MTYPES = ["df-list", "nested_univ", "numpy3D"] class ConstantPwTrafoPanel(BasePairwiseTransformerPanel): """Pairwise panel transformer that always returns a c...
e1bd050fa23bd855b54b29e60caa4b04856fcf682ee284e9135551297e711e84
Python
3,006
111
from numpy import random, array, zeros, empty import os from sklearn.model_selection import KFold from sklearn.linear_model import LogisticRegression from sklearn.svm import SVC from xgboost import XGBClassifier import joblib def readTest(filename): data = open(filename, "r") lines = data.readlines() data_feature...
1af74e15342bd17e9787df53daa5ffe110769ede901ed5982e8b7deefb33dc3e
Python
3,007
108
from __future__ import annotations import pandas as pd from .STDataset import STDataset def low_variance_filter(dataset: STDataset, var: float = 0) -> STDataset: """ Filter genes with low variance. This may also filter genes with 0 expressions. Parameters ========== dataset : STDataset ...
9849b56cd1858d4777c39ad35f051507e8b7c1d34e4cde6e6b3125162ac33ead
Python
3,007
101
# copyright: sktime developers, BSD-3-Clause License (see LICENSE file) # Ported from skchange (BSD-3-Clause), original authors: Tveten """Change score adapter that wraps any cost into a change score.""" __author__ = ["Tveten"] from sktime.detection._utils import check_interval_scorer from sktime.detection.base._bas...
deadeeeaec92d550238b2d6d8424f37ad719c432bc056548d0f9c0090dc631fb
Python
3,008
92
# 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...
47eba5ad18f4e9eac72e7065ba8a8cdd5f157bfe489fbeafa4f386dedc7377ab
Python
3,009
97
# -*- coding:utf-8 -*- import os os.environ["CUDA_VISIBLE_DEVICES"] = "0" from keras.preprocessing import text, sequence from keras.models import Model from keras.layers import Input, Embedding from keras.layers.core import Dropout from keras.layers.convolutional import Conv1D, AveragePooling1D from keras.layers impo...
795eec78bd6dd13001861270e37d7fac8bfec37428ef3e4c74ec112006188943
Python
3,009
99
import pandas as pd import os BASE_PATH = 'data/main_dataframes/' CORRECTION_FOLDER = 'data/main_dataframes/CrisprOR fixes/' # EXPERIMENTS_TO_FIX = ['doench2016_hg19' # 'hart2016-Rpe1Avg', # 'hart2016-Hct1162lib1Avg', # 'hart2016-HelaLib2Avg', # ...
bc602e69798c30cf50f4718fdb2ad48b15fa5a1d47ea7079b0a199c6936ac060
Python
3,015
91
import numpy as np import pandas as pd from typing import Iterable, Union from lee_et_al_2023.src import base def load_gnn_rf_predictions(mol_codes): """Load GNN and RF ratings for a set of RedJade codes. Args: mol_codes: Molecules for which to retrieve predictions """ files = { ...
b2ad221c95aece15aa4ce7a8a0c64e71452899f064c22aa9be0dab9cf9b5b54a
Python
3,016
94
# 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...
5518887e3860550316bc7b81d7b04807197e6adc04642f24a9e74f5c2ffa5c3f
Python
3,017
96
#!/usr/bin/env python import sys import os import math import re from os.path import isfile, join, isdir from kn_common import pipetools,pipedef from kn_pipeline_class import CPipeError,CPipeStep class CPipeNNCell(CPipeStep): def progress_update(self,txt): if re.match(r'#PROGRESS#\d*#', txt): progress=in...
e5e5540e3231468d6d4688de8a2633680d84cdd8fa4dcf65f68b1764f61c2e3a
Python
3,018
101
# Copyright (c) ONNX Project Contributors # SPDX-License-Identifier: Apache-2.0 from __future__ import annotations import numpy as np from onnx.reference.op_run import OpRun def _batchnorm_test_mode( x: np.ndarray, s: np.ndarray, bias: np.ndarray, mean: np.ndarray, var: np.ndarray, epsilon:...
4406829953a656d9b286c587d4ec51d07d467bfc3f9117f90d3e48452a2d7e2f
Python
3,019
84
# Copyright (c) OpenMMLab. All rights reserved. import warnings from typing import List import numpy as np from mmcls.core import average_performance, mAP from .base_dataset import BaseDataset class MultiLabelDataset(BaseDataset): """Multi-label Dataset.""" def get_cat_ids(self, idx: int) -> List[int]: ...
6c94ce2444e71cf989048133b4cbbb67cfb02074b0651410e92c09dba21ddc56
Python
3,019
68
import logging # PyTorch modules import torch from torch.utils.data import DataLoader # Cormorant modules and functions from cormorant.engine import Engine from cormorant.engine import init_logger, init_cuda from cormorant.engine import init_optimizer, init_scheduler from cormorant.models.autotest import cormorant_test...
24e139540e36945adbbdf99e68872a411d02e49a1a59ae2293299323470e0a18
Python
3,021
102
# 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...
cb8de14e0c4a57145f2104786cb76d8628efc4d2dc95d186ea194b07b938fb47
Python
3,022
86
# 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...
ac1792fbfab7571d3463b45688a7899f3b180b00557f7b0d3feef4683ff7be18
Python
3,023
88
# Copyright 2019 DeepMind Technologies Ltd. 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...
da59a027efe125debafc1b8b598de08f98e0f6274850be8c8d0ea29d34fbe995
Python
3,023
88
# coding = utf-8 """Sparsemax activation function. Pytorch implementation of Sparsemax function from: -- "From Softmax to Sparsemax: A Sparse Model of Attention and Multi-Label Classification" -- André F. T. Martins, Ramón Fernandez Astudillo (http://arxiv.org/abs/1602.02068) """ import torch import torch.nn as nn ...
804d8985e4ff8c0f4737c64427cee2365dff74d90a39e92bda7bb42fbc73dfb2
Python
3,024
83
# Copyright 2019 DeepMind Technologies Ltd. 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...
c00487b26240e888e3bee94b7e1540d1cb2875f1bde93c9c4b9c4a2fb2f9021c
Python
3,024
83
"""Conversion utilities for mtypes.""" __author__ = ["fkiraly"] def _concat(fun1, fun2): """Concatenation of two converter functions, using the same store. Parameters ---------- fun1, fun2 : functions in converter signature, see datatypes._convert Returns ------- function in converter s...
315d3e313a1c4875bd54494502c69f298985ba82e9895f9457afaf17578dd5e9
Python
3,027
85
import io import torch from PIL import Image from torchvision import transforms from torch.autograd import Variable from .vision_handler import VisionHandler class ObjectDetector(VisionHandler): """ ObjectDetector handler class. This handler takes an image and returns list of detected classes and bounding...