sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
7ce43697cadab0e6a589c38c56437523e30a8aad57cd9922590da61a83dd1815
Python
5,000
132
from rest_framework import serializers from django.utils import timezone from training.models import TrainingExperiment from dataset.models import Dataset from .models import ExperimentDataset from utils.associations import ( validate_approval_status_on_creation, validate_approval_status_on_update, ) def is_...
f77be4075ab67747abfed7b4fbb9a7d70be0bb1f81103aacb3b04712ceab6fbd
Python
5,000
135
"""Smoke tests for the pyoxigraph API surface used across all Babel datahandlers. These tests exercise Store.bulk_load() and RdfFormat.* directly, which are bypassed when other tests inject a pre-built store via ClassName.__new__(). """ import io import pyoxigraph import pytest def _store_from_bytes(data: bytes, f...
2acfd3d98afcaad1553a98e040420c1500526f5d2746c7691a829fad5ce0267d
Python
5,004
146
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import os import shutil import itertools from multiprocessing import Pool import numpy as np from dmriqcpy.analysis.stats import stats_mask_volume from dmriqcpy.io.report import Report from dmriqcpy.io.utils import (add_online_arg, add_overwrite_arg, ...
39f68b9c42fa140c59fd76335e49e468aca4febf651cddbbfd1aaddf086d9c4d
Python
5,004
146
#!/usr/bin/env python3 """Offline self-test: emapper over every --itype against the downloadable mini dataset, diffed against committed golden annotations. Requires the ``test_datasets/data`` + ``test_datasets/fixtures`` + ``test_datasets/golden`` directories (produced by ``make_test_dataset.py`` and ``gen_golden.py``...
9a5dc3316bf6bdc5999cc04033cf361f8394f345f3f1a4014be6f2a5c4c31481
Python
5,004
85
import os import pandas as pd import shutil import json def format_filenames(source_dir, target_dir): if not os.path.isdir(target_dir): os.makedirs(target_dir) subject_info = dict() file_info = [] for dir1 in os.listdir(source_dir): if dir1.startswith('S'): space_idx = dir...
8298c50fed7ab8792cd2f0598a5a6263a4f6bd4ab7ada7ffa9df1e6c160472d4
Python
5,005
173
""" 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 ..initializers import he_orthogonal_init class EfficientInteractionDownProjection(torch.nn.Module): """ Down pro...
bbe669f29315b8cbf5e6067e53e1e3abbc17741709c7e32b79c0be018f4e4cc5
Python
5,005
96
# -*- coding: utf-8 -*- from django.db.models import Count from django_migration_testcase import MigrationTest class Migration0018Tests(MigrationTest): app_name = 'catmaid' before = '0017_update_edge_indices' after = '0018_add_stack_mirrors_and_groups' def migrate_kwargs(self): return { ...
25e08bacf0e1265ac8e38d833937dcd90a3b0709434863d8036fd0b2167a35fc
Python
5,007
135
import os import medperf.config as config from medperf.enums import AutoApprovalMode from medperf.exceptions import InvalidArgumentError, MedperfException from medperf.utils import sanitize_path, validate_and_normalize_emails class UpdateAssociationsPolicy: @classmethod def run( cls, benchmar...
7a5fb17435b3e1783ea6ce997da11fc74511538d740fe103e057040959e69d9d
Python
5,008
136
"""Test singularity{,-ce} & apptainer versions.""" import pytest from packaging.version import Version import cwltool.singularity from cwltool.singularity import ( get_version, is_apptainer_1_or_newer, is_version_2_6, is_version_3_1_or_newer, is_version_3_4_or_newer, is_version_3_or_newer, ) ...
065942d96f44b02e8c5cb0f8379ccbd0085e00995d3bf49bd1a0bcd623521d64
Python
5,011
146
""" Benchmark the data throughput of the Data Extraction from the HDF5 dataset. """ import argparse import json import os import time from nearl.io.dataset import Dataset def benchmark_dataset_method(dset, exit_point=None, **kwargs): st = time.perf_counter() st_total = time.perf_counter() print("Started...
96dee99579ad7589528918dba86a1f7c31d1b91b93ddfc1bea296a07a366ea5a
Python
5,018
141
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn import torch.nn.functional as F from mmcv.cnn import ConvModule, build_activation_layer, build_norm_layer from mmseg.registry import MODELS from .decode_head import BaseDecodeHead class DCM(nn.Module): """Dynamic Convolutional Mod...
8383f59872bd1e48cb92972ef2a6583ada212c936807b250daa4cda347a0f688
Python
5,019
137
#!/usr/bin/env python3 # # Copyright 2015, Daehwan Kim <infphilo@gmail.com> # # This file is part of HISAT 2. # # HISAT 2 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 the License, or # ...
87b59fb71fa5bdee9abea4b396534a5afebe4ad4132a8e440061fd4898c0b2e8
Python
5,027
124
import os.path import pandas as pd import numpy as np import matplotlib.pyplot as plt SIGNAL_PATH = r'8.csv' # Please set this PATH to the signal waveform CSV file. CLUSTER_RESULTS_PATH = r'DBSCAN_f8.csv' #Please set this PATH to the CSV file generated by DBSCAN.py. tInc = 4.000000e-06 SENSOR_PAD = [2,1,4,...
8b22c41d609e27eefd01f822102a7b2bedbf4252a797b6b87a7a055fea901340
Python
5,027
153
import numpy as np import pytest from keras.utils.test_utils import layer_test from keras.layers import pooling from keras.layers import Masking from keras.layers import convolutional from keras.models import Sequential @pytest.mark.parametrize( 'padding,stride,data_format', [(padding, stride, data_format) ...
ba0e517cff757bda21acb8b9ea5a4e941966523ae812ad67011886f4892d906b
Python
5,029
111
""" Preprocess the motion curves into adequate length and format to be loaded in the motion simulation pipeline. - run this script (from iml-dl/.) with: python -u ./projects/motion-simulation/preprocessing/motion_curves.py --input_dir folder_with_motion_data --output_dir output_folder --output_dir_s...
bf3aa1e590e70b93e52c4122785f5538ec99d8f07d46d7eb084c488fc1a6c9ce
Python
5,031
88
# %% libraries import os, glob, re import shutil import gzip from os.path import join from nilearn import image, plotting, masking import numpy as np import matplotlib.pyplot as plt import numpy as np import pandas as pd import itertools import pathlib import argparse epi01_fname = '/Users/h/Documents/projects_local/...
bf5fddbc5c6e4941e0c105bb8a6a9740f8d6a70808f1d8565e63727f60ba14b7
Python
5,034
130
import time import numpy as np from Nearl import data_io, log, models from scipy import stats from sklearn.metrics import mean_squared_error, r2_score from sklearn.model_selection import train_test_split st = time.perf_counter() log("Loading data...") input_files = [ "/MieT5/Nearl/data/trainingdata/misato_trains...
ece02cc01c14004c24842c020f28b617393811b6d7711bc8ba2d8116cc2e3d64
Python
5,035
181
""" 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 numpy as np import torch from .base_layers import Dense from torch_geometric.nn.models.schnet import Gau...
1c889a632be6531d0d157e2d6ab86dacc58a9099babd7b4bdc73bcc1fde84df7
Python
5,037
145
#!/usr/bin/python import logging import os import re import shutil import sys from collections import defaultdict from isorefiner.common import get_version, run_command, func_with_log logger = logging.getLogger(__name__) def main(args): try: # Set variables raw_reads_files = [os.path.abs...
29b637da97684e2504d27f1424354caa047442502139a62bb5ea082a923c8b42
Python
5,043
154
import sys import pandas as pd import numpy as np import diffrax import jax.numpy as jnp import jax import optax import argparse jax.config.update("jax_enable_x64", True) from jaxkineticmodel.parameter_estimation.training import ( create_log_params_means_centered_loss_func, log_transform_parameters, expone...
f895df1ad67df2b55850649f51ca0d0ca4a32b3f36ada58a0219ec9bc26ae656
Python
5,045
186
# pylint: disable=missing-function-docstring """Global configuration for XGBoost""" import ctypes import json from contextlib import contextmanager from functools import wraps from typing import Any, Callable, Dict, Iterator, Optional, cast from ._typing import _F from .core import _LIB, _check_call, c_str, py_str d...
87cd4c8d04addc85e7deef83628afb390360ef985b91c64f82fdc4e5c627c9b1
Python
5,049
143
""" Functions dealing with 2d and 3d curve fitting Copyright (c) 2019 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ # TODO: implement robust fitting, i.e., detection and removal of outliers. See: # https://github.com/spinalcordtoolbox/spinalcordtoolbox/blob/24ec6668d623be00194b21038...
a559a4671e85fa2255f77bdad64838aa44d18e2c08d31d6f8f524e0bf8d83f08
Python
5,050
1
# -*- coding: utf-8 -*- """ Generates simulated (matching) GRFs on the surface of fsaverage5 with a specified correlation for use in "ground truth" testing of spatial null models. """ from pathlib import Path import os from joblib import Parallel, delayed import nibabel as nib import numpy as np import pandas as pd ...
4dc8096afbd1a530b5cb2cbe7fb3b91e254d84b6821695571ce5fbb0a30eada9
Python
5,051
147
import torch import torch.nn as nn import torch.nn.functional as F class SE_block(nn.Module): def __init__(self,inchannels,reduction = 16 ): super(SE_block,self).__init__() self.GAP = nn.AdaptiveAvgPool3d((1,1,1)) self.FC1 = nn.Linear(inchannels,inchannels//reduction) self....
9ca49a33def161d2cafa56ddef744178fa56d3219242bd8b69909904c2e63dff
Python
5,051
174
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import os from setuptools import find_packages, setup # Package metadata NAME = "SAM-2" VERSION = "1.0" DESCRIPTION = "SA...
398037728ccdce78cdb8a7d3e49153a6e1cb9c1dd74263a1b3ae413591e8a15e
Python
5,056
153
import random from typing import Optional, Sequence from pathlib import Path import hydra import numpy as np import omegaconf import pytorch_lightning as pl import torch from omegaconf import DictConfig from torch.utils.data import Dataset from torch_geometric.data import DataLoader from ccdvaeplus.commo...
020e4aee90541cee81bef7373b89175aed9c5f9dd621fb784f9b08c9859c2e57
Python
5,057
165
import ase import numpy as np from DiastereomericResolutions.Representation.molecular_representation import ( MolecularRepresentation, ) from ..Helper_funs.mopac_funs import ( compute_partial_charges, pm7_compute_bonds, ) from . import PERIODIC_TABLE_PROPS from .weighted_rdf import gen_weighted_rdf np.se...
2a515e4e2254182325edd0d07147b72cdfa49adc0409d970c692d1f3c9ed14e6
Python
5,057
140
import torch from torch import nn import numpy as np from torch.autograd import Variable from torch.nn import init from ccdvaeplus.pl_modules.condition_block import ScalarEmbedding, comp_embedding class Generator(nn.Module): def __init__(self, dim=[256, 128, 50], condition_prop=False, condition_formula=T...
40a934ba4fff7a69dd310a59a742553857cd066eeb3727b1e260f4d63c2762e4
Python
5,059
156
#!/usr/bin/env python # -*- coding: utf-8 -*- # ----------------------------------- # @File : dataset.py # @Time : 2024/03/13 14:22:36 # @Author: Zhang, Zehong # @Email : zhang@fmp-berlin.de # @Desc : None # ----------------------------------- import os import math import numpy as np import pandas as pd import tor...
4689f522afd5bcb269aeeaf2626be7c595af266b9323c5a37cc70fd96dff1b10
Python
5,061
167
"""CLI login (device-code flow) router.""" import logging import secrets import string import uuid from datetime import UTC, datetime, timedelta from typing import Annotated import jwt as pyjwt from fastapi import APIRouter, Depends, HTTPException, Query, Response from sqlmodel import select from zndraw_auth.db impo...
8dda2da8b874800fb3da041b763b5e1f932b7bf477b140b1d8692a1137703990
Python
5,061
129
import ItClust as ic import scanpy.api as sc import os from numpy.random import seed from tensorflow import set_random_seed import numpy as np import warnings import sys import metrics as M os.environ["CUDA_VISIBLE_DEVICES"]="1" warnings.filterwarnings("ignore") #import sys #!{sys.executable} -m pip install 'scanpy==...
2ba3ebddc54413a3099ae388b763f93b8ca6114da376237b169ee5b8e9aebadf
Python
5,063
174
""" Filtering criteria (predicates) """ from abc import ABC, abstractmethod from .qualtrim import expected_errors from .modifiers import ModificationInfo class Predicate(ABC): @abstractmethod def test(self, read, info: ModificationInfo) -> bool: """ Return True if the filtering criterion mat...
eaac2f86140d8c17d86e55692e48e914d90da37db0b2bd5e3001bd76964065fa
Python
5,063
202
import pytest from cutadapt.cli import main from utils import assert_files_equal, datapath, cutpath # pytest.mark.timeout will not fail even if pytest-timeout is not installed try: import pytest_timeout as _unused except ImportError: # pragma: no cover raise ImportError("pytest_timeout needs to be installed"...
7b13863b1ebf820b539bf32bc1b64d734a2ff2b1f478984aa6b87bd7a980a43e
Python
5,064
122
#! /bin/python3 import subprocess from subprocess import PIPE import time from .bcolors import Bcolors import os def run_instruction(cmd, fun, dry_run, fun_module, name, logfile, slurm = None, modules = None): with open(logfile, "a") as log: if slurm != None: cmd = ' '.join(cmd) job...
4e4b158d701f843f8c7098bb21d9cb95470f99cec63224deea6be48e997034fa
Python
5,067
115
import json import shutil from pathlib import Path import numpy as np import pytest from guppy.analysis.io_utils import read_hdf5 from guppy.testing.api import locate_run_folder, step1, step2, step3 from guppy_test_data import STUBBED_TESTING_DATA SESSION_SUBDIR = "csv/sample_data_csv_1" STORE_ID_TO_STORE_LABEL = { ...
b4a457ece1d5cca8bec309773ce30aeed2c6890c3c9b3c4b33781c7d351dd960
Python
5,067
142
## ECCV-2018-Image Super-Resolution Using Very Deep Residual Channel Attention Networks ## https://arxiv.org/abs/1807.02758 from model import common import torch.nn as nn def make_model(args, parent=False): return RCAN(args) ## Channel Attention (CA) Layer class CALayer(nn.Module): def __init__(self, channel...
d93fd96a54594f84af9dcdeb6f61ced22e562954982475dab33d4b8059a0306f
Python
5,072
154
# -*- coding: utf-8 -*- # tests/test_angles.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade, Tobias Lemke # # Encodermap is free sof...
ae02690c31e17bd63063f56faac66f1d1044a8e25a85f5e5cf8015b7fd50aa0d
Python
5,073
146
import os import sys from pdb import set_trace as bp import infomap import matplotlib import networkx as nx import numpy as np from nilearn.input_data import NiftiMasker from nilearn.masking import unmask from sklearn.cluster import KMeans from sklearn.metrics import pairwise_distances # from sklearn.metrics.pairwise...
580660e703f718bc48d43f346fa00853802360f828b59050baae56f4109d218a
Python
5,074
138
import pickle import numpy as np from pathlib import Path def model_values_path(): """Returns the location of the cas9 cleavage model values. Returns ------- os.pathlike Path to the pickle containing the cleavage values. """ THIS_DIR = Path(__file__).parent path_to_model_values = P...
a02bfb652e808b1f261b9705038d4dc18fa8c3af87a5ff60a3eca8b2aa145f9a
Python
5,077
158
#!/usr/bin/env python # 2023 Jamie McGowan <jamie.mcgowan@earlham.ac.uk> # # Reports how many species a BUSCO family was found to be single-copy in # Only looks at single-copies, ignores if present as multi copy or fragmented # Usage: python count_buscos.py -d BUSCO_runs import argparse, os, sys from os import chdi...
41a694aa7975ec7473594266424952a72df2fc1b6746d5ac732c5d15e0c9bd08
Python
5,078
131
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule from mmengine.model import BaseModule from mmseg.registry import MODELS from ..utils import resize @MODELS.register_module() class JPU(BaseModule): """FastFCN: Rethinki...
bae7b52d75243479201f76a64dd8e175911432f796aeeee1a6bef636aea4b58b
Python
5,079
121
import time import numpy as np from sklearn.ensemble import RandomForestRegressor as randomforest from sklearn.metrics import mean_squared_error, r2_score from sklearn.model_selection import train_test_split from scipy import stats from Nearl import utils, data_io, models, printit st = time.perf_counter() printit...
de833cec365f718929fde072163c1a0a4fe06a77639fa313b9e99b957edbf619
Python
5,080
164
"""Compute the efeatures generated by the released l5pc model""" """ Copyright (c) 2016-2022, 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 Public Lic...
b6dec7c5ecaee764140a234f694ad75f6d642b8fc863438728709e14615a8003
Python
5,081
90
from gpflow.kernels import SharedIndependent from grid_cell.gaussian_wishart.src.likelihoods.WishartProcessLikelihood import * from grid_cell.gaussian_wishart.src.likelihoods.FactorizedWishartLikelihood import * from grid_cell.gaussian_wishart.src.models.WishartProcess import * from grid_cell.gaussian_wishart.src.model...
00baff70f6a66ef4f960f3e6e8773ac1a09751abf34efce1fae4841848e5eeaf
Python
5,083
154
import os import math from decimal import Decimal import utility import torch import torch.nn.utils as utils from tqdm import tqdm class Trainer(): def __init__(self, args, loader, my_model, my_loss, ckp): self.args = args self.scale = args.scale self.ckp = ckp self.loader_train ...
0418f764fe03b63e312a49f5a2b1e08eb77b118c0d51fc09247b632bf0895908
Python
5,087
89
# 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...
ea50bf74ba1e38a13e0781f250edf8488aecb16eb907473ad579b0ef4311e0b6
Python
5,090
126
import sys from pathlib import Path import pandas as pd import cv2 import time from joblib import Parallel, delayed import os import shutil import numpy as np def save_frames_as_images(src, dst, starts, ends): dst = Path(dst) dst.mkdir(exist_ok=True, parents=True) cap = cv2.VideoCapture(str(src)) for ...
9a94f1e2e2fd9644e299a30ad17df90f043a2fec95a2415acb084fc859d1f64a
Python
5,091
137
#!/usr/bin/env python3 -u # 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 argparse import pathlib import torch from esm import Alphabet, FastaBatchedDataset, ProteinBertModel, pretr...
e9fa5550118d84ab2d778d79cdfcd6d775c759651c501be05e673efa7a7491e1
Python
5,092
129
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp import warnings from typing import Optional, Sequence import mmcv from mmengine.fileio import get from mmengine.hooks import Hook from mmengine.runner import Runner from mmengine.visualization import Visualizer from mmseg.registry import HOOKS from...
4b568646375fa26b904c038012f04a720bf44e5ce510f86f75d6a98afe56267c
Python
5,094
164
"""Compute the efeatures generated by the released l5pc model""" """ Copyright (c) 2016-2022, 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 Public Lic...
6f02820beb11294311925236d9b4eadbbfee1591ae385939db1b74883514b292
Python
5,094
174
""" Shared graph model error reporting code currently used in the validator, summarize_graph and meta_knowledge_graph modules """ from enum import Enum from json import dump as json_dump from sys import stderr from typing import Dict, List, Optional, TextIO class ErrorType(Enum): """ Validation error types ...
5edb188d121e9e4e14905b6aee8d6dfb7b666441a17aa3a3e17bdc51c7de532a
Python
5,099
133
#!/usr/bin/env python ## ---------------------------------------- ## scikit-ribo ## ---------------------------------------- ## Run RNAfold in parallel ## ---------------------------------------- ## author: Han Fang ## contact: hanfang.cshl@gmail.com ## website: hanfang.github.io ## date: 12/28/2016 ## ---------------...
f4c2edb4b7ed919886428141e7a3479a5114405a457a1f982f8eabbb49764b00
Python
5,100
127
import torch import math from dl_utils.config_utils import set_seed from mr_utils.parameter_fitting import T2StarFit, CalcSusceptibilityGradient from projects.moco_t2star.utils import * set_seed(2109) config = { 'out_folder': './results/MRM/', 'data_params': {'path': './data/links_to_data/recon_test_motion/',...
73475311c7cc562a794c111b89dee2739aa17ceb158c94337616a53c3be61a00
Python
5,101
140
"""Unit tests for BaseRecordingExtractor contract.""" import h5py import numpy as np import pytest from guppy.extractors.base_recording_extractor import ( BaseRecordingExtractor, read_and_save_events_for_extractor, ) from guppy.testing.mock_recording_extractor import ( _MOCK_DURATION_IN_SECONDS, _MOCK...
a21b879a8ee8a08e1d69750f28b056e0aeec65f3ec307fabaa709d8c41ebd9e7
Python
5,104
127
import numpy as np from scipy.signal.windows import gaussian from scipy.interpolate import CubicSpline from zigzeg import event_finder, find_runs from zigzeg.events import find_events_threshold from scipy.signal import find_peaks from sklearn.neighbors import KernelDensity def find_events_peaks(x, thresh, distance=10...
af0590fc540ea192a3c8bc987a29cda7658c9f4d7833aae0a2280b130ba7ae72
Python
5,104
131
# -*- coding: utf-8 -*- import json from django.urls import reverse from django.conf import settings from django.http import HttpResponseRedirect from django.views.generic import TemplateView from django.contrib import messages from django.contrib.auth import get_user_model from django.contrib.auth.models import Grou...
736b12a7a16dad977d121e020c8f478a8234c2b88c6b79966cb1b66a8ce20c71
Python
5,105
153
import concurrent.futures as cf import datetime import logging import socket import subprocess import sys import time from typer import Argument, Typer from DiastereomericResolutions.Helper_funs.db_utils import _get_needed_pairs_from_file from DiastereomericResolutions.Helper_funs.job_db import ( complete_job, ...
03c63c317d8e06f468115862f9cf16e1d5d1e74cda70e25d21281bfc1b12b1a4
Python
5,106
109
# coding=utf-8 # Copyright 2022 EleutherAI and The HuggingFace Inc. team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2...
9e23c24a76da06a03df531dc15c69601eeab45c8d04e1b10ac37acd5136e5f9d
Python
5,106
169
"""Stores Research Object including provenance.""" import hashlib import os import pwd import re import uuid from collections.abc import Callable from getpass import getuser from typing import IO, Any, Optional, TypedDict, Union def _whoami() -> tuple[str, str]: """Return the current operating system account as ...
bc105e31a58bb16f05b6ea0a094bf89f5597e325a7e02441ea2a5ddaf1ea0ddf
Python
5,108
156
"""Seed the server database with demo entries for integration tests or tutorials. Tokens to access the local server are either from the local JWT factory provided in the repository root, or from the auth provider. The later case is to do integration tests with the auth provider. For simplicity, the auth provider tokens...
adb8d86aff43edd146f939ecfd10ee3f6e01e9bc11f342ceff6776350622861f
Python
5,109
181
# 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 support for HDF5 dimension scales...
b7bb55a7ec7dd7079813cd1460a2b4b49bd0056bf2aa6a78f6d3ea603fb97c92
Python
5,109
138
""" Functions dealing with centerline detection and manipulation Copyright (c) 2017 Polytechnique Montreal <www.neuro.polymtl.ca> License: see the file LICENSE """ import os import datetime import logging import numpy as np from spinalcordtoolbox.image import Image from spinalcordtoolbox.utils.sys import sct_dir_lo...
fb6823a582397bed9e30b23eb8da47c19cde9e7bb965d1a884f3a911180f4479
Python
5,110
95
NEO4J_TEST_CONNECTION = """MATCH (n) RETURN count(n) as count""" # create NEO4J_CREATE_DOCUMENT_NODE_RETURN_ID = """ CYPHER 3.5 CREATE (node { }) RETURN ID(node) as ID""" NEO4J_CREATE_NODE_SET_PART = "SET node.`{attr_name}` = {{`{attr_name}`}}" NEO4J_CREATE_NODE_SET_PART_MERGE_ATTR = "SET node.`{attr_name}` = (CASE WH...
f44061fd6cae94e21b8d98747d2a706f29c4e663d1576edde5d4cb1b0a9a4cd2
Python
5,113
113
# # measure the localling decoding performance on different data. Run generate_processed_exp_data.py first. Requires run lca_upper_bound.py and generate_processed_exp_data.py first import numpy as np import matplotlib.pyplot as plt import hickle as hkl import os from sklearn.linear_model import LogisticRegression from ...
b59e620848b39d916cf0411f8046503caf4b762de10b2a3ad374967fc27dbd79
Python
5,114
128
# Copyright (c) OpenMMLab. All rights reserved. from typing import List, Optional, Union import numpy as np import torch import torch.nn.functional as F from .typing_utils import SampleList def add_prefix(inputs, prefix): """Add prefix for dict. Args: inputs (dict): The input dict with str keys. ...
072711f88ee556b2492601eab95776cfffd9fe4ca79c8977410fa3b5f7f8daa5
Python
5,115
116
#!/usr/bin/env python2.7 import os import argparse import subprocess as sp import multiprocessing as mp import shlex import datetime import re import chisel src = os.path.dirname(chisel.__file__) from ..Utils import * def parse_args(): description = "CHISEL command to re-run the inference of allele- and haplot...
96d23b519c37edb5275b135d0d86ec4bf104039737a7fa7f2d4f4a4123146c61
Python
5,117
143
# Copyright (c) OpenMMLab. All rights reserved. import argparse import datetime import json import os import os.path as osp from collections import OrderedDict from utils import load_config # automatically collect all the results # The structure of the directory: # ├── work-dir # │ ├── config_1 # │ │...
913137914bfd5d2816bd79f1470ad5f953e8abde9db582114ba29862e7cee15c
Python
5,119
168
#!/usr/bin/env python3 # # Figure 2: All data, sorted from low to high, no correlations # import sys import matplotlib import matplotlib.pyplot as plt import numpy as np import base # Sigma multiplier to get 90-th percentile s90 = 1.6448536269514729 # Include Oocytes or not nooocytes = True # Gather data print('Ga...
6a48e6caa655c3545eca53bb468826f752c9096625cedc5815ecd8c2fa06fdee
Python
5,122
116
"""Tabulate MONDO's ``oboInOwl:hasDbXref`` target namespaces against what Babel actually ingests. Babel builds MONDO's concords from ``skos:exactMatch``/``closeMatch`` only, with one deliberate exception (``MONDO_GARD``). This script regenerates the evidence table in ``docs/sources/MONDO/README.md``: for every namespa...
c49a51d4ce21a4ae38e142f683bef39ea62c9959321e32abab9dbae70bfe225f
Python
5,122
155
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os.path as osp import nibabel as nib import numpy as np from mmengine.utils import mkdir_or_exist from PIL import Image def read_files_from_txt(txt_path): with open(txt_path) as f: files = f.readlines() files = [file.strip() for f...
08e32444e5c3b6bc9bd6422ccf63d50591e947784d2f51cbba69d6a223513950
Python
5,123
155
import os import tempfile import threading import unittest from sqlmodel import Session, create_engine, select from DiastereomericResolutions.Helper_funs.job_db import ( Job, complete_job, create_md_db, get_job, register_worker, ) from DiastereomericResolutions.Molecular_dynamics.md_config import ...
314b10d53348d2055a663fabefb7e2dde5accccb78599a3dee8fbf14dfd91940
Python
5,124
172
import typer from typing import Optional import medperf.config as config from medperf.decorators import clean_except from medperf.commands.view import EntityView from medperf.entities.execution import Execution from medperf.commands.list import EntityList from medperf.commands.execution.create import BenchmarkExecutio...
9b5a4192d030c0b5ccb8ac3de6f572b03cef219f5ed49e76f01fd87851b111a7
Python
5,124
145
from itertools import product import os import itertools from bdpy.dataform import Features, DecodedFeatures from bdpy.evals.metrics import profile_correlation, pattern_correlation import hdf5storage import numpy as np import pandas as pd # Main ####################################################################### ...
bbd05f25ad9812c445995d2797f5b3287f3522b2a30ebc309a73c8336353ff84
Python
5,124
152
import torch import torch.nn as nn def mask_zero(mask, value): return torch.where(mask, value, torch.zeros_like(value)) class DistanceToBins(nn.Module): def __init__(self, dist_min=0.0, dist_max=20.0, num_bins=64, use_onehot=False): super().__init__() self.dist_min = dist_min self.d...
ccc71619fdc48574cd994a3c01ef24c35051f388f8f797bda8cb9715406143f2
Python
5,130
173
""" 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 ..initializers import he_orthogonal_init class EfficientInteractionDownProjection(torch.nn.Module): """...
03686393f4828ff4e51ffc38b16f9325e400b8fbb6c8c05ad004058df3aed794
Python
5,131
198
# Author: Huaxu Yu # Evaluate feature quality by chromatographic peak shapes, mz errors, rt errors, etc. # imports import numpy as np from numpy import dot """ Functions ------------------------------------------------------------------------------------------------------------------------ """ def calculate_gaussia...
44bda2091f19a443b4338e3a08918551cc94db6048ac31a4d2c8333a30cc6925
Python
5,144
149
# -*- coding: utf-8 -*- # tests/test_non_backbone_atoms.py ################################################################################ # EncoderMap: A python library for dimensionality reduction. # # Copyright 2019-2024 University of Konstanz and the Authors # # Authors: # Kevin Sawade, Tobias Lemke # # Encodermap...
f6d507c5f5a14559a2d30981cbd0d2dfeadde25ed0fb90fd02cb37114173fefd
Python
5,148
103
import statistics import surrogateTraining from surrogateParams import surrParams import weightAnalysis import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec import numpy as np def makeMultiHiddenSpikePlot(x_spikes, y_spikes, indices, tag, fileName = 'hiddenDataSpikes.png', plotdir='.', dim=(3,5)): ...
08aa3243d6ac81049945419734b54000826da3c77467b6770aab29c36b26e66e
Python
5,151
91
from src.circuit import create_exc_neurons,create_inh_connections from src.stimulus import create_experimental_stimulus from pyrates.frontend import CircuitTemplate import argparse def main(args): # Print parameters params = vars(args) f = open(f'{args.outdir}/parameters.txt','w') for p in params.keys(): line =...
980c4fda57bd6ab9eac8f358712eea432e133415d3c33a4f1267dd35c4c2c9bf
Python
5,151
150
""" 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 TYPE_CHECKING, Optional, Union import numpy as np import pytest from syrupy.extensions.amber import AmberSnapshotExtensio...
a474b27ce5b5e3210f5eed9041b3c1ebf360d0d2556de97ad1d2f92fddc565b9
Python
5,154
155
from typing import List import numpy as np import pandas as pd import pytest from xgboost import testing as tm pytestmark = [pytest.mark.skipif(**tm.no_spark())] from xgboost import DMatrix, QuantileDMatrix from xgboost.spark.data import ( _read_csr_matrix_from_unwrapped_spark_vec, alias, create_dmatrix...
d9ff92180c213b3571cec57d235d5a1766b0db83ef8fc5aef152b010ef2231b5
Python
5,154
133
import sys import typer import logging import logging.handlers from medperf import __version__ import medperf.config as config from medperf.decorators import clean_except, add_inline_parameters from medperf.commands.execution import execution from medperf.commands.execution.create import BenchmarkExecution from medper...
ea69dc025ba1e2d71f853e07db9c94f37fa5be12beb298f5a7594fb89ef27ce9
Python
5,155
159
import logging import os import ase.io as ase_io import numpy as np import torch from simgen.element_swapping import SwappingAtomicNumberTable from simgen.generation_utils import calculate_restorative_force_strength from simgen.integrators import IntegrationParameters from simgen.manifolds import MultivariateGaussian...
197ffa30b819d6b35feae930fa52495ed98d775c77a671638e302ecd77869365
Python
5,158
142
import warnings from typing import Iterator, List, Optional import torch from torch.utils.data import Dataset, RandomSampler from torch.utils.data.sampler import Sampler, BatchSampler from torch.utils.data.distributed import DistributedSampler class DynamicBatchSampler(Sampler): r"""Dynamically adds samples to ...
0eacbadb5100658043e2d23220e3e370d21bd63b0ffe4edc8d31b418153be285
Python
5,161
167
#!/usr/bin/env python """ MetaWIBELE: combine_gene_sequences module Combine genes sequences from different samples 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 d...
eb1c1fff7b82a18c2b7e0b06d525d1997c1bf7ae12cc54072f1b6ce9c8807075
Python
5,162
123
from PyQt5 import QtCore, QtWidgets, QtGui import quantities as pq import numpy as np class ABFLoaderDialog(QtWidgets.QDialog): def __init__(self, parent, abf): QtWidgets.QDialog.__init__(self, parent, flags = QtCore.Qt.WindowTitleHint | QtCore.Qt.WindowCloseButtonHint) self.setWindowT...
4da15e292de8b34738c028ab56c276facc38fb982f2518f61d85423e29f166d3
Python
5,164
149
"""MLCube handler file""" import typer from collaborator import start_collaborator, check_connectivity from aggregator import start_aggregator from plan import generate_plan from hooks import ( aggregator_pre_training_hook, aggregator_post_training_hook, collaborator_pre_training_hook, collaborator_pos...
dd38d536fff6d8a2405c030eebe118a87c34faf6c5c140b4e99c503617e163fb
Python
5,164
129
## The following code contains work of the United States Government and is not subject to domestic copyright protection under 17 USC § 105. ## Additionally, we waive copyright and related rights in the utilized code worldwide through the CC0 1.0 Universal public domain dedication. from ipaddress import IPv4Address, ip_...
2b91a6aedf8f372516f0357c85940b2fcab352bd2eadbfcde2687d14fd53f9a1
Python
5,165
137
#!/usr/bin/env python # -*- coding: utf-8 -*- """ R5-Helicon Neural Simulation This script runs simulations of coupled R5 and Helicon neuron populations under different time-of-day conditions (morning and night). """ import argparse import os import numpy as np from brian2 import * # Import local modules from R5_He...
67a5c1dc15b4d023aba4a83b1c1473b6c74f563b744d8ae7ade9edb5e6e25228
Python
5,166
131
import bitsandbytes as bnb import torch from transformers import AutoModelForCausalLM, AutoTokenizer, BitsAndBytesConfig import random import sys import json # sys.path.append("/home/aoboyang/local/captum") from captum.attr import ( FeatureAblation, ShapleyValues, LayerIntegratedGradients, LLMAttribu...
6112b93cda6e14a36021450da1f4717ab73724f723b677e0bac73eefbe90f612
Python
5,167
120
import os from json import JSONDecodeError from string import Template from time import sleep from urllib.error import HTTPError from SPARQLWrapper import JSON, POST, POSTDIRECTLY, SPARQLWrapper2 from src.babel_utils import get_user_agent from src.util import get_config, get_logger logger = get_logger(__name__) cl...
a78d36b2c5c2dec3dc5e480b5f2c64f1af234cbe67d4610147fb658521bd0e06
Python
5,168
147
#!/usr/bin/env python import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from utils import Variable device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') class MultiGRU(nn.Module): """ Implements a three layer GRU cell including an embedding layer and...
640dd681b749f4eab29305a3a0cfec52285abaec9355768bd7eb635989416b8c
Python
5,173
147
"""MLCube handler file""" import typer from collaborator import start_collaborator, check_connectivity from aggregator import start_aggregator from plan import generate_plan from hooks import ( aggregator_pre_training_hook, aggregator_post_training_hook, collaborator_pre_training_hook, collaborator_pos...
9735596237d6245506a1fa29c55ab703772ee68b1f1d79a5453fce4419a15d84
Python
5,173
191
import sys import re import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import deepxde as dde from pathlib import Path from parameters import N, beta, sigma, S0, I0, R0 sns.set_theme(style="whitegrid") def dinn( data_observed, parameters, hyperparameters, e...
6179eebc285889f1e226dcc4249767ba86460dd4653f5fa4458a03f8ea39028a
Python
5,177
155
from tqdm import tqdm import pandas as pd import argparse from rdkit import Chem # suppress rdkit warning from rdkit import RDLogger RDLogger.DisableLog('rdApp.*') from rdkit.Chem import AllChem from rdkit.Chem.Draw import rdDepictor ''' preprocess: 1. remove the invalid 3d conformer 2. remove the molecules with...
703a399a7b693403858fc481ef6669dd501b29c6a58832e9b9252bdc8a5806bb
Python
5,177
155
# MagellanMapper logging """Logging utilities.""" import logging from logging import handlers import pathlib class LogWriter: """File-like object to write standard output to logging functions. Attributes: fn_logging (func): Logging function buffer (list[str]): String buffer. """...
80bfedc5f0a279126d9e98031ca6781682db7b12e606e5d85dfad01ed44e1181
Python
5,179
147
#!/usr/bin/env python import numpy as np import torch import torch.nn as nn import torch.nn.functional as F from MCMG_utils.utils import Variable device = torch.device('cuda:0' if torch.cuda.is_available() else 'cpu') class MultiGRU(nn.Module): """ Implements a three layer GRU cell including an embedding layer...
6bb0e95914032ae5bef40fa22822308bfd056951e99f9252731d0e33a1e276c7
Python
5,181
125
# coding=utf-8 # 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 compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless re...
2e7d13103b12ba546657dc8776706b99c69b7f923675e02553394dc6622b7264
Python
5,182
192
# 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...
3b1e9c5ca9f68be29e4952b2cd94aa78bb68f387a0bdf359d91b8e0f92ab4bfe
Python
5,183
164
import csv from functools import partial from pathlib import Path import tensorflow as tf from tensorflow.keras.applications.resnet import preprocess_input from tensorflow.keras.layers.experimental.preprocessing import Resizing AUTOTUNE = tf.data.experimental.AUTOTUNE @tf.function def preprocess_input_fn(data, prep...