sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
2436733839dc4efde5c4b7b83282aab6b2b623a68feb450ac100394706c5c54f
Python
1,387
38
# %% import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from pymaid_creds import url, name, password, token import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) import connectome_tools.process_matrix as pm import connectome_tools.celltype as ct import navis ...
9d598749a21fadc49ee85ed377e72883fd26472c8c1dc2c3160c3c1424f67046
Python
1,388
55
import torch import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter from graphxai.datasets import ShapeGGen from test_homophily import homophily_test def build_SG(HF): SG = ShapeGGen( model_layers = 3, num_subgraphs = 100, prob_connection = 0.0...
50537baa360c075add6833e8ac63edd5435504ad9ce04067025ffc93e248fb3b
Python
1,389
58
TMP = 'tmp' LOG = 'log' INFO = 'info' TARGET_FILE_NAME = 'target.pdb' MODEL_FILE_NAME = 'model.pdb' X_FILE_NAME = 'x.txt' X_RES_FILE_NAME = 'x_res.txt' Y_FILE_NAME = 'y.txt' Y_GLOBAL_FILE_NAME = 'y_global.txt' ADJ_B_NAME = 'adj_b.txt' ADJ_C_NAME = 'adj_c.txt' ADJ_RES_NAME = 'adj_res.txt' AGGR_MASK_NAME = 'aggr.txt' C...
dbccdb90a366580b849108f860c77f39e48db9c4c65be8f211b0b2e96e62b69a
Python
1,389
32
# 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...
3fb6912a93bdedb734faeb20b46a39c48dc5672e25cb654888b6a8d22d14a6ad
Python
1,390
37
# 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...
498b1f4ce0e427b61e9e571fddcff1ad8317679fe3066c8fcdcd1960ae709951
Python
1,390
33
''' - Loads a vector of frequencies `freq.npy` ''' import numpy as np from sim_geometry import * import carpet.physics.friction_pairwise as physics ## Parameters # Physics set_name = 'machemer_4' # which hydrodynamic coefficients to use order_g11 = (4,0) order_g12 = (4,4) # Physics # period = 31.25 # [ms...
77cb493c40f9ea28a5f84cccb9f6370e78e8f1e0e05b9a969f011c59728fa006
Python
1,390
54
''' Random Baseline ''' import pandas as pd import random import numpy as np from sklearn.utils import resample from sklearn.metrics import confusion_matrix, accuracy_score, f1_score, classification_report, matthews_corrcoef, balanced_accuracy_score test = pd.read_csv('../../data/final/CSV/Test.csv') y_test = list(t...
1cd1381864286ca7eff4e0df66c2a16eb120b876d0fc036d3e49a1331a792235
Python
1,391
89
import sys import nrrd from skimage import io import os, os.path import math import h5py import time import numpy as np import pandas as pd import pickle import more_itertools as mit import matplotlib.pyplot as plt plt.switch_backend('agg') import pandas as pd import csv import scipy def extract_brain_ROI_name_fr...
70e49279ad144cf72ac94b7129778781a65f941e298335179368bc83e99217ef
Python
1,392
37
# Copyright 2020 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...
6032d22e584eb8278b00b4577119d94519be01111a21cbc6db75883810608164
Python
1,393
43
''' Simple simultaneous network control of Bonsai and OpenEphys. Dependencies: 1. pyOSC 2. SimpleOSC ''' import argparse from simpleOSC import initOSCClient, sendOSCMsg import zmq import random import sys import time if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("...
99a9e7acb6f17227d5540d12a71b203fa0b8ba2787dc1108629e0626f6386fc9
Python
1,393
57
import json import os import sys from Classes.RubyInterfacer import RubyInterfacer from Classes.SearchModule import SearchModule # If executing from Ruby code if os.path.isdir("/home/neuromine/Neurolex_py"): os.chdir("/home/neuromine/Neurolex_py") if os.path.isdir("/var/www/NeuroML-DB.org_Ontology"): os.chdir...
aa7c236003c08dda56239358c259643a73432879dffc9aba71c630d8508a2f2c
Python
1,393
33
"""Data loading and preparation. The main entry point is the :py:class:`Data` class, which handles loading time series data from various formats (NumPy, MATLAB, FIF) and preparing it for model training. Modules ------- - :py:mod:`~osl_dynamics.data.base` — :py:class:`Data` class for loading and preparing data, and ...
92e5e8b486242197fa570dc7611ca86b14de3751edcb9ba092be1387cd3924c7
Python
1,395
41
__author__ = 'jieqing jiao' __email__ = "jieqing.jiao@gmail.com" import numpy as np import nibabel as nib def extract_regional_values(image, parcellation, labels): idx = labels_to_index(parcellation, labels) regional_values = np.mean(image[idx, ], axis=0) return regional_values def labels_to_index(parc...
080e6808dfd8d37f2d5aa4e776e43679a5ce37041e3a4e974ccb320da5c023c6
Python
1,397
25
from .assigners import (AssignResult, BaseAssigner, CenterRegionAssigner, MaxIoUAssigner) from .builder import build_assigner, build_bbox_coder, build_sampler from .coder import (BaseBBoxCoder, DeltaXYWHBBoxCoder, PseudoBBoxCoder, TBLRBBoxCoder) from .iou_calculators import B...
87bff7cde249d1d593bb95fe4023763eb5f1825b9b035f9432f46dd67b69ccb3
Python
1,397
53
import sys, time, pickle import torch import networkx as nx import matplotlib.pyplot as plt from graphxai.datasets.shape_graph import ShapeGGen def parse_args(): arg_dict = {} assert len(sys.argv) >= 4, 'usage: python3 test_one_ul.py <num_subgraphs> <prob_connection> <subgraph_size>' arg_dict['num_subgr...
2710df4a110e4c7c762f98f3fd9507bf82142423f90ee46736c300f906a057e9
Python
1,398
33
# Copyright 2020 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...
74fce953898eb5d6a45d902e0f4206f3dead44720a87e0ea02b01ba0f5737913
Python
1,398
35
# -*- coding: utf-8 -*- # @Author : WenHan from tensorflow import keras # The architecture of the proposed 1-D CNN. def build_net(input_shape, n_feature_maps, nb_classes): inputs = keras.layers.Input(shape=input_shape) x = keras.layers.Conv1D(filters=n_feature_maps, kernel_size=5, strides=1, padding='same'...
b3d609c0a1fdcb987ce936c26bc9162e1e2714c1d280ab72f43009dd8e98da98
Python
1,399
40
from snakemake.shell import shell shell.executable("bash") log = snakemake.log_fmt_shell(stdout=False, stderr=True) params = snakemake.params.get("extra", "") pipe = "" if snakemake.output[0].endswith(".bcf"): pipe = "| bcftools view -Ob -" if snakemake.threads == 1: freebayes = "freebayes" if snakemak...
3a839e4d8f2c88754e8daf64d56aeaffb4b62d552fe0ccb66519fe5b31ee2052
Python
1,400
27
# 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...
138cdccdeef08a7ea751e1d57812644793d95da66b66a4d2bfe8e87554110f93
Python
1,402
36
import unittest from oaklib.datamodels.vocabulary import IS_A, PART_OF from oaklib.implementations.sqldb.sql_implementation import SqlImplementation from oaklib.resource import OntologyResource from oaklib.utilities.subsets.slimmer_utils import roll_up_to_named_subset from tests import INPUT_DIR, OUTPUT_DIR DB = INPU...
7df01d21d7eb0e160c127adf4928ff1ab0c51c285ebd8903c4a7a87785262e04
Python
1,402
32
import numpy as np class convers_pca(): def __init__(self, no_of_components=None): self.no_of_components = no_of_components self.eigen_values = None self.eigen_vectors = None def transform(self, x): return np.dot(x - self.mean, self.projection_matrix.T) def inv...
f75a2b7bcecd2ba49ee1f890759e96b1698aa84536e9629c1af52b069239b009
Python
1,402
52
from dataclasses import dataclass from typing import Iterable, List from oaklib import BasicOntologyInterface from oaklib.datamodels.validation_datamodel import SeverityOptions, ValidationResult from oaklib.types import CURIE @dataclass class OntologyRule: """Base class for all ontology rules.""" name: str ...
381cf58ec138ffc63764eac7b65087413962cef01fefe3aa37ac3bfceff3a8df
Python
1,403
46
import random import torch from graphxai.explainers import PGMExplainer from graphxai.datasets.feature import make_network_stats_feature from graphxai.gnn_models.node_classification import BA_Houses, GCN, train, test # Set random seeds seed = 0 torch.manual_seed(seed) random.seed(seed) n = 300 m = 2 num_houses = 30...
593f1f7067aff6c2aee4e5d85ceab21e101000a25a3e2b0c0cfa52a72616f0e7
Python
1,404
43
from torch import nn from .registry import CONV_LAYERS CONV_LAYERS.register_module('Conv1d', module=nn.Conv1d) CONV_LAYERS.register_module('Conv2d', module=nn.Conv2d) CONV_LAYERS.register_module('Conv3d', module=nn.Conv3d) CONV_LAYERS.register_module('Conv', module=nn.Conv2d) def build_conv_layer(cfg, *args, **kwar...
f8a19329c8c0135905092040a6fb3f82032978a236e0d7e3aaca0c7e6d1314d7
Python
1,404
45
import pandas as pd import numpy as np from util import tprint from gensim.models import KeyedVectors def read_pretrained_w2v(pretrained_w2v_fname, is_glove): """ reads pretrained word embedding from the given file name is_glove: if True, assumes the format of GloVe text file. otherwise, word2vec bin file...
869131cbd789669495494a994dc493aef321df029fbf15612f0429c8c6ddbb43
Python
1,405
42
import random import torch from torch.testing import assert_close import pytest from ..embeddings import GridEmbedding2D, GridEmbeddingND # Testing grid-based pos encoding: choose a random grid # point and assert the proper encoding is applied there def test_GridEmbedding2D(): grid_boundaries = [[0, 1], [0, 1]...
8db77f8bed84bfbf3068e141c84641bb341b09e2db40ccfe971f3a19b31866b9
Python
1,405
38
import unittest from linkml_runtime.dumpers import yaml_dumper from oaklib import get_adapter from oaklib.utilities.validation.disjointness_rule import DisjointnessRule from oaklib.utilities.validation.rule_runner import RuleRunner from tests import INPUT_DIR, OUTPUT_DIR, SUBATOMIC_PARTICLE TEST_OUT = OUTPUT_DIR / "...
365824008b77a0ae05886f3a1faff9535e0ed3b1a7b2ecf5622d5025c56e26f8
Python
1,406
46
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from . import transforms as T def build_transforms(cfg, is_train=True): if is_train: min_size = cfg.INPUT.MIN_SIZE_TRAIN max_size = cfg.INPUT.MAX_SIZE_TRAIN flip_horizontal_prob = 0.5 # cfg.INPUT.FLIP_PROB_TRAIN ...
a8c15251fcd8fe8bd61adc6fc72b39a7fe0da12ea698299fd6bc78f88214b408
Python
1,406
44
import os.path as op import numpy.testing as npt import pytest import nibabel as nib import nibabel.tmpdirs as nbtmp import dipy.data as dpd import dipy.core.gradients as dpg from AFQ.models import dki from AFQ.utils.testing import make_dki_data def test_fit_dki_inputs(): data_files = ["String in a list"] ...
dae258e926644b17cd4e2ef8a73fe610dfe038952f65102854db30023a4fc0cb
Python
1,406
43
from setuptools import find_packages, setup def read_version(): with open('dendrify/version.py', 'r') as f: lines = f.readlines() for line in lines: if line.startswith('__version__'): delim = '"' if '"' in line else "'" return line.split(delim)[1] return "unknown" ...
dbe14716d7fc042533083919d5e058e5bb91cfff9612a7a910bc71ea3a1cdbaf
Python
1,406
36
#%% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') print(os.getcwd()) except: pass sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') from pymaid_creds ...
e932dacadc0e464ed7fb3b1a524a79ac0303bf7562bef896c2bd06a7f78f3e22
Python
1,406
61
# %% [markdown] # # import os import colorcet as cc import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from src.io import savefig FNAME = os.path.basename(__file__)[:-3] print(FNAME) def stashfig(name, **kws): savefig(name, foldername=FNAME, s...
2a5bb8bce60baad553f8d937107e8ec1e6095bcdcab19674badf453c0d42f984
Python
1,407
26
import sys sys.path.insert(0, '.') from svgkit import Svg, C, render_png W, H = 1260, 320 s = Svg(W, H) s.text(W / 2, 44, "Building CARLA from source (Linux, UE 5.8)", size=26, weight="bold", anchor="middle") s.text(W / 2, 72, "What the one-time setup script CarlaSetup.sh does, in order", size=15, color=C["sub"]...
90015a171210682208cac4fdc548921e6998630f48e880eafdf1e9177b27d242
Python
1,407
37
import sys from graphxai.datasets import BAShapes assert len(sys.argv) == 4, 'usage: python3 test_BAH_vis.py <shape_insert_strategy> <labeling_method> <feature_method>' assert sys.argv[1] in ['ub', 'lb', 'global', 'bound_12'], "shape_insert_strategy must be in ['ub', 'lb', 'global']" assert sys.argv[2] in ['e', 'f', ...
ddd82bf4803012705e4eddcf9d57efa7fd917902be0729d0940fde8ca981adec
Python
1,407
43
''' force density: OK: `all` OK: 1 object; 1 object in array OK: 2 objects OK: 2 commands with different objects OK: indices to skip don't work? ''' from mesh.plot.mlab_viewer import MeshViewer folder = 'data/cilia_plane2' # 'data/sphere_wall' cilium_radius = 0.11 plotter = MeshViewer(folder) plotter.triangular_me...
9d398f00e798a4e34715de845fc806463b20c75437e63dd1e1ec1290ca017482
Python
1,408
41
# 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...
694c6fa80d2cc7294839fa94499ad47577436dd0dc74713374af6f698df13939
Python
1,409
34
# Copyright 2020-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 agre...
c4cdc5beff68c3eb4d105e25560999663fb5fe6569783fa4be59145c90fe7609
Python
1,409
51
from sklearn.base import TransformerMixin from sklearn.preprocessing import StandardScaler class NoFitMixin: def fit(self, X, y=None): return self class DFTransform(TransformerMixin, NoFitMixin): def __init__(self, func, copy=False, **kwargs): self.func = func self.copy = copy ...
e907afb6fabc8521c017e0bd57c7eecda4cc515f06406a487aa88deb5af0fbdd
Python
1,409
41
from setuptools import setup, find_packages from debarcer.version import __version__ # Utility function to read the README file. with open("README.md") as infile: content = infile.read().rstrip() setup( name = "debarcer", version = __version__, author = "Richard Jovelin", author_email = "richard.jovelin@oic...
3b4d43b75c0698a956cfa174f9fe20d89fa270d070be15eba651d232cfc14609
Python
1,410
56
from numpy.testing import ( assert_, assert_equal, assert_almost_equal, assert_array_almost_equal, assert_raises, assert_array_equal, dec, TestCase, run_module_suite, assert_allclose) import sima import sima.motion import sima.motion.frame_align from sima import Sequence from sima.mi...
6b3d5562d87877b25d05392040d54d42ae89f14679d43f974e2112b838ca0f23
Python
1,410
34
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Module containing common constants for the GUI. Created on Thu Jun 20 13:16:31 2019 @author: nicolas """ import os.path ## Constants # Pages identifiers PAGE_SELECTION = 1 # output selection between raw/ccreg/warped PAGE_MODEL = 2 # correction of the m...
edc5712d3fdd638d8645834b194489d5e591362bcc9e5dd9dd42f7a4aacae23f
Python
1,411
55
#!/usr/bin/env python # Read a reference fasta file, write a Reference object to a pickle # file for use as input to findOverlaps.py, etc. import os import sys import optparse import re # regular expressions import cPickle as pickle from tt_log import logger import Reference as ref VERSION = '20150105.01' d...
41f14da9fa40269c6ee6973ba8463b5c530db7eeb742195fc9ce7bbc58e6a425
Python
1,414
47
#!/usr/bin/env python import os from setuptools import setup, find_packages from bruker2nifti.__init__ import __version__ as version def requirements2list(pfi_txt="requirements.txt"): here = os.path.dirname(os.path.realpath(__file__)) f = open(os.path.join(here, pfi_txt), "r") l = [] for line in f.re...
8a3cbd6666a592e3cc186cceda2fcadf4c0573a80f8c6ef1ece1452ceec64e6c
Python
1,414
38
import pandas as pd import os import AIS_parameters import tqdm import itertools import numpy as np from rapidfuzz import process, fuzz from scipy import stats path = os.path.join( AIS_parameters.dirs['root'], 'download') ## columns = dict() for file in tqdm.tqdm(os.listdir(path)): if file.endswith('....
0657836cb504734e6020cff21f2d6f007aad0dfab54e52c970d62562e1603aa5
Python
1,415
38
from dash_extensions.enrich import Output, Input, State, callback from dash.exceptions import PreventUpdate from RV.callbacks.utils.channel_selection_utils import get_10_20_channels def register_channel_selection_callbacks(): @callback( Output('RV-channel-selection-dropdown', 'value', allow_duplicate=Tru...
50a9a15e9668de63d4be08e29bf1cff3552ba6d12cfef9c7a17d87bb6cc4cc71
Python
1,417
34
import os from setuptools import setup, find_packages # Utility function to read the README file. # Used for the long_description. It's nice, because now 1) we have a top level # README file and 2) it's easier to type in the README file than to put a raw # string in below ... def read(fname): return open(os.path....
89d8111df74c46207cf0e7cb7acd1a6a4635110b0c7fd731f734c74a3422081c
Python
1,418
47
import numpy as np import tensorflow as tf import time import h5py from Network.PatchHandler3D import PatchHandler3D def load_indexes(index_file): """ Load patch index file (csv). This is the file that is used to load the patches based on x,y,z index """ indexes = np.genfromtxt(index_file, delimite...
b80aae92a185160522b7217c555048125d157ffe75a721bad0095c1a850eb49a
Python
1,418
43
#!/usr/bin/env python3 # Copyright 2019 Yusuke Fujita # Apache 2.0. """This script generates hypothesis utterances aligned with reference segments. Usage: gen_align_hyp.py alignment.txt wc.txt > hyp.txt alignment.txt is a session-level word alignment generated by align-text command. wc.txt is a sequence ...
baa6cf2f10698796dbc59833cb4c528ce7f310c5d6f9437be69b0402d9e4411e
Python
1,420
27
from utils import Config from utils.ArticlesProvider import ArticlesProvider from utils.decomposition import Decomposition from sklearn.decomposition import LatentDirichletAllocation from sklearn.feature_extraction.text import CountVectorizer class LDADecomposition(Decomposition): def __init__(self, config: Config...
f9519507d738fe22c9bc89865553510395a507220ea9faf964ed9cf221b49cc2
Python
1,422
38
# 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...
8269a321ea7387344375bcc831ea520a40610c02adafb22983b9269b49a4a6b5
Python
1,423
46
import sys def packaged_startup_error(exc): diagnostic_hint = '' try: from backend import diagnostics from backend import jobs diagnostic_id = jobs.new_diagnostic_id() diagnostics.log_exception(diagnostic_id, 'startup', 'application', exc) diagnostic_hint = ' Diagnostic...
8a9992ed39aaffc40138b4750572d743f71c16585de2b2d9fabf4e98093445c6
Python
1,425
45
""" This package contains modules related to objective functions, optimizations, and network architectures. """ import importlib from models.basic_model import BasicModel def find_model_using_name(model_name): """ Import the module with certain name """ model_filename = "models." + model_name + "_mod...
a417b8759cb3e8935fd5119a9c5e19de36f1ba6addc1a4bdc101f822eac37e20
Python
1,425
43
import torch.nn as nn from mmcv.cnn import kaiming_init from mmdet.models.registry import BACKBONES from .derive_blocks import derive_blocks from tools.apis.param_remap import remap_for_paramadapt @BACKBONES.register_module class FNA_Retinanet(nn.Module): def __init__(self, net_config, output_indices=[2, 3, 5, ...
b34c75787f31d1f48d48c2404d909bdbbf96fd9f62ce52dd03fe3dc9ca6b73bd
Python
1,427
61
#!/usr/bin/env python # coding: utf-8 ''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' import os from gpiozero import CPUTemperature import torch def getFreeDescription(): free = os.popen("free -h") i = 0 wh...
591e4533a98005b695d00cf4a691b9f5364e16d1d560167ba83ba00326896b8f
Python
1,428
61
# Copyright (c) Open-MMLab. All rights reserved. from mmcv.utils import Registry HOOKS = Registry('hook') class Hook: def before_run(self, runner): pass def after_run(self, runner): pass def before_epoch(self, runner): pass def after_epoch(self, runner): pass ...
b6ea4f4f9404c9c6ceaf1bc4dc147e68986d0ae25a524521624069963eb8ad2c
Python
1,429
37
# 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 a...
bd6214917038fa613c0fc9cfde30c23a6ad23dff314743e019d71dacd09a2fa3
Python
1,429
39
# Copyright 2021 Google Research. 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 applicable law...
4430f65b052d33fd42b4d451ffbda8cddad0fa94c0728a866bf6b72c6cec9d0c
Python
1,430
26
from .accuracy import Accuracy, accuracy from .ae_loss import AssociativeEmbeddingLoss from .balanced_l1_loss import BalancedL1Loss, balanced_l1_loss from .cross_entropy_loss import (CrossEntropyLoss, binary_cross_entropy, cross_entropy, mask_cross_entropy) from .focal_loss import Focal...
5729d6200cace768af08394eae65637f1661149f8c9dd1316fd6db2aa3e102ce
Python
1,431
46
from __future__ import division, print_function import numpy as np import tensorflow as tf from tensorflow.python.ops import gradient_checker from tensorflow_forward_ad import maxpool_gradgrad class MaxPoolGradGradTests(tf.test.TestCase): def test_basics(self): tf.set_random_seed(1234) x_shape = [4, 4, 4...
77f3256f9263447d716db2faed3543fe0e8f252bb9a7ea020ef9517718dce35c
Python
1,431
33
import os from cosmos_workers.common.hfcache import materialize_snapshot, snapshot_dir def _fake_cache(root, repo="nvidia/Cosmos-1.0-Guardrail", rev="abc123"): repo_dir = root / "hub" / ("models--" + repo.replace("/", "--")) blobs = repo_dir / "blobs" snap = repo_dir / "snapshots" / rev (snap / "bloc...
9e2aef878774a19e67fe7eecc32533f892995ff77ffb2c4b0ab35b2154145ce0
Python
1,431
48
import torch from cgtasknet.instruments.instrument_subgroups import SubgroupFinder def test_create_subgroup_finder(): sgf = SubgroupFinder(dt=1e-2) assert sgf.dt == 1e-2 def test_compute_average_freq_zeros(): sgf = SubgroupFinder() s = torch.zeros(100, 4) fixation = torch.zeros(100) fixatio...
d5401838e437751f9efbfe895a753e8fee1979c5a4aa34703b5fa302bdcddead
Python
1,432
50
import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns from sklearn.ensemble import RandomForestRegressor from sklearn.metrics import mean_absolute_error, mean_squared_error, mean_absolute_error from pandas.api.types import is_string_dtype, is_numeric_dtype, is_object_dtype, is_cat...
0374ac043c87cc17fea79be8092e4b06316ef3c3d0aa1d6be38396e231be2b5d
Python
1,433
41
""" running the ntf over a range of frequencies.""" from ..forward import network_transfer as nt import numpy as np def run_local_coupling_forward(brain, params, freqs): """run_forward. Function for running the forward model over the passed in range of frequencies, for the handed set of parameters (which must ...
e8a4c8fbe61193b7e22bd2c57b59700d17d37d86ed6c85c1f1b69be9e6140c6f
Python
1,433
55
"""Base class for all parsers.""" from abc import ABC, abstractmethod from dataclasses import dataclass from typing import Any, Callable, Iterator, List, Optional, TextIO, Tuple @dataclass class ColumnReference: """A way of indexing a column.""" index: Optional[int] = None """Number of the column (zero-...
1646067423f0ef1c219a995f12c9fea4324e0ff046a53d2ad34880fea7434e27
Python
1,434
43
__author__ = 'jieqing jiao' __email__ = "jieqing.jiao@gmail.com" import nibabel as nib import numpy as np def extract_regional_values(image, parcellation, labels): idx = labels_to_index(parcellation, labels) regional_values = np.mean(image[ idx,], axis=0) return regional_values def labels_to_in...
7f41da49ad79e1c23ea92a8ad0fbbbefd18221c453ef640df12454852e36cf82
Python
1,435
46
import multiprocessing import dask import subprocess # Generates fingerprints for training set n_cores = multiprocessing.cpu_count() print("Number of cpus:", n_cores) with open("all_training_pdbs.list") as f: all_training_pdbs = f.read().splitlines() files_per_core = len(all_training_pdbs) // n_cores + 1 for cor...
cf5812e999c39760f7236f1ce0883da1cd6d1899125ed056ee826d115098457b
Python
1,435
37
import unittest import curies from linkml_runtime.loaders import json_loader from oaklib import OntologyResource from oaklib.converters.obo_graph_to_obo_format_converter import ( OboGraphToOboFormatConverter, ) from oaklib.datamodels.obograph import GraphDocument from oaklib.implementations import SimpleOboImplem...
13dba7d8bfa8cdd097fbc2b55f0ffef7cec1bb589780fa25fde8f3cf3096018d
Python
1,437
44
__author__ = 'duarte' from modules.parameters import ParameterSpace, copy_dict from modules.signals import empty from modules.visualization import * from modules.io import set_project_paths from defaults.paths import paths import matplotlib.pyplot as pl from matplotlib import cm import visvis import scipy as sp from sc...
430117f054754a661a90f7583f385ed531e680f30da90f7af17f82c657ad290e
Python
1,439
49
import pandas as pd import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from nilearn import plotting from ukbb_variables import observations mpl.rc( '...
8e266d96fa6839db1f7e9876a9274b27a8995a91b60f0c7c6e48f10dcb7ccfab
Python
1,439
48
import os import torch class Dictionary(object): def __init__(self): self.word2idx = {} self.idx2word = [] def add_word(self, word): if word not in self.word2idx: self.idx2word.append(word) self.word2idx[word] = len(self.idx2word) - 1 return self.word2id...
0ca62f29366e77de5d6d82368522b3019eb2a81725cfdd59d91a07a1c6088ad7
Python
1,440
44
__author__ = 'duarte' from modules.parameters import ParameterSpace, copy_dict from modules.signals import empty from modules.visualization import * from modules.io import set_project_paths from defaults.paths import paths import matplotlib.pyplot as pl from matplotlib import cm import visvis import scipy as sp from sc...
b5b0e00b2d658a411e37ea8575907da82be6707247ad9226e2b6bdd82113a0c0
Python
1,440
43
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> """Feather data format reader After https://arrow.apache.org/docs/python/_modules/pyarrow/feather.html """ from pyarrow.lib import FeatherReader, DictionaryType import numpy as np from .._data_obj import Dataset, Factor, Var class Reader(FeatherReader): ...
6ca64de8cb01f7ace17de2ec4f16ffe5491c7bb9a9b0adaf1f96f5fca8da9aa5
Python
1,441
52
""" Test methods in the _common methods module """ import numpy as np import unittest from selene_sdk.predict._common import get_reverse_complement_encoding from selene_sdk.sequences import Genome class TestReverseComplement(unittest.TestCase): def setUp(self): self.example_encoding = np.array( ...
b63acef0c05506003d744c7621590ae62193d919b99223557bab3da4fb2b2734
Python
1,441
44
import numpy as np import torch def get_Pareto_fronts(scores): """Identify the Pareto fronts from a given set of scores. Parameters ---------- scores : numpy.ndarray An (n_points, n_scores) array of scores. Returns ------- list of numpy.ndarray A list conta...
be53d1977514436606aa22ca07c0d9404a290487c933d8b8af48eff2198393d0
Python
1,442
46
import torch from torch.nn.parameter import Parameter import numpy as np from torch import sigmoid class HardConcrete(torch.nn.Module): def __init__(self, beta=1 / 3, gamma=-0.2, zeta=1.0, fix_temp=True, loc_bias=3): super(HardConcrete, self).__init__() self.temp = beta if fix_temp else Parameter...
5522876709f512b2271ac3c11c3ef8215046799e324bf29a9012b240df355d36
Python
1,443
40
import os import numpy as np stats = [] cpu_seconds = [] for dirname in os.listdir('03-results/'): full_dirname = os.path.join('03-results/',dirname) if not os.path.exists(full_dirname+'/results.txt'): continue results = open(full_dirname+'/results.txt').readlines() for time_fn in os.listdir(fu...
5dee3185ebede5f2ea1732dbf57360edfa1669bd903bdb94aa06c22b0c09ace7
Python
1,444
51
import torch import os import numpy as np import cv2 def convert_points_to_image(samp_pts, H, W): """ Inputs:- samp_pts: b, 1, k, 2 """ b, _, K, _ = samp_pts.shape # Convert pytorch -> numpy. samp_pts = samp_pts.data.cpu().numpy().reshape(b, K, 2) samp_pts = (samp_pts + 1.) / 2. samp_pts = samp_pts * np.arr...
6ee558ffe50d11e09f6a14f1b9dda6f16c9cae6987139f287545f1c35980b802
Python
1,445
39
import torch class LARS(torch.optim.Optimizer): """ LARS optimizer, no rate scaling or weight decay for parameters <= 1D. """ def __init__(self, params, lr=0, weight_decay=0, momentum=0.9, trust_coefficient=0.001): defaults = dict(lr=lr, weight_decay=weight_decay, momentum=momentum, trust_co...
61ce8a71a5dad3def3f3ec44d979d9112fc3fba396fc13eebbf9aab9c7bd0cf3
Python
1,446
61
import gzip import sys input=sys.argv[1] output=sys.argv[2] fh=gzip.open(input,'rt') fho=gzip.open(output,'wt') outln=[None]*21 ctr = 0 for line in fh: line = line.strip() elems = line.split("\t") if ctr == 0: # header line fho.write("PValue\tSNPName\tSNPChr\tSNPChrPos\tProbeName\tProbeChr\tProbeCenterCh...
ed0dc5f6e51d6713a1a11e4d537a5050d69f3e4ca8eb2a6ad4505753d32ae02b
Python
1,446
39
# Read through all .txt files in ../brain_samples/ and filter ena.txt to only include those samples import glob import datetime samples_to_keep = set([]) for f in glob.glob('../brain_samples/*txt'): with open(f) as input_file: header = input_file.readline().strip() if header != 'brainSamplesToInc...
eece4f00a17183b12ac8ae47bab3a58e1f67e4f0783157f771c8c6345f876de9
Python
1,447
56
import random import torch import numpy as np import networkx as nx import matplotlib.pyplot as plt from torch_geometric.utils import to_networkx from graphxai.datasets.real_world.mutagenicity import Mutagenicity import graphxai.utils as gxai_utils mutag = Mutagenicity(root = '.') # MUTAG notation: [C, N, O, ...] ...
d8b4837125d3ebc6761eb7384858192ebe03dcd4439b083aca035551d0452ff2
Python
1,448
36
rule make_minimap2_index: input: 'refs/{name}.fa.gz' output: 'refs/{name}.mmidx' shell: 'zcat {input} | minimap2 -H -k 13 -d {output} /dev/stdin' rule map_to_controls: input: seq='sequences/{name}.fa.gz', idx='refs/controls.mmidx' output: 'alignments/{name}-controls.bam' threads: 40 shell: ...
f03430069485ed1a70880a2170cf5ee429a5c3d61e28d65849f4d2a1460ab337
Python
1,448
55
import unittest from deeprank_gnn.NeuralNet import NeuralNet from deeprank_gnn.ginet import GINet from deeprank_gnn.foutnet import FoutNet from deeprank_gnn.sGAT import sGAT def _model_base_test(database, model, task='reg', target='irmsd', plot=False): NN = NeuralNet(database, model, node_fea...
0f3c637a3223101c258d7fe841d5b1b295fc8fe8755e47c6a7ccb227d21de6ae
Python
1,449
41
from functools import partial import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from pycpd import affine_registration import numpy as np import time def visualize(iteration, error, X, Y, ax): plt.cla() ax.scatter(X[:,0], X[:,1], X[:,2], color='red', label='Target') ax.scatter(Y[:,0],...
23c2231ba1e71ddc219fa602eba3eb3f9f636393aab1df4b4cb72a28b6e780a2
Python
1,449
37
# 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 a...
8fd8d721e6612ff1edff38ef3d7efb9e9d4ca10cf0ab2a50c4e6689e1edafacc
Python
1,449
49
import tensorflow as tf import numpy as np __all__ = ['l2_loss', 'l1_loss', 'edges_loss', ] def l2_loss(image, reference): with tf.variable_scope('l2_loss'): return tf.reduce_mean(tf.squared_difference(image, reference)) def l1_loss(image, reference): with tf.variable_scope('l1_loss'): ...
e1cf0e38f57418916beec9761f3ef96dbb36cac70da76535104d5b8fb6ba73ad
Python
1,450
49
import torch from typing import List from .explanation import Explanation def aggregate_explanations( exp_list: List[Explanation], reference_exp: Explanation = None, feature_aggregator = torch.max, node_aggregator = torch.max, edge_aggregator = torch.max, node_level: b...
e234214197fbc0b5b5616de2039f3db9cf2689f125825f9db6a63485d2766ae9
Python
1,450
30
from distutils.core import setup with open("./requirements.txt") as f: REQUIRES = [line.strip() for line in f] setup( name = "bayesian_bootstrap", packages = ["bayesian_bootstrap"], version = "1.1.0", description = "Bayesian Bootstrapping for statistics and regression models", author = "Louis ...
4d3e6726ffe7206a1d6878be1259638216061e90f0e5cb862074b69c60206d4b
Python
1,451
55
#!/usr/bin/env python # coding: utf-8 # Evaluation: Transformer Dose Calculation ## Import libraries and define auxiliary functions import h5py import numpy as np import sys sys.path.append('../src') from preprocessing import DataRescaler from evaluation import gamma_analysis, error_analysis # Prepare input data. pa...
fca6b13127ca7c07b5b45503019f8cd71f6273f6eeded33b6a39aa98987f2684
Python
1,451
54
""" Write out footprints specified by DLKeys as GeoJSON Useful for visualizing which tiles remain after population filtering """ from argparse import ArgumentParser import descarteslabs as dl import json from shapely.geometry import mapping from tqdm.contrib.concurrent import process_map def read_dlkeys_file(dlkeys_...
2d866a93aa22dca895a56f3754cae96d8a3d08d4ba8af7ae709aac2625f53100
Python
1,452
50
import torch import pytorch_lightning as pl from pytorch_lightning.callbacks import ( EarlyStopping, LearningRateMonitor, ModelCheckpoint, ) from .callbacks import LatentSpaceSaver, Plotter from ..models.main_net import MainNet from ..data.datamodule import DataModule def setup_model_and_dm(tasks, ds_para...
a1f8e276b78564b49859326704bb56c9720e85ad4e759c748aa61866148b49af
Python
1,452
41
import os import pandas as pd import numpy as np from sklearn.linear_model import LinearRegression import statsmodels.api as sm import statsmodels.formula.api as smf from statsmodels.stats.anova import anova_lm def p_adjust_bh(p): # Benjamini-Hochberg p-value correction for multiple hypothesis testing p = np.a...
a8e96979707a235f0a53ba77cdc52f4220237b72a4cf2a28f927670bcda63dd1
Python
1,452
40
# Copyright 2020 Google Research. 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 applicable law...
847074a4c2eda7856aa5cb63f887e1a9794c4b334499b0a0f921873db6d7e3ff
Python
1,453
44
from setuptools import setup, find_packages with open('README.md') as readme_file: readme = readme_file.read() with open('HISTORY.rst') as history_file: history = history_file.read().replace('.. :changelog:', '') with open("requirements.txt") as req_file: requirements = list(filter(None, req_file.read()....
2003c9f6c870b94b7c3c7decb07747d0498d78430047650c36ddb534c87a4504
Python
1,455
46
import logging import os import numpy as np import yaml from numba import njit from pathlib import Path logger = logging.getLogger(__name__) def check_dir_exists(directory: str, logger=False): if not os.path.isdir(directory): if logger: logger.error(f"{directory} does not exist. Check your pa...
18ac0e6ebf44d0b7fdad757e6001ad6ac611b24b204a904329ca3c7ea0e0c403
Python
1,456
28
import sys, io, base64 sys.path.insert(0, '.') from PIL import Image from svgkit import Svg, C # usage: diag_client_server.py <out_dir> <server_screenshot> W, H = 1000, 400 s = Svg(W, H) # server: a simulation screenshot clipped to a rounded panel sx, sy, sw, sh = 30, 40, 540, 320 im = Image.open(sys.argv[2]).convert('...
90c98c080d4207036c9eb8a0974dfe12bdc163ad8c2c07596b3be2b3430ccee7
Python
1,456
50
#%% import os try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') print(os.getcwd()) except: pass #%% import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt # import pair stats pairs = pd.read_csv('data/pair_distances.csv') pair_ranks = pd.read...
d3ba8115af21f78a3f3fdaf89a26d6f451ce5314644a3a2acf765b04cbae1477
Python
1,456
36
"""Data files used by osl-dynamics. This subpackage provides brain atlases, MNI surfaces, masks, and other reference files needed by the processing and analysis pipelines. They are not shipped with the package: each one is downloaded from `osl-files <https://github.com/OHBA-analysis/osl-files>`_ on first use and cache...
8cc93619f5dd5e276d4cee7e10a2fb6581ae2c9c5a0d7bfa51db49e8aa3f07f2
Python
1,457
41
from functools import partial import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D from pycpd import deformable_registration import numpy as np import time def visualize(iteration, error, X, Y, ax): plt.cla() ax.scatter(X[:,0], X[:,1], X[:,2], color='red', label='Target') ax.scatter(Y[:...
83be66716bdb95a6b32845e5c218b88e76ba6a7590e6a97b080ea54edd56ad0a
Python
1,458
14
def gettingStarted(): return """ \nWelcome to SAFT - Semi-Automatic Fluorescence Trace analysis \n---------------------------- \nHere is some advice for novice users \nLoad your data (traces in columns) from Excel. The first row should name the regions of interest (ROI), and each condition should be a separate shee...