sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
75fc6efc450a71169124f5d23850b26cf1818fe8b6e95ad56b23eb17a60a7b77
Python
809
29
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="nirsimple", version="0.1.6", author="Johann Benerradi", author_email="johann.benerradi@gmail.com", description="fNIRS signal processing simplified", long_description=long_description, ...
039dcfc30f7c69e1dcc129ddbae0cb4afaf6dda36203335eda318d849feeb89e
Python
810
31
# %% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') print(os.getcwd()) except: pass import pymaid import numpy as np import pandas as pd A1 = pymaid.get_skids_by_annotation('mw A1 neurons') A1_names = pymaid.get_names(A1) A1_names_array = [] for skid in ...
54b5eab82d7bfce1f3e3d015bb39ea2fc9cb0bde6f9774a7d27bb62d56b57657
Python
810
36
import unittest from alpamayo_nurec import NurecEpisodeComplete, _tick_and_capture class _FinishedScenario: def __init__(self): self.running = True def tick(self): self.running = False def is_running(self): return self.running class _NoFrames: def has_complete_batch_after(...
8eedc9008ff60e068420746da574adc0ae546dff7605bfa869fa3bd3951883c8
Python
810
45
from darela import SUR import autograd.numpy as anp import matplotlib.pyplot as plt release = { "Vm": 4.8, "Km": 0.2, "DAp": 0.43, "kS": 0.9, "kE": 1.05, "kads1": 0.035, "kads2": 0.14, "kads3": 0.09 } kinetic = { "ktypes": ["stf", "std", "ltd"], "p": [0.0105, -0.003, -0.0011],...
9cd5a0e0c01f1d6984b4c8012c5f55a9aaaaaaa7efde36981c0e87322d213f13
Python
810
36
from abc import ABC from typing import Dict, List, Iterable, Any from oaklib.interfaces.basic_ontology_interface import BasicOntologyInterface from oaklib.types import CURIE class PatcherInterface(BasicOntologyInterface, ABC): """ Applies diffs See `KGCL <https://github.com/cmungall/knowledge-graph-chan...
e02635e1bed9157bd93547d6167bc99303e2ddfd02dda139ab4caeabaa7206cd
Python
810
21
#!/bin/bash # 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 ...
40a7fe0a6eccb034b2e9ba180690fbae77b460747392b5b69d56c4aaa0cbe820
Python
811
23
import tensorflow as tf # Dispersion interaction based on Cn coefficients and the Becke-Johnson damping scheme proposed in # https://aip.scitation.org/doi/10.1063/1.1949201 def BJ_dispersion(R2, C6, C8, C10): Rvdw = get_Rvdw(C6, C8, C10) Rvdw_2 = tf.square(Rvdw) Rvdw_6 = tf.math.pow(Rvdw_2, 3) Rvdw_8 =...
d0cde36d340cee86731ea2e9651524c245ed4fb1fdc1a3e04e649a9206887e0b
Python
811
13
from .base_options import BaseOptions class PredictOptions(BaseOptions): def initialize(self, parser): parser = BaseOptions.initialize(self, parser) parser.add_argument('--pet_file', type=str, required=True, help='Which PET file shall be used?') parser.add_argument('--prostate_contour', ty...
648de48c9cd77749d869f4079c1bba893b1008fad67d77345e201303ad4e71e9
Python
812
40
''' Velocity vs. calcium concentration ''' from pylab import * width, height = 2, 2 K_electromotor = 1.4e-6 #2.4e-6 #.5e-6 # in uM n_electromotor_coupling = 2 # 3.7 v_plus = .5 #v_plus = .55 #el0 = 1/(1+(1e-7/K_electromotor)) #v_plus = .5/(2*el0-1) #print('v_plus =',v_plus) v_minus = -v_plus fig = figure('Angle', (w...
a20116649e6bfe132b1e3085219e0ac047593ed1394c79e6376da9189608547f
Python
812
39
import gzip import sys ## converts GTEx 1_10497_C_T_b37 ids to chr:pos infile = sys.argv[1] # SNPs.txt.gz with GTEx ids outfile = sys.argv[2] # Output filename prefix fh = gzip.open(infile,'rt') fho = gzip.open(outfile+".txt.gz",'wt') fho2 = gzip.open(outfile+"-mappings.txt.gz", 'wt') set = set() for line in fh: ...
b0cf80a846ef83092ba141d9e519522ce842b6006eaf38c54a757a24c4314928
Python
813
28
import navis import pytest import tempfile from pathlib import Path @pytest.mark.parametrize("filename", ['', '{neuron.name}.swc', 'neurons.zip', '{neuron.name}.swc@neurons.zip']) def test_swc_io(filename): with tempfile.TemporaryDirecto...
2cb266dfba0575f13d46261463dfac25564d554ec8439e0430e5731b2b036320
Python
814
29
"""Shared fixtures. Unit tests need no CARLA server; tests marked ``integration`` run only when ``CARLA_COSMOS_TEST_PORT`` is set.""" import os import sys import pytest sys.path.insert(0, os.path.join(os.path.dirname(__file__), "..")) def pytest_collection_modifyitems(config, items): if os.environ.get("CARLA_...
4d7448afa14811038b2a8a49375a837b6c6251f06769f6ef0a4aff786b20b840
Python
814
18
# 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...
7ebd8ad6649461579701ae38c20c95159947f6b35f0d47fb1ec584720e018bfb
Python
814
21
from .darcy import DarcyDataset, load_darcy_flow_small from .navier_stokes import NavierStokesDataset, load_navier_stokes_pt from .pt_dataset import PTDataset from .burgers import Burgers1dTimeDataset, load_mini_burgers_1dtime from .dict_dataset import DictDataset from .mesh_datamodule import MeshDataModule from .car_c...
eea1eb0dde736e334ebd9c52f55c77e48a5a8379353925d5cc045f054f8d0bf0
Python
814
34
""" Basic tests of BFS. Author: Mengye Ren (mren@cs.toronto.edu) """ import numpy as np import unittest from tensorflow_forward_ad.cbfs import bfs class BFSTests(unittest.TestCase): def test_bfs(self): adj = np.array([[1, 1, 0], [0, 0, 1], [0, 0, 0]], dtype=np.int8) self.assertTrue(bfs(adj, 0, 2, None)) ...
f0e8e79842bb1c4d1dfd0f3e98e581fc9a3cd66e45aa9b6e486a6ba5037f04c3
Python
814
24
import numbers import numpy as np def check_random_state(seed): """Turn seed into a np.random.RandomState instance Parameters ---------- seed : None, int or instance of RandomState If seed is None, return the RandomState singleton used by np.random. If seed is an int, return a new Ran...
7b94e98c4d3cb047fd4a0f06a019a38399df4526e3e7e32058ce5fcc28a59e5b
Python
815
37
from typing import Any from PyQt5.QtCore import QObject, Qt from PyQt5.QtWidgets import QMenu class SensorServiceItem(QObject): # region Class Initializer def __init__(self, parent: QObject = None): super(SensorServiceItem, self).__init__(parent=parent) # endregion # region Abstract Insta...
7d4cc1bc9e6af8e987f4c56eaee4c1bc38496144bb58218e3d4aae03fa6d25ef
Python
815
18
# 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...
88cf331b8ab84c00ded57adb97fa41d2195915f8c8458622b128f0422e3d3bc0
Python
815
17
# This script is part of navis (http://www.github.com/schlegelp/navis). # Copyright (C) 2018 Philipp Schlegel # # 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...
cc5c473986dd1bf72c8675a60d8532eed7b4dc346873599a6e56cb5a6e62cd8d
Python
815
28
import torch from cgtasknet.net import SNNlifadex from norse.torch import LIFAdExParameters def load_network(f: str, v_th: float, tau_a_inv: float, filter_parameter: float, hidden_size: int, feature_size: int, output_size: int, save_states: bool = False, device: torch.device = torch.device('cpu')): ...
28daadf093e810fc419ac0257b805069f512064e60a6b0ab83a81ebdd6f2636d
Python
816
32
import csv import sys from dataclasses import dataclass, field from typing import Any from linkml_runtime import CurieNamespace from linkml_runtime.dumpers import yaml_dumper from linkml_runtime.utils.enumerations import EnumDefinitionImpl from linkml_runtime.utils.yamlutils import YAMLRoot from oaklib.io.streaming_wr...
13ca6e1daa84b8d432978914e39f463e94be08fc1facc277e79d1e499f534ed7
Python
817
23
# 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...
4a39918b90863e16f3cee2e56027578a869f08878001348ffb3d6a28fa78e198
Python
817
23
from mmdet.models.detectors import SingleStageDetector from mmdet.models.registry import DETECTORS from mmdet.core import bbox2result @DETECTORS.register_module class SingleStageDetectorSearch(SingleStageDetector): def __init__(self, **kwargs): super(SingleStageDetectorSearch, self).__init__(**kwargs) ...
7f19a6208209221d6c3f51cf45a2ecb844864334e3f0fb43cdc47734b06efe6c
Python
818
29
from datetime import datetime from pathlib import Path from spotipy.model import SpotNet from cenfind.cli.train import fetch_all_fields from cenfind.constants import datasets from cenfind.core.data import Dataset from cenfind.training.config import config_unet PREFIX_REMOTE = Path("/data1/centrioles/canonical/") d...
2925fe9192258be2879e1502901e937e697f915cfd35a8d7a2f9e6cc06877eda
Python
819
32
__author__ = "Johannes Köster" __copyright__ = "Copyright 2018, Johannes Köster" __email__ = "johannes.koester@protonmail.com" __license__ = "MIT" import os from snakemake.shell import shell known = snakemake.input.get("known", "") if known: known = "--dbsnp " + known extra = snakemake.params.get("extra", "") ...
a10d2a53b23a8fee6105c23960ff1d32e426b935b3897945b3e1349e110ba978
Python
819
24
import argparse import yaml from wandb_utils import WandbLogger WANDB_ARTIFACT_PREFIX = 'wandb-artifact://' def create_dataset_artifact(opt): with open(opt.data) as f: data = yaml.load(f, Loader=yaml.SafeLoader) # data dict logger = WandbLogger(opt, '', None, data, job_type='Dataset Creation') i...
a227abcc7e841c9eafd3b108087cd1dfb9af949f35fb00ebca2aab7c4b384be0
Python
819
32
import unittest import numpy as np class TestImports(unittest.TestCase): ''' Test import of various packages, needed for this project ''' def test_various_imports(self): import matplotlib import pandas def test_parallel_libs_import(self): import threading import ...
24fc26605ad17bcd3dec29b4a133be6a99b21ed11228ff8e85f8a073e9e76cf1
Python
820
17
# 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...
dc4fdd4d7b3e4507e30a14120656707bda53a6b2c32a2261862ed5091747fdb5
Python
820
35
from setuptools import find_packages, setup setup( name="tmkit", version="0.0.6", keywords=["pip", "tmkit"], description="TMKit", long_description="TMKit", license="GNU GENERAL V3.0", url="https://github.com/2003100127/tmkit", author="Jianfeng Sun", author_email="jianfeng.sun@ndorms...
eecb89dfc41766f0a684b52031f176043fa5e743eaf9ae3ce8c0dcb3d45958e7
Python
822
29
""" Tools for handling info in mitochondria tables """ def string2list(stringlist,targtype=int): """ In DataFrames that have been saved to .csv files, lists are sometimes converted to string types. In mitochondrial dataframes this is often the case. This tool converts a list with the contents of a...
950f5a90bfc974954c698bf995905c827db3e9c65ceafe500c63518312897682
Python
824
32
import os from setuptools import setup, find_packages with open('README.md', 'r') as f: long_description = f.read() setup( name="crossmapy", version="0.0.1", author="Peng Tao", author_email="taopeng543@gmail.com", url='https://github.com/PengTao-HUST/crossmapy', description="causal inferen...
3acde784916589027b33567143644159ffd18874ff58ad375a48f5f23ebf3cde
Python
825
33
import logging from dataclasses import dataclass from pathlib import Path from typing import Type, Union @dataclass class OntologyResource: """ A representation of an ontology resource. This may be a local or remote file, or an ontology name that is part of a remote service """ slug: str = None ...
48dd2d7f19dbb3afca7dee5cde33b30bc3b130a29e599fb677d1e2c4327a8c48
Python
827
28
import unittest import pytest from oaklib import get_adapter from oaklib.interfaces.association_provider_interface import ( AssociationProviderInterface, ) from oaklib.utilities.iterator_utils import chunk # TODO: use mock tests @pytest.mark.skip(reason="Network dependency") class TestPantherDB(unittest.TestCas...
0684ff1b1afffa2d19fbbb03471f1ac52919e2dab15071d97af2d9b0e0eb7fd0
Python
829
21
import pandas as pd dataPath = "C:/Users/Hamish/Desktop/InjectionsA1_AllenBrainAtlas/projection_search_results.csv" # has to be downloaded beforehand df = pd.read_csv(dataPath) from selenium import webdriver from selenium.webdriver.common.by import By from webdriver_manager.chrome import ChromeDriverManager browser =...
05fca3a06d79ff74a8b2cff7999c3b7cab83ab7ab47c19460740a48ca5fb4bd0
Python
831
22
# 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...
464017d7bd1164807a471518f5ce5565b130cebdf2952cec4b4de964464f3789
Python
831
26
# Copyright (c) Open-MMLab. All rights reserved. import torch.distributed as dist from .hook import HOOKS, Hook @HOOKS.register_module() class SyncBuffersHook(Hook): """Synchronize model buffers such as running_mean and running_var in BN at the end of each epoch. Args: distributed (bool): Whethe...
780b0be60745fbe8ba76f649e1566e93e8e5588e8f4652ddb896905f7a8e3586
Python
833
33
import math import torch from torch.nn import Linear from torch.nn import init class XavierLinear(torch.nn.Module): """ Linear transform initialized with Xavier uniform """ def __init__(self, input_dim, output_dim, bias=True): super(XavierLinear, self).__init__() self.input_dim = in...
cda01f86c873fc69e0a3c6e7e89a55bab6263639c30ad964b8fa8a6bc9cd154f
Python
833
22
from benchnirs.load import load_dataset from benchnirs.viz import epochs_viz ALL_DATA_PATH = '../../data/dataset_' # path to the datasets DATASETS = {'herff_2014_nb': ['1-back', '2-back', '3-back'], 'shin_2018_nb': ['0-back', '2-back', '3-back'], 'shin_2018_wg': ['baseline', 'word generation'...
d9dedc9692617a7ef9f788932d02426d983a59f86cfca846297ab47a37b13257
Python
833
35
''' Calculates spontaneous avoiding response frequency vs. standard deviation of noise ''' from brian2 import * from behavior import * from pylab import * movie = True C = paramecium_constants()['C'] N = 200 duration = 120*second tau_noise = 20*ms eqs= paramecium_equations() + Equations(''' dv/dt = (IL+ICa_cilia+IK...
1691a15798c36845ee1796f8d4f4d8f72a5835b0c2e1a80bf7a5c0c839400cbe
Python
834
41
import numpy as np from sympy import * import mpmath as mp def local_stability(parameters): tau_e = parameters["tau_e"] tau_i = parameters["tau_i"] gei = parameters[ "gei" ] # excitatory-inhibitory synaptic conductance as ratio of E-E syn gii = parameters[ "gii" ] # inhibito...
93afb04efbd53ce4bb0694b5bd1878e6f35432e558e2589ea301a3f3489e48af
Python
834
32
import argparse import torch if __name__ == "__main__": parser = argparse.ArgumentParser( description="Extract factor/eigenvectors of latent spaces using closed form factorization" ) parser.add_argument( "--out", type=str, default="factor.pt", help="name of the result factor file" ) ...
a0204144ddb662a083bb4cb74a3fdc1f09892f167dd4e7086ff21c930d4c4bb2
Python
834
38
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from Bio import SeqIO class EmptyFastaError(Exception): """Error raised if FASTA file does not contain sequence""" def get(fasta_fpn...
ac18f60ecb23b99cf1c02ad425f09d911e2f473fc866a40b19bd5cd5e91fd157
Python
834
36
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 25 10:31:51 2020 @author: smithm3 """ import click import unetsl.model from tensorflow import keras @click.command() @click.argument("model_file") @click.option("--layer", default=None) def main(model_file, layer): model = unetsl.model.loadMo...
0f7bf3726bea3a7998ad937fe3bb0ecaaab14b5aa5c4ff563cc38d6f002d151e
Python
835
16
# 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...
2d2d6c29d75769367646d2409488b8ae73c92aeaf591c9767052fd73a17a2306
Python
835
30
from setuptools import setup requirements = [ "numpy", "scanpy", "numba", "pandas", "scikit-learn", "scipy", "seaborn", "matplotlib", "pytest", #TODO: For simplicity adding it to requirements. ] gpu = ["torch"] setup( name="scPrisma", version="0.0.5", ...
748f5219d45b2326829ffbc8bfd655450316fd40755ab29595114fa272ef98d2
Python
835
29
# -*- coding: utf-8 -*- # File : unittest.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. # https://github.com/vacancy/Synchronized-BatchNorm-PyTorch # Distributed under MIT License. import unittest import numpy as np from tor...
ad30302cf26ec8fc7c08f8bcbc8017ab1d5a5388ffe4d20207a91d55d23db899
Python
835
17
import subprocess as sp from .logger import get_logger LOGGER = get_logger() def run_model(fixed_path=None, moving_path=None, fixed_seg_path=None, moving_seg_path=None, output_path=None, task="B"): if (fixed_seg_path is None) or (moving_seg_path is None): # LOGGER.info("The fixed or moving segmentation...
03c18617a56f1f7181379741febaef44cc0976b58cdc3fa4d9f2e543edca9195
Python
836
35
__author__ = "Johannes Köster" __copyright__ = "Copyright 2018, Johannes Köster" __email__ = "johannes.koester@protonmail.com" __license__ = "MIT" import os from snakemake.shell import shell known = snakemake.input.get("known", "") if known: known = "--dbsnp " + known extra = snakemake.params.get("extra", "") ...
c6f083c3ee3033663133f7a1a019e544abd5b642cb62c552acfe4b2d66979456
Python
836
23
import logging import logging.config from pathlib import Path from .util import read_json from datetime import datetime def setup_logging(save_dir, log_config='utils/logger_config.json', default_level=logging.INFO): """ Setup logging configuration """ log_config = Path(log_config) if log_config.is...
a8f16ee59f047d80c3caf6c9f67793a3798077fc1ea0dc780b44e1d493ab38d9
Python
837
20
from easydict import EasyDict # Baseline config - Convolution 1D task1_baseline_config = {"seed": 42, "val_size": 0.2, "split_videos": False, "normalize": True, "past_frames": 100, "future_frame...
ff12822301c612d35009af302bccbbfc549746f4cafe7f06a156f67ce9fba152
Python
837
32
import numpy as np import os from machemer import num_phases, shapes_data_path def get_colors(num, cmap): ''' :param num: How many colors to return :param cmap: e.g. 'jet' 'viridis' 'RdBu_r' 'hsv' :return: ''' import matplotlib.cm as mcm cm = getattr(mcm, cmap) return cm(np.linspace(0,...
34f59c549ec48023709460ffb4b7a59c5d183c6919fc96bae6dfc6c912ca12bc
Python
838
30
#!/usr/bin/env python import sys import codecs romanToScript = {} lexiconLocation = sys.argv[1] wordLexiconLoc = sys.argv[2] outLexiconLoc = sys.argv[3] # First create a map from the romanized to the script version lexicon = codecs.open(lexiconLocation + "callhome_arabic_lexicon_991012/ar_lex.v07", \ encoding="...
64f5dfc76fffb45092ef6944a548cca7060f6167b7340ce167d2aa379ad03292
Python
838
19
from .heuristics import MiddleDistCentroid,MiddleWingAngleMinIntruder,MiddleWingAngleMaxIntruder,MiddleAxisRatioResident,MiddleAxisRatioIntruder, MiddleAngleSocialIntruder, MiddleSpeedResident, MiddleWingAngleMaxResident, MiddleSpeedIntruder,MiddleWingAngleMinResident, MiddleAngularSpeedResident, MiddleAngularSpeedIntr...
9d74035b1735931c4a82517da745b4733817175059346458c75f86c4f2b689e3
Python
839
33
def _no_tqdm(iterable, *args, **kwargs): """ replacement for tqdm that just passes back the iterable to silence `tqdm` """ return iterable def _no_progressbar(progress, total_length): """ no-op calls to update the `fetcher` progress bar """ return def reset_progressbars(gallery_conf,...
d358a164338c51717cde95017fbe0f31d93f467433b36707e8ed2dd462b5149f
Python
841
27
import importlib import os from collections import namedtuple import torch if torch.__version__ != 'parrots': def load_ext(name, funcs): ext = importlib.import_module('mmcv.' + name) for fun in funcs: assert hasattr(ext, fun), f'{fun} miss in module {name}' return ext else: ...
519c7df99d6537ddfd12eeffcd0a52d43c339ab41b75ffccb7119c934b6c61f2
Python
842
40
""" scHumanNet: Construction of cell-type-specific functional gene network This package provides tools for constructing cell-type-specific functional gene networks using SCINET and HumanNetv3, with functions for downstream analysis including hub gene identification and differential network analysis. """ __version__ =...
74bc935e318a953547c94fd35cc5b24a3782c3db0f1101833eed4d627eb90b9c
Python
842
37
#!/usr/bin/env python3 # Copyright 2017 Bengu Wu # Apache 2.0. # This script splits the test set utt2spk into enroll set and eval set # For each speaker, 3 utterances are randomly selected as enroll samples, # and the others are used as eval samples for evaluation # input: test utt2spk # output: enroll utt2spk, eval ...
7a54f8b6142051858c37c2dd2943f39b4a9640a9859946dd6023539d62ddde19
Python
842
21
from .._widget import PalmariWidget from ..data_structure.acquisition import Acquisition from ..data_structure.experiment import Experiment from ..processing.image_pipeline import ImagePipeline from glob import glob import numpy as np # make_napari_viewer is a pytest fixture that returns a napari viewer object # capsy...
b9f6acd15cf605dd88df0c19fa5d00afa8b219e2a8884e120cd1c90bea6653e9
Python
843
26
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch from .batch_norm import FrozenBatchNorm2d from .misc import Conv2d from .misc import ConvTranspose2d from .misc import BatchNorm2d from .misc import interpolate from .nms import nms from .roi_align import ROIAlign from .roi_align impo...
ec4592a5cffa1742fd10f55f9ce19b305912c8d6d13a669325561cc0b20b24e7
Python
843
23
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. import torch if torch._six.PY3: import importlib import importlib.util import sys # from https://stackoverflow.com/questions/67631/how-to-import-a-module-given-the-full-path?utm_medium=organic&utm_source=google_rich_qa&utm_campai...
755cf03f100ee810199f760b9517ff3c3f39674aab0d981e64ddce14eb2da248
Python
844
31
#%% from src.data import load_metagraph mg = load_metagraph("G") meta = mg.meta #%% mbin = meta[meta["class1"] == "MBIN"] mbin mbin.loc[[4381377, 10673895]]["name"] #%% from src.visualization import simple_plot_neurons from src.pymaid import start_instance from src.visualization import CLASS_COLOR_DICT as palette...
f38fb7202d12dcc6912a562056d3fc1073efeda83ee2c571ec1df07d0e976d79
Python
844
31
from typing import Any, Tuple import torch class SNNOneState: def __init__(self, model) -> None: self.model = model def one_state(self, x: torch.tensor, state: Any) -> Tuple[torch.Tensor, Any]: out, new_state = self.model(x, state=state) return out, new_state class SNNStates(SNNOne...
91f8e92cc309458c580cb21cbbf74d6bcd74acff28a88a5818d4ad07d1dc18c5
Python
846
15
# This recipe shows the current traffic rules affecting the vehicle. # Shows the current lane type and if a lane change can be done in the actual lane or the surrounding ones. # ... waypoint = world.get_map().get_waypoint(vehicle.get_location(),project_to_road=True, lane_type=(carla.LaneType.Driving | carla.LaneType...
c4c5b3dc673454fea7999ae8f4059031be64eb73ee9bcaa5ba5593b8db81794d
Python
846
37
import numpy as np from cgtasknet.tasks.reduce import _generate_values def test_generate_value_mode(): mode = "value" values = [0, 1, 2, 3, 4] size = 10 for value in values: assert np.allclose( np.ones(size, dtype=np.float64) * value, _generate_values(mode, size, value) ) ...
d8f45a41cc55f375a296777065762e3f6769264dbb8d2107dc604ea2f6eca8e6
Python
847
35
from moses.trans import ( TranslationModel, TranslationTrainer, translation_parser, ) class ModelsStorage: def __init__(self): self._models = {} self.add_model( "translation", TranslationModel, TranslationTrainer, translation_parser, ...
24270402a4170aa36b69d6c40502544dd73d599b34214d2c256ce319301a07a3
Python
848
25
# 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...
965a23f2c2ce6a8a8c82920a11c855213010f88e7b4bd46effc6056ab8788582
Python
848
23
# 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...
a88a6a84dd895c594327bbfd6d4a00e9307437c07a4d890f2a7b040b73647a6d
Python
848
29
from collections import defaultdict IMG_DATA_PATH="charpragcap/resources/visual_genome_data/" REP_DATA_PATH="charpragcap/resources/resnet_reps/" TRAINED_MODEL_PATH="data/models/" WEIGHTS_PATH="charpragcap/resources/weights/" S0_WEIGHTS_PATH="s0_weights" S0_PRIME_WEIGHTS_PATH="s0_prime_weights" caption,region = 0,1 star...
4775c49e1294bfabe470423d82576cf4337c8106f9e97cb2c7cfba00d43f49d9
Python
850
27
from typing import List, Tuple, Union from linkml_runtime.linkml_model import SlotDefinitionName from linkml_runtime.utils.yamlutils import YAMLRoot from oaklib import BasicOntologyInterface def add_labels_to_object( oi: BasicOntologyInterface, obj: YAMLRoot, pairs: List[Tuple[Union[SlotDefinitionName, ...
799221f40f74db2581f616d93ccda50fac0d76f60020656e168050e0ec434e43
Python
850
37
from __future__ import print_function import os import torch from torch.utils.ffi import create_extension #this_file = os.path.dirname(__file__) sources = [] headers = [] defines = [] with_cuda = False if torch.cuda.is_available(): print('Including CUDA code.') sources += ['src/nms_cuda.c'] headers += ['...
81fc9e18b144324097ae0fac6087f7b5851dce1a6b07f6d717edc2cd1cb32bf2
Python
850
32
##Code by Isaac Arias S - YachayTech University ##Biomedical Engineer Student. ##School of Biological Sciences and Engineering. import shutil import os import fnmatch file = open("TrainHRF.txt","r") f = file.readlines() newList = [] for line in f: newList.append(line.strip() + ".jpg") ##Add the c...
8c2b471be52b92946883756b839a4be6c0994716814edfb8377075b380341b9e
Python
850
25
import unittest from alpamayo_display import SimulationVideoClock class SimulationVideoClockTest(unittest.TestCase): def test_twenty_fps_duplicates_each_ten_hz_state(self): clock = SimulationVideoClock(20.0) self.assertEqual([clock.advance(0.1) for _ in range(4)], [2, 2, 2, 2]) def test_frac...
d677e5d86e94b56183b7fac59dee7c0fade511380e94f4ec04ee58287ad0a29a
Python
850
32
from typing import Tuple, Union import torch import numpy as np def get_device( use_cuda: bool, ) -> Tuple[torch.device, Union[torch._C._CudaDeviceProperties, None]]: """retrieves information about device (CPU or CUDA) Args: use_cuda (bool): if cuda to be used Returns: Tuple[torch.de...
424286c2426c5ef339dfbe4902117690702987a7390cc1ed8b1fb1887c77dc8a
Python
851
28
#%% import os import sys try: os.chdir('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/maggot_models/') sys.path.append('/Volumes/GoogleDrive/My Drive/python_code/connectome_tools/') except: pass import pandas as pd from pymaid_...
18b3905742baabbbd259c0f486e1e7b21066bd1a71b1e0a0f6dc28a49d257733
Python
852
28
import os import torch device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # sets device for model and PyTorch tensors # Model parameters image_w = 112 image_h = 112 channel = 3 emb_size = 512 # Training parameters num_workers = 1 # for data-loading; right now, only 1 works with h5py grad_clip =...
30622c33751fdabdb1eca256e2f591a660208167b7155f72269e7a8c8f0601cc
Python
852
25
# -*- coding: utf-8 -*- import numpy as np from . import utils from . import mi from ._base import _ConventionCausality class TransferEntropy(_ConventionCausality): def fit(self, data, mi_kwargs=None): self._preprocess(data) self._fit_data(mi_kwargs) def _fit_data(self, mi_kwargs=None): ...
9bc05d5e927ef0fb66d430117ec51551366de7f41da0f884caa07b494d720de7
Python
852
33
from dataclasses import dataclass from enum import Enum from pathlib import Path import pandas as pd # ----------------------------------------------------------------------------------------------------------- # Data paths across tasks @dataclass class Ferret(): """ Metadata associated with a specific subject "...
045cd328128d4fef564ceb606f2ea40d5fe431af1539502296919d124f87e7e2
Python
854
25
import urllib import yaml from urllib import request TAXONOMY_DETAILS_YAML = "https://raw.githubusercontent.com/obophenotype/brain_data_standards_ontologies/pcl_migration/src/dendrograms/taxonomy_details.yaml" species_mapping = {"mouse": "Mus musculus", "human": "Homo sapiens", ...
e66bdef8cb25f28a00c5378e3ee0cdf4cafa885d98ac850c2dbf8ddf2840ed49
Python
854
32
import numpy as np import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt from matplotlib import colors as mcolors folders = ['/clusterfs/lawrencium/yaningl/Research/DK3_duke_forest_1996_2005_041417/sim_' + str(i) for i in range(1, 11)] year = 2005 col_num = 4 colors = ['red', 'green', 'b...
62791930713aa245a3e3e4fdd4bc74d7fc33f988559b7e1bc14551dc11b6ba1d
Python
856
22
""" File: __init__.py Created: 2020-04-29 Last Changed: 2020-04-29 Author(s): H.H.Wiersma Code to create distribution plot and a mask image used in the research plan Copyright (C) 2019 H.H.Wiersma This program is free software: you can redistribute it and/or modify it under the terms of the GNU Genera...
b61bbaf51ac29d1734d52eb9f64c18481e12347d067f369a6e80b00d68859a3a
Python
856
25
from typing import List, Any, Optional from zencfg import ConfigBase class DistributedConfig(ConfigBase): """ DistributedConfig provides config options for multi-GPU and multi-node settings. Our current setup depends on ``torchrun``-based Elastic Launch and the ``nccl`` distributed backend for commun...
835904b339c0244fcd9ee88d1ac10579506fc0803ebea4996f3d2f409dadd9c3
Python
857
36
import ast import numpy as np import cloudvolume as cv import json from meshparty import skeleton_io """ Skeleton handling Label conventions: {1: 'axon', 2: 'basal dendrite', 3: 'apical dendrite', 4: 'ambiguous dendrite', 5: 'ambiguous', 0: 'soma'} """ SMOOTHED_SKELDIR = "data/smoothed_skels" SMOOTHED_LABELDIR ...
661d9eaa7eef0bb201b71b1884f7bad7e486adfe6746a81f87b53a7ea85dea6a
Python
858
32
#!/usr/bin/env python3 import os import sys import json def main(argv): fp = open(argv[1], encoding = "utf-8") js = json.load(fp) fp.close() metas = {} for ele in js: fname = ele['file'] metas[fname] = ele fWavScp = open(os.path.join(argv[2], 'wav.scp'), 'w') fText = open(os.path.join(argv[2], '...
fa4caff6284e25eace10fe436b8c0c1a214b84ed8d2793bbd3ed34b79b191128
Python
858
28
import mmcv from .version import __version__, short_version def digit_version(version_str): digit_version = [] for x in version_str.split('.'): if x.isdigit(): digit_version.append(int(x)) elif x.find('rc') != -1: patch_version = x.split('rc') digit_version...
13936ef4a542e38bcb2f2ec4d568609d01c7ddf3a303a83336b30c22bfee2195
Python
861
20
"""Test methods in data structures.""" from unittest import mock from unittest.mock import MagicMock from fi_parliament_tools.parsing.data_structures import Transcript @mock.patch("fi_parliament_tools.parsing.data_structures.json.dump") @mock.patch("fi_parliament_tools.parsing.data_structures.atomic_write") def test...
7719899ab4219fb8bfad9b7e2d99bc6515f69467cb6574456b3e832e8ce73adc
Python
861
29
def contrast_index(x1, x2, double=True): """ Calculate the contrast index between two arrays. The contrast index is symmetrical with respect to the choice of the baseline for comparison Parameters ---------- x1 : ndarray of floats An ndarray to compare. The contrast index will have ...
0b310f1ba56e3440d511ca7637f9871df8bfbc4deafd8ac71ef097aedffaaf61
Python
862
26
from setuptools import find_packages, setup VERSION = '1.0.5' DESCRIPTION = 'A package for adding dendrites to SNNs' LONG_DESCRIPTION = 'A package for adding dendrites to SNNs in Brian 2' # Setting up setup( name="dendrify", version=VERSION, author="Michalis Pagkalos", author_email="<mpagkalos93@gmail...
eaf3dc56abbed90c4c07785d2d9c5fac52e5bf1f5328376f43853d865153c502
Python
862
34
from __future__ import absolute_import import numpy as np import torch def nms_cpu(dets, thresh): dets = dets.numpy() x1 = dets[:, 0] y1 = dets[:, 1] x2 = dets[:, 2] y2 = dets[:, 3] scores = dets[:, 4] areas = (x2 - x1 + 1) * (y2 - y1 + 1) order = scores.argsort()[::-1] keep = []...
9f8ccde20594d7a330f731e6e7f376701cd5d9b2f5a94461c17582d6f6dc9af8
Python
863
28
from flask import Flask, Blueprint from bds_api import settings from bds_api.restplus import api from bds_api.endpoints.search_service import ns as api_namespace from werkzeug.middleware.proxy_fix import ProxyFix app = Flask(__name__) # added for https bugfix https://github.com/noirbizarre/flask-restplus/issues/565 ap...
ce4fd7186e0cef3ede47116b459e0251ea92d3e7aefa4ae7fae4ac98c7b41900
Python
863
35
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" from typing import List def Palette( chains: List[str], prot_c: str = "rainbow", sm_c: str = "blue_green" ) -> None: """ Apply...
4644b7489e2f092cca335a3a26d13fdfb552e7176ccfe39d294f5882db4e0078
Python
864
16
# 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...
abd9dc623f1e42d16de54ad2a1de054fda8df323cbc8b42f38ba81124b0e66c6
Python
864
33
"""Figures for custom plots""" from ._base import EelFigure, Layout, XAxisMixin class Figure(EelFigure): """Empty figure Parameters ---------- nax : int (optional) Create this many axes (default is to not create any axes). ... Also accepts :ref:`general-layout-parameters`. aut...
bf6365ffda3b263bb218671512b994968854bfcb897fe32d6ea27f85d178b73f
Python
864
37
# This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ This module contains the different parameters sets for each behavior. """ class Cautious: """Class for Cautious agent.""" max_speed = 40 speed_lim_dist = 6 speed_decrease = 12 ...
971221e284a5583a09c51457dafe083fb2d69b15c171f4052b3a7adb998a0ff9
Python
865
25
#!/usr/bin/env python3 # encoding: utf-8 # @Time : 2017/12/16 下午8:41 # @Author : yuchangqian # @Contact : changqian_yu@163.com # @File : camvid.py import numpy as np from datasets.BaseDataset import BaseDataset class CamVid(BaseDataset): @classmethod def get_class_colors(*args): return [[128, ...
aae9eec196d325860dd40de0d08b35f2dce1f59bcd2e53282cb7db1c78d303c4
Python
865
19
# This script is part of navis (http://www.github.com/schlegelp/navis). # Copyright (C) 2018 Philipp Schlegel # # 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...
98f451fa4adca4b490258c15f5de1afbd0f1dc2c353ff7e68e223b48ccb6874e
Python
868
26
import os import synapseclient import synapseutils import argparse import getpass parser = argparse.ArgumentParser(description='Download RNAseq and genotypes of CMC.') parser.add_argument('RNAseq_directory', help='Directory to download RNAseq data to') args = parser.parse_args() user = input("Synapse username:") pas...
b8b0b4fa4886b0dce2121bfffc9cd17b297b61e86f33428bfc54a7529a4e00df
Python
871
22
# This script is part of navis (http://www.github.com/schlegelp/navis). # Copyright (C) 2018 Philipp Schlegel # # 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...
4d43ce842227d6c4b27a41fdfe993493a990fe0168b7e111b4ba65c29cc23e2e
Python
872
40
''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' from abc import ABC, abstractmethod class ModelTrainer(ABC): def __init__(self, model, args=None): self.model = model self.id = 0 self.ar...
50e81378c6fb849173f5c3284be0e5870759a0389b77d89370027d76e63d4c48
Python
872
26
from unittest import TestCase from drugex.molecules.converters.standardizers import DefaultStandardizer from drugex.molecules.mol import DrExMol from drugex.molecules.suppliers import StandardizedSupplier, ListSupplier class TestStandardizer(TestCase): def test_default(self): """ Tests whether t...
35637b3547a673bd4125aef268c73ea08a1b455af5ef482b3973acdfe3d10ce5
Python
873
40
class RSA_World: def __init__( self, target, speaker, rationality="DEFAULTBAD", ): self.target=target self.rationality=rationality self.speaker=speaker def __hash__(self): return hash((self.target,self.speaker,self.rationality)) def __eq__(self,other): return self.target==other.target and sel...