sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
0ab5cb71712976520398d8d3b8bfe07bbb705251073ac546c6c5c7adaf48749d
Python
3,530
94
""" EEG speech envelope TRF ======================= Analyze continuous speech data from the mTRF dataset [1]_: use the boosting algorithm for estimating temporal response functions (TRFs) to the acoustic envelope. """ # Author: Christian Brodbeck <christianbrodbeck@nyu.edu> # sphinx_gallery_thumbnail_number = 4 import...
2393ce3e894759db7264bf8392572eaf5a3e670bd1a289678705801f04d4085d
Python
3,530
109
""" Convert gtex gene ids to genesymbols, normalize the expression, and write the resulting dataframe to disk """ import argparse import numpy as np import pandas as pd def parse_gtex_file(file_path: str) -> pd.DataFrame: """ Read the expression data from a GTEx file Arguments --------- file_pa...
2e37f47f165b667e7ab115a9195ee7e1064d22209d3613a3c57c07e375a39964
Python
3,530
188
# Generic import yaml import time import torch import pickle import pprint import numpy as np import pandas as pd import matplotlib.pyplot as plt # Libraries from pathlib import Path # Own from ls2d.utils import _load_pickle from ls2d.utils import _dump_pickle # ------------------ # Load config # ------------------ ...
d8baba34ed9b97ed8ca46a09d1502389d588507765e9de98ba656cbe67886961
Python
3,530
87
# 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...
97f9a4053e614b1b46f7ae67e618579864e31f514203bb1c9572f70f1b81f4e8
Python
3,534
121
# %% [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 mpl_toolkits.mplot3d.art3d import Poly3DCollection from scipy.integrate import tplquad from scipy.stats import gaussian_kde import pymaid from src.data import load...
9d382bd4451fbffbcc386a6b80f4fbe14203facd6f89c66ac3e94de3f8b27aa7
Python
3,534
125
# %% [markdown] # # from src.graph import MetaGraph, preprocess from src.data import load_metagraph import numpy as np import pandas as pd import seaborn as sns import matplotlib.pyplot as plt import networkx as nx def get_edges(adj): edgemat = np.empty((len(adj), 2 * len(adj))) for i in range(len(adj)): ...
03936bf1d2f10792b04c9e5e1f2ac9b5e1fc9ba18a0423de2e96db5511bf353e
Python
3,535
103
# python 3.7 """Contains the base class for generator in a GAN model. This class is derived from the `BaseModule` class defined in `base_module.py`. """ import numpy as np from .base_module import BaseModule __all__ = ['BaseGenerator'] class BaseGenerator(BaseModule): """Base class for generator used in GAN var...
76f21d6db976693156c207741da82812c7b57e4067b3c8b4c73481212d05a91f
Python
3,536
105
import json from utils import full_target_file_pipeline FASTA_PATH = "/mnt/datasets/DeepCT/male.hg19.fasta" ALL_TARGETS_PATH = "/mnt/datasets/DeepCT/all_features/sorted_deepsea_data.bed" def create_mini_fasta(fasta_path, mini_fasta_path, mini_fasta_counts_path): """ Sample some lines from `fasta_path` to cr...
d273653d77f906422fb5669dc1d100b94a98ca8faacca3c18a310a5fa67d132b
Python
3,536
103
import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms # Device configuration device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Hyper-parameters sequence_length = 28 input_size = 28 hidden_size = 128 num_layers = 2 num_classes = 10 batch_size = 100 nu...
56c4fdf1b64ea5eb63e806f89da2301bc84cc4e8702455aaa01b52fb181fa494
Python
3,537
106
import os import time import logging import numpy as np from siVAE import FeatureImportance as FI def residual_analysis(self, y_reconstruct, y_test, min_PVE = 0, take_mean = False, verbose = False, save_PVE = False): """ Calculate PVE and RE of the true and reconstructed numpy array Return [RE...
6fdf586e8e00ec4277b5b6b7141d949457b875d5ab646676822deab0b2ff9e8a
Python
3,537
139
"""The functions used in the program search. This library implements the functions that will be used in the program search. Having a shared library of functions will make it easier to share the discovered algorithms between different tasks. For example, if we want to evaluate one algorithm on both language and vision ...
bb03b17f3f676d16e39077db9a7f5a72a5d3bae85d429ddd14708aaab5399ad4
Python
3,537
117
import os from skimage import io, transform import torch import torchvision from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F from torch.utils.data import Dataset, DataLoader from torchvision import transforms#, utils # import torch.optim as optim import numpy as np from PIL imp...
cb9fee74fd9918f6aea45f0d9997c24887b6a12ea01063fb01b667d32fd5c2a6
Python
3,538
99
import logging import os import zipfile import anndata import numpy as np import pandas as pd from scvi.data import setup_anndata from scvi.data._built_in_data._download import _download logger = logging.getLogger(__name__) def _load_seqfishplus( save_path: str = "data/", tissue_region: str = "subventricul...
73737f3b921cc01a6e974aa44b2c211eb9cb079b54e23f6f0f3a7d5839d15eac
Python
3,540
111
# -*- coding: utf-8 -*- import pathlib import queue, subprocess, threading, io, os, sys import time class GpuThread: def __init__(self, gpu, pool): self.gpu = gpu self.pool = pool self.queue = queue.Queue() self.thread = threading.Thread(target=self.run) self.log = io.Strin...
48564d8d2d3fda118a92bd98ebe0ca123160adcbe902079a57862186b504d98c
Python
3,541
80
# python 3.6 """Revised from Inverts given images to latent codes with In-Domain GAN Inversion.""" import os import argparse from utils.inverter import StyleGANInverter from utils.visualizer import save_image, load_image, resize_image def parse_args(): """Parses arguments.""" parser = argparse.ArgumentParser() ...
82f533b90381d16d3dd2227067804bd4f3961cfaa27aa477ceb941f94145dd11
Python
3,541
84
"""Phase 3d regression tests: dual-DAN model and latent inhibition. These tests pin down the headline behaviour: - Dual model acquires CS+ on a control (un-pre-exposed) schedule - Dual model shows latent inhibition: pre-exposed CS+ acquires slower - Pure RPE does NOT show latent inhibition (the structural predic...
2b6b8af61afb76e400b4f7c206075ff167bd64c55580e72d2624768a3d2401c8
Python
3,544
112
''' Figure 7. Zoom on action potential. Ionic current in the example, based on passive subtraction. Estimation of calcium accumulation. ''' from brian2 import * from brian2.units.constants import faraday_constant as F import yaml from file_management import * from pylab import * import matplotlib.font_manager as fm imp...
baa3a8b32def2c8c7cbe2d481148043e6301bef4ba6ee344856a68505b3b723a
Python
3,546
86
import numpy as np import matplotlib.pyplot as plt from scipy.signal import hilbert, welch class WelchPSD(): def __init__(self, signal, fs=25000, nperseg=1024, scaling="density", unit="microV", tokens={}): self.fs = fs self.nperseg = nperseg self.scaling = scaling self.unit = unit ...
aec106ad98ef74c0544865a5eb14a58d5822aacb41c934e965d5bb3e4c55709b
Python
3,549
110
""" Kuramoto-type model. - Sinusoidal coupling - accelerated with numba """ import numpy as np import math import numba def njit_wrapper(use_numba, *args, **kwargs): ''' Wrapper for numba njit decorator If :param use_numba: is True -> will use @njit with given args and kwargs. ...
dbc2400530fc60c1fe4c71f645e64169461822992b439aaea87a18b83df93b64
Python
3,549
80
#!/usr/bin/env python # Copyright 2014 Johns Hopkins University (Authors: Daniel Povey, Vijayaditya Peddinti). Apache 2.0. # creates a segments file in the provided data directory # into uniform segments with specified window and overlap from __future__ import division import imp, sys, argparse, os, math, subproces...
069f52003a2ea9126fc859b9107b965ebe96eb913b50d7ad07fd47790bd45cd7
Python
3,550
94
"""This file is for back-of-the-envelope calculations / figures based on them.""" import numpy as np def binary_svd_depth_size(n, k, interport_distance=25, device_length=200, loss_db: float = 0.3): """Binary SVD architecture depth and size. Args: n: Number of inputs. k: Number of outputs (ge...
5983df2676d1ca7612dbf08ac67de75cd2309df596e5823944415da12c7a5c6f
Python
3,551
100
r"""Modified from https://github.com/facebookresearch/detectron2/blob/master/detectron2/layers/wrappers.py # noqa: E501 Wrap some nn modules to support empty tensor input. Currently, these wrappers are mainly used in mask heads like fcn_mask_head and maskiou_heads since mask heads are trained on only positive RoIs. "...
89559f406de2847a1f447fb76bf2a27fe2ce4af8df3c61327d68d5101285f3ec
Python
3,551
110
import numpy as np import torch from torch import nn from torch.nn import functional as F from torchvision import transforms class ToOneHot(object): """ Convert the input PIL image to a one-hot torch tensor """ def __init__(self, n_classes=None): self.n_classes = n_classes def onehot_initialization(self, a): ...
fdc35a18af7d59039782b79422d8b8393dc3393c1b2c58a42914277f7abfddc8
Python
3,551
83
#!/usr/bin/env python3 # Copyright 2020 Yuri Khokhlov, Ivan Medennikov (STC-innovations Ltd) # Apache 2.0. """This script converts JSON to VAD alignment. Single-speaker speech is treated as 1, whereas both silence and overlapped speech as 0. This can be used for excluding overlapping regions from i-vectors estimati...
07776f1b3f78f7b32ee36b2436df1cfc4c84707b69ab3e9c2d783e121ec2c4d5
Python
3,552
98
import numpy as np def linear_(x, params): a, b = params return a*x+b def sigmoid(x, L, x0, k, b): return L/(1+np.exp(-k*(x-x0)))+b def sigmoid_fit(x, y): from scipy.optimize import curve_fit ymin = np.percentile(y, 5) ymax = np.percentile(y, 95) x0 = np.percentile(x, 70) p0 = [yma...
4e69a25f88c7830525e0ef7405fb8c3523df5f8ac5e4c9da1048e5a70e3335f0
Python
3,555
116
''' Define the Layers ''' import math import torch import torch.nn as nn import numpy as np def pad_mask(seq, pad_idx=0): return seq == pad_idx def tri_mask(seq, diag=1): ''' For masking out the subsequent info. ''' sz_b, len_s = seq.size() masks = torch.ones((len_s, len_s)).triu(diagonal=diag) m...
050e3e81c4777caf05e1169b8e5536d50f251f46b9e10be528728e1c79908c89
Python
3,556
119
from collections import namedtuple import torch from torch.nn import Conv2d, BatchNorm2d, PReLU, ReLU, Sigmoid, MaxPool2d, AdaptiveAvgPool2d, Sequential, Module """ ArcFace implementation from [TreB1eN](https://github.com/TreB1eN/InsightFace_Pytorch) """ class Flatten(Module): def forward(self, input): return inp...
093bbc8a99817390baca9829fdca1d97bc68705cc777db5ccd1092b0dedb8cec
Python
3,556
94
import numpy as np import torch import functools class CORE_Dataset(torch.utils.data.Dataset): 'Characterizes a dataset for PyTorch' def __init__(self, data, tokenizer, use_ratio = 1, which_label = 'void_fraction'): label_dict = { 'void_fraction':2, 'pld':3, ...
bea66e23aefc7e62c2d06c40730efe0ab9bfe2c9653dc51ce61e57fb59a3c0ef
Python
3,556
113
import logging from typing import Any, Dict, List, Optional, Tuple import numpy as np import pandas as pd import pytorch_lightning as pl import torch import torch.nn as nn from FrEIA.framework import ReversibleSequential from FrEIA.modules import AllInOneBlock from hydra.utils import instantiate from src.util.util imp...
8b009f53638c3daa05bde9a5ac08cc55d2dab4abe8b25caa7454abc3b186078a
Python
3,557
89
import torch import torch.nn as nn from .conv_ws import CONV_LAYERS,ConvAWS2d #from mmcv.cnn.utils import constant_init #from .registry import CONV_LAYERS import torch.nn.functional as F #from mmcv.utils import TORCH_VERSION #from torch.autograd import Variable class Attention(nn.Module): def __init__(self,...
3cb24c8db42a4855de305dd5e5a5b121193253b39e88990fef32861ae9471903
Python
3,560
63
import os # Heuristics created by Vincent for Abbas dataset sample6. # 27th Nov. 2019 # updated 23th Jan. 2020 def create_key(template, outtype=('nii.gz',), annotation_classes=None): if template is None or not template: raise ValueError('Template must be a valid format string') return template, outtype,...
89871e1b20df677975fcde016a8e39b50d8d84f2061b582cfb2f5905648bdc36
Python
3,561
99
import math import unittest from types import SimpleNamespace import numpy as np try: import carla except ImportError: # the wheel is optional for the pure-python tests carla = None from alpamayo_coordinates import ( alpamayo_points_to_carla_local, carla_rotation_matrix, history_to_alpamayo, ) ...
8a3665bcb587c069899af9581b68cfb78ebea7c43bb2708cfdc6fcc79208dce1
Python
3,561
120
from __future__ import print_function, absolute_import import os import os.path import torch import torch.utils.data as data import torchvision import torchvision.transforms.functional as TF from dataloader.data_utils import * def generate_pair_images(root, gap=6, win_gap = 7): images = [] root = os.path...
517ff6a8d69edd542bcfd8af798b8f52783435073e0eb7b249189203599cb612
Python
3,562
94
# 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...
2c306433088756f3a314025f5f10047691459bd6c28c06b869fd2ec1e65e4e41
Python
3,564
80
"""Phase 3c regression tests: extinction behaviour. Documents the complementary failure modes of RPE and the Bayesian-observer AIF formulation: - RPE extinguishes correctly under signed weights (allow_negative_weights=True). - AIF (perceptual-Bayesian) cannot extinguish; this is informative, not a bug. """ import num...
eea7b16712566225d4608b9c0f7ebbd4524e8012d1f1aa276aafb82122ea7707
Python
3,564
112
# 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...
337f1ccbb7d63abab71eed8c4811fee97315bd3ba646885b6569cbb62b46f7d0
Python
3,566
101
import torch.nn as nn from mmcv.cnn import constant_init, normal_init from mmdet.models.registry import BACKBONES from .derive_blocks import derive_blocks from .operations import Conv1_1, conv_dw from tools.apis.param_remap import remap_for_paramadapt @BACKBONES.register_module class FNA_SSDLite(nn.Module): ext...
73863ef59efcf34ed50d8cd0224b4b68487946449722900ee3e5925e987567a3
Python
3,566
132
import corticostriatal as cs from matplotlib import pyplot as plt from matplotlib import patches as mpatches from matplotlib import lines as mlines from matplotlib.legend_handler import HandlerLine2D, HandlerTuple from jax.random import PRNGKey,split,uniform from jax.ops import index,index_update from jax import numpy ...
9b752981195cbd0aa4802e1f6277727ea778a7b1e0905b941c3a0c7751ab7235
Python
3,566
99
# 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...
b6e606e97d067ee2bfdc642500d73d37c1dfe6b6a6c981b73d99470d7b621ef3
Python
3,566
81
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. from collections import OrderedDict import logging import torch from maskrcnn_benchmark.utils.imports import import_file def align_and_update_state_dicts(model_state_dict, loaded_state_dict, silent=False): """ Strategy: suppose that the...
37c8a0277bd2964ae71ebebfe2e8f9186a2bec1a68885f895f9dca9cb8f2ca04
Python
3,567
92
''' @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...
c01abbba0955c9c2074b0efc119e84f132969727fb6c21c07b649214d13dbd74
Python
3,567
92
# 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...
1caba972be41cf5b282d7d7129b71a934cf6c3ebea885ebf946136ed58bb4a8e
Python
3,568
116
import numpy as np import pandas as pd def exp_smoother( sequence, da, nsyllables=10, baseline_temperature=0.1, entropy_tau=10, usage_tau=200.0, entropy_scaling=0.3, usage_scaling=0.3, eps=1e-10, log_variables=False, ): from rl_analysis.photometry.decoding.util import stab...
5011667a20ec260e614b7e566987b5912fc93db79b869ba096f3d2cf9aaae081
Python
3,568
92
# python 3.7 """Contains the base class for encoder in a GAN model. In addition to the two-player game between generator and discriminator in GANs, some work introduce an extra encoder to facilitate real image inference. The encoder can be view as the reverse of the generator, which projects a given image back to the ...
7aa45607d50e25abf8dc011ecf7f75f36bb36c1cd40a5042d74ddc8acdf65f2c
Python
3,569
86
''' @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...
309822655c099995026edfccd939c8857d7ddaa69a4fc1d0d2592aa9f92a18a5
Python
3,570
97
"""Tests for `navis.drop_internals` - the wrapper, not the repair. The repair itself lives in navis-fastcore and is tested there. What navis adds is the bookkeeping around it, and two pieces of that are easy to get wrong. fastcore reports "I kept surface I could not vouch for" with `warnings.warn` and a `stacklevel` ...
4ecfda2a32b39c5f89f66c5d021deaa950d9e05631f418a0688b7ce431567daa
Python
3,571
111
# -*- coding: utf-8 -*- # File : test_sync_batchnorm.py # Author : Jiayuan Mao # Email : maojiayuan@gmail.com # Date : 27/01/2018 # # This file is part of Synchronized-BatchNorm-PyTorch. import unittest import torch import torch.nn as nn from torch.autograd import Variable from sync_batchnorm import Synchroniz...
96017766629be45139d6dcb6e2765eed675bb16c2b08885b46d7b9331962b918
Python
3,571
99
import gurobipy as gp import numpy as np from mip.mip_nn import MIP_NN from globals import EPSILON, CONT, GUROBI_ENV, LOG class MAX_M(MIP_NN): def __init__(self, data, architecture, bound, reg, fair): model = gp.Model("Gurobi_NN", env=GUROBI_ENV) if not LOG: model.setParam("OutputFlag", 0) self.N...
2d7d02e4e6db56a0155434b8b34ff2fc0c836e6697a52a70c6c21cc2a8994e70
Python
3,572
110
#! /bin/env/python from rdkit import Chem ##### Sanifix 4 by James Davidson ###### """ sanifix4.py Contribution from James Davidson """ def _FragIndicesToMol(oMol, indices): em = Chem.rdchem.EditableMol(Chem.rdchem.Mol()) newIndices = {} for i, idx in enumerate(indices): em.Add...
fa31789edf85005c2767966af7fea37cf34906a74f2bb7af62fe6e338fa8f054
Python
3,573
124
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
9066e3cab2e00b7f68472dffde838abdfa02252210dad15a2ca1a3f9df62f75f
Python
3,574
144
from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf import os def create_op(func, **placeholders): op = func(**placeholders) def f(**kwargs): feed_dict = {} for argname, argvalue in kwargs.items(): p...
ac3c1c81d4d11e0d76c3d3fbecc4d3a07c6c5e19a5bd8c66a503526c1923a0fb
Python
3,574
92
#!/usr/bin/env python3 import argparse import BTlib import glob import os from collections import defaultdict import pandas from pathlib import Path #################################### ### Parse command-line arguments ### parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser...
bbc3fdb17560b88d3b96890ee76375da78474158edbb83984c8c1463ca2bd36b
Python
3,574
125
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
e57c9a1b4fbfa5795e8f057f9d09f17244cc187d7c77fc64c2ca1afa9dbe9924
Python
3,574
125
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
662fbb74549198330c0c530c0448bac524a19f90218c70131b72781f9d36aafa
Python
3,575
90
# 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...
abd5f4c88780cf0f4dc2a4e539715e27d9971bf5c37bad9062eaa3cf93a41f98
Python
3,577
104
# 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...
c36993099b3f32446536a08517aead9e0f2d2a7fd525aec1859ccd000910e4a3
Python
3,577
120
import argparse import os.path as op from glob import glob import pandas as pd def _get_parser(): parser = argparse.ArgumentParser(description="Get subjects to download") parser.add_argument( "--dset", dest="dset", required=True, help="Path to BIDS directory", ) parser...
12275d4c8ec3fb09821e25b04feaac818b7f1f21288afde3ccdedc50fc29603e
Python
3,580
97
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # Set up custom environment before nearly anything else is imported # NOTE: this should be the first import (no not reorder) from maskrcnn_benchmark.utils.env import setup_environment # noqa F401 isort:skip import argparse import os import torch...
1db617c824ed58548a172921f68751de5da8b484a98813578332fd15ff4a125e
Python
3,582
99
import argparse import os import pandas as pd import numpy as np from rdkit import Chem from rdkit.Chem import MolFromSmiles, MolToSmiles, AllChem, Descriptors from rdkit import DataStructs from rdkit.Chem import Descriptors import chemprop from chemprop.args import TrainArgs, PredictArgs from chemprop.train import cr...
29374799b285b13b3ab8be2e800640df92b4c47c8f70e1f1a58feef848cc3ca5
Python
3,582
94
# 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...
9b0eddfd204f157dead7d5ccf31306f2ba57c8c008a726e3b13523414ba844b4
Python
3,582
90
# Code adapted from here: # https://github.com/joe3141592/PyTorch-CAM import numpy as np import torch import matplotlib.pyplot as plt import skimage.transform from aug_accuracy import InputError class ActivationMap: def __init__(self, model): '''The initializer needs to find the final layer before avgpool...
d2bd169f054189b37a5ff62fe27b6d675d30423ea0582bb257e047033af06932
Python
3,583
121
import logging from typing import Union import numpy as np import torch from rich.console import Console from rich.logging import RichHandler from ._compat import Literal logger = logging.getLogger(__name__) scvi_logger = logging.getLogger("scvi") class ScviConfig: """ Config manager for scvi-tools. E...
f3452f15848773c60b38034f77ad488c425802c75cdcdc2168e74eee477e6c02
Python
3,583
123
from setuptools import setup, Extension from setuptools.command.build_ext import build_ext import sys import setuptools import os __version__ = '1.3.1' def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() class GetPybindInclude(object): """Helper class to determine the pybind...
fb7da6534cf7c93344363e8bb29f2ac655d8ca32f5eed5c32f21481202ca08dd
Python
3,583
108
#!/usr/bin/env python """ TL info printer """ # 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>. # ====================================================...
2687c335aea9e3bbc776cf747857cec6bdefa475b00753bd473d1e9f3e6f5c81
Python
3,588
109
__author__ = "Jianfeng Sun" __version__ = "v1.0" __copyright__ = "Copyright 2023" __license__ = "GPL v3.0" __email__ = "jianfeng.sunmt@gmail.com" __maintainer__ = "Jianfeng Sun" import time class Single: """It offers methods to perform a sliding window op for each of central residue pairs for a given sequ...
3326f5994e5486d3f21f5986c7579c818ddb6600e4323012d32bc6c426ba7e73
Python
3,590
124
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
500ebb1a27d06533940852f2779d5ffb72f8e8bd54c24917bb530d37948c822a
Python
3,590
90
import argparse import gzip parser = argparse.ArgumentParser(description='Merge MetaBrain with eQTLs from eqtlGen et al.') parser.add_argument('eqtlGen_eqtls', help='eQTLs from eqtlGen') parser.add_argument('name', help='name that is given in output columns') parser.add_argument('MetaBrain_eqtls', help='eQTLs from Meta...
9ab4f7714d18e4f5b15db6258fb554e03cd2d3bb4499d1ba0808902754c85d75
Python
3,591
125
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
e6d037a35223220fb4b1305c9e03a9e8bf150ddaed283768a7dfa7fab621d8a7
Python
3,591
104
import torch from sklearn import metrics import numpy as np def accuracy(output, target): with torch.no_grad(): pred = torch.argmax(output, dim=1) assert pred.shape[0] == len(target) correct = 0 correct += torch.sum(pred == target).item() return correct / len(target) def prec...
bdf7590f7d48b97836a9a985aa099dbb432a386a8d19a034bd1fa86958a18c21
Python
3,592
114
"""Tools for importing data through mne. .. autosummary:: :toctree: generated events epochs mne_epochs add_epochs add_mne_epochs epochs_ndvar evoked_ndvar sensor_dim stc_ndvar forward_operator inverse_operator DatasetSTCLoader .. currentmodule:: eelbrain Managing events with ...
8d1b465391630d294a164bd64bbf70a4430c79d9dab0c35d43eac19dbba8a228
Python
3,593
84
import synapseclient import getpass import synapseutils import glob user = input("Synapse username:") password = getpass.getpass('Synapse password:') syn = synapseclient.Synapse() syn.login(user,password) samples_processed = {'featureCounts':set([]), 'kallisto':set([]), 'rMats':set([])} studies = ['MayoTCX','MayoCBE'...
a7f0d189b176d27cda89f5c38c7dcc4f6bb1901c940aa08223e72d09f5821487
Python
3,593
85
import torch import torch.nn as nn import torchvision.models as models from torch.nn.utils.rnn import pack_padded_sequence from torch.autograd import Variable from recurrent_rsa.rsa_utils.build_vocab import Vocabulary import pickle class EncoderCNN(nn.Module): def __init__(self, embed_size): """Load the p...
818150f2ea9741277684d6e6d374fc145381c9d865c84a3fc29de33e7e13a433
Python
3,595
125
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
8919f702e2a534621ea17efa117091f9029c20df5adb87c42e437211ba7fa2f1
Python
3,595
118
import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from slideflow.clam.models.model_mil import MIL_fc, MIL_fc_mc from slideflow.clam.models.model_clam import CLAM_SB, CLAM_MB import pdb import os import pandas as pd from slideflow.clam.utils import * from slideflow.clam.utils.core_ut...
bdc2128428522aacb40beeaeeb8499a1d4fedc8c5eba32a9f58ba00f9b1bd374
Python
3,595
125
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
d29fc3fd54602130e60d3ee3d7246a026a42b8f70a47a3b3cad9a6e15ff6cb89
Python
3,595
125
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
6c3d55b26e2f4c3445edb00f50540d606a8a83cf153098cfad359d3988152121
Python
3,596
145
# -*- coding: utf-8 -*- """ Created on Tue Jul 20 18:47:06 2021 @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_...
1ba37cf9a35b32b2fb77befb595d8e6031c651a1efc60f70463294e3fbd6471c
Python
3,597
95
#!/usr/bin/env python3 # # Copyright (c) 2018 Institute for Basic Science # # 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 u...
0e7070bbdeb8e3394e7505a58f4f6be8a3beffea854070e085ffeac1eaca7c9c
Python
3,598
145
# -*- coding: utf-8 -*- """ Created on Tue Jul 20 18:47:06 2021 @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_...
d1fa01a10450f90515fceb7df4e4e8b98dc3ea4b503292b9868090077c400a0b
Python
3,600
102
import torch import torch.nn as nn import torchvision import torchvision.transforms as transforms # Device configuration device = torch.device('cuda' if torch.cuda.is_available() else 'cpu') # Hyper-parameters sequence_length = 28 input_size = 28 hidden_size = 128 num_layers = 2 num_classes = 10 batch_size = 100 nu...
33d50323e463ba80d672496bfe7de5f25a2fc1042124f4981c1264d855a0f354
Python
3,601
125
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
7b6cfef99bc416539c17f464e324dcb47adda49618c02cbfd5a5860b8da56949
Python
3,601
125
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
b08d639048dd658a31f453d1b6338cdad7493ecd4dafeb61b606e6c4b6a8f9d7
Python
3,601
129
# model settings model = dict( type='RetinaNet', pretrained=dict( use_load=True, load_path='./seed_mbv2.pt', seed_num_layers=[1, 1, 2, 3, 4, 3, 3, 1, 1] # mbv2 ), backbone=dict( type='FNA_Retinanet', net_config="""[[32, 16], ['k3_e1'], 1]| [[16, 24], ['k3_e6',...
e027177f48bd828ad6ebb5103a9c97db7b52e67f038adb8c0180d815d807dea6
Python
3,601
125
import csv import os import sys def feature_to_index(cases, column_nb, offset=0): feature_set = set() for case in cases: if len(case) > column_nb: feature_set.add(case[column_nb]) l = list(feature_set) index = {} i = 0 for f in l: if f != '': index[f] = i...
7f81f4a522175382dcb21dbe69aab24f1c9d36e35a54ca026803e978e57a4e85
Python
3,603
84
# 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...
d557caf0a727a24e9440345a1bc961628cc7b1f02f5342e27cd057485932c116
Python
3,603
101
from dataclasses import dataclass from typing import List from lark import Lark, Transformer from deprecated.classic import deprecated from oaklib.datamodels.search_datamodel import SearchBaseConfiguration, SearchProperty, SearchTermSyntax from oaklib.datamodels.vocabulary import LABEL_PREDICATE, SYNONYM_PREDICATES f...
e93b48fb1c951667ad7e9b1ab4a7f2e6edb96fa489516bf275159cb579f201c6
Python
3,603
96
""" this code establishes the real-time port b/t FDTD and Python to enable state and reward passes for optimization of photonic crystals by RL. NOEL, Renjie Li, December 2021 The simulation file used here is taken directly from Loncar's paper: Deterministic design of wavelength scale, ultra-high Q photo...
bbfaf2004c74c76a2ef0857bfd10a112934ee85fbdffe1ee824444a71551c9cd
Python
3,604
101
import pandas as pd import matplotlib.pyplot as plt import numpy as np import seaborn as sns from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import mean_absolute_error, mean_squared_error, mean_absolute_error from sklearn.model_selection import cross_val_score from sklearn.model_selection impor...
cb8853f8d0bb411de2b6730c710cc268562f21e81c0607eb5d56b291c574663c
Python
3,604
110
import torch import torch.nn as nn import torch.nn.functional as F class TextEncoder(nn.Module): def __init__(self, channels, kernel_size, depth, n_symbols): super().__init__() self.embedding = nn.Embedding(n_symbols, channels) padding = (kernel_size - 1) // 2 self.cnn = list() ...
dedd7f840228794b39789e9dee897013963a2591551d3b15c11f33c65134c215
Python
3,604
96
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import os import sys sys.path.insert(0, os.path.abspath('../..')) sys.path.insert(0, os.path.abspath('../../..')) sy...
53df5e41506c455697b6b532ef113ad3aaa6467bfde982721c19fde11dcdf58f
Python
3,605
85
import pandas as pd import glob import os import numpy as np import sys from sklearn.metrics import roc_auc_score, precision_score, recall_score, accuracy_score atac_data = ['BICCN2', 'GSE111586', 'GSE123576', 'GSE126074', 'GSE127257', 'GSE1303990'] rna_data = ['BICCN2', 'GSE126074', 'GSE1303990'] rna_data = ['BICCN2'...
7fff9547160724ea5aa8c724dceba1a8b76fa106c4100113f8f686d09a5bc57c
Python
3,607
144
# encoding: utf-8 from __future__ import absolute_import, division, print_function import argparse import os.path as osp import sys import time import numpy as np import torch.utils.model_zoo as model_zoo from easydict import EasyDict as edict C = edict() config = C cfg = C C.seed = 12345 """please config ROOT_d...
214664a078929896a996f8a15c497f042552edcf9c7f7631d2b7ccc349340199
Python
3,609
107
import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, kaiming_init from mmdet.core import auto_fp16, force_fp32 from mmdet.models.builder import HEADS @HEADS.register_module() class FusedSemanticHead(nn.Module): r"""Multi-level fused semantic segmentation head. .. code-block...
4db15047c5801f2d96376bc91ae3737a17b87c43b2b3dea085e78762dfcb2eb5
Python
3,609
111
from dolfin import Cell, Expression, UserExpression import numpy as np def cell_orientation(is_1d_in_3d): '''A line mesh in 3d cannot be oriented - fall back to 0''' return lambda cell: cell.orientation() if not is_1d_in_3d else 0 class DegreeOfFreedom(object): '''Evaluator of dof of V on functions''' ...
38a059a79a7a18202ec0073c05afb123f37069e40d31e65a2c52269d41f19347
Python
3,610
125
# -*- coding: utf-8 -*- """ Created on Fri May 14 23:06:21 2021 @author: Sleepymouse """ import glob import numpy as np import pandas as pd from scipy.stats import chi2 import sympy import csv import matplotlib.pyplot as plt import sys #wheel managerから排出されたファイルは.csv形式(名前は.xls)なので、.xlsに変換sにて保存しなおしてから使用すること #mac #path...
eb75d9373ce5534721f468706e229713a92cf92ddde0d456da572e5d4672bcf2
Python
3,612
105
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
d3aa3a221a9f4f8c0988f239d3602c76300b0bda02853eff961a22111d4a079b
Python
3,613
108
# 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 # # httpwww.apache.orglicensesLICENSE-2.0 # # Unless required by applicable law or agreed to in wri...
f09c357b2ddf9fc027d539dd533225bfdd5977bcfeebe264721c75b7c2e20fe7
Python
3,613
88
# 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...
e7ace105db659e9a9aec4c431323f9702f2eb4dd97d361d6464ff215b09e10b2
Python
3,615
127
''' To add/improve: - objects are solid color or trimesh - exclude large arrows in vicinity of singularity ''' import numpy as np import FBEM import matplotlib.pyplot as plt def _get_keys(projection): if projection == 'xy': keyX = 0 keyY = 1 keyZ = 2 elif projection == 'xz': ke...
79245ec8076e547ed005d8a44696a4687742f26826fd4a7ef8ccf91bfed0f334
Python
3,616
97
# 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...