sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
78c7638a1d6f2c9e0bc3972f37f89e3520df7b8f96a7090de58e93dc4d0eee7e
Python
5,922
196
""" 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 from typing import Optional import torch from ocpmodels.common.utils import scatter_det from ocpmodels.modules.scaling import Sc...
21a29a324df74964346f6e1607f2bcc66f6e28cacc22195437d330fff76b50cd
Python
5,925
155
import matplotlib.pyplot as plt import sys import pyspike as spk import pandas as pd import numpy as np import os import math import matplotlib.pyplot as plt import seaborn as sns ac_spks = pd.read_pickle('ic_spks_full.pkl') freq_ls = [1000., 1500., 2000., 3000., 4000., 6000., 8000., 12000., 16000., 2000...
308b0be8b3b3f021b3d1ca74566d1ffd39777c829e4dc49d5fa569191ee363db
Python
5,927
223
import os import pytest from medperf.entities.benchmark import Benchmark from medperf.entities.cube import Cube from medperf.entities.dataset import Dataset from medperf.entities.execution import Execution from medperf.tests.entities.utils import ( setup_benchmark_fs, setup_benchmark_comms, setup_cube_fs, ...
5707267467f799270a1f4df6eb862739b82dff24f08c32e485547453d8c70acb
Python
5,928
181
import argparse import os import re import sys from typing import TextIO import cpplint from cpplint import _cpplint_state CXX_SUFFIX = set(["cc", "c", "cpp", "h", "cu", "hpp"]) def filepath_enumerate(paths: list[str]) -> list[str]: """Enumerate the file paths of all subfiles of the list of paths""" out = [...
5f5e337af50bc7bfdf98fa26633013dece0d9635a0173f12ab0f8791d4a0be8a
Python
5,929
155
import matplotlib.pyplot as plt import sys import pyspike as spk import pandas as pd import numpy as np import os import math import matplotlib.pyplot as plt import seaborn as sns ac_spks = pd.read_pickle('acx_spks_full.pkl') freq_ls = [1000., 1500., 2000., 3000., 4000., 6000., 8000., 12000., 16000., 200...
9f8fe611e7800bfd2a651fc976ba9c533f806b2528b0d0681e79e68b538c4d5d
Python
5,930
191
"""Demonstrates active learning molecular dynamics with constant temperature.""" import argparse import os import time import ase.io import numpy as np from ase import units from ase.md.langevin import Langevin from ase.md.velocitydistribution import MaxwellBoltzmannDistribution from mace.calculators.mace import MAC...
22cdfcea62c14e0bd2a481ac33e91fc9541cdcfd376fa88a01b4eadc73f2591b
Python
5,932
159
import logging from pathlib import Path from sys import stdout from openff.interchange import Interchange from openff.toolkit import Molecule from openff.toolkit.typing.engines.smirnoff import ForceField from openff.toolkit.utils.exceptions import UndefinedStereochemistryError from openmm import System, app, unit from...
a778be00d67c393c5a62869e7acfb7bd9b6568ba7bfaff8522105b7bbc575c31
Python
5,933
181
#!/usr/bin/env python # coding: utf-8 import os.path as op import random import time import matplotlib.pyplot as plt import numpy import sklearn import torch import torch.nn.functional as nn_func from sklearn import preprocessing from sklearn.metrics import adjusted_rand_score from torch.nn import Linear from torch_g...
c3951356dae68561e0bd54da8f3df1680eefba6b85e43c3637da2bcaf14c4f3b
Python
5,933
105
import os import pickle as pkl import shutil from src.nnunet_v1 import train_nnunet from nnunet.paths import default_plans_identifier def train_on_task(task, network, network_trainer, fold, cuda_device, plans_identifier, continue_training=False, current_epoch=0): os.environ['CUDA_VISIBLE_DEVICES']=cuda_device ...
c1fd431e511eb461239e9c8371436cfa8c6a2d0a84b503fa496940e050465372
Python
5,937
156
# Copyright (c) OpenMMLab. All rights reserved. import argparse import glob import math import os import os.path as osp import tempfile import zipfile import mmcv import numpy as np from mmengine.utils import ProgressBar, mkdir_or_exist def parse_args(): parser = argparse.ArgumentParser( description='Con...
857150dc46cf76c1df0c07c255ac0eafe41affeeba9573c8caa442710c45d537
Python
5,941
214
import re import typer from getpass import getpass from yaspin import yaspin from contextlib import contextmanager from .interface import UI class CLI(UI): def __init__(self): self.spinner = yaspin(color="green") self.is_interactive = False self.is_parsed_output = False def print_url...
e221fb4903c26abb1d3f132c2d26d649002c3c9b1bbec239ca8e51d82b7b35fc
Python
5,944
228
import numpy as np import pandas as pd from tqdm import tqdm import time import matplotlib.pyplot as plt import py4DSTEM # import seaborn as sns from bayes_opt import BayesianOptimization print(py4DSTEM.__version__) n_dim = 8 init_points=20 n_iter=4000 dataset = py4DSTEM.read("ptycho_Si-110_18nm.h5") dataset.calibr...
ca3eb54db8f9cdf02e6d99328d07b971471e71c5d502c577082d55c3334f3d22
Python
5,945
185
import pytest import os import base64 from medperf.commands.certificate.utils import ( current_user_certificate_status, check_matching_certificates, load_user_private_key, ) from medperf.tests.mocks.certificate import TestCertificate from medperf import config from medperf.enums import CryptoKeyType PATCH_...
4f4fd9e325cc73b2c9c606652cc85c2b30993eb1ba6f896d11079c26929f459d
Python
5,946
167
# -*- coding: utf-8 -*- import tensorflow as tf import numpy as np import pandas as pd from scipy.spatial import distance_matrix from qtools.encoding import onehot_encoding #https://github.com/keras-team/keras/pull/10856 #puts four identical models besides each other and concatenates the output. class quartetm...
d9ec23a2d0c2ec0184dad2cf3621c63278e2ca619ef857b244b1e87c8d2c5368
Python
5,946
141
# The following code is modified based on https://github.com/pytorch/text/blob/master/torchtext/vocab.py import array import zipfile from tqdm import tqdm from six.moves.urllib.request import urlretrieve import os import os.path as osp import torch import io def reporthook(t): """https://github.com/tqdm/tqdm""" ...
6a18d68817b95d36f33a4264627338301dfe7c6f2159de89b846e4e9ce6ddf2a
Python
5,950
193
#!/usr/bin/env python3 """ Aggregate unblinding analysis for the CICADA smoothing blinded-review packet. Reads: * BLINDED_SCORING.csv * PRIVATE_UNBLINDING_KEY.csv Prints ONLY aggregate results by default. It does not print subject IDs, task names, or IC numbers. All inputs/outputs remain PRIVATE human-subject-de...
867bd85217b95685a890a68b1a148717db0ea4bd4fda0d526466b9132b64a5ab
Python
5,950
171
""" Functions for building libxgboost """ import logging import os import pathlib import shutil import subprocess import sys from platform import system from typing import Optional from .build_config import BuildConfiguration def _lib_name() -> str: """Return platform dependent shared object name.""" if sys...
10d4df585e03dc1442e07f73f3f1d63eee02a0befff751c9c3450fa512032c20
Python
5,953
195
# -*- coding: utf-8 -*- # @Author: Theo Lemaire # @Date: 2023-08-17 16:10:10 # @Last Modified by: Theo Lemaire # @Last Modified time: 2024-10-20 15:00:50 ''' General utility functions. ''' import os import numpy as np import pandas as pd from scipy.interpolate import interp1d import datetime import matplotlib.bac...
ce64eab1e51e4ec0387b4095736504fe9b2e9ef99fdea16b74cedf8ad5cee49c
Python
5,953
127
import pytest from CybORG import CybORG from CybORG.Shared.Session import Session from CybORG.Simulator.Scenarios.EnterpriseScenarioGenerator import EnterpriseScenarioGenerator from CybORG.Agents.SimpleAgents.ConstantAgent import SleepAgent from CybORG.Simulator.Actions.ConcreteActions.RemoveOtherSessions import Remov...
17ab23c98ad012685a53df46c86cb074ed4aabc688fd931b5d775bb22ee1a523
Python
5,955
157
import sys import shutil import os import math import numpy as np from cloudvolume import CloudVolume from cloudvolume.exceptions import EmptyVolumeException import logging import argparse from PIL import Image import pathlib2 as pathlib from tqdm import tqdm import imageio logging.basicConfig(level=logging.INFO) logg...
c398596627c37617d1ee87b4222f617eaab22b95f61a53d997f4d30ecb7aae9d
Python
5,955
140
import torch import pandas as pd from sklearn.linear_model import LogisticRegression, LogisticRegression from sklearn.model_selection import cross_val_score, LeaveOneOut import numpy as np import os from tqdm import tqdm import sys features = ['sonority','manner','voicing','place'] def feature_decodability(state_dict...
64aaaf9ae4e41a56b223957116e5178de19181e97c6343ee405ec4c12d06a199
Python
5,957
166
import os import tempfile import numpy as np import pytest import xgboost as xgb from xgboost import testing as tm from xgboost.testing.continuation import run_training_continuation_model_output rng = np.random.RandomState(1337) class TestTrainingContinuation: num_parallel_tree = 3 def generate_parameters...
c9522b051ee81688f0da7c54c7e4159c953def2343f7639f52db194719ee0526
Python
5,960
178
# -*- coding: utf-8 -*- import json import logging from typing import List from urllib.request import Request, urlopen from urllib.error import HTTPError, URLError from django.conf import settings logger = logging.getLogger(__name__) def load_json(url): logger.debug("janelia_render.models.load_json: entry, ur...
b1445d088254892cdfe58deb79506d9fa397197c3f4b3800bfaaea0ad263eab3
Python
5,961
198
#*******************************************************# # Classes used as configuration files #*******************************************************# class datasetConfig: ''' Class for defining dataset parameters: shape, split ratio, augumentation etc. ''' ''' Imgs_png_home_path = Root direc...
8a159ee3ffbf8184e64099d48bc240c63dc868dcc8032e6d0d6087b80789adc6
Python
5,964
167
import torch from torch import nn from torch_geometric.nn import GCNConv, GATConv, HypergraphConv from torch_geometric.utils import add_self_loops from collections import OrderedDict import numpy as np class GCN(nn.Module): def __init__(self, in_features, depths, ...
fa54ca23a80c01941819af74cce2b54f3d648a36846d16a8df05ac32a819f95f
Python
5,967
171
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmseg.models.backbones.twins import (PCPVT, SVT, ConditionalPositionEncoding, LocallyGroupedSelfAttention) def test_pcpvt(): # Test normal input ...
5b373608ba4848df0ec5476bfdc409c00e46939a7df3fca9e6a892b36e6cc341
Python
5,971
133
"""What acquisition format a session holds, and what that implies for NWB export. Shared by Step 6 (which needs to know whether the user must supply a session start time) and Step 7 (which needs to tell the converter how to read the raw folder), so it lives apart from either step's orchestration. """ from .utils impo...
7f7dafe27bf0eec6befebe1e3e2738af931080560fe59b12c13c318e04440980
Python
5,972
155
import numpy as np from dataclasses import dataclass from typing import Union, Optional import torch @dataclass(frozen=True) class Flatten: def __call__(self, data: np.ndarray): return data.reshape(data.shape[0], -1) @dataclass(frozen=True) class TakeEventByTime: """Take events in a certain time inter...
f1835fd7cc6f399b03884698ede3600f465d15866277a3e0073e2886e4d124ff
Python
5,973
144
import shutil from pathlib import Path from unittest.mock import patch import holoviews as hv import pandas as pd import panel as pn import pytest from guppy.frontend.parameterized_plotter import ParameterizedPlotter from guppy.frontend.visualization_dashboard import VisualizationDashboard from guppy.testing.api impo...
0452eb6b069b44075c32b62a593ec5539609c911994ed07e8e5eacd7762da312
Python
5,981
128
# SPDX-License-Identifier: Apache-2.0 import mxnet as mx def Conv(**kwargs): body = mx.sym.Convolution(**kwargs) return body def Act(data, act_type, name): #ignore param act_type, set it in this function body = mx.sym.LeakyReLU(data = data, act_type='prelu', name = name) return body def get_fc1...
2c869be9943c46db5151fd240b90d157e25a1a83912a924bd2ab6a7cb5f4d4fb
Python
5,985
126
import os from pathlib import Path import moviepy.editor as mpy from matplotlib import pyplot as pl, colors from moviepy.video.io.bindings import mplfig_to_npimage def plot_kinematics(timeindex, motion, contraction_peaks: list, relaxation_peaks: list, file_name: Path, contraction_bases: dict = No...
64ae90d7e2e1b6627cd64e0ef521dd84801febdfc9e0934b9fca254fe38c8b66
Python
5,985
155
import shutil from pathlib import Path from unittest.mock import patch import h5py import holoviews as hv import numpy as np import pytest from guppy.frontend.visualization_dashboard import VisualizationDashboard from guppy.testing.api import locate_run_folder, step1, step2, step3, step4, step5 from guppy.utils.store...
3063a75667b07c9b00ee1891ab4d3a1f6fb2978dff589318b56350792926c785
Python
5,989
155
# -*- coding: utf-8 -*- from collections import defaultdict from django.http import JsonResponse import json from typing import Any, DefaultDict, Dict, List from urllib.request import Request, build_opener from urllib.error import HTTPError, URLError from catmaid.models import Stack # These DVID instance types are s...
c8b80374cd0ab5068688adb884ef64c71ca0a1be11d3101353f605f553e8f102
Python
5,992
167
# Copyright (c) OpenMMLab. All rights reserved. import argparse import gzip import os import os.path as osp import tarfile import tempfile import mmcv from mmengine.utils import mkdir_or_exist STARE_LEN = 20 TRAINING_LEN = 10 def un_gz(src, dst): g_file = gzip.GzipFile(src) with open(dst, 'wb+') as f: ...
5255d9ac471a23cc3cb1849b46014a0ed5589021248311afdd9849b8aa5c9893
Python
5,993
239
"""Built-in activation functions. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import six import warnings from . import backend as K from .utils.generic_utils import deserialize_keras_object from .engine import Layer def softmax(x, axis=-1): """...
a2c52ada7908d825f7ed4475b711cf993a35161de2783002b66ae72322592ee6
Python
5,993
194
import os import time import argparse from datasets import load_dataset # from auditory_cortex import cache_dir def is_not_speech_or_music(sample): """Returns true if 'speech' is not one of the labels.""" for label in sample['human_labels']: if 'speech' in label.lower() or 'music' in label.lower(): return Fals...
06fa61e8d77266820ff50d85f7a2da61e14d4c340db078bf9400e4a12187c839
Python
5,999
127
# SPDX-License-Identifier: Apache-2.0 import argparse import check_model from pathlib import Path import subprocess import sys import test_utils import os tar_ext_name = ".tar.gz" onnx_ext_name = ".onnx" def get_all_models(): model_list = [] for directory in ["text", "vision"]: for root, _, files i...
8f8eeec9bf6e2164eba9089a50f96003d3f73443101f2e03c3494e378621894a
Python
5,999
180
#!/usr/bin/env python # # Copyright 2008, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
c7c10c697d155414c92f2f8e52dd111dc5221e29c94f5b5844c6794e19625460
Python
6,000
168
import os from medperf import config from medperf.account_management.account_management import get_medperf_user_data from medperf.entities.ca import CA from medperf.entities.event import TrainingEvent from medperf.exceptions import ( CleanExit, ExecutionError, InvalidArgumentError, MedperfException, ) f...
e43b685d7916f357e4298d44e7bac5d09af61906966f313e145e39289121d19d
Python
6,000
185
"""Tests for create_hoc.py""" # pylint: disable=W0212 import os from bluepyopt.ephys.acc import ArbLabel from bluepyopt.ephys.locations import NrnSomaDistanceCompLocation from bluepyopt.ephys.parameterscalers import NrnSegmentSomaDistanceScaler from bluepyopt.ephys.parameterscalers import NrnSegmentSomaDistanceStepS...
7b89f42ecff0f6ade8dc20c117d96a02e1aa9a4624104ccdce351dee24011b05
Python
6,004
171
from ipaddress import IPv4Address from CybORG.Shared import Observation from CybORG.Shared.Session import RedAbstractSession from CybORG.Simulator.Actions import RemoteAction from CybORG.Simulator.Actions.ConcreteActions.Portscan import Portscan class DiscoverNetworkServices(RemoteAction): """ A high level R...
c83b91e0dfac5af77de28951c647f411aa2e9b4ee0ee22f703615d4e344bab5d
Python
6,005
157
# -*- coding: utf-8 -*- # Generated by Django 1.11.14 on 2018-07-20 14:27 import logging from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.db import migrations, models import django.db.models.deletion import django.utils.timezone from catmaid.apps import get_system_u...
24f1175e33a9a728f09f2bd57366836e01ac0d977f3bddad489293eaabb69f4a
Python
6,006
181
#!/usr/bin/env python # # Compute TSNR using inputed anat.nii.gz and fmri.nii.gz files. # # Copyright (c) 2014 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE import sys import os from typing import Sequence import numpy as np from spinalcordtoolbox.image import Image, add_suffix, empty...
234fea75488ed2b875428e653d3b40def75664fa6f9ea7af207abd98bbedcecb
Python
6,011
173
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Plotting subroutines """ from nilearn import plotting import matplotlib.pyplot as plt from matplotlib import gridspec, cm import numpy as np import os from neuromaps.datasets import fetch_atlas surfaces = ['fsaverage', 'fsLR'] def vrange(scalars, pv=5.): # check...
3d221f75d68e8023790c776c2418592308a460a457c6be78922ab8b73e65172a
Python
6,019
164
#!/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, ...
aa25c58dd60bbbf0088a33242f2ba8b4aad8738a63bc3e3bed07ca2167a5cf15
Python
6,027
185
# Standard library imports import os import random from collections import defaultdict from io import StringIO from typing import Dict, List, Tuple from pathlib import Path from Bio import SeqIO import sys import math import time # Third-party library imports import matplotlib.pyplot as plt import numpy as np import t...
733c0c1103c73b39a949176b012ed05d21165cb9885fb86bc456e9058e08fb5e
Python
6,028
180
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jun 7 09:37:11 2021 Inport and export data handler @author: leupinv Helper functions for working with directories and subdirectories """ #%% Scan directories and sub directories import os import mne import time def filter_list(list_,value): filt...
bbc4fc7cc99ab40686e0b7d377b4664234c4b7f4f24cbfe3c7c0b5d68107fd46
Python
6,033
170
""" 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 logging import torch.optim as optim from torch.nn.parallel.distributed import DistributedDataParallel from ocpmodels.common import d...
c474860eec75fd33df783f5a9b616eebedbb4b3393fac8478bc0182152a67299
Python
6,034
136
import numpy as np import tensorflow as tf import time import datetime import os import sys import h5py from pathlib import Path import evidential_deep_learning as edl from .util import normalize, gallery class Gaussian: def __init__(self, model, opts, dataset="", learning_rate=1e-3, tag=""): self.loss_fu...
9bbe1edb91371fd6d94ae67982fac522e465ca2d995b36a7d73708d568dde0ec
Python
6,035
166
"""This script runs a comparison in terms of similarity on the sbml-test-suite for increaising functionality""" import os import pandas as pd import datetime from jaxkineticmodel.load_sbml.sbml_model import SBMLModel import jax.numpy as jnp from jaxkineticmodel.utils import get_logger import numpy as np import roadru...
48dad4a97c2589e742536a7c49c4b9288732a71d3fab6e25000f02cb84283c92
Python
6,037
195
"""Testing conversion with conversion saved on datalad""" from __future__ import annotations from glob import glob import os import os.path as op from pathlib import Path import re from typing import Optional import pydicom as dcm import pytest from heudiconv.cli.run import main as runner from heudiconv.parser impo...
7c5fd28b81a86574637753be74ec30fa95cbe3d3bf760043f91caa33317b95f4
Python
6,037
136
"""Unit tests for detecting a Cloudflare bot-challenge response during download. HMDB (and possibly other sources later) now fronts its download URL with a Cloudflare challenge page instead of a plain 403 -- see docs at https://developers.cloudflare.com/cloudflare-challenges/challenge-types/challenge-pages/detect-resp...
b30b97c02419e674f73ab10bcb875af543e4c38f3fa37729a724cd3636c636a2
Python
6,037
180
import numpy as np import os import random import time import torch from os import path as osp from .dist_util import master_only from .logger import get_root_logger def set_random_seed(seed): """Set random seeds.""" random.seed(seed) np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual...
7a119c99b55c76f44712f19daab0e07863a41c7545570040b1232d6dd73e4399
Python
6,038
202
"""Shared fixtures and test extensions for worker E2E tests.""" import threading from collections.abc import Callable from pathlib import Path from typing import Any, ClassVar import ase import ase.io import pytest from zndraw import ZnDraw from zndraw_joblib.client import Category, Extension from zndraw_joblib.sche...
c8d1f05218a89a552af3c44a4e833dbf974ab3f2abc63a54013255137c368a62
Python
6,040
146
import pandas as pd import numpy as np import math from primo.models.simulator import Simulator #Predicted Cas9 Activity def get_activation_score(seq1, seq2): """ Given two DNA sequences of length 20, Returns a float between 0 and 1 of the Cas9 activity between them if one were gRNA and one were the DNA se...
304e42779165930da15efa84328438b4b2da713d43a95eecf0ed48387418f2ed
Python
6,042
168
#-*- coding: utf-8 -*- #setting############################################## n_jobs=16 #並列処理の数 t_n_jobs=16 PARAMETER_DIR='/Volumes/Siena/CP/parameter' #n_jobs=40 #並列処理の数 #t_n_jobs='cuda' #PARAMETER_DIR='/home/takeiyuuichi/Dropbox (MEG)/CP/parameter' set_environment='main' SET_EVENTID=[2,3] event_id = dict(control=2...
f38b2de39e4d6d47c0e893f033aeb8a395119dc6c51f0387853dd9a1a78121cd
Python
6,045
155
from dataclasses import dataclass, field from typing import Any, Dict, List, Optional, Union import os import sys sys.path.remove(os.path.abspath(os.path.dirname(sys.argv[0]))) import numpy as np import torch import torch.nn as nn from datasets import load_dataset from peft import LoraConfig, TaskType, get_peft_model ...
66c97b0e0610e1979dfa60fa98dfab9c223330c0198bce4c6c5f1dbc671b4b02
Python
6,046
173
import sys sys.path.append("/tudelft.net/staff-bulk/ewi/insy/DBL/plent/NeuralODEs/jax_neural_odes") sys.path.append("/home/plent/Documenten/Gitlab/NeuralODEs/jax_neural_odes") 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_...
6f741dda1f556e0b002eab28ac36b627d9bc396cbb6b96fc7bef362a2a8e48ed
Python
6,048
175
#!/usr/bin/env python """ MetaWIBELE: prepare_domain_databases module Extract the Pfam name for each Pfam item 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...
bbabada2b794f290632dc6cf8611cc3f4f1b46161b046d5fb62d572b3b935003
Python
6,048
177
"""E2E tests for #906 — global extension cleanup after worker disconnect. Covers the two acceptance criteria: 1. After ``jobs.disconnect()``, ``GET /v1/joblib/rooms/@global/jobs`` no longer includes the extension (graceful path). 2. After SIGKILL, the background sweeper removes the extension within ``worker_tim...
0ef456677ba1e7b02ad63ff629b3af65120cf94d5eb58a3703eb0ff293c5fde9
Python
6,055
227
"""Unified state file for server registry and token storage. Replaces separate PID files (~/.zndraw/server-{port}.pid) and tokens.json with a single ~/.zndraw/state.json (mode 0600). All writes use tempfile + os.rename for atomicity. """ from __future__ import annotations import contextlib import json import loggin...
12bf1806740645dc05a3c6d72d2f7c74127c3c838e7168cb431f0976fb713c6f
Python
6,055
132
import os import torch import torchvision # from tensorboardX import SummaryWriter import numpy as np from PIL import Image import shutil import torch.nn as nn import logging # tensor to PIL Image from optimizer import logger def tensor2img(img): img = img.cpu().float().numpy() if img.shape[0...
78982587d33cf8966c2856ceabffdd2e09e169fb3dd5472e8f1743d4d83aaf20
Python
6,055
166
from ..common import ut, make_name import h5py as h5 import numpy as np class TestVirtualSource(ut.TestCase): def test_full_slice(self): dataset = h5.VirtualSource('test','test',(20,30,30)) sliced = dataset[:,:,:] self.assertEqual(dataset.shape,sliced.shape) # def test_full_slice_inve...
2cb930f9ef2417fe4405a2a0dc0535828f60a661676cfd153780a98f3afd0af5
Python
6,056
175
import torch.nn from torch import nn as nn import numpy as np class ResHetEncoder(torch.nn.Module): def __init__(self, box_size, latent_dim): super().__init__() # call of torch.nn.Module # self.down = nn.AvgPool2d(2,stride = 2) self.lin1 = nn.Linear(in_features=box_size ** 2, out_feature...
7768c56d398475b9adf3e681c467dc0cf7ae42305b58c6a1733b006c9a11c0f5
Python
6,058
186
"""FastAPI-Users configuration and exported dependencies. This module exports the key dependencies that other packages should import: - current_active_user: Depends() for authenticated active user - current_superuser: Depends() for authenticated superuser - fastapi_users: The FastAPIUsers instance for including router...
1c4a7abc4d29af44e05d9dca03b6faaaf25f20616cb5b84dcb7347a4c25a7fd8
Python
6,061
168
#-*- coding: utf-8 -*- #setting############################################## n_jobs=16 #並列処理の数 t_n_jobs=16 PARAMETER_DIR='/Volumes/Siena/CP/parameter/' #n_jobs=40 #並列処理の数 #t_n_jobs='cuda' #PARAMETER_DIR='/home/takeiyuuichi/Dropbox (MEG)/CP/parameter' set_environment='main' SET_EVENTID=[2,3] event_id = dict(control=...
1c563f879b9d0bde2ae93a33d2fe3fb31e5d3d6278824e7753c4922aa6be269e
Python
6,062
136
#!/usr/bin/env python2.7 import os, sys import shlex import argparse import subprocess as sp from multiprocessing import Lock, Value, Pool from collections import defaultdict from Utils import * def parse_args(): description = "Cell-specific allele counting for a given list of point mutations." #which must be ...
540a5665eaa17123c33350a8b626ccea42561a91725f23d5dc5a9f6044e8b6d6
Python
6,062
153
# Profile settings # Author: David Young, 2019, 2020 """Profile settings for grid search hyperparameter tuning.""" from collections import OrderedDict import dataclasses from typing import Dict, List, Sequence import numpy as np from magmap.settings import profiles def make_hyperparm_arr(start, stop, num_steps, nu...
63051f9a7c7a82734855347b20279ea686661fbf08070f7961b3a9d0dbf303d7
Python
6,064
185
# Copyright (c) OpenMMLab. All rights reserved. import argparse import numpy as np import torch import torch._C import torch.serialization from mmengine import Config from mmengine.runner import load_checkpoint from torch import nn from mmseg.models import build_segmentor torch.manual_seed(3) def digit_version(ver...
1e683f111af17731b48caff4d820a2a33469b7fd7244a8fd0c49b6d559acc0de
Python
6,073
156
#!/usr/bin/env python """ MetaWIBELE: combine_abundance_annotation module Combine abundance details to specific features 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")...
1ee55896063fb5866d60704d98416def7fc8cd13ff80e8033e332345ea91fbfc
Python
6,075
186
''' Demo for creating customized multi-class objective function =========================================================== This demo is only applicable after (excluding) XGBoost 1.0.0, as before this version XGBoost returns transformed prediction for multi-class objective function. More details in comments. See :do...
41ec61dd2a4e72a529c6dc4a921a9f6aee94a526e005738d597d4721bbc6152b
Python
6,076
157
import tensorflow.keras as keras import tensorflow as tf import numpy as np import time from utils.utils import save_logs from utils.utils import calculate_metrics from utils.utils import save_test_duration class Classifier_INCEPTION: def __init__(self, output_directory, input_shape, nb_classes, verbose=False, ...
81708aa8d44390e0566a9378ffd83dc5ef88b71cb0fef961c6233a95dc0342cb
Python
6,076
181
import argparse import glob import math import os import os.path as osp import mmcv import numpy as np from mmengine.utils import ProgressBar, mkdir_or_exist def parse_args(): parser = argparse.ArgumentParser( description='Convert GID dataset to mmsegmentation format') parser.add_argument('dataset_im...
8b1d82bf323ce6819a7a998e279c17caf2fe606a51a82c494df0f0b0978807ff
Python
6,083
164
# 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...
d6eac22135c7a75767b8cf850a9ede163f8d025e7224803efa74d51988fd92f5
Python
6,084
134
import shutil from pathlib import Path import numpy as np import pandas as pd import pytest from guppy.analysis.io_utils import read_hdf5 from guppy.analysis.standard_io import read_binned_metrics_from_hdf5 from guppy.testing.api import step1, step2, step3, step4 from guppy.utils.utils import parse_run_name from gupp...
c44e4fb659f50d9db4fc6422312e8ec2303245020c28354efb911d5a0fab8e0e
Python
6,085
157
import torch import numpy as np from data import gen_data import os import deepxde as dde from modelGc import FourierDeepONet as Gc from modelGp import FourierDeepONet as Gp # ensure that the device is set to GPU or CPU device = torch.device("cuda" if torch.cuda.is_available() else "cpu") # load pretrained neural oper...
e4a50395ddfa7ac1b0daf0636a2f95927a6756e22e9c6570f0d7caa6058a47c8
Python
6,086
187
# -*- encoding: utf-8 -*- ''' Copyright 2022 The International Digital Economy Academy (IDEA). CCNL 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.o...
5830650fde536c0be35dbdc48fec0250fa3f3d50eb25ef314d83bdd8073bc406
Python
6,087
187
## ## CPCantalapiedra 2020 # This is an adaptation of ete3 NCBITaxa module # to embed it directly within eggnog-mapper import os import pickle import sqlite3 from ...emapperException import EmapperException from ...common import get_ncbitaxadb_file ncbi = None def get_ncbi(usemem = False, dbfile = None): globa...
b45989d0234970a9fd0de428fd5fe2e32cf2bf6856eec981da5ac9bb843a1dfd
Python
6,088
139
import numpy as np import tensorflow as tf import tensorflow_probability as tfp import time import datetime import os import sys import h5py from pathlib import Path import evidential_deep_learning as edl from .util import normalize, gallery class BBBP: def __init__(self, model, opts, dataset="", learning_rate=1e...
2a8b0199d12d25d0020b5d2fca6ac7918998b3d0ed2985ab53bbcb7c95ea8159
Python
6,090
140
#!/usr/bin/env python # # Copyright 2017, Daehwan Kim <infphilo@gmail.com> # # This file is part of HISAT-genotype. # # HISAT-genotype 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 Li...
e11527b644b4f2ef45229ad2f5cb0f5a2c26fdc05bffa3369e876c8559862337
Python
6,090
159
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. # pyre-strict import logging import os from typing import Any, Callable, Dict, IO, List, Union import yaml from iopath.common.file_io import g_pathmgr from yacs.config import CfgNode as _CfgNode BASE_KEY = "_BASE_" class CfgNode(_CfgNode): ...
3ace844af67795ca16aa6a6eb3d469881e3644a96118bc9c42884f24fd67b71e
Python
6,094
167
from dataclasses import dataclass, field import os import json import logging from argparse import Namespace from typing import List, Literal, Optional, Union from pydantic import AnyHttpUrl, BaseSettings, HttpUrl, validator, BaseModel CURRENT_DIR_PATH = os.path.dirname(os.path.abspath(__file__)) # request body # 使用...
79022578e9c3336ce342c6e9555513bab95196140604cd6b0b4458d1adcf2765
Python
6,095
162
import mne import sys, os from tqdm import tqdm from glob import glob import numpy as np import itertools import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # go to base directory and import globals base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) #ptmp_dir = "/ptmp/kroma/...
42fe9cad59aad703e6f1d64375401d65a7f5faf401db3db7413ace1ac59c53b5
Python
6,099
223
#!/usr/bin/env python3 """ Create blinded time-series and power-spectrum PNGs for CICADA IC review cases. This script works ONLY from the already-blinded Review_###_timeseries.txt files. It does not read the unblinding key and therefore does not expose subject, task, consensus label, historical CICADA label, or 11-mm ...
49e5f89f71e47041a7284a41bafd18b63d508e240d75cd17bb19b76aa67f06b6
Python
6,101
161
""" Parallel-specific integration tests for GuPPy. These tests exercise the multiprocessing code paths (Step 2 and Step 4) with ``number_of_cores=2``. They are kept separate from the main test suite so that the main suite can run under pytest-xdist (``-n auto``) without interference from nested worker pools. Run these...
4a0fc8def6ec00dffbdb744b6f5b0e0184bd3cb69d247b3a7a1c67829068db02
Python
6,103
196
#!/usr/bin/env python3 """ Rica Local Server - Serves tedana output for Rica visualization Usage: python rica_server.py [--port PORT] [--no-open] Options: --port PORT Port to serve on (default: 8000) --no-open Don't auto-open browser Place this script in your tedana output folder and run it to vi...
a8f7b62bfba1f5d1fa10e704a83f62f42d3bba9e4ac5a210046e3c0b53bb4d18
Python
6,104
194
import torch import torch.nn.functional as F from torch import nn from torch.nn.parameter import Parameter class var_norm(nn.Module): def __init__(self, num_features, eps=1e-3): super().__init__() self.num_features = num_features self.running_var = Parameter(torch.ones(num_features), requ...
2d67a0f4eac615454cddd6f3e05a86e80331ffa01c9261a3b5c9a44f6a24a679
Python
6,106
185
# Code adapted from https://github.com/Sage-Bionetworks-Challenges/brats-dream-challenge-infra/blob/main/Docker/score.py from pathlib import Path from typing import Dict, Union import re import yaml import os import subprocess from loguru import logger import numpy as np import pandas as pd from sklearn.metrics impor...
a4f09f4bfbca0bad07e184f5fe6e935515939f6d0d854ce149298c9a93d623f2
Python
6,109
168
from typing import Union import numpy as np from scipy.io.matlab import mio5_params # For mat_struct from abc import ABC, abstractmethod NEURAL_DATASETS_REGISTRY = {} def register_dataset(name: str): """ Decorator to register a neural dataset class. Args: name (str): name of the dataset to...
10ac44e93029b68321556a711f1746c609373e3ecc4bd1b31a7d535e34123e4c
Python
6,111
121
# pytest unit tests for sct_compute_ascor import pytest import logging import csv from spinalcordtoolbox.image import Image from spinalcordtoolbox.scripts import sct_compute_ascor, sct_crop_image, sct_deepseg, sct_label_utils from spinalcordtoolbox.utils.sys import sct_test_path logger = logging.getLogger(__name__) ...
0b3f9296140948d8d10de4fbbabdfa7274b5697eb682c74fee70b8eb660abba6
Python
6,112
163
# Copyright (c) OpenMMLab. All rights reserved. from typing import List, Tuple import torch import torch.nn as nn import torch.nn.functional as F from mmengine.model import BaseModule try: from mmdet.models.dense_heads import \ Mask2FormerHead as MMDET_Mask2FormerHead except ModuleNotFoundError: MMDET...
5b87e0fd1e2029e05eb8f027d04b2482f8a4eb6cbb1941d55db848329dc492e5
Python
6,112
177
# -*- coding: utf-8 -*- import pandas as pd import numpy as np from sklearn.model_selection import train_test_split from sklearn.model_selection import cross_val_score from sklearn.preprocessing import MinMaxScaler from sklearn.ensemble import RandomForestClassifier from sklearn.naive_bayes import GaussianNB from skle...
bb01a7382491b774d4f3b04d6f05596f714dfc6c9b04f5555fa066da77ea9bd7
Python
6,115
213
#!/usr/bin/env python # coding=utf-8 # Copyright 2023 Statistics and Machine Learning Research Group at HKUST. All rights reserved. """A simple shell chatbot implemented with lmflow APIs. """ import logging import json import os import sys sys.path.remove(os.path.abspath(os.path.dirname(sys.argv[0]))) import torch impo...
ff573d14b7a0faf60459c107ae08085d809c82be6ed030cdd8e4b92ef24ea5fa
Python
6,117
144
import os,sys import torch import argparse import warnings import numpy as np import pandas as pd sys.path.append("/home/xuchang/Project/STMAP/SEDR/SEDR-master") from src.graph_func import graph_construction from src.utils_func import mk_dir, adata_preprocess, load_ST_file import anndata from src.SEDR_train...
1a9cba52fcb3095d3e85bec5ede4d432980546856ada42fc49ba83dbe202650d
Python
6,119
192
# # calculation of synthetic accessibility score as described in: # # Estimation of Synthetic Accessibility Score of Drug-like Molecules based on Molecular Complexity and Fragment Contributions # Peter Ertl and Ansgar Schuffenhauer # Journal of Cheminformatics 1:8 (2009) # http://www.jcheminf.com/content/1/1/8 # # seve...
3f24ac6cdb61a74946351b773f2f63750d0a40019c46c1d3ab3e75989ce1ed4f
Python
6,119
181
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...
c68d7cc24e827677f3c30ed023236235bae73cda2083dc45998eefe38880773e
Python
6,120
166
import pytest import numpy as np from keras import initializers from keras import backend as K # 2D tensor test fixture FC_SHAPE = (200, 100) # 4D convolution in th order. This shape has the same effective shape as FC_SHAPE CONV_SHAPE = (25, 25, 20, 20) def _runner(init, shape, target_mean=None, target_std=None, ...
99187fd700351cb8ddd55850e4d1b17bf97b888be17aed4f245d26ea172c9b80
Python
6,122
99
# 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...
3dfabf1ef51a47237283965fc47cde299086b4d2d3277dee8d1fba2ec5d97daa
Python
6,123
189
"""Tests for frame selection REST API endpoints.""" import json import pytest from helpers import MockSioServer, auth_header, create_test_room, create_test_user_in_db from httpx import AsyncClient from sqlalchemy.ext.asyncio import AsyncSession # ======================================================================...
29e145b10913ceabc62f101c9a4c36cb9bd99e1f3e12d3d28a2749954978798b
Python
6,125
177
""" 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_geometric.nn import SchNet from torch_scatter import scatter from ocpmodels.common.registry import registry from ocp...