sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
a1f63a59c7e4725954d50a099b276ba3c8aaa09a96a93ce981a6dafdd547c6cf
Python
10,118
352
'''Tests for functions in io_utils.py. ''' import os import io import pytest from contextlib import contextmanager from keras.models import Sequential from keras.layers import Dense from keras.utils.io_utils import HDF5Matrix from keras.utils.io_utils import H5Dict from keras.utils.io_utils import ask_to_proceed_with...
c73ba24daf46479d9c781084384076f2e31c8c5300acb905dfd92d0333a1afb7
Python
10,118
329
""" Mechanism classes Theses classes represent mechanisms in the model """ """ Copyright (c) 2016-2020, EPFL/Blue Brain Project This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General...
d33b7604de8732be7fc0fcc718ce16aad85863a414681ef7b467ad252730d901
Python
10,118
287
import statsmodels.nonparametric.kernel_regression from KDEpy import FFTKDE from multiprocessing import Pool, Manager, get_context from scipy import stats import numpy as np import os import pandas as pd import statsmodels.discrete.discrete_model from anndata import AnnData import scipy as sp _EPS = np.finfo(float).ep...
7e4fd27e93546ac5a7e70dd419b852a1167370b8948abfe2c0fb343b53452b36
Python
10,119
171
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
80cb323a79be304c55b1868a1227b5ff8d584cfaef4c23cbbc71a4d3db7df421
Python
10,119
279
# tests/test_router_jobs.py """Tests for job registration endpoint using shared fixtures from conftest.py.""" from uuid import UUID from conftest import make_room_address from zndraw_joblib.exceptions import ProblemDetail from zndraw_joblib.schemas import JobResponse, JobSummary, PaginatedResponse def test_registe...
bb0d8776917ef0ec3d0d2534a6416fc2e903ebfd39c65646bff11b85bf03e5d5
Python
10,121
398
import os from medperf.exceptions import InvalidArgumentError import pytest import logging from pathlib import Path from unittest.mock import mock_open, call, ANY from medperf import utils import medperf.config as config from medperf.tests.mocks import MockTar patch_utils = "medperf.utils.{}" def init_mock_isdir(ex...
4679a53272af0deb117e764d9d26ee4c4b5d5de80b74982d815cc84e1e83d130
Python
10,133
232
# -*- coding: utf-8 -*- """Normalization layers. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from ..engine.base_layer import Layer, InputSpec from .. import initializers from .. import regularizers from .. import constraints from .. import backend as...
67d8f81284b3f5e4f32662ff47ea0bee96d53502635970f4869758f3e1f0d6a7
Python
10,135
382
import h5py import pathlib as pl pathsToKeep = { # Labjack barcode data "barcodes", "barcodes/labjack", "barcodes/labjack/indices", "barcodes/labjack/trains", "barcodes/labjack/values", "barcodes/neuropixels", "barcodes/neuropixels/indices", "barcodes/neuropixels/trains", "barc...
a5fb3b273acd76a81510eec79ba417a170b2323fd34d2e9fcc2036a09ee3d417
Python
10,136
214
print('--------Mendeley-2020 dataset----------') import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.preprocessing import StandardScaler from sklearn.utils import shuffle from tensorflow.keras.models import Model from tensorflow.keras.layers import Input, Dens...
f95799f1b0f03cd13def2507b7e7bd8d768a2fb86989acf4470bc86d9fefe1e0
Python
10,136
276
import time import datetime import sys from visdom import Visdom import numpy as np import torch import glob from fastl2lir import FastL2LiR from bdpy.dataform import Features, load_array, save_array import os, hdf5storage class Logger(): def __init__(self, n_iterations, batches_iteration): # self.viz = Vi...
e442f55094c973e733073301c47c57d76dedbe33d961ab9252b7515243891995
Python
10,147
231
#!/usr/bin/env python """Estimate the peak RAM needed to bulk-load RDF file(s) into an in-memory store. Several Babel data handlers load a whole RDF/TTL/OWL dump into an in-memory ``pyoxigraph.Store`` before querying it (e.g. ``ChemblRDF`` in ``src/datahandlers/chembl.py``). On a large dump this can need far more memo...
84bb6d21110d369a4c018ef31951e2ba5cb540e839e209dd93d380ddf16ec48f
Python
10,154
320
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ Attribute data transfer testing module ...
aefb470680a7d37e179eaea446fb2dac955d91945258e96c7bebe8d77dd30f96
Python
10,164
315
import argparse import time import pandas as pd import matplotlib as mpl import matplotlib.pyplot as plt import pickle import numpy as np from scipy.stats import gaussian_kde from sklearn.metrics import roc_curve, auc from sklearn.metrics import confusion_matrix from tqdm import tqdm import torch import torch.nn as nn ...
8413336174f78d23db83307b469b59b3112ffeb7fc789a27dd20bac05d1e0da1
Python
10,165
253
"""Utilities related to model visualization.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os from ..models import Model from ..layers.wrappers import Wrapper # `pydot` is an optional dependency, # see `extras_require` in `setup.py`. try: im...
d1477e867ea6370f9c4317b99fda1133ecefc0b54f9b50db28679ee5063d2895
Python
10,166
313
import argparse import os import pathlib import subprocess import sys from collections import Counter from multiprocessing import Pool, cpu_count from typing import Dict, List, Tuple from test_utils import PY_PACKAGE, ROOT, cd, print_time, record_time class LintersPaths: """The paths each linter run on.""" ...
672829a019e2a1112ebb6aab62262c47a9e34089e4c2fa6e2613235f399701e6
Python
10,167
176
import json import numpy as np import pandas as pd from feater import io # from Nearl import utils, data_io import nearl #### Task1: # 1. Check if the QM and MD data are present in the database # 2. If NO, update the supercedes list #### Task2: # Find the ligand atom index in the MD trajectory # 1. Initial selectio...
da3e40016bbf663a0ec40698db4ce63d548f5f540b9a8c29e4338cd5b990ae30
Python
10,167
219
import argparse import logging from typing import Type from catmaid.control.importer import AbstractImporter, InternalImporter, FileImporter from catmaid.models import Project, User from catmaid.util import str2bool from django.core.management.base import BaseCommand, CommandError from django.db import connection from...
6ad0f820c3b9f5aad0f586b89b9a6fef71c204d0889f7c52f7039d9a27ac1588
Python
10,170
271
import torch import torch.nn.functional as F import numpy as np import logging from PIL import Image from losses import * from options import * """ Define task metrics, loss functions and model trainer here. """ def randrot(img): mode = np.random.randint(0, 4) #用于生成随机整数0,1,2,3 return rot(img, mode)...
a95873a267d3887a2b900065a7f4e36f8c2c2594489dc9d5852e64be6adebb71
Python
10,170
289
import numpy as np import json import copy import hashlib import time from multiprocessing import Pool INPUT = 'input' OUTPUT = 'output' CONV3X3 = 'conv3x3-bn-relu' CONV1X1 = 'conv1x1-bn-relu' MAXPOOL3X3 = 'maxpool3x3' NUM_VERTICES = 7 OP_SPOTS = NUM_VERTICES - 2 MAX_EDGES = 9 ALLOWED_EDGES = [0, 1] CANONICAL_OPS = [C...
52cc2c1204ac379838c56be1c95e328b6e9968a509bd231502521e5f2560ea1d
Python
10,174
233
from fengshen.data.task_dataloader.task_datasets import LCSTSDataModel from transformers import T5Tokenizer, MT5ForConditionalGeneration from transformers.optimization import get_linear_schedule_with_warmup from pytorch_lightning import Trainer, loggers from pytorch_lightning.callbacks import ModelCheckpoint from trans...
e746d28dfd23bb9423d853e360bc641c245493da8dcc867d52df5e4f094e29d7
Python
10,177
273
import os import numpy as np import pytest import shutil from keras import callbacks from keras.models import Sequential, Model from keras import layers from keras import backend as K from keras.utils import np_utils from keras.utils.test_utils import get_test_data from keras.utils.generic_utils import to_list from ke...
a37ad26799d274f46ad3831579191caea500a9fa0229b22848febc57b2340db7
Python
10,178
208
# Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """GaNDLFTaskRunner module.""" from copy import deepcopy import numpy as np import torch as pt from openfl.utilities import split_tensor_dict_for_holdouts from openfl.utilities import TensorKey from openfl.federated.task.runner_fets_...
261d6a22b9bed8de8f67c3aaed995c9177c02c35dc1cd1783327d0477c7f9aa3
Python
10,180
328
import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import matplotlib.ticker as ticker import numpy as np from mpl_toolkits.axes_grid1.inset_locator import zoomed_inset_axes from mpl_toolkits.axes_grid1.inset_locator import mark_inset EV_list = [ 25, 100, 500, 1000, ] plt.figure...
409fc045894b2b40575209b7a10de4f0c117de379cb3c8669be64d28363805ff
Python
10,183
290
from collections import Counter from unittest.mock import MagicMock import numpy as np import pytest from mace.tools import AtomicNumberTable from scipy.special import softmax # type: ignore from simgen.element_swapping import ( SwappingAtomicNumberTable, catch_diverged_energies, choose_indices_to_change...
f9da565faa7fe95a6f587f0eeb40c570f21d103d5842aafdeae2d398b2e8b108
Python
10,186
316
import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.parameter import Parameter from torch.nn.modules.module import Module ###################################ZINB################################### ###################################ZINB################################### #################...
fa463d1f3806d0b257e3e8fe20a9d85d20cae27ba3624a6063a4f24f01fa416b
Python
10,203
318
# Copyright (c) OpenMMLab. All rights reserved. import math import torch import torch.nn as nn import torch.nn.functional as F import torch.utils.checkpoint as cp from mmcv.cnn import build_conv_layer, build_norm_layer from mmseg.registry import MODELS from ..utils import ResLayer from .resnet import Bottleneck as _B...
bfdbfc7c9f406aa1915c10d50e6f3d3db9acffb7aa4505b84dae39954a29d40e
Python
10,209
277
# This file is part of h5py, a Python interface to the HDF5 library. # # http://www.h5py.org # # Copyright 2008-2013 Andrew Collette and contributors # # License: Standard 3-clause BSD; see "license.txt" for full license terms # and contributor agreement. """ Implements high-level operations for attribu...
89ceb6517faf2f95f096532c7fca3da734e818691f5578ef5dd4630fa5543500
Python
10,213
275
# Copyright (c) OpenMMLab. All rights reserved. # Referred to: https://github.com/KU-CVLAB/CAT-Seg/blob/main/cat_seg/third_party/clip.py # noqa import hashlib import os import urllib import warnings from typing import List, Union import torch from PIL import Image from torchvision.transforms import (CenterCrop, Compos...
c2b984359fe483640fcc2313570bbbd2128eede99bdbf0fa586ec8e0e1a1ecb7
Python
10,213
285
import torch import torch.nn.functional as F import math class KANLinear(torch.nn.Module): def __init__( self, in_features, out_features, grid_size=5, spline_order=3, scale_noise=0.1, scale_base=1.0, scale_spline=1.0, enable_standalone_scale_...
f6df62a62dc43e9934ab20a63ed5833811bd095e49ba62c71371697282d69114
Python
10,218
306
import math import pytorch_lightning as pl import torch import torchmetrics from torch.nn import CrossEntropyLoss, MSELoss from omegaconf import DictConfig from models.alif import EFAdLIF, SEAdLIF from models.li import LI from models.lif import LIF from models.rnn import LSTMCellWrapper layer_map = { "lif": LIF,...
7bbfccb71ae6b9610e940c40967c717ad7d12ed019f016b936aea6d13905b17c
Python
10,221
280
#%% file import pre procesing import pandas as pd import numpy as np import io import os import glob import matplotlib.pyplot as plt import seaborn as sns import scipy.stats as stats from matplotlib.ticker import MaxNLocator from array import * # frequency and intensity list for later freq_ls = [1000., 1500., 20...
a59be7946c233648ecf36d02ed688f828ed6dbd84d04d2782811c9d99c3e617f
Python
10,222
280
#%% file import pre procesing import pandas as pd import numpy as np import io import os import glob import matplotlib.pyplot as plt import seaborn as sns import scipy.stats as stats from matplotlib.ticker import MaxNLocator from array import * # frequency and intensity list for later freq_ls = [1000., 1500., 20...
a6ec00bf0cdf33b63d0c3e3a40851d68460ea024fc4a69ac33f964fa8846573e
Python
10,227
331
import numpy as np import pandas as pd from numba import njit from scipy.sparse import csr_matrix from anndata import AnnData from typing import Optional from os import listdir from pathlib import Path @njit def bin_indices(coords: np.ndarray, coord_min: np.ndarray = np.array([0,0]), binsize: int = 50) -> int: ...
7f31d356b278143fba4511aa679e047546235e9a210b07f016c158e0fa60a76b
Python
10,228
281
# t-leNet model: t-leNet + WW import tensorflow.keras as keras import tensorflow as tf import numpy as np import time from utils.utils import save_logs_t_leNet as save_logs from utils.utils import calculate_metrics class Classifier_TLENET: def __init__(self, output_directory, verbose,build=True): s...
3e791e553950094512a6713a9e76ec841e9927f98af2640b9d3a2991f7fa05dc
Python
10,229
304
"""These tests are not meant to be run on CI. """ from __future__ import print_function import keras from keras import backend as K from keras.utils import multi_gpu_model import numpy as np import pytest import time import tempfile import tensorflow as tf from keras.preprocessing.image import ImageDataGenerator py...
e39747837389550743534636528742d1a182e956d255823f0706c5c5eb7bdb8c
Python
10,229
252
import logging from pathlib import Path from medperf.commands.execution.execution_flow import ExecutionFlow from medperf.entities.dataset import Dataset from medperf.entities.benchmark import Benchmark from medperf.entities.report import TestReport from medperf.exceptions import InvalidArgumentError from medperf.utils...
00d6b5e14b594aa6521b41110ce930ba95ee93633204078842406e25bba99060
Python
10,239
270
import argparse import random import time import numpy as np from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader from torchvision import datasets, transforms from sklearn.metrics import roc_auc_score, average_prec...
122b509dc8b8f6802f9f3c2300358c6e536e2bceca030c594d22a9bc8ff7c511
Python
10,247
270
import argparse import random import time import numpy as np from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader from torchvision import datasets, transforms from sklearn.metrics import roc_auc_score, average_prec...
327d26d8cd404b6411259006a55d56388389d363d2dcd90f6f32a5f47cfaecb8
Python
10,247
282
# -*- coding: utf-8 -*- # tests/test_dihedral_to_cartesian.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade, Tobias Lemke # # Encoder...
40c4c0f49fa299a0d2032d72f3d90665819250f1c841476c40feacf2e5c0155f
Python
10,250
228
import numpy as np import torch from torch.nn.functional import relu def eval_gabors(img, gabor_filters, resp, batch_size=100, device=torch.device('cuda'), rectify=True): # response to images for k in np.arange(0, img.shape[-1], batch_size): kend = min(img.shape[-1]*1.0, 1.0*(k+batch_size)) ke...
ca7f70bb0ef60f8d24e2f8ed76c3b563ef123cc0fdb5174b2ff2d6c28022be42
Python
10,251
273
## BRIE model import time import numpy as np from scipy.sparse import issparse import tensorflow as tf import tensorflow_probability as tfp from tensorflow_probability import distributions as tfd class Model_init(): """Random initialize parameters for BRIE2 model """ def __init__(self, Nc, Ng, Kc, Kg, i...
fdd96b013173561bf0fd1761f77903a1c299c82a7214aae13efd3bf932ad02c2
Python
10,256
292
# TODO: break this up by modules from heudiconv.cli.run import main as runner from heudiconv.main import workflow from heudiconv import __version__ from heudiconv.utils import (create_file_if_missing, set_readonly, is_readonly) from heudiconv.bids import (popul...
fa718f92a1c031f56f4cc929504bf3e55b751f7c9bc06dfde9184d30f9aac59b
Python
10,268
254
#!/usr/bin/env python # ---------------------------------------- # scikit-ribo # ---------------------------------------- # main wrapper # ---------------------------------------- # author: Han Fang # contact: hanfang.cshl@gmail.com # website: hanfang.github.io # date: 3/28/2017 # -------------------------------------...
78f202c98f8b86005c3879728925d3cb6d601af575a0e8f245e8ce7ce43a4e69
Python
10,269
202
"""Measure the GARD_label concord: what it links, and how often the same rule would be wrong. The concord itself only ever runs on the GARD ids no other concord places, so its own rows cannot be checked against anything. This script gets a precision number by running the *same rule* over the GARD ids MONDO and DOID **...
1d8674b908e82bb3dd632a70d91d0df0977e2f299843007257b7a6895e902da5
Python
10,281
311
from typing import Dict, Set, Any, List from ordered_set import OrderedSet import sqlite3 from kgx.sink.sink import Sink from kgx.utils.kgx_utils import ( extension_types, build_export_row, create_connection, get_toolkit, sentencecase_to_snakecase, ) from kgx.config import get_logger log = get_log...
64c2c0c5ea879839f668408264d902b05074429486c8d0ed03d4d7fc9e1b3e01
Python
10,290
235
import os import torch import torch.nn as nn import torch.nn.functional as F from transformers import BertConfig,TransfoXLConfig from transformers.configuration_utils import PretrainedConfig from transformers.modeling_utils import PreTrainedModel from transformers.utils import cached_path,hf_bucket_url from fengshen.mo...
e66ccc1d2da46929e0864b7bd2a916cc2a4015ec0fcf5ca89feaa53c17763968
Python
10,291
283
""" Absolute checks on the geometry of the voxelization kernel. ``frame_interp_global`` no longer strides the whole grid per atom; it visits the integer bounding box of the atom's cutoff ball. Two details make that delicate: * the two passes cover **different** extents. The normalizer runs over the buffered grid, w...
cbda2c5d7a15d60041e2043342939d870254564a2b8ae06e5257a45faafa5685
Python
10,292
179
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
52621c1173206207817fd51fcf6c11b3577579ce6444f90fa6bdb5a45837fb8a
Python
10,297
305
""" This script computes and saves regression results for layers of DNN models and neural areas. It uses the TRF class to compute the regression and saves the results in a CSV file. It also allows for the option to save the parameters of the regression model. Args: dataset_name: str ['ucsf', 'ucdavis'], -d mod...
c3145491af6ec92326aa1e9abc30c1d9e454cf0f2e871d823445e48add5ee1a1
Python
10,301
271
import argparse import random import time import numpy as np from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader from torchvision import datasets, transforms from sklearn.metrics import roc_auc_score, average_prec...
c11c69300624049f7c1a3f22cb7e6fc99ff060d8aa61b4dcca3d6c5096c47483
Python
10,309
271
import argparse import random import time import numpy as np from tqdm import tqdm import torch import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from torch.utils.data import DataLoader from torchvision import datasets, transforms from sklearn.metrics import roc_auc_score, average_prec...
2cc6f2c977e685fb48946b7dcbe87488f9c92178dc78c9d026dcd4673c330cb8
Python
10,320
294
# Copyright (c) OpenMMLab. All rights reserved. import math import torch import torch.nn as nn from mmcv.cnn import ConvModule, Linear, build_activation_layer from mmengine.model import BaseModule from mmseg.registry import MODELS from ..utils import resize from .decode_head import BaseDecodeHead class ReassembleBl...
005c8ed61a9034c217e9851f97c0072072eb98f68241aaccd3ba4a22f1233e20
Python
10,327
334
import os import pytest from deprecation import deprecated from kgx.graph.nx_graph import NxGraph from kgx.graph_operations.summarize_graph import ( summarize_graph, generate_graph_stats, GraphSummary, TOTAL_NODES, NODE_CATEGORIES, NODE_ID_PREFIXES, NODE_ID_PREFIXES_BY_CATEGORY, COUNT_B...
cadc2e5ece8c8ac1a8ef45fa4d29ed952364c89d7afa7da4706fe610e97ad141
Python
10,329
268
"""Unit tests for the panel that renders what one DANDI asset holds. The streaming preview is a constructor injection point, so every test here runs against an in-memory stand-in with no archive access. """ import holoviews as hv import numpy as np import pytest from guppy.frontend.dandi_preview_panel import ( C...
5a04cd45853f91cfb581c26443bdd43f65622a28a5d43d8c8d873ed83d38d32c
Python
10,336
213
import json import os import shutil import time import apybiomart.classes as _apy_classes from apybiomart import find_attributes, find_datasets, query from src.util import ensure_parent_dir, get_config, get_logger logger = get_logger(__name__) # apybiomart's pre-flight connectivity check uses HTTPS and fails with S...
b9d21e182aca9a16245316f0ba4e7fe25a14008685885b6a6ce4fd8912ea80b1
Python
10,336
353
from __future__ import annotations import sys from typing import Any, Optional import numpy as np import pandas as pd def _getArea(box: list[int]) -> int: """Return area of box. Args: box (list[int]): box of object Returns: area (int): area of box """ area = (box[2] - box[0]) ...
8aaab55965afa7290061f600c2f385d20edea2f367365322c560b7a048b63d04
Python
10,337
244
from ml_training.dataset import CustomDataset, train_val_test_split, extract_data, train_val_test_split_custom from ml_training.model import LocalTransformer, GRU, BasicTransformer, LSTM from ml_training import config from ml_training.config import update_config from torch.nn import BCEWithLogitsLoss from torch.optim i...
5020e320c185ae5354123ad133196a8b7a0264d9f102a28c90cb2cab0a4ef6ba
Python
10,342
297
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from dash_bootstrap_templates import load_figure_template import dash_bootstrap_components as dbc from dash import Dash, dcc, html, dash_table # ============================================================================= # import callbacks and components # I tranfered ...
9ddd7a6c633cb6615f400beb3aa1a9ba44bd61380c2dbbd12ab483cf20a8645c
Python
10,342
221
import numpy as np from collections import Counter, defaultdict import sys from glob import glob from sklearn.base import clone as CLONE import sklearn.metrics as metrics from sklearn.preprocessing import StandardScaler # Imputation from pickle import dump, load # Models from sklearn.tree import DecisionTreeClassifie...
3a4cd07140987127a16f9fc5cf6de097a5357d4af06af55510fe9f0422d09399
Python
10,344
199
# Jason Keller # Feb 2020 # ============================================================================= # Program to set BlackFly S camera settings and acquire frames and write them # to a compressed video file. Based on FLIR Spinnaker API example code. I have # also tested with a Flea3 camera, which works b...
f1411cb45f03ab04af8bed4e4e5c6797fe3901d093fcb738f86cb299c0da4674
Python
10,355
208
import os, argparse, time, json import numpy as np import pytraj as pt from scipy.stats import entropy from collections import OrderedDict import nearl import nearl.data from nearl.io import Trajectory def parser(): parser = argparse.ArgumentParser(description="Featurize the trajectories") parser.add_argument...
f1df683b36132a445b7fdcb6945276a94941dbaf9378bbab42ea1f54ea940e0c
Python
10,355
279
# Copyright (c) OpenMMLab. All rights reserved. import threading from queue import Queue from typing import List, Optional, Tuple import numpy as np import torch from mmengine import Config from mmengine.model import BaseModel from mmengine.registry import init_default_scope from mmengine.runner import load_checkpoint...
dcdb7757c8c94d0de7bdf0621f4c6a8a354bec2f34b02ad83695126a5e7263be
Python
10,357
309
import torch import itertools import json import hashlib import os from matplotlib.ticker import FormatStrFormatter, StrMethodFormatter import umap from matplotlib import pyplot as plt import torch.nn as nn import torch.optim as optim import torch_geometric import torch_scatter import torch.multiprocessing as mp from ...
e317cdd5ea87f678928816cabbfd107dba7f511b78ff986b9ff917bcf60d6f53
Python
10,357
289
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import os import sys import time import numpy as np import tensorflow as tf from datetime import datetime from tensorflow.contrib.slim.python.slim.nets import inception from tensorflow.contri...
b43c63ba46b22114829b27b9dda236876aabdf9d155719f42c53970a439a3b51
Python
10,360
251
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from typing import Optional import ase.db.sqlite import ase.io.trajectory import numpy as np import torch from torch_geometric.data import D...
7c1c8e6397cc73d1c2065b83d95b141b52f7c1664526d812a49c27c4cd65d9b7
Python
10,364
236
""" This scripts trains four ablation models: - Ablate neuroimaging features: train an MLP on clinical data only - Ablate VGAE: train a MLP on PCA-reduced neuroimaging features - Ablate VGAE: train a MLP on t-SNE-reduced neuroimaging features - Ablate MLP: train a VGAE with a linear regression head Dependencies: - exp...
8ca7ac0277c28f4095bb8765eeacc1cd588b7b90f5904054df68ce93efad4478
Python
10,372
328
#!/usr/bin/env python """ MetaWIBELE: ddi_DOMINE_protein module Summary the domain-domian interaction based on DOMINE database Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Sof...
08b718c908adb4e4bfeb2dd4d00765ae1e026398558c867d27e8ded32a07d6df
Python
10,377
303
import cv2 import numpy as np from basicsr.metrics.metric_util import reorder_image, to_y_channel import skimage.metrics import torch def calculate_psnr(img1, img2, crop_border, input_order='HWC', test_y_channel=False): """Calculate PSNR...
1bd751120e14c3c121d98582037bfe55a591a99d51cf0b6051fe6fe42ca0db1a
Python
10,377
300
# Copyright (c) 2021, EleutherAI # This file is based on code by the authors denoted below and has been modified from its original version. # # Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in complian...
b7748b7c11ce3adea841dd8046544bd627df52d714d8a79fede56ddc3e8bad08
Python
10,387
282
import numpy as np import pandas as pd from stns import find_nearest from scipy.stats import zscore __all__ = ['get_ISI_per_time', 'calculate_percentile', 'split_spike_data_into_list_of_segments', 'pad_spike_data_to_compensate_for_terminal_silence', 'check_all_neurons_included_add_filler_if_not', ...
7d9cacff2d10f75da5d6da4bc3ed8412268a5fca63ea7744b02d4deb3e48cbd4
Python
10,402
254
"""Regression tests for the cross-compendium DuckDB report queries. These exercise the two-pass duplicate-detection rewrite in ``src/reports/duckdb_reports.py``: a spillable ``COUNT(*)`` pass that finds the duplicate keys, followed by a ``LIST()`` pass restricted to those keys. The fixtures are deliberately tiny; the ...
3c61251f0088d6a6c41f0d8e6a4b8922701d1c2d499e8173e6f60732bb35a3ac
Python
10,403
274
from dataclasses import dataclass from torch.utils.data._utils.collate import default_collate import copy import torch import numpy as np @dataclass class CollatorForLinear: args = None tokenizer = None label2id = None def __call__(self, samples): cls_token = "[CLS]" sep_token = "[SEP...
597b2b435ea05a411e06e3ba67751b4c52060865b20fafc4b3c174fb03e2efb3
Python
10,404
309
"""################################################################################ > # **Introduction** > The notebook is divided into 4 major parts : * **Part I** : define the functions * **Part II** : define the CNN model * **Part III** : optimization using the search algorithm ##############################...
206d3f3d92fcb241d9706db97f3b31b47461ad782eac2e614c7670a31f6689eb
Python
10,408
291
"""Count reads in transcript for well-based scRNA-seq or bulk RNA-Seq""" import sys import time import numpy as np import multiprocessing from .sam_utils import load_samfile, fetch_reads, check_pysam_chrom def _check_SE_event(gene): """Check SE event""" if (len(gene.trans) != 2 or gene.trans[0].exons...
103db3e501176161457a72b1ee6171fcf2ee73f65a06fcaf4214f443caf7b964
Python
10,416
295
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import math import numpy as np import sympy as sym from scipy import special as sp from scipy.optimize import brentq def Jn(r: float, n: i...
1d35584b30fc07f1763848e0edaa476c8324f35dd9e85d42e7158240b4d1c513
Python
10,416
306
from scripts import load from scripts import oed import os import json import numpy as np def gene_aser_aiy_synapse_change( gene_number, start, stop, num, gene_path="../result/Result_aiy_aiz_negative.json" ): """ ASER-AIYのシナプス特性を変化させる。 gene_number: 改変する遺伝子の番号 start: 10,11の結合(ASER-AIY)に対して加える範囲の最小 ...
10924e56999dfe00095787f31465a4decfd267088c3b297c1b48c8ff6051aa1f
Python
10,420
278
#!/usr/bin/env python """ MetaWIBELE: mspminer_protein module Extract annotation of MSPs Copyright (c) 2019 Harvard School of Public Health 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 withou...
5dd5de40f6a583f0350acc747510120dba0a05f51e3470291f18c64ecf13cf3c
Python
10,420
295
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import math import numpy as np import sympy as sym from scipy import special as sp from scipy.optimize import brentq def Jn(r: float, n: i...
aac28fe8a13f59779fd07255cdf9769352a373f7179c77665597f32fb14e66d9
Python
10,423
369
"""Connection management for zndraw-cli. Handles server URL resolution and token resolution via ClientSettings (pydantic-settings source chain). Provides a Connection dataclass that wraps httpx.Client with base_url and auth header. """ from __future__ import annotations import contextlib import json import sys from ...
5774dc9bcc6142b3bc76e3c1ddb82129d9b85a4bd9c085b998b2e438f43646ef
Python
10,425
232
import numpy as np import pandas as pd import pytest from guppy.analysis.standard_io import write_tonic_to_hdf5 from guppy.frontend.tonic_epochs import ( TonicEpochConfig, TonicResultsView, build_tonic_results_view, ) from guppy.utils._hdf5_io import write_hdf5 @pytest.fixture def run_folder(tmp_path): ...
a3813281481bb7039b0dba65ebdf2a7a6c5e0d6f8ea670547135bf6cccba1d1e
Python
10,426
201
##### Data preparation file for training Restormer on the DPDD Dataset ######## import cv2 import numpy as np from glob import glob from natsort import natsorted import os from tqdm import tqdm from copy import deepcopy from joblib import Parallel, delayed import multiprocessing from pdb import set_trace as stx def ...
a67c8d562d040ee98ea4815272adaa6d3f531fb7288b9d5a4efcc2f08574b4bf
Python
10,443
333
import errno import io import os import sys from abc import ABC, abstractmethod from enum import Enum from pathlib import Path from typing import BinaryIO, Optional, TextIO, Any import dnaio from xopen import xopen from cutadapt.utils import logger try: import resource except ImportError: # Windows resou...
b8bb6e49bb3d14dbd0c28dbfd20cf3fba7e46aa425a80b7b030b51794d6fff48
Python
10,447
326
""" Django settings for medperf project. Generated by 'django-admin startproject' using Django 3.2.5. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathlib...
1e471186594f4c941f78eb843c575d679efbf970762c758e37bde09912b24c4f
Python
10,450
364
from ._version import __version__ from pathlib import Path from os import getenv BASE_DIR = Path(__file__).resolve().parent.parent.parent major_version, minor_version, patch_version = __version__.split(".") # MedPerf server server = "https://api.medperf.org" certificate = None local_server = "https://localhost:8000...
fa6561f41aafb2e84418627f8c8a29e7ec5a0455b400759fc51c00abdf8b1218
Python
10,452
236
# Script to load, perform basic postprocessing, and plot data analysis for the # GCaMP mice data. import sys import os sys.path.append("./utilities") from pylab import * from scipy.stats import pearsonr from matplotlib.animation import FuncAnimation from mpl_toolkits.axes_grid1.axes_divider import make_axes_locatable...
05cb79933ec1d8e67d2ee128732caddddecd2ec262d024a69bc7f2a482d29643
Python
10,461
286
import numpy as np import pyqtgraph as pg from PyQt5 import QtCore, QtGui from PyQt5.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem, QHBoxLayout, QWidget app = QApplication([]) windows = {} def view_arrays(arrays, *args, **kwargs): layers = [{'data': array, 'name': str(i), 'visible': True} for i, a...
1a60e7f61bef1fc2010d10f032f2c4f9afc7d09e1c0a15a5e3a329b3a98bc11e
Python
10,462
282
from collections import defaultdict import json import logging import select import signal import time from typing import Dict, List, Set from django.conf import settings from django.core.management.base import BaseCommand from django.db import connection from catmaid.control.edge import get_intersected_grid_cells f...
f8870752bc2d878c356ad8d82ca7373cfc8f05b56d4393976febf64ed98e4dad
Python
10,462
295
# Copyright DST Group. Licensed under the MIT license. import datetime from ipaddress import IPv4Address, IPv4Network import CybORG.Shared.Enums as CyEnums class NetworkInterface: """A class for storing network interface information """ def __init__(self, hostid: str = None, ...
75ac444c50954d00e18f535f204ca43e7b20934a6737c177b32482c754efde25
Python
10,475
297
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import imageio import os import sys import tqdm import numpy as np import SimpleITK as sitk import tensorflow as tf from tensorflow.contrib.slim.python.slim.nets import inception from geomstat...
7a6dee7066c75ba7d47ec60ce280c9a817403878f21fe1467890564f79152089
Python
10,477
338
import numpy as np import scipy.optimize from argparse import Namespace from tfwrap import tf import math class Optimizer: def __init__(self, name=None, displayname=None, dtype=None): self.name = name self.displayname = displayname if displayname is not None else name self.dtype = dtype ...
f637ae4a38be525d287c3f0c85075a6a5159f769d91ae3c085b28094e56d788c
Python
10,480
202
# Sapbert (https://github.com/RENCI-NER/sapbert) requires input files # in a particular pipe-delimited format: # biolink:Gene||NCBIGene:10554||AGPAT1||1-acylglycerol-3-phosphate o-acyltransferase 1||lysophosphatidic acid acyltransferase, alpha # i.e. the format we need is: # biolink-type||preferred ID||preferred la...
028ece4b77e96907bc852dc781ea5f92f3f10f9a53322ce36d886250ed308307
Python
10,486
302
## ## CPCantalapiedra 2020 import os import subprocess from argparse import Namespace from collections import defaultdict from ...common import get_pfam_db, get_call_info, ESL_REFORMAT, TIMEOUT_LOAD_SERVER from ...emapperException import EmapperException from ...search.hmmer.hmmer import HmmerSearcher from ...search...
f299b44126dedb2d2d7b8398b0801f79beac7acb7f8bb873ff8ff983b5a9e911
Python
10,491
297
import logging from collections import Counter from collections.abc import Sequence from pathlib import Path import numpy as np import pandas as pd import torch from torch.utils.data import DataLoader, TensorDataset from DiastereomericResolutions.main import ModelTask from DiastereomericResolutions.main.molecule_db i...
583d8fb3e93b0c95cc87bdf96500b8d9644c560ca1c5d06dcedeacd9c9999ae2
Python
10,495
305
import tensorflow as tf import numpy as np import matplotlib.pyplot as plt import data_utils as du from pathlib import Path import time from datetime import datetime import gc import os from tensorflow.keras import layers, models, optimizers, callbacks from tensorflow.keras.callbacks import Callback from dfa_lib_pyt...
4352bdcbff430f8f0e6f56b8e929d5ebd58a0e44a6acb7a677c451a1b1fcf4d1
Python
10,505
174
''' Created on 24 Apr 2020 @author: Francois STÜDER ''' import argparse import sys from Bio.Seq import Seq from datetime import datetime from multiprocessing import Pool from os import path from time import time from SysISTD import __version__ from SysISTD import tools from SysISTD import misc from SysISTD import ...
103bc5943bb2c1544bdcc6da7309277181b29ecf0f52bdd1a49c4d6d137a39ed
Python
10,507
310
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import torch from torch_scatter import segment_coo from torch_sparse import SparseTensor from .utils import get_inner_idx, masked_select_spar...
5451e88841a20ee0c357a7659b9b2593b1e12e83fadbe019b38c21cffb64ebd0
Python
10,510
301
import numpy as np from scipy.special import expit import scipy from cogmodels.base import CogModel2ABT_BWQ, CogParam class RL_4p(CogModel2ABT_BWQ): def __init__(self): super().__init__() self.fixed_params.update({"b0": 1.0, "q_init": 0.0, "gam": 1.0, "CF": False}) # used fixed for hyperp...
374fb974866c623a68f277ad1a5d98ff5b2afffa069244015b93a4f0f05bae19
Python
10,512
275
import logging import math import re from pathlib import Path import numpy as np import pandas as pd from .io_utils import ( make_dir_for_cross_correlation, recording_site_from_preprocessed_label, ) from .psth_utils import create_Df_for_psth, getCorrCombinations from ..utils.utils import output_label_under, r...
688d024ecdad8ff069b03df7bdad2f4baea99cb715b00851a25b35e573528503
Python
10,513
208
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.cluster import DBSCAN from sklearn.metrics import silhouette_score, silhouette_samples from scipy.spatial.distance import cdist from sklearn.neighbors import NearestNeighbors # Constants definition CSV_READ_PATH = r'detect_spi...
ca2fe4d0b45b0f4de2a873d57e791a9dd7da277075ce9c9dd84e56b7959b8477
Python
10,515
382
import os import tempfile import weakref from typing import Any, Callable, Dict, List import numpy as np import pytest from hypothesis import given, settings, strategies from scipy.sparse import csr_matrix import xgboost as xgb from xgboost import testing as tm from xgboost.data import SingleBatchInternalIter as Sing...