sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
eadc783c18a3805b5c1edee4f3f2369469a9b5c007f0057899009c0acb118e82
Python
4,013
103
"""Rig presets, YAML round trip and the roofline mounting rule (pure parts).""" import numpy as np import pytest import carla from carla_cosmos import coords from carla_cosmos.contracts import AV_CAMERAS from carla_cosmos.rig import Camera, Rig, _apply_mount_rule, rear_axle_xy_from_bones def test_presets(): av...
3f7efe837f13d49c0aca969b425383c5225edc21c04e25a009070f8599838911
Python
4,014
122
import torch import torch.nn as nn class MoCo(nn.Module): """ Build a MoCo model with a base encoder, a momentum encoder, and two MLPs https://arxiv.org/abs/1911.05722 """ def __init__(self, base_encoder, dim=256, mlp_dim=4096, T=1.0): """ dim: feature dimension (default: 256) ...
e2ce140bd91a926565f6592101d36c3354020bdd0467a44f15e67a49260bb537
Python
4,015
66
"""Run the tuto_G_traffic_manager set_path example and record what the vehicles actually drive. tm_paths.py OUT.json R1S R1(comma) R2S R2(comma) [seconds]""" import json, random, sys, os import carla sys.path.insert(0, os.path.dirname(__file__)); import scene out, r1s, r1, r2s, r2 = sys.argv[1], int(sys.argv[2]), [int(...
ef5a202615d645392a49ac208286096f1f96b60e7d42faa084543da0c17f65bf
Python
4,015
117
# 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 a...
2593b5e30c0b74cb2f0c080bda732dd4ff8a697eff91747810b1c9e55a0691cf
Python
4,016
145
""" Associating mitochondria to a set of skeleton nodes More precisely, finding the set of skeleton nodes that is the closest to some mesh vertex of each mitochondrion. Labels each such mitochondrion with the set of skeleton node indices that is paired with it in this way. """ import sys import time import operator im...
1775a24b05b37ed4e9b79352cbf0b0e59f4a9d02c9f90af5903de775544dfcfb
Python
4,017
99
import torch import torch.nn as nn import torch.nn.functional as F import math from drugex import utils class Attn(nn.Module): def __init__(self, h_dim): super(Attn, self).__init__() self.h_dim = h_dim self.main = nn.Sequential( nn.Linear(h_dim, 100), nn.ReLU(True),...
762801294fc92d8727350e652959e4bc4558a097a32b1049431d556d2156fb39
Python
4,017
122
import argparse import os import autosklearn.classification import joblib import medmnist import numpy as np from medmnist import INFO, Evaluator from medmnist.info import DEFAULT_ROOT def main(data_flag, time, input_root, output_root, run, model_path): time = time * 60 * 60 info = INFO[data_flag] ...
98a07db3d39f9b59a41244083f085ebc27c75d35dbc27811e3b693c7aaf1f85b
Python
4,017
120
#################################################################################################### # Copyright (c) 2019 - 2023, EPFL / Blue Brain Project # Author(s): Marwan Abdellah <marwan.abdellah@epfl.ch> # # This file is part of VessMorphoVis <https://github.com/BlueBrain/VessMorphoVis> # # This program is free ...
35398b75843b673559635b7c49d41bd1aa0347a4019cb5943c71446848e37650
Python
4,018
137
""" Neighbor Search for Graph Neural Operators =========================================== This tutorial demonstrates neighbor search algorithms used in Graph Neural Operators (GNO). Neighbor search is crucial for: - Finding spatial relationships in irregular point clouds - Computing Nyström approximations of kernel ...
f1688006b544aa2bbe0e26b101408456f14c87b82256cb42639f74c4b491b578
Python
4,018
91
from palm_tools.analysis.mmd_analysis import MMDInterGroupAnalysis, MMDInterUnitAnalysis from palm_tools.analysis.mds_analysis import MDSAnalysis from palm_tools.data_structure.trackset import TrackSets import logging import numpy as np from palm_tools.post_processing.ts_post_processing import PostProcessingStepSeries ...
16fe33a0abfc28c776d7e57dbd7e6b9ea8272f03f448cba69d505ef2f7999d14
Python
4,022
167
""" Compute in-connection degree, in-synapse degree. """ import numpy as np import pandas as pd import pickle def main(): Neuron = load_dict("../data/Neuron.pkl") seg_id_list = Neuron["segment_id"] n = seg_id_list.shape[0] conn_fname = "../data/pyc_pyc_subgraph.csv" conn_all_fname = "../data/pyc_all_synapse.cs...
36cd3e3827850d73bc4f1654d350b346fc80a7662aaa767313daa99ca4c594b0
Python
4,022
101
import cog import tempfile from pathlib import Path import argparse import cv2 import torch from PIL import Image import torch.nn.functional as F from torchvision import transforms from models.models import create_model from options.test_options import TestOptions from util.reverse2original import reverse2wholeimage fr...
0a1489ecb00a5cb77ae4b90543a91a178167ded99dad9da773605813b1c1260a
Python
4,024
133
import os import random import albumentations import albumentations.pytorch import numpy as np import torchvision from PIL import Image class ResizeRandomCrop: def __init__(self, img_size=320, scale_rate=8 / 7, p=0.5): self.img_size = img_size self.scale_rate = scale_rate self.p = p ...
248edb4e03ea161d049d10514bf9b56f1a9f75bcc17324d40f90a50a4c1b7c39
Python
4,024
128
import math import paddle.nn as nn import paddle num_classes = 93431 class SEBlock(nn.Layer): def __init__(self, channel, reduction=16): super(SEBlock, self).__init__() self.avg_pool = nn.AdaptiveAvgPool2D(1) self.fc = nn.Sequential( nn.Linear(channel, channel // reduction), ...
2553f8c48550e9ebfb5ccebee9d343ac7f4ade53d37e95820ee7d3f375da70cf
Python
4,024
104
"""Public-API and CLI regressions for #800, part of #757.""" import gzip from pathlib import Path import random import subprocess import sys import MACS3 import pytest from conftest import macs3_env, no_core_dumps HEADER = "@SQ\tSN:chr1\tLN:1000000\n" def record(name="rev", flag=16, cigar="50M", pos=5000): r...
4edc4e08c34d3cb4528589f8b6e99a4bafaadced86fd6b35adcd5f7d4afcf5cc
Python
4,024
120
# Some part of the code was referenced from below. # https://github.com/pytorch/examples/tree/master/word_language_model import torch import torch.nn as nn import numpy as np from torch.nn.utils import clip_grad_norm_ from data_utils import Dictionary, Corpus # Device configuration device = torch.device('cuda' if to...
c3b22437216e99fd7f867597219ecb9718085848e19237081ee571e9bbc29322
Python
4,025
139
#%% [markdown] ## Linking transcriptome and connectome via graph matching # > A simple attempt to see if one 'ome can be aligned to the other 'ome # # - toc: true # - badges: false # - categories: [pedigo, graspologic] # - hide: true # - search_exclude: true #%% import os import time from pathlib import Path import m...
ad5af0007738dfff22bcd33926c802d46575d8f687ba1d088e8fc9eb2b36efc6
Python
4,027
111
""" Handles outputting the model predictions """ from .handler import PredictionsHandler class WritePredictionsHandler(PredictionsHandler): """ Collects batches of model predictions and writes all of them to file at the end. Parameters ---------- features : list(str) List of sequence-...
d13a89fe45e62c3820eadb4c6a1a8ba54dc211e0ef494692aaf7f9be8c73c45e
Python
4,028
110
import tensorflow as tf EPSILON = 1e-12 #------------------------------------------------------------------------- """ Non-saturating minimax loss Goodfellow et al. Generative adversarial networks. NeurIPS, 2014 https://arxiv.org/abs/1406.2661 """ @tf.function def minimax_D(real_output: tf.Tensor, fake_outp...
f9a91e7a94105185417516789b21e0955a1bacd24aa2c699b7d56213d37b6130
Python
4,029
100
from __future__ import print_function import torch import numpy as np from PIL import Image import numpy as np import os # Converts a Tensor into a Numpy array # |imtype|: the desired type of the converted numpy array def tensor2im(image_tensor, imtype=np.uint8, normalize=True): if isinstance(image_tensor, list): ...
b515772b1b7973df36624cef8ac689e8cb8e32979a3000c7baac8d287c4d9337
Python
4,031
122
""" File: cmd_line_arguments.py Created: 2020/03/19 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version...
97e6d4995b8ebd46ac28d030878cd3a054f8edb9dd4be87347bc06de2d59e237
Python
4,032
110
import math import torch from torch.testing import assert_close import pytest from ..embeddings import SinusoidalEmbedding # Testing NeRF Embedding: start with a simple range # and see that it is embedded properly batch_size = 4 num_freqs = 3 in_channels = 3 n_in = 2 max_pos = 10000 if torch.backends.cuda.is_built...
c66086d0121bb9a315c8242c5b6db9c790586023934b50b6d322124e15153f0e
Python
4,033
119
from Lif_Parameters import * from Lif_Equations import eqs_LIF seed(val) ##################################### # Initialize the neuronal populations ##################################### # ------- Layer 0 ------- l0 = NeuronGroup(n_cells, eqs_LIF, method='exponential_euler', threshold='vm>v_th', reset='vm=v_r', refra...
f515e51de21a983e0c35743417a615ee6b704531d0f734494a851d7779af911e
Python
4,033
113
"""Generic dataset download helpers for CROPro CLI. This module intentionally contains no dataset-specific URLs or presets. Dataset specific download behavior can be provided through local dataset plugins. """ from __future__ import annotations import urllib.parse import urllib.request import zipfile from dataclasse...
f2fe94cd2d5e1ac3a4250b8758b455cdaf833d6df8897801c8d4092e1c35efe2
Python
4,035
178
# %% [markdown] # # import os import colorcet as cc import matplotlib as mpl import matplotlib.pyplot as plt import networkx as nx import numpy as np import pandas as pd import seaborn as sns from scipy.stats import rankdata from sklearn.decomposition import PCA from graspy.plot import heatmap, pairplot from graspy...
52e3f4650a9e1f7d1f986c24e1338e23b9831973c1eba5477ed7464aca414690
Python
4,037
100
# 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...
572cb3e2c25688951a9adf8661813a356b5398e77ff39918eaac37b9b1ffd357
Python
4,037
116
import numpy as np from keras_preprocessing import image def random_flip(img, mask, u=0.5): if np.random.random() < u: img = image.flip_axis(img, 1) mask = image.flip_axis(mask, 1) if np.random.random() < u: img = image.flip_axis(img, 0) mask = image.flip_axis(mask, 0) retu...
ad439a2178355be77c8dacfa257e570a68904cacdb5d47cf69f9ead8f8387c26
Python
4,038
113
# ---------------------------------------------------------------------- # LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator # https://www.lammps.org/ Sandia National Laboratories # LAMMPS Development team: developers@lammps.org # # Copyright (2003) Sandia Corporation. Under the terms of Contr...
3dbe438e86a8d94aabc0d4eaaa10e7f85b2334f5e3b6c745b4249a94b7cc167e
Python
4,039
102
import torch from fairseq.models.bart import BARTModel import argparse from tqdm import tqdm import os from os.path import join import logging import time def generate_TLDRs(bsz, count, datadir, outdir, checkpoint_dir, checkpoint_file, test_fname, beam, lenpen, max_len_b, min_l...
36028a00d67c2c4a2fca8abbc687a0adf3fc94ec136b3e420596ea02c2cb6198
Python
4,042
124
import math import glob import argparse parser = argparse.ArgumentParser(description='Create slurm jobs to merge gVCFs together in batches of 200') parser.add_argument('list_of_vcfs', help='.txt file with list of path of VCFs to merge (only for chr15, this will be replaced for other chr numbers)') parser.add_argume...
4bbd8c4779abc89f3580b9528500b3e78fef59917aa66faa052f48b4faee27ec
Python
4,042
145
import math import torch import torch.nn as nn import torch.nn.functional as F from a2c_ppo_acktr.utils import AddBias, init """ Modify standard PyTorch distributions so they are compatible with this code. """ # # Standardize distribution interfaces # # Categorical class FixedCategorical(torch.distributions.Catego...
93ba1fb9626bcc03eb278aaae77eccb5059888471fd3b3058731c9e838851315
Python
4,042
118
from torch_geometric.loader import DataLoader import pytorch_lightning as pl from torch.utils.data import random_split from torch.utils.data.distributed import DistributedSampler from . import default_ds_params, default_graph_info # from ..simulation.diffusion_models import generators, params_sampler from ..simulation...
eece9afb0553c3cef4f054275314eb7ccb97bdd4634cd6892bef2bd2aff1f8f6
Python
4,042
151
#!/usr/bin/env python ### # #%L # Triangulated surface for deforming in 3D. # %% # Copyright (C) 2013 - 2023 University College London # %% # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software wi...
21caf85e289d9f3a448b549d2ef2261cc93b69362659dbd3e712596c5142980b
Python
4,043
109
# -*- coding: utf-8 -*- import time from collections import OrderedDict import numpy as np import torch import torch.nn as nn from torch.autograd import Variable from utils.module_madd import compute_module_madd class CModelHook(object): def __init__(self, model, input_size, device): assert isinstance(m...
22561a94a15d3bcdf79aa9c51e20ad6f7ae7973974ca8647aa867d16a8201760
Python
4,044
82
__author__ = 'tsungyi' from . import _mask # Interface for manipulating masks stored in RLE format. # # RLE is a simple yet efficient format for storing binary masks. RLE # first divides a vector (or vectorized image) into a series of piecewise # constant regions and then for each piece simply stores the length of # ...
fd2eb516230acf281635a5c26523b7af128cb85ae1cd83a95230d9275ac3baf1
Python
4,044
98
from collections import defaultdict from dataclasses import dataclass from typing import List, Iterable, Tuple, Callable, Optional, Any, Dict import sssom from oaklib.datamodels.obograph import Node from oaklib.datamodels.validation_datamodel import ValidationConfiguration, ValidationResult from oaklib.interfaces.basi...
374e0e65b42a99eb14fb60b8ba9ce793fb1eff81b1220dc75d565e2f6fdcb823
Python
4,045
69
# A dictionary that contains templates of frequently used models or strings library = { # Adaptive exponential integrate & fire: 'adex': ('dV{0}/dt = (gL{0} * (EL{0}-V{0}) + gL{0}*DeltaT{0}*exp((V{0}-Vth{0})/DeltaT{0}) + I{0} - w{0}) / C{0} :volt\n' 'dw{0}/dt = (a{0} * (V{0}-EL{0}) -w{0}) / tauw{...
8b517c42866f5d39ad0fc5e654ac9a173fe9c9b62378c04b54a8e6e1be057a68
Python
4,045
98
# -*- coding: utf-8 -*- """ Created on Mon Dec 2 09:42:42 2019 @author: rjovelin """ import pysam from debarcer.utilities import get_consecutive_items from debarcer.utilities import GetContigs def FindRegionsCoverage(bamfile, contig, min_cov, region_size, max_depth, ignore_orphans, stepper): ''' (str, str...
8b7b1a89e680b8a9566b1b8200e453b05e752ce8ed073385a51fd03798e4958e
Python
4,047
126
#!/usr/bin/env python # -*- coding: utf-8 -*- """Provides methods for accessing the interface eAE API. """ import json import stat import os import zipfile import http.client as http from subprocess import call from uuid import uuid4 __author__ = "Axel Oehmichen" __copyright__ = "Copyright 2017, Axel Oehmichen" __c...
89693413094cd2d99437e400b2c736f5a1ae64f738ef0e646f0f1285e885a4a4
Python
4,048
116
import os import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import numpy as np from subprocess import Popen, PIPE from IPython.core.debugger import * import sys from Bio.PDB import * import pyflann def test_alignment(target_pdb_fn, source_pdb_fn, aligned_pdb_fn, interface_dist = 10.0): ...
ece6b3931cfeae8f2b4265ae093ae5222efa9359eb1aeac173b0aae79d351bf7
Python
4,055
85
""" Model for a honeybee olfactory receptor (OR) type. The receptor is modeled with a system of ODEs which govern the fraction of unbound receptors (r0), the receptors bound to odorant i (rb0, ..., rb2), and the receptors bound and activated by odorant i (ra0, ..., ra2). Was formulated, the model supports 3 active che...
edea2f164fb6f0edc7b41341883b60b9747a28d71a8880c23a6ff171b0aab374
Python
4,055
112
# 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 a...
2fa997ab2d7f7546ed4301c117bdb84024e94788f7fbe6c5ae69ddc75ecbe85e
Python
4,056
107
""" File: cmd_line_arguments.py Created: 2020/11/09 Last Changed: 2020/11/12 Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, eit...
b65dd40bcfafadd26a562b903f18de858284788656d5e249093b3519204f5d5d
Python
4,056
92
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...
e66565f8ff03f1247f11d0423e97a22ebff11642d238ed56101ac2e74d0f5eff
Python
4,056
145
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import unetsl.data import unetsl.config from unetsl.cli_interface import getFilePrompt def getNumberList(inp): print(inp) values = inp.split(); print(values) x = [] for v in values: try: d = float(v.rstrip(",")) ...
cb2d26ab9c3639128c5ae12b1141aa2c69389c115bc6b18081fb63171325a117
Python
4,057
140
#!/usr/bin/env python # coding: utf-8 # # Author: Kazuto Nakashima # URL: http://kazuto1011.github.io # Created: 2017-11-19 from __future__ import absolute_import, print_function from collections import OrderedDict import torch import torch.nn as nn import torch.nn.functional as F try: from encoding.nn ...
535355129f5e90ed8b56daa33b25bb81c3274591f94f13e975da6510ab336154
Python
4,059
125
from bonelab.util.aim_calibration_header import get_aim_density_equation import numpy as np import vtkbone import os from vtk.util.numpy_support import vtk_to_numpy from glob import glob from torch.utils.data import Dataset class HRpQCTAIMDataset(Dataset): def __init__(self, data_dir, data_pattern, transform=No...
c51bf970932e2680340b19c30ef6455d0fd30c131f88eae9f92c4b645a929d35
Python
4,066
115
# Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma # de Barcelona (UAB). # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """Verify that the Boost dependency used to build carla.libcarla is 1.90.0. ue5-dev builds Boost vi...
2ee8752bf35b715d38dbe46a7bdefae75ac2cfc74305a4a45156fc7133ab6cdc
Python
4,070
120
from __future__ import division import argparse import numpy as np import os import os.path as osp import sys sys.path.append(osp.join(sys.path[0], '..')) import time import torch import warnings warnings.filterwarnings("ignore", category=UserWarning) import models from mmcv import Config from mmdet import __version_...
3330342a05eb445bf74a34de8cea3f4ea29bc55a6f09d931d86263e307a68765
Python
4,070
123
import argparse import os import autosklearn.classification import joblib import medmnist import numpy as np from medmnist import INFO, Evaluator from medmnist.info import DEFAULT_ROOT def main(data_flag, time, input_root, output_root, run, model_path): time = time * 60 * 60 info = INFO[data_flag] ...
c96d118829f729f0fd44b48a7e4a8408f1fedf9771e041be90ce9a91acf04e47
Python
4,071
117
nC = 3 # number of channels / colors # nR = 5 nR = 1 # number of rounds (except the last dT labeling) roundRef = -1 # round containing the cell reference; use -1 for the last round cellch = 2 # channel containing cell reference img_size = (2048, 2048) sigma = 2 # estimate size of spots to detect # shif...
1c5d6d007d2caa3b4cd75e1f7e855880ed112067b2b868ab299bb2a39f07d73c
Python
4,072
117
from constants.enumerates import ElectricalAppliances WINDOWS = { 'NFED': { ElectricalAppliances.MICROWAVE: 50, ElectricalAppliances.KETTLE: 50, ElectricalAppliances.FRIDGE: 350, ElectricalAppliances.WASHING_MACHINE: 150, ElectricalAppliances.DISH_WASHER: 450, }, 'S...
2f3a8b5c1dd9447fe5034858d75b4a503bbc363f61e952f352771eed34b5b6ab
Python
4,072
106
import torch from ..builder import BBOX_SAMPLERS from ..transforms import bbox2roi from .base_sampler import BaseSampler @BBOX_SAMPLERS.register_module() class OHEMSampler(BaseSampler): r"""Online Hard Example Mining Sampler described in `Training Region-based Object Detectors with Online Hard Example Mining...
e233257006d177116a03ac858da8fab5ad52b59a8c62543d365f137da2715295
Python
4,072
141
# # A simple file for converting any XML file via an XSL stylesheet # # Author: Padraig Gleeson # # This file has been developed as part of the neuroConstruct project # This work has been funded by the Medical Research Council and Wellcome Trust # # import sys, os # This can be changed to any local file or a...
e95a0995ef460ebb81c5c3d9b388ea7db3bbf1005295aa2dca46d72b7e9997cd
Python
4,072
157
# -*- coding: utf-8 -*- """ Created on Mon Feb 14 15:11:48 2022 @author: N.V """ import numpy as np import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation import os # note that this must be executed before 'import numba' os.environ['NUMBA_DISABLE_INTEL_...
248d7e38d63acf86562cec6d4d3dde5fc88b63c9c4a3ba47a63fe03a4f59417b
Python
4,073
109
""" File: filter_technical_covariates.py Created: 2020/10/13 Last Changed: Author: M.Vochteloo Copyright (C) 2020 M.Vochteloo This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either...
8ca86ef8b56be8788c9ce8664a3dc9dd72bc0a76f27f3ef6201f62dd750739ad
Python
4,073
137
import os import numpy as np import torch from torchvision import transforms from torch.utils.data import DataLoader, Dataset classes = {'airplane' : 0, 'bathtub' : 1, 'bed': 2, 'bench': 3, 'bookshelf':4, 'bottle':5, 'bowl' : 6, 'car':7, 'chair' : 8, 'cone' : 9, 'cup':10, 'curtain':11 , 'desk':12, 'door':1...
7306c94b1d2cce32974a729ebec3e253045e5fccc095d36c9c050932b1d7a9b6
Python
4,074
123
""" (stability) 1) edge mask of original graph by some explainer 2) edge mask of perturbed graph by some explainer (faithfulness) 1) edge mask of original graph by some explainer 2) ground truth edge mask Compute importance score """ import random import torch from torch_geometric.data import Data from graphxai.uti...
8ce2100e75730bd7524ecf50e3cf1a4991a23167fa8a0cf6e6d25a671a7d991b
Python
4,075
126
# Copyright (c) 2015-present, Facebook, Inc. # All rights reserved. """ A script to run multinode training with submitit. """ import argparse import os import uuid from pathlib import Path import main as classification import submitit def parse_args(): classification_parser = classification.get_args_parser() ...
f999d4be30b9adc3cbad49f64ba87fb9addf5bfc6d93ab8dde425b100d6a74c3
Python
4,076
105
#%% 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 from data_settings import data_date, pairs_path import pymaid rm = pymaid.CatmaidInstance(url, token, name, password) from contools import Celltype, Celltype_Analyzer, P...
20b380c900886a7e1c8e8bcdaa559536278da2b22ca271dccc93879dc29aa267
Python
4,077
112
from collections import defaultdict import numpy as np import pandas as pd from sklearn.metrics import auc, roc_curve from sklearn.utils import resample from tabulate import tabulate from tqdm import tqdm white = "White" asian = "Asian" black = "Black" def get_boostrap_ci_for_split_race_experiment( targets_race...
057838e7d41dd8422d8f8806c7f8d35f76387b142e4bb43fa04c2557a2335d5c
Python
4,078
177
# %% [markdown] # ## import os import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from matplotlib.patches import Circle from mpl_toolkits.axes_grid1 import make_axes_locatable from mpl_toolkits.mplot3d.art3d import Poly3DCollection from scipy.integrate...
24ab61d7e4cb689b1e61b78a199021bd094fb63b4e6a27575b0acf5d367b4347
Python
4,078
134
import logging from typing import Tuple, Union import anndata import numba import numpy as np import pandas as pd import scipy.sparse as sp_sparse logger = logging.getLogger(__name__) def _compute_library_size( data: Union[sp_sparse.spmatrix, np.ndarray] ) -> Tuple[np.ndarray, np.ndarray]: sum_counts = data...
554b6b202d2b29ff5a6310b67f34553bdaabc05b61e9b64050e8a537387d2dfa
Python
4,078
138
""" StyleMapGAN Copyright (c) 2021-present NAVER Corp. This work is licensed under the Creative Commons Attribution-NonCommercial 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, U...
55fc78dbac64752c4153bd83f9aee7f5715a121e03e427b3fd1fa659e5614771
Python
4,078
119
# 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...
dfc442e32574550fae5f19847dccb5a865c2bbb4524e44b952137ed192a88bf6
Python
4,079
98
# 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...
99ab5735d571a7ef8557808c70d110bcd475e5a2485b85205bf9c6eef54a60f0
Python
4,080
83
import torch import torch.nn as nn import torch.nn.functional as F from core.models.base_models import Enc, FCAttention, get_xception_a from core.nn import _ConvBNReLU __all__ = ['DFANet'] class DFANet(nn.Module): def __init__(self, nclass, backbone='', aux=False, jpu=False, pretrained_base=False, **kwargs): ...
c6b4f01b307dc2d8c683e4ffdb05e257a389e5a0b0a0e08429b61c9d95899d2b
Python
4,080
112
from utils.ArticlesHandler import ArticlesHandler from utils import solve, embedding_matrix_2_kNN, get_rate, accuracy, precision, recall, f1_score from utils.Trainer_graph import TrainerGraph from utils import Config, accuracy_sentence_based import time import numpy as np # from utils.postprocessing.SelectLabelsPostpro...
4cbe5f71278bb81723438c720b634279cf107cb5e378b9bfd6c07033a1708d24
Python
4,083
113
import pandas as pd import pybedtools import logging, os def log_message(*message): """write message to logfile and stdout""" if message: for i in message: logging.info(i) print(i) def query_alias(aliases, gene): """check if gene is in list of aliases""" # check if va...
bce6b5b32deffd1cc6bf2b6bf47a33ac4cfacdf5d4193aa5603a295f8baefffe
Python
4,084
98
#!/usr/bin/env python # Copyright 2015 Minhua Wu # Apache 2.0 # convert acronyms in swbd dict to fisher convention # IBM to i._b._m. # BBC to b._b._c. # BBCs to b._b._c.s # BBC's to b._b._c.'s import argparse,re __author__ = 'Minhua Wu' parser = argparse.ArgumentParser(description='format acronyms to a._b._c.') p...
fd782d5a129822a20f604c7b8905a911f5d966bac85790c200edcabaea6279a9
Python
4,085
102
import jax.numpy as jnp import xarray as xr try: DPHOX_IMPORTED = True from dphox.device import Device from dphox.pattern import Pattern except ImportError: DPHOX_IMPORTED = False from ..fdfd import FDFD from ..typing import Callable, Iterable, List, Optional, Size, Union class Component: def __...
098b774a15763dc503b673a5be1ab75ea2b9e1e153aa70ad3ade92053e032887
Python
4,086
102
# 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...
93485b66e223ae6cf898cecd4d7cc2f65a4efca467ca2e65dc538154933b6e94
Python
4,086
108
import autograd.numpy as anp from .base import BaseModel # ODE Model constructor class # Used as constructor for SUR class ODEModel(BaseModel): def __init__(self, kinetics: bool = True): super(ODEModel, self).__init__(kinetics) # FSCV experiment parameters def initialize(self, bursts: list, f:...
659869484bd6911002636a49e0a269b85057878827680a88c5c6b41be3b86a2d
Python
4,088
122
# 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...
982e9a3cb2393044674faad7a10575c27366b282f7b836e2a0ca76a8b62f61bb
Python
4,088
122
# 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...
68288612efbab7287fe36dd32887fc2cc8ad413f58ba4f4b7330b361effc36cf
Python
4,090
120
import os import torch import numpy as np import pandas as pd from torch_geometric.data import Data from graphxai.utils import Explanation, edge_mask_from_node_mask, aggregate_explanations #def load_graphs(dir_path: str, smiles_df_path: str): def load_graphs(datapath: str): ''' Extracts datasets from a forma...
90b3f486c710ab4147a9e18bfe12a0351c0d5943a8dcff97bde6c1fef814cbec
Python
4,090
135
#%% import pandas as pd from pathlib import Path import numpy as np import matplotlib.pyplot as plt # %% csv_dir1 =Path("fit_csvs_short/") csv_dir2 =Path("fit_csvs_skipped_split/") #%% df_list=[] for csv_file in sorted(csv_dir1.glob("*/*.csv")): df_list.append(pd.read_csv(csv_file,index_col=0)) full_df1=pd.concat...
d525b0fbab6923e0be6db69ec46bbe0614f842b9022df017b9ffc1981e114f3c
Python
4,092
98
# basic imports import os import pickle import numpy as np # framework imports from cobel.agents.sfma import SFMAAgent from cobel.interfaces.gridworld import InterfaceGridworld from cobel.analysis.rl_monitoring.replay_monitors import ReplayMonitor def single_run(world: dict, mode: str = 'default', trials: int = 20, t...
f81f549e5eb6236629dc06aa04e23a8a00c584bdd35abc9949cdaf68e3544569
Python
4,092
102
import numpy as np import itertools import torch import torch.nn.functional as F def resample(x, res_scale, axis, output_shape=None): """A module for generic n-dimentional interpolation. For 1D and 2D inputs, the ``resample`` function uses PyTorch’s built-in spatial interpolators for efficiency, applying...
97861d0471f48fffa63236da2a7e821f91a3bde1f5e791ed511f514c9b30a653
Python
4,093
111
import base64 import logging from copy import deepcopy from itertools import product from random import shuffle from typing import Iterator, List, Set, Tuple from oaklib import BasicOntologyInterface from oaklib.datamodels.obograph import ( ExistentialRestrictionExpression, LogicalDefinitionAxiom, ) from oakli...
fa2aae641f116063172a40aa7240da0fa294d15db6e65ac204da92f4d14de580
Python
4,096
99
import cv2 import torch import fractions from PIL import Image import torch.nn.functional as F from torchvision import transforms from models.models import create_model from options.test_options import TestOptions from insightface_func.face_detect_crop_multi import Face_detect_crop from util.videoswap_multispecific im...
6e96f58afefe9c99189215e7e5982977534de97441b62a3b29dfa2efcda91db6
Python
4,098
111
#!/usr/bin/env python3 # # Copyright (c) 2018 Hyeshik Chang # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modi...
9a6f2f08246fde0d799959052aed89fd78a94fc7f55c1450dd81d7659efdb98f
Python
4,099
132
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class EDANet(nn.Module): def __init__(self, classes=2, aux=True): super(EDANet, self).__init__() self.layers = nn.ModuleList() self.dilation1 = [1, 1, 1, 2, 2] self.dilation2 = [...
2340eb5b06d74097ca2f7a1650972be0e6f96c35c4b03cc5d648949bb470cc63
Python
4,100
115
''' @author: Mahbub Ul Alam (mahbub@dsv.su.se) @version: 1.0+ @copyright: Copyright (c) Mahbub Ul Alam (mahbub@dsv.su.se) @license : MIT License ''' '''@file early_sepsis_detector.py run this file to go through the complete neural net training, testing and evaluating procedures, look at the 'early_sepsis_detector_con...
80ce73938f821dc6f03276f6f7c9d9cb6a0dd88a935dfe2f189bf9d60e79416e
Python
4,100
113
# 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...
3dc5e35a26ee0967285857826cd4441206075bd24c8d52669c4975403b2948a7
Python
4,102
105
''' Track anterior and posterior ends. The first frame of each trial is matched to subsequent frames. Remember that "anterior" and "posterior" refer to two unidentified ends here; they could be posterior and anterior. Results are saved in um, measured along the main axis and the normal axis. ''' import os import numpy ...
22c47060c1acb9c67f3acaa608ad7ada3514cbbbd24d2ff77b419ac9797d723b
Python
4,104
94
# 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...
0890fdb234426a4776f86e9c7e2e14585fd1900fce21d1a18e26f3f575abc744
Python
4,105
58
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # NO CHECKED-IN PROTOBUF GENCODE # source: nre/grpc/protos/common.proto # Protobuf Python Version: 5.29.0 """Generated protocol buffer code.""" from google.protobuf import descriptor as _descriptor from google.protobuf import descriptor...
32ed825b12059bd4686b6dc5979a2feb3bbd59c5488f86075467f5c87a9e6d13
Python
4,105
110
import os import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.ticker as mtick from matplotlib import gridspec import matplotlib.colors as colors import seaborn as sns from scipy import stats sns.set_style("ticks") hfont = {'fontname':'Myriad Pro'} from matplotlib import colors # de...
64e3fe65e3d7b0d68a9d055d6b6e6abf773144849b33ab5f62bfe48f8da50462
Python
4,108
91
# 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...
3681d9a21f10bf7a275290f15568d55220d9c9ff39cab8cc09f69d97e8f17df1
Python
4,109
114
import mne import numpy as np from mne.viz import plot_epochs_image, plot_compare_evokeds from scipy.stats import sem def _standard_error(x): """ Compute confidence interval bands based on standard error. Parameters ---------- x : array of shape (n_observations, n_times) The signal obser...
db436e8dfcc15d5bdfd6276a028ea776facc7e0bf8fd444a97511ab67a7bb7a0
Python
4,109
162
import numpy as np import torch import torch.nn as nn from torch.utils.data import Dataset, DataLoader import torch.nn.functional as F import torch.optim as optim torch.backends.cudnn.enabled = False torch.manual_seed(42) class TDSNet(nn.Module): def __init__(self): super(TDSNet, self).__init__() self...
4d6c801ade42714063ab00ad867cd6ef43a3fbaa0f76752fecd75eeb16e03150
Python
4,110
111
""" Copyright 2020 - by Jerome Tubiana (jertubiana@gmail.com) All rights reserved Permission is granted for anyone to copy, use, or modify this software for any uncommercial purposes, provided this copyright notice is retained, and note is made of any changes that have been made. This softwar...
f195d67a670f499c848b5c6b893bfd4f821440ffe66809e13a92dd03189f2238
Python
4,112
107
# 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...
bb42277853ead52f6463108e33a3d8045f6a8612d9cbaa22986047bf42590ce8
Python
4,114
122
''' Figure 7. Fit to the example. ''' from brian2 import * import yaml from file_management import * from pylab import * import matplotlib.font_manager as fm import os from fitting import * from plotting import * from matplotlib import gridspec fontprops = fm.FontProperties(size=18) width, height = 5, 7 t1 = -50*ms ...
8516971832ee29777cc124a571dbba0cb88d2cfbd05bc0eff67056841e3f93ab
Python
4,116
127
import numpy as np from tqdm import tqdm import scipy.io from dipy.io.stateful_tractogram import StatefulTractogram, Space import nibabel as nib from AFQ.data.utils import BUNDLE_MAT_2_PYTHON # This dictionary is used to convert the names of the bundles # from old pyAFQ bundle names to the new pyAFQ bundle names. ...
25a1b5b52349c989a04e6bfe4f554fff1f5dbcb4acd2e2142029da628220b2ce
Python
4,117
146
''' This script was used to create the test QSAR models in this folder. Data is QSPRpred tutorial data, which can be downloaded from the following link: https://1drv.ms/u/s!AtzWqu0inkjX3QRxXOkTFNv7IV7u?e=PPj0O2 ''' import os import pandas as pd from qsprpred.data import QSPRDataset from qsprpred.data.descriptors.finge...
8d78ecb055fbcc85a5e9f6652ade2a6b03161dab96f01a656a3b376d4a9bae4c
Python
4,117
120
from __future__ import absolute_import from __future__ import division from __future__ import print_function import multiprocessing import numpy as np import tensorflow as tf from tflib.data.dataset import batch_dataset, Dataset _N_CPU = multiprocessing.cpu_count() def memory_data_batch_dataset(memory_data_dict,...
6b0c0a04633aa2bff9b9053ee10f6496ea650c40d046a6a1abdf99cd0feb81ab
Python
4,118
107
# 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...
85526bba3d4f3b48fc99897efbebf0b63cb89f415f99a19f35c0225683f6585e
Python
4,118
131
from __future__ import division from __future__ import print_function from __future__ import absolute_import import os import models import traceback import numpy as np import tflib as tl import tensorflow as tf os.environ['CUDA_VISIBLE_DEVICES'] = '0' """ param """ epoch_ = 25 batch_size = 64 lr = 0.0002 gpu_id = 0...