sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
d0152d459e9eed3235c44b64dda4b07c261713f25510ed7610d32de5648a3b43
Python
6,863
209
"""Integration tests for worker resilience — SIO disconnect vs. HTTP DELETE. Verifies that removing eager `cleanup_worker()` from SIO `on_disconnect` does not break the system: - SIO disconnect preserves worker records (sweeper handles cleanup). - HTTP DELETE (jobs.disconnect()) still cleans up correctly. - Server res...
2a2c70f27b8ab135d0cdbdd27ab5cc9222cb1ffb5810a55fadff47d0ffe0874b
Python
6,866
183
# Copyright (c) OpenMMLab. All rights reserved. from typing import Optional, Tuple, Union import torch import torch.nn as nn from mmcv.cnn import ConvModule, build_activation_layer, build_norm_layer from mmengine.model import BaseModule from torch import Tensor from mmseg.models.decode_heads.decode_head import BaseDe...
a8187fb3530ddddcc22ce42400bb1017262e965600bea3c4c31622966b9a755e
Python
6,868
175
"""EGNN model""" from typing import Optional, Tuple import torch from torch import nn, Tensor from .block import EquivariantBlock, SinusoidsEmbeddingNew from .util_funcs import coord2diff, symmetrize_edge, get_ji_bond_index class EGNN(nn.Module): def __init__( self, in_node_nf: int = 8, ...
b600ce294342388c68e3d4b12a7ea7aaafeb828d340074ae42a05b78749f3811
Python
6,868
232
"""Main Graupner-Brunel STDP example script""" # pylint: disable=R0914 from __future__ import print_function import pickle import bluepyopt as bpop import matplotlib.pyplot as plt import numpy as np import gbevaluator import stdputil cp_filename = 'checkpoints/checkpoint.pkl' evaluator = gbevaluator.GraupnerBrunel...
32ec106f8062162986df7fc9027b2b503be1fc939304841cf45f384f072027a4
Python
6,869
133
# coding=utf-8 # Copyright 2021 The IDEA Authors. 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 required by a...
7a0446044fb8696515999dfa2f4fa4d537024917f38b52b29da4ef314c955816
Python
6,871
198
#!/usr/bin/env python import argparse import errno import glob import os import platform import shutil import subprocess import sys from contextlib import contextmanager # Monkey-patch the API inconsistency between Python2.X and 3.X. if sys.platform.startswith("linux"): sys.platform = "linux" CONFIG = { "USE...
b8077a8e4b4ef15c5e4ee39d8a036ebcf8af0d34ec91010b6081a8bd978e6e05
Python
6,873
211
import sys import yaml import hashlib DEFINE = 'YAML_GEN_TESTS' EVENT_COUNT = 5 def encode_stream(line): for c in line: if c == '\n': yield '\\n' elif c == '"': yield '\\"' elif c == '\t': yield '\\t' elif ord(c) < 0x20: yield '\\x' +...
06137e30a7a90eecbeb032760053f17c916a8322a9e758e5e2b362452804ada9
Python
6,875
178
# SPDX-License-Identifier: BSD-3-Clause import torch import onnxruntime import onnx from onnx import numpy_helper from PIL import Image from torchvision import transforms import numpy as np import os import urllib # GitHub Repo | Model MODELS = [ ('pytorch/vision:v0.5.0', 'shufflenet_v2_x0_5'), ...
96b53d636e4a9cfa89fe5dbe5ee53aa4643cb1233ba0f48d0861d3e5e88c9625
Python
6,875
175
import numpy as np from os.path import dirname from collections import Counter from copy import deepcopy from math import log from PIL import Image, ImageDraw, ImageFont, ImageChops class Motif: """ The Motif class is a convenience class to compute and plot a position-weight matrix (PWM). The only functio...
29bffe37488fc43cfb4203cd0c449bcb779fe54c6b24b96150005f4bb5040480
Python
6,879
170
""" Detection of the posterior edge of C2-C3 disc The models have been trained as explained in (Gros et al. 2018, MIA, doi.org/10.1016/j.media.2017.12.001), in section 2.1.2, except that the cords are not straightened for the C2-C3 disc detection task. To train a new model: - Install SCT v3.2.7 (https://github.com/sp...
e7a8b0a59599f1b54b40975afccb3ff75271d9985ae3735d7dbf64d1e0639e6b
Python
6,880
151
import nibabel as nib import matplotlib.pyplot as plt from matplotlib.colors import LinearSegmentedColormap import numpy as np import pandas as pd import openpyxl from openpyxl.styles import Font, Alignment, PatternFill # Define the colors for the colormap colors = ["blue", "aquamarine", "yellow", "red"] #...
969a4a2ea91a7a500aab043f701cd28579b74e568d11dd7e32aca10ad94b4ea6
Python
6,882
169
# resnet model # when tuning start with learning rate->mini_batch_size -> # momentum-> #hidden_units -> # learning_rate_decay -> #layers import tensorflow.keras as keras import tensorflow as tf import numpy as np import time import matplotlib from utils.utils import save_test_duration matplotlib.use('agg') import ...
466490c290c431ce1a8c44e62c8f48023a77a78a0c7be30b0e1193b3dc424a93
Python
6,884
209
from django.conf import settings from django.db import connection from django.http import JsonResponse from django.utils.decorators import method_decorator from django.views.decorators.cache import never_cache from django.contrib.auth.decorators import login_required from django.shortcuts import get_object_or_404 from...
9f4095a15912ada32a2658516588126776fa025ab8141a6d8910ee3b27cd43f6
Python
6,886
128
# -*- coding: utf-8 -*- from django.test import TestCase from django.contrib.auth import get_user_model from django.http.request import QueryDict from catmaid.control.common import get_request_bool, get_request_list from catmaid.models import Project, Class, Relation, ClassInstance, \ ClassInstanceClassInstance fr...
75ba904573d93244c4c1ea3bc0d3064d7e6b0ff31551dbee7cfd6b4360338735
Python
6,887
124
# 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...
dcf24d0e7bceb3de9107495b20c773718f4db5a2d0e0777f1cd71bedf80d5d77
Python
6,887
118
import scipy import numpy as np from .gemsbindings import KvlMeshCollection, KvlTransform, KvlOptimizer, KvlCostAndGradientCalculator, KvlImage def kvlWarpMesh(sourceMeshCollectionFileName, sourceDeformation, targetMeshCollectionFileName): # # Applies sourceDeformation to the reference node positions of the s...
fdb19e094a34f5a1a0ea9bae4d4c5a40a182f44737eae1b620bce81b0674cbe4
Python
6,887
173
#!/usr/bin/env python # # Generate QC report # # Copyright (c) 2019 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE import os import sys from typing import Sequence import textwrap from spinalcordtoolbox.reports.qc import generate_qc from spinalcordtoolbox.reports import qc2 from spinalc...
e980b52ef82023c19235d74156636166aef2e6306098e81f8c8838b9b1890c67
Python
6,888
204
"""Panel controller for BrainGlobe access""" from typing import Callable, Optional, Sequence, TYPE_CHECKING from PyQt5 import QtCore from magmap.brain_globe import bg_model from magmap.io import libmag if TYPE_CHECKING: try: from brainglobe_atlasapi import BrainGlobeAtlas except ImportError: ...
7fdfd475faccfe2ebb75bf4311f30e4917f388505fc7e603c0503464c8c0ea62
Python
6,889
204
import time import json from collections import defaultdict import torch import torch.nn.functional as F import torch.distributed as dist import utils def inference(data_loader, model, result_path, class_names, no_average, output_topk, tb_writer=None, write_embeddings=False): print('inference') ...
6b237aa18602adb6145aa48f96dcf97bb1af102566cab06e213364715d9fc951
Python
6,890
225
#*******************************************************# # Classes used as configuration files #*******************************************************# class datasetConfig: ''' Class for defining dataset parameters: shape, split ratio, augumentation etc. ''' ''' Labes_csv_path: Root directory w...
bb473b135474c2f2ad600508a442d8bf56acad07d5f143670d0780fdd3dcd51c
Python
6,892
203
from typing import List from medperf.commands.association.utils import ( get_experiment_associations, get_user_associations, ) import medperf.config as config from medperf.entities.interface import Entity from medperf.entities.schemas import BenchmarkSchema from medperf.account_management import get_medperf_us...
0a2aa2c8abf5d8bee6d15bbc81017cd13ebcdd6d1c113043ad6d27270e843fad
Python
6,894
211
""" 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 Public License version 3.0 as published by the Free Software Foundation. ...
d7e073e959f0f683fdbd294fd399741e1e818d8729334ebad6273afa54ae4afc
Python
6,894
155
import torch from torch.optim import lr_scheduler import numpy as np from data import read_config, get_datasets, get_generic_dataset import models from training import Trainer import argparse import sys, os, json def parse_args(): # Get args parser = argparse.ArgumentParser() parser.add_argum...
1ad6012d1a86ccad6c3a99079d3dfcf6ce401df9e1013dcdc45b884d792853d1
Python
6,899
160
import json from tqdm import tqdm import argparse def save_data(data,file_path): with open(file_path, 'w', encoding='utf8') as f: for line in data: json_data=json.dumps(line,ensure_ascii=False) f.write(json_data+'\n') label2id={"打车": "0", "地图导航": "1", "免费W...
06f8ecdb5876b30bf9e6febe1c0517117818d6e717d98185de6affa4cab48b6f
Python
6,904
171
'''Feature prediction with neural code conversion: prediction (test) script''' import os import glob import numpy as np import pandas as pd import hdf5storage import bdpy from time import time from bdpy.util import makedir_ifnot from bdpy.dataform import load_array, save_array from fastl2lir import FastL2LiR # Main ##...
7772a865961424a6815b64d6ed69e92c1ce9e1257df43c0ffac075d9249951cf
Python
6,907
178
import numpy as np def create_experimental_stimulus(condition, dt, c_coh_gra, c_coh_pla, c_incoh_gra, c_incoh_pla, test = 'NullMov', num_stim_dirs = 3, T = 48000, t0 = 0, t0adap = 6000, t0test = 36000, duralt = 1500): """ Creates stimulus conditions to pass to neurons, according to experimental protocol. Argu...
e151d4d49da2df97e18a0d05c9e1e211f0ae8fde86704943d731a5f30e91c18e
Python
6,907
174
from nilearn.image import load_img import numpy as np import nibabel as nib from nilearn.plotting import plot_img def get_axial_slices(nii_file_path, num_slices): """ Calculate axial cut coordinates (in world space) for a NIfTI file using Nilearn. :param nii_file_path: Path to the NIfTI (.nii) ...
68889daa89bd1fd0de7c8dd8298e0ea5a54fd8f50e13f7eaba50776971281c1e
Python
6,908
212
#!/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...
e3e17e52f23a85794205ef098d072c2d3f4f28a096e01013c9085dbba559d3db
Python
6,908
236
"""Test fixtures for zndraw-auth.""" from collections.abc import AsyncGenerator from typing import Annotated import pytest from fastapi import Depends, FastAPI from httpx import ASGITransport, AsyncClient from pydantic import BaseModel from sqlalchemy import text from sqlalchemy.ext.asyncio import async_sessionmaker,...
8f8144590e47d7cf4cb0f634d52cc70037aa21cb80ea5cd24a6063368146b589
Python
6,909
225
"""Tests for application configuration.""" import os from pathlib import Path import pytest from httpx import AsyncClient from zndraw.config import Settings class TestStorageUri: """Test storage URI configuration.""" def test_default_storage_is_memory(self) -> None: """Default storage should be me...
9f97764246a15800b44be5c8ffc885c6794d1f2826b93419465024152d37246a
Python
6,909
198
import os import numpy as np import pandas as pd import math import random from datetime import datetime import pickle from utils import pkl_load, pad_nan_to_target from scipy.io.arff import loadarff from sklearn.preprocessing import StandardScaler, MinMaxScaler def load_UCR(dataset): train_file = os.path.join('da...
aacf94341e8a4bfbc8a0c5f7f2a4703f3e450778502e69bf8f02ae6878dd3f17
Python
6,909
210
""" Basic interface between the UI and the processing module @author: Andrei Istudor andrei.istudor@hu-berlin.de """ import socket from sys import argv from os import path import time import subprocess # from main import processVideo from ProcessVideo import ProcessVideo from Logger import Logger # def setNon...
61a1ec63872057477d8abf00ce081c87545c616ef2d02e8a84d54e14426bf6ba
Python
6,915
189
# tests/test_router_task_submit.py """Tests for task submission endpoint using shared fixtures.""" from unittest.mock import AsyncMock, MagicMock from conftest import make_room_address from zndraw_joblib.exceptions import ProblemDetail from zndraw_joblib.registry import InternalRegistry from zndraw_joblib.schemas im...
7c7036c7b3b716ae27491fe6307ff2e17757e5d0a23666a1e1a91753ab57f3e4
Python
6,915
155
# We now have data that has been PLS'ed/CCA'ed with fMRI as the informing variable # I may be missing import statements, so add if you find something I missed import os import pandas as pd import numpy as np from tqdm import tqdm CURR_PATH = '/Users/karinsaltoun/dblabs/asymm_pat_age_progression' os.chdir(CURR_PATH)...
2d6ecf31eb367f1488d370f7f42704a49c70f7c884e5636a7078512f326b9b10
Python
6,918
191
import os import datetime import shutil import math import random from transforms.spatial import Preprocessing from sklearn import metrics from dataset_info import label_info import numpy as np import torch from sklearn.metrics import classification_report from copy import deepcopy class ModelEMA: """ Model Expon...
ce668e3c1a441793c4ff2a6b59cd217bff478e9d21521bc595352fe8ec18d79b
Python
6,919
189
from rest_framework import status from medperf.tests import MedPerfTest from parameterized import parameterized, parameterized_class class BenchmarkTest(MedPerfTest): def generic_setup(self): # setup users bmk_owner = "bmk_owner" prep_mlcube_owner = "prep_mlcube_owner" ref_model_...
818b24c437b85d543bc3c69f7ca2df063c903b1c8094bf823959dcc74f1e2c7b
Python
6,924
209
# src/zndraw_joblib/dependencies.py import hashlib import json from typing import Annotated, Any, Protocol, runtime_checkable from uuid import UUID from fastapi import Depends, Path, Request from fastapi_users.authentication import JWTStrategy from zndraw_socketio import AsyncServerWrapper from zndraw_joblib.exceptio...
c1f8e86ccee6c87e3ddfc864f2865bbeaf2ba86a4404e555a37792f169f5e130
Python
6,925
176
"""Regression checks for the chemicals compendium. Two kinds of assertions live here: EXPECTED_IN_CHEMICALS / NOT_IN_CHEMICALS — ID-presence checks: is a CURIE in the chemicals intermediate ID file? — These depend on existing vocab fixtures (mesh_pipeline_outputs, umls_pipeline_outputs, …) — only writ...
5cc65022159d6e4461141357e6998056cd89826ae0adbc4ef37dbf2d5b7d1e54
Python
6,930
183
import h5py import os import numpy as np import networkx as nx import pickle as pkl import scipy.sparse as sp from datetime import datetime from pathlib import Path def load_hdf_data(path, network_name='network', feature_name='features'): """Load a GCN input HDF5 container and return its content. ...
d58dd75e926bbbb7b5f7ce92d3fc70f28960ac5bf8c3ea15a57023d63d95f397
Python
6,934
216
from zetapy import getZeta, zetatest from joblib import Parallel, delayed from myphdlib.general.toolkit import psth2 # from myphdlib.pipeline.main import ModuleBase import numpy as np # TODO # [ ] Recompute the visual response amplitudes and compute respone amplitudes to saccades # [ ] Measure the latency to the very ...
5bffb9bb16ab07907469781f0a456e2ff111bad9a7f1ea1bae7b97471e898b53
Python
6,935
248
import pytest import numpy as np from numpy.testing import assert_allclose from keras import backend as K from keras import activations from keras.layers.core import Dense def get_standard_values(): """A set of floats used for testing the activations. """ return np.array([[0, 0.1, 0.5, 0.9, 1.0]], dtype...
3b80a652f14489383df703dcbb9322af7def1338b3b3ae48d70b2051a0fa2970
Python
6,939
167
"""Context-Aware Implicit Neural Representations to Compress Earth Systems Model Data DEVELOPED AT: Department of Chemical Engineering University of Utah, Salt Lake City, Utah 84112, USA DIRECTOR: Prof. Salah A Faroughi DEVELOPED BY: ...
9ea01f28e1117ca2a02a3ff3455e8b21fdddfa73ce6b80c26c4d48306562d388
Python
6,940
235
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import matplotlib.pyplot as plt import json import seaborn as sns class DefaultTracking(): """Expects to get a dict with a value for each epoch in form {measure1:[val1, val2, ...], measure2:[val1, val2, ...], ...} """ values = None def set_d...
017dbec4fa6358a7ef99e84aa1efa72310743963773a8670f50de2394d089083
Python
6,943
193
# Copyright (c) OpenMMLab. All rights reserved. from unittest.mock import patch import pytest import torch from mmengine.structures import PixelData from mmseg.models.decode_heads.decode_head import BaseDecodeHead from mmseg.structures import SegDataSample from .utils import to_cuda @patch.multiple(BaseDecodeHead, ...
a6512fd9176514dc64e91330aad5cc0fda1116caf0d4844898b32dc0ca88fff8
Python
6,945
175
#!/home/preclineu/hansav/.conda/envs/py38/bin/python """ Created on Thu Aug 29 11:16:53 2024 @author: hansav """ """ #################### #Elastic Net Regression classification BDI score --> PERMUTATION #################### """ import pandas as pd import numpy as np import os import sys from pcntoolkit.dataio.file...
10c878ca2cf0d92f38eacaa7198c2d56e8e86b8261e30d36eb117ad6f7449860
Python
6,947
193
# Copyright DST Group. Licensed under the MIT license. from ipaddress import IPv4Address, IPv4Network from typing import Optional from networkx import shortest_path, NetworkXNoPath, NodeNotFound from networkx.classes.function import nodes, induced_subgraph from CybORG.Shared import Observation, CybORGLogger from CybO...
9ec222065eff38cfa31a24731e35c4ee31b3ab28d4827dd3523eefc94393bf36
Python
6,949
242
import urllib.parse from io import BytesIO from pathlib import Path from typing import IO, Any, cast import pytest from cwl_utils.types import CWLObjectType from ruamel.yaml.comments import CommentedMap from schema_salad.sourceline import cmap from cwltool.builder import content_limit_respected_read from cwltool.comm...
022cbb7ffb362d47543c567e065cc16053d583ce40618a2a15fa5c780fe871fe
Python
6,952
193
import torch from torch.nn import Module from torch.nn import functional as F from models.graph import NodeEdgeNet from models.transition import ContigousTransition, GeneralCategoricalTransition from .common import * from .diffusion import * class BondPredictor(Module): def __init__( self, confi...
c33d8eeadefe2b339efa67ef5603259f02650e41353cdd6ecbc893a740902e9b
Python
6,955
164
import time import argparse from types import SimpleNamespace from pathlib import Path import torch from eval_utils import load_model # It only takes effect on the model parameters guided by conditions. def generation(model, ld_kwargs, num_batches_to_sample, num_samples_per_z, batch_size=512, d...
174b85f5fccd8e771362452ab493bb11eaa76598999db6653031fdb1f5a482dc
Python
6,959
210
#!/usr/bin/env python # coding: utf-8 # In[45]: import torch import pickle import os import ipdb import os.path as osp import numpy as np import pandas as pd from torch_geometric.data import Data from torch_geometric.data import InMemoryDataset from torch_sparse import coalesce def load_dataset(path='../data/raw...
bb6e6a23c0f63164a84b9e40e188df806f82b20f498f0953fff15139abc1b581
Python
6,965
207
"""Can a DLPack-adopted grid be fed straight into a 3D CNN? test_dlpack_paths.py checks the protocol -- capsules, ownership, rejection. This file checks the thing the protocol exists for: that the tensor coming out the other side is a first-class input to torch's Conv3d and to the models in nearl.models, with no copy,...
9b5155c524bea53416d953b5700e04900e6d4637e6a002b7a14aa0e199b7f2d5
Python
6,966
201
import numpy as np import pytest import torch from ase import Atoms from ase.build import molecule from e3nn import o3 from mace.modules.blocks import RealAgnosticInteractionBlock from mace.tools import AtomicNumberTable from hydromace.interface import HydroMACE from hydromace.tools import ( assign_num_hydrogens_a...
aa91bed5827b0785227774476aa82bbf10f26413dad95b93401054683f53ce42
Python
6,966
201
#!/usr/bin/env python # # Compute MT saturation map and T1 map from a PD-weigthed, a T1-weighted and MT-weighted FLASH images # # Reference paper: # Helms G, Dathe H, Kallenberg K, Dechent P. High-resolution maps of magnetization transfer with inherent correction # for RF inhomogeneity and T1 relaxation obtained ...
e169b1a7272fe9632a0d9496203e77bc1ba533deeb01ebf153d17611ae5c239e
Python
6,967
170
# Once we generate the compendium files, we need to convert them into the # Knowledge Graph Exchange (KGX, https://github.com/biolink/kgx) format. # This file provides code for doing that, based on the code from # https://github.com/NCATSTranslator/NodeNormalization/blob/68096b2f16e6c2eedb699178ace71cea98dc794f/node_no...
a7ef2a7c6980f8ac3b786ca18482c3f2d10c929b34922ce98b9403f8ffdb0854
Python
6,972
193
from luna.paths import LunaPaths from luna import candidate_info, dataset from luna.ct import Ct from luna.prepcache import LunaPrepCacheApp from torch.utils.data import DataLoader from Utils.models import * from Utils.TrainModelLUNA import * from Utils.config import * from tqdm import tqdm import matplotlib.pyplot as ...
d56e8d7eec3274d2409d1fb226a6d10594e96531010b426b099bbf3f73b272fa
Python
6,972
170
from typing import Optional, Sequence import torch._dynamo.guards from models.helpers import generic_scan, generic_scan_with_states, spike_grad_injection_function import torch import torch.nn.functional as F from torch.nn import Module from torch import Tensor from torch.nn.parameter import Parameter from module.tau...
0cd8702fba92972e2b34802d1c690f11e5ec4686e3633ba24569234788c1bdb1
Python
6,975
198
"""Preprocessing functions to extract gfp peaks.""" from typing import Optional, Union import numpy as np from mne import BaseEpochs, pick_info from mne.io import BaseRaw from mne.io.pick import _picks_to_idx from numpy.typing import NDArray from scipy.signal import find_peaks import matplotlib.pyplot as plt ...
19263da7b547eec1c6336caf4d6b06566bbc2f4855339703a16edaaeae02726f
Python
6,975
202
# /// script # requires-python = ">=3.11" # dependencies = [ # "requests>=2.30.0", # ] # /// """ Script for downloading and building HDF5 on Windows This does not support MPI, nor non-Windows OSes This script may not completely clean up after itself, it is designed to run in a CI environment which thrown away eac...
5113e7d119e98081391a57547c98bbc5ad8e1d8b3f6e39cf7aeb5c7e04853392
Python
6,978
158
import logging from collections import defaultdict import jsonlines from src.babel_utils import glom from src.categories import GENE from src.metadata.provenance import write_concord_metadata from src.prefixes import NCBIGENE, UNIPROTKB from src.util import LoggingUtil logger = LoggingUtil.init_logging(__name__, lev...
ad571f3779aa04794c6a7fc52b95f91f6b61cf8ba8bd05a67ef989f4815ecf3b
Python
6,978
236
import os import pytest import medperf.config as config from medperf.entities.cube import Cube from medperf.containers.runners.runner import Runner from medperf.tests.entities.utils import ( setup_cube_fs, setup_cube_comms, setup_cube_comms_downloads, ) from medperf.exceptions import InvalidEntityError fro...
be6e10e2aa172f996daaf5e3a86e427a3e66e0fefed69fbe85364e88e4a613df
Python
6,979
168
import json import pytest from guppy.frontend.group_labeling import ( CREATE_NEW_GROUP, EDIT_EXISTING_GROUP, GroupLabelingPage, save_group_definition, ) from guppy.utils.utils import GROUP_MEMBERS_FILENAME, read_group_members @pytest.fixture def member_run_folder(tmp_path): """A usable group mem...
2283a557c904f3efc7ebda085e155846168672aed14554d95976bdd69e1a66f2
Python
6,980
196
# 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. # Borrowed from https://github.com/facebookresearch/segment-anything from typing import List, Tuple import torch from to...
a3bd94f4cec8f568545c19b054df7e44556bb73f30c6242e7ab22f254beec57d
Python
6,982
197
_base_ = ['../_base_/default_runtime.py', '../_base_/datasets/cityscapes.py'] crop_size = (512, 1024) data_preprocessor = dict( type='SegDataPreProcessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], bgr_to_rgb=True, pad_val=0, seg_pad_val=255, size=crop_size, test_cfg=...
18badae7a83580b9ad27eaa8992fef0e318d884a9c5de6b2ffd2b8fb1348ea42
Python
6,983
206
#!/usr/bin/env python2.7 import os, sys import argparse import math import ctypes import warnings import multiprocessing as mp from multiprocessing import Lock, Value, Pool import numpy as np import scipy.spatial from Utils import * def kclustering(data, restarts, threshold, seed=None, lord=1, j=1, LB=1, UB=None...
f7908751d4ee0b114a893397f5540b7190ad54152055589d17f3350345ea6a3d
Python
6,986
178
"""Contract tests for orchestrate_read_raw_data error enrichment.""" import shutil import time from pathlib import Path import pytest from guppy.extractors.base_recording_extractor import BaseRecordingExtractor from guppy.orchestration.read_raw_data import orchestrate_read_raw_data from guppy.utils.progress import S...
7030bae2aaf9c548885b40cda1d2578dbf9cdcf23594f04290d4a292d3c7de8b
Python
6,987
162
import argparse import os from torch.autograd import Variable import torch from time import time from models import Converter import numpy as np from bdpy.dataform import save_array from bdpy.util import makedir_ifnot from utils import fastl2lir_parameter, test_fastl2lir_revise import itertools, bdpy from utils import ...
bfd760531f2a5815aa42e46ef4d5d9afc1c0722ed6304332beaa7f2805cd24e8
Python
6,987
162
# 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...
a420d5ddae16c53fb39310c7d1454cc5b93938a4aae4f665dfdb5e627d60b3c1
Python
6,988
310
import torch import torch.nn as nn import torch.nn.functional as F import pdb class DoubleConv(nn.Module): """(convolution => [BN] => ReLU) * 2""" def __init__(self, in_channels, out_channels, mid_channels=None): super().__init__() if not mid_channels: mid_channels = out_cha...
15678ad3502e2f7bafe07fd799fc861d6212e2b8e96578309e463e8a72fd9f66
Python
6,991
242
import os import re import numpy as np import pathlib as pl from scipy.signal import find_peaks # Number of samples in a single LabJack dat file NSAMPLES = 12000 # Number of channels sampled by the LabJack NCHANNELS = 9 class LabJackError(Exception): pass def readDataFile(dat, line_length_range=(94, np.inf)): ...
742a018eaa4635f8ed27e5908fabc9d7383e056c7aa4f30b772f0609ea42f015
Python
6,992
205
# 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...
7e66e353293810775d97a7f4410d0f9169a5e6261987dc18c8499c0fb124b904
Python
7,000
159
# 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...
acbaf4d13651eff2b78b1b3906f21d3e4eb6e2b7ce983a011c97d08b7c080df4
Python
7,009
184
''' These functions are rather specific to Amod's deeplearning code and should probably be either moved or completely deleted. It might make sense to develop some more universal normalization utility functions. ''' import numpy as np def piecewise_linear_normalize(in_img_data, ref_img_data): '''Function to piece...
bad9bf4cc431eebbe39beb9dd6da77f0cb8a33f77b69bb88d1146df4cc46e1df
Python
7,009
238
#*******************************************************# # Classes used as configuration files #*******************************************************# class datasetConfig: ''' Class for defining dataset parameters: shape, split ratio, augumentation etc. ''' ''' Labes_csv_path: Root directory w...
f3012247bedca4b88ed8837b0e00ae61c0531fa0c4e517afff10fd2b4a680779
Python
7,009
191
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import itertools from multiprocessing import Pool import os import shutil import numpy as np from dmriqcpy.analysis.stats import stats_mean_in_tissues from dmriqcpy.io.report import Report from dmriqcpy.io.utils import (add_online_arg, add_overwrite_arg,...
0c3682b748f9ad4d37e167184233f1a2af4bb2bbf99e1a8a8fd2b3bc51458b02
Python
7,010
156
import os from freesurfer.samseg.SamsegLesion import SamsegLesion from freesurfer.samseg.SamsegLongitudinal import SamsegLongitudinal from .SamsegUtility import * class SamsegLongitudinalLesion(SamsegLongitudinal): def __init__(self, imageFileNamesList, atlasDir, savePath, userMode...
12f7260d741a1bec71692d464f173b4132507bb0ea63b3c1724521ddc70bb2bc
Python
7,015
204
from __future__ import absolute_import from __future__ import division from __future__ import print_function import argparse import imageio import os import sys import numpy as np import tensorflow as tf from tensorflow.contrib.slim.python.slim.nets import inception from geomstats.invariant_metric import InvariantMe...
09d5ba175f159e5bb1c659fac142d6e6194cd6522bd327856af0ecf6c6200186
Python
7,025
272
## ## CPCantalapiedra 2020 import os, subprocess, sys def run(cmd): ''' Runs eggnog-mapper with the arguments specified. Replaces leading ./emapper.py with the current Python interpreter so that tests always run inside the active venv. ''' if cmd.startswith("./emapper.py"): cmd = sys.e...
cfeee7581fe17c8be7b2b525bcb0d4c6107ca702979812a5d47ae8ad524ae7ad
Python
7,025
219
from functools import partial import numpy as np import torch from tqdm import tqdm from neuralpredictors.measures import modules from neuralpredictors.training import ( early_stopping, MultipleObjectiveTracker, LongCycler, ) from nnfabrik.utility.nn_helpers import set_random_seed from ..utility import sc...
563ba8114476f77e1a160d2aba9b84b474caacbcfe8c78361359b17875a4cc3a
Python
7,026
220
import logging import traceback import os import platform import re import socket import subprocess import sys import tarfile from importlib import metadata import psutil import yaml from medperf import config def get_system_information(): try: # Get basic system information system_info = { ...
afe7ce2e1f9adc3ee666c0616779e82e7b9a0468d411a39928b4d9dbc8f6efed
Python
7,026
207
""" Processing of raw geographic data for model """ import pandas as pd class Geoprocessing(object): """ Processing of raw geographic data for model. """ def __init__(self, limit_to_england=False): """ Initialise geographic class. Attributes ---------- admi...
5d0b4541d825edfce2c2d17784671375c4668cf34e65fa54818107421882c963
Python
7,027
244
#!/usr/bin/env python """ Module for calculations related to the SO(3) group """ import sys import numpy as np import torch from typing import Tuple, Union, TypeVar Tensor = TypeVar('torch.tensor') def taitbryan_to_matrix( angles: Union[Tensor, np.ndarray] ) -> Union[Tensor, np.ndarray]: """ Takes ...
4ba26f4969919fd08bbd2d38aa10d7e0113508dab0d778c7ded8fa934a585c6f
Python
7,038
229
"""CLI commands for visual preset operations.""" from __future__ import annotations import fnmatch import pathlib # noqa: TC003 — Typer evals annotations at runtime from typing import TYPE_CHECKING, Annotated import typer from zndraw.schemas import Preset, PresetRule from .connection import ( PasswordOpt, ...
0dd9f50770428f94082961c9645909a187bde39813e8818bf634d08f208b7901
Python
7,040
230
""" Benchmark the 3 modes: 1. Static feature: AtomType 2. Marching Observers 3. Probability Density Flow """ import argparse import json import os import time from collections import OrderedDict import h5py as h5 import nearl import nearl.features import nearl.featurizer import nearl.io # from nearl.io import Traje...
72d689d00bfd9b00012dc3271ff765639e13b0c65fd9eb5d44a5d47145a5e50d
Python
7,047
128
# 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...
0b2682e3c5598f3df2566e9013f9a6e761e782dc00f78d0ba53dff12a0c9e7f6
Python
7,051
221
""" DeepEtoProfile entry point: pheno_ui.py - Defines the :class:`pheno_ui` class - The __main__ method intatiates this class with the number of processing tasks passed as parameter (default = 1) and shows the dialog """ """ @author: Andrei Istudor andrei.istudor@gmail.com """ __version__ = 0.1 import os im...
b90ffb4c4de03a792a95a11af70c63a8dc59cc10936b939f37fbe5f0142f4f80
Python
7,051
187
import torch import torch.nn as nn def weights_init(m): if isinstance(m, nn.Linear): torch.nn.init.xavier_uniform_(m.weight) torch.nn.init.zeros_(m.bias) class PINNet(nn.Module): def __init__(self,input_size, pathway, num_fc): super(PINNet, self).__init__() ...
51db2ff5f96bab2744566e44b6e7e2ee6387f4e436b7ca18e7a07ced67ba1ed6
Python
7,053
185
import abc # import sklearn.metrics import numpy as np import tensorflow as tf import os import sys import pandas as pd def pairwise_dist (A, B): """ Computes pairwise distances between each elements of A and each elements of B. Args: A, [m,d] matrix B, [n,d] matrix Returns: D, [m,n] matri...
ec5e2024cda4db47b607d87a41d7451f1bb65cd8a2b891830496c60ec8aa4eba
Python
7,053
175
"""Tests for the build-report archiver (``releases/scripts/archive_build.py``). The two behaviours worth pinning are the ones that protect the repository from a bad archive: the size cap that keeps a 200 MB DuckDB dump out of git, and the check that the prefix report is stamped with the release it is being filed under...
0403e149ec8b19e758b72872b9d8ef7fb4b93cfa8d93565bbb96b934232e3aaf
Python
7,055
170
"""Tests for cwltool.load_tool.""" import logging import urllib.parse from pathlib import Path import pytest from cwl_utils.types import CWLObjectType from schema_salad.exceptions import ValidationException from cwltool.context import LoadingContext, RuntimeContext from cwltool.errors import WorkflowException from c...
d7a8ae50b16e3002edcc050e04956177f0574b4e0069283509bc8fc25ad9107d
Python
7,057
179
from pathlib import Path import numpy as np import pandas as pd import panel as pn import pytest from guppy.analysis.io_utils import PSTH_SIGNIFICANCE_DIRNAME from guppy.frontend.psth_significance_view import ( PsthSignificanceView, build_psth_significance_view, describe_comparison, metric_label_for, ...
8eee0d15919a071da7560e2644e8213c82e792a379d30826e313cb892928e7d7
Python
7,059
166
""" Configurator.py Default class for configuring DL experiments """ import copy import logging import torch from dl_utils.config_utils import check_config_file, import_module, set_seed class DLConfigurator(object): """ DL Configurator - parametrization of deep learning via 'config.yaml' - ...
d09dec77a32198aee9ade204295c93b70979346889643c4d3aa0e01063cd9fae
Python
7,061
179
import os import torch import random import numpy as np import torch.nn as nn import torch.nn.functional as F from utils import * from const import * from random import shuffle from model import * from sklearn import metrics from dataset import MyTestDataset from torch_geometric.loader import DataLoader from sklearn.m...
73de9c900d6236949c37c6222db0cc3922abada0ac4b8a23d1007f8188f8544d
Python
7,062
208
import numpy as np import torch.nn.functional as F import torch import random import pickle from tqdm import tqdm from pathlib import Path import os def set_seed(seed): np.random.seed(seed) torch.manual_seed(seed) torch.cuda.manual_seed(seed) random.seed(seed) torch.backends.cudnn.deterministic = ...
9910966e0c6af05fb0f73b1a48db1f1bd2742f57ac976715d8a1c854d986d77b
Python
7,064
184
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import os import shutil import numpy as np import pandas as pd from dmriqcpy.analysis.utils import (dwi_protocol, read_protocol, identify_shells, build_ms_from_shell_idx) from dmri...
af67f22825bb939d87f8e4ce630d94dfa1f6d85f7022dde212ebeef92d96a61c
Python
7,065
189
# -*- coding: utf-8 -*- import logging import requests from django import forms from django.core.exceptions import ValidationError from django.contrib import messages from django.shortcuts import redirect from formtools.wizard.views import SessionWizardView from catmaid.control.common import is_valid_host from catmai...
25fad5ee664fb280a464ea87d591cd2b74f4999f4f225d4847ff100b4bcdb3eb
Python
7,067
183
from __future__ import annotations from typing import Any import numpy as np from scipy.optimize import linear_sum_assignment from soccertrack import BBoxDataFrame from soccertrack.utils.utils import list2dict def mota_score(bboxes_track: BBoxDataFrame, bboxes_gt: BBoxDataFrame) -> dict[str, Any]: """Calculates...
fb90d00c2ee24aa857bfdd221fb98a75e55cf7ceeb43b50c1be2be718ea4535d
Python
7,068
160
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 Ensemble: def __init__(self, models, opts, dataset="", learning_rate=1e-3, tag=""): self.mse = ...
fd572de371d060fd4b4b9da68324869e770eb371b19871ee432a1f10bbd81db0
Python
7,068
175
# SPDX-License-Identifier: Apache-2.0 import torch import onnxruntime import onnx from onnx import numpy_helper from transformers import GPT2Model, GPT2LMHeadModel, GPT2Tokenizer import numpy as np import os # Transformers has a unified API # for 8 transformer architectures and 30 pretrained weights. # Mode...
15e57d894ee45cc253584c8eec8768b2fd8e64503b2204778d88bc0a4fcb2093
Python
7,069
183
# coding=utf-8 # Copyright 2021 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.0 # # Unless r...
5efc8b4c3ef8e0a42551c59ea84ff3d40f53143d55e5b4f5498bf1480424dbee
Python
7,074
233
import matplotlib.pyplot as plt import seaborn as sns import pandas as pd import matplotlib.ticker as ticker import numpy as np EV_list = [ 25, 100, # 500, # 1000, ] # avg of 100 runs optimal_mean = [ -20_556, -108_539, -2_764_761, -11_034_490 ] optimal_std = [ 6_191, 24_080, ...