sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
c52a0d6b65b9cdff8986d36fd2350ca9078d527b4de17d3bdfe94a98d62a35a9
Python
3,193
94
""" Script to convert soccertrack dataset format to YOLOv5 format. """ import argparse from pathlib import Path from joblib import Parallel, delayed import cv2 import numpy as np import yaml import soccertrack from soccertrack import Camera from soccertrack.logging import logger, tqdm # Move each file to their resp...
45a0b9804717dbc617cd846cd5d0d90140f2a09a33f372abc0312755c5629df6
Python
3,195
89
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import os.path as osp import tempfile import zipfile import mmcv from mmengine.utils import mkdir_or_exist CHASE_DB1_LEN = 28 * 3 TRAINING_LEN = 60 def parse_args(): parser = argparse.ArgumentParser( description='Convert CHASE_DB1...
a451a932c3dd5a91045855708ddf9f4fa1382e4bc73bac53e2b11fe97330af12
Python
3,196
90
# coding=utf-8 # Copyleft 2019 Project LXRT import os import os.path as osp import sys import csv import base64 import time from tqdm import tqdm import numpy as np import json import pickle import pdb csv.field_size_limit(sys.maxsize) FIELDNAMES = ["img_id", "img_h", "img_w", "objects_id", "objects_conf", ...
d109abbc95164bb3da2fb77a46fb33102c83b06a300728ecd5712c633d8f819f
Python
3,197
100
"""Floor geometry with grid and shadows support.""" import typing as t from pydantic import Field, field_validator from .base import BaseGeometry class Floor(BaseGeometry): """A floor plane with grid and shadows support.""" active: bool = Field( default=False, description=( "Wh...
587421edef9464521fc28aecb3eb03231a3ba84432eb2b5f9257501a3009f9d0
Python
3,198
90
from __future__ import print_function import pytest import time import random from keras.datasets import cifar10 from keras.datasets import cifar100 from keras.datasets import reuters from keras.datasets import imdb from keras.datasets import mnist from keras.datasets import boston_housing from keras.datasets import fa...
15cb425f2d27f848ad2d008ec2ed6aae3d17bf443505b34fdf33f24fc3d87ee8
Python
3,201
116
# -*- coding: utf-8 -*- """ Some functions comes from https://github.com/scilus/scilpy/blob/master/scilpy/io/utils.py """ import glob import os def add_overwrite_arg(parser): """ Add overwrite option to the parser. Parameters ---------- parser: argparse.ArgumentParser object """ parser.a...
f383f40a880a60637f111a1f8066b954c726367a919eb189c3ba205d24d1959d
Python
3,202
105
# Residual Dense Network for Image Super-Resolution # https://arxiv.org/abs/1802.08797 from model import common import torch import torch.nn as nn def make_model(args, parent=False): return RDN(args) class RDB_Conv(nn.Module): def __init__(self, inChannels, growRate, kSize=3): super(RDB_Conv, self)...
4a4d5d50e3cf0c531457d29ae425b3a5ff63fea46fd540b7df63f012b8895e85
Python
3,204
87
# 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...
ba971c714e3b4f1e109665b9fa8170d8261733fc0132f4ed4979586637151089
Python
3,205
96
# -*- coding: utf-8 -*- """ Created on Fri Jul 9 15:24:53 2021 @author: Engi """ import os import platform platform.system() # define starting datafolder if platform.system() == 'Darwin': os.chdir('/Volumes/BBC/BBC/WP1/data/EEG/tsk') base_datafolder = '/Volumes/Elements/' else: os....
b76fcdf45e25889410747dc18031f25e9db750cdaa5923762b5c433099f25438
Python
3,206
109
#!/usr/bin/env python """ MetaWIBELE: filter_clusters module Filter out specific clusters Copyright (c) 2019 Harvard School of Public Health Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software witho...
d3ec528e5a641ee4dec54eb56aa6c7970187d4de4b6cb93055a4c191050fe468
Python
3,208
106
"""Tests for CLI bookmarks commands.""" from __future__ import annotations from typing import TYPE_CHECKING from zndraw.schemas import BookmarksResponse, StatusResponse from .conftest import invoke_cli if TYPE_CHECKING: from typer.testing import CliRunner def test_bookmarks_list_empty( cli_runner: CliRun...
654188dc506f2d2a39889813be1ca87d491f46adf15589000fdbf86de7500431
Python
3,209
100
# Copyright (c) OpenMMLab. All rights reserved. import pytest import torch from mmseg.models.backbones.swin import SwinBlock, SwinTransformer def test_swin_block(): # test SwinBlock structure and forward block = SwinBlock(embed_dims=32, num_heads=4, feedforward_channels=128) assert block.ffn.embed_dims =...
8c874cf39ba03eb9b968f33b3b4f47f01e927fc688aaa38100849b3848dfc213
Python
3,209
126
import numpy as np import nearl.all_actions as all_actions # from nearl import features agg_map = { 1: "mean", 2: "std", 3: "median", 4: "variance", 5: "max", 6: "min", 7: "sum", 8: "slope" } def get_mean(points): return np.mean(points) def get_std(points): return np.std(points) def get_med...
05b0cdc85a5e185b66a5225102208f69920c8e80a0fc329b58c11a4ad092b88e
Python
3,210
107
""" 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 numpy as np import pytest import torch from ocpmodels.modules.evaluator import ( Evaluator, cosine_similarity, magnitude_...
0e95cc1433b9e239dbc51fbcc5f6561702ebbb0fec101dbbfa882c068ae1139c
Python
3,212
118
import pytest from medperf.exceptions import CleanExit from medperf.commands.mlcube.delete_keys import DeleteKeys from medperf.tests.mocks.encrypted_key import TestEncryptedKey PATCH_DELETEKEYS = "medperf.commands.mlcube.delete_keys.{}" CONTAINER_ID = 1 @pytest.fixture def deletekeys(mocker): mocker.patch( ...
c117570ee6fb143500171e1c7f516326c455c791b093236bd4cc7948f06f6f44
Python
3,212
91
# Copyright (c) OpenMMLab. All rights reserved. import argparse import glob import os.path as osp from mmengine import Config from mmengine.fileio import dump, load def parse_args(): parser = argparse.ArgumentParser( description='Gather benchmarked model evaluation results') parser.add_argument('conf...
25bc7189ab234653f3af2eb47aeab1992c0d72b35589c543c774fd95c43103aa
Python
3,213
70
# Top 20 color words in English color_words = ['red', 'green', 'blue', 'yellow', 'pink', 'black', 'white', 'gray', 'purple', 'orange', 'brown', 'beige', 'gold', 'silver', 'navy', 'teal', 'olive', 'maroon', 'violet', 'cyan'] ...
b8e887fa0328bdf157739f5adec060d755a12d4919fdd7d3d832fd505525e665
Python
3,213
102
"""Unit tests for broadcast_room_update helper routing logic. These tests cover the scoped delivery introduced in Task 18: - PUBLIC rooms broadcast to the shared rooms:feed channel. - GROUP rooms fan out to each group member's user:{uid} channel. - PRIVATE rooms deliver only to the owner's user:{uid} channel. Real so...
01557cde38a9da2924e04afdd5610236e193c68494353fd39bd4bebccd9945ae
Python
3,214
96
import argparse import os import re import yaml import json import pandas as pd import SimpleITK as sitk def convert_to_brats_label_style(tool_outputs_dict): output_folder = "/corrected_predictions" os.makedirs(output_folder, exist_ok=True) tool_outputs_dict_corrected = {} for subj, path in tool_outpu...
19e53e591e82ddf6e5a91adf506ee1c4af741372de0cd9fe003c12f4643cab38
Python
3,218
98
# 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. """ Tests the h5py._hl.filters module. """ impo...
383cae47127e1aa4912850b396d3d23d116ee52b05e3410207b76f8e10ddbbb0
Python
3,219
74
import numpy as np import pytest from guppy.analysis.cross_correlation import compute_cross_correlation def test_identical_arrays_max_correlation_at_lag_zero(): signal = np.sin(np.linspace(0, 4 * np.pi, 200)) result = compute_cross_correlation([signal], [signal], sample_rate=20.0) cross_corr_row = result...
27539bf9e8722c72787d765309f0af8407fafeffe8ace3125d02ac04f4384a7e
Python
3,221
91
import socket from dataclasses import asdict import numpy as np import pytest import xgboost as xgb from xgboost import RabitTracker, build_info, federated from xgboost import testing as tm from xgboost.collective import Config def run_rabit_worker(rabit_env: dict, world_size: int) -> int: with xgb.collective.C...
6040c2c8d2dede8fae5272454ef04229e9d8686eb14b391438b3bd9dfd18b530
Python
3,224
136
import os from medperf.exceptions import ExecutionError import pytest from medperf.tests.mocks.dataset import TestDataset from medperf.commands.dataset.export_dataset import ExportDataset PATCH_EXPORT = "medperf.commands.dataset.export_dataset.{}" @pytest.fixture def dataset(mocker): dset = TestDataset(id=None...
91cce944b3ac55effc12608bfdd30789ba5c9aa73beaf3c7deb629e2f2fa5503
Python
3,224
74
import numpy as np from guppy.utils.artifact_windows import ( complement_windows, coords_to_windows, merge_windows, windows_to_coords, ) class TestMergeWindows: def test_disjoint_windows_are_sorted_and_unchanged(self): assert merge_windows(windows=[(5.0, 6.0), (1.0, 2.0)]) == [(1.0, 2.0),...
abe1d4cb9461989bd510730fb18443a362104da1597a06c647b412c32306bd16
Python
3,225
72
# For benchmark preprocessing usage: # # python Preprocessing_scFile.py --inputfile /home/wangjue/biodata/scData/allBench/9.Chung/T2000_UsingOriginalMatrix/T2000_expression.txt --outputfile /home/wangjue/biodata/scData/9.Chung.csv --cellcount 317 --genecount 2000 --split space --cellheadflag False # python Preprocessin...
2d0b78827495ebb06d551d9900cf0674342c4b0dd0ec1178bcc1b46a8328746b
Python
3,227
109
from typing import Optional from medperf.entities.aggregator import Aggregator import typer import medperf.config as config from medperf.decorators import clean_except from medperf.commands.aggregator.submit import SubmitAggregator from medperf.commands.aggregator.run import StartAggregator from medperf.commands.list...
ec7cf686ebe7fc6150ad2726d7a3df3b1e06ec08b7b6b8299d05b4683ec82440
Python
3,227
100
""" 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 os from ocpmodels.common.registry import registry from ocpmodels.trainers.forces_trainer import ForcesTrainer class ...
d40b7fffc94da8e9833d1206ded70c493b6f0e6beae589543c72d80f9b3185c5
Python
3,228
112
from .token_storage import TokenStore from medperf.config_management import read_config, write_config from medperf import config from medperf.exceptions import AuthenticationError from medperf.entities.user import User def read_user_account(): config_p = read_config() if config.credentials_keyword not in conf...
e1bdeb3b36afc905be23aad6bf0a2984c61ab557d221b1038d597ca9ac604427
Python
3,228
84
import numpy as np import pytest from dante.obj_functions import Ackley, Rastrigin, Rosenbrock, Griewank, Michalewicz, Schwefel class TestFunctions: @pytest.mark.parametrize( argnames=("dims", "x", "expected", "scaled_expected"), argvalues=[ (3, [1, 2, 3], 7.016453, 14.231930), ...
ddfcbcf2f61f111ef93f184ae496f4113b7fea104a4ba16688e88224fa51f8aa
Python
3,229
97
""" 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 sympy as sym import torch from torch_geometric.nn.models.schnet import GaussianSmearing from ocpmodels.common.typing import assert_is...
d367c12b09f12755cdcfcec2c0d0c7c03daddd1e7d195cdd118b60c9ce1f8853
Python
3,230
104
#!/usr/bin/env python3 """Smoke-check a downloaded eggnog-mapper data dir. Verifies that: - eggnog.db exists, is a v7 schema, has the expected core tables - prots and protein_names have plausible row counts - taxa.db is reachable and has a species table - eggnog_proteins.dmnd is present (basic byte-level sanit...
f4ab54bd787739adef0a1afbe9877ca81763b9a5ea844f5253658f2d297c4213
Python
3,231
104
# -*- coding: utf-8 -*- """ Created on Wed Sep 25 12:02:59 2024 @author: AC """ import pandas as pd from sklearn.model_selection import train_test_split from sklearn.linear_model import SGDClassifier from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, confusion_matrix, roc_a...
572f7b3b2ab27f9618d6451b13d7ee9478e171583d29cf145e29e0b53e9402c5
Python
3,232
93
## import bz2 import gzip import os import re import sys CLEAN_SEQ = re.compile("[\s\-\.]+") def _fasta_open(source): """Open a FASTA source for text reading, auto-detecting gzip/bzip2.""" from pathlib import Path if not (os.path.isfile(source) or Path(source).is_file()): return iter(source.split...
d1fe42f45c30aa2e855e7ecc9ae40f48860c53346d688a7febccdbbc569912c7
Python
3,232
88
# Dynamic features: property density flow and marching observers ################################################################ import h5py import nearl import nearl.features import nearl.featurizer import nearl.io FEATURIZER_PARMS = { "dimensions": 32, # Dimension of the 3D grid "lengths": 16, # Length ...
ec71e431ed24ed5e0410efc76502d3bd581e23e97fa72678b86dec880a968f1d
Python
3,232
80
"""Mixin of contract tests for :mod:`guppy.utils.dandi_filter`. Bound twice: once in ``test_dandi_filter.py`` against a local server that answers byte ranges as the archive does, serving real NWB files, and once in ``test_dandi_filter_live.py`` against the archive itself. The offline binding is a faithful substitute f...
9ca7e3b47a8214f0108bc02c9d50ec1b209a86556fb97fb7d6abf52627f7d013
Python
3,234
80
from qtools.relative_relevance.utils import get_non_zero_features_and_positions, find_folders_with_subfolder, is_larger_subtree, merge_runs_by_epoch, create_df_every_fifth from qtools.relative_relevance.visualize import plot_relative_relevance, plot_delta_relevance_boxplot import numpy as np from scipy.stats import ma...
d232006c0d33cfa4783d8bf2cb85a10fc4a481137c52ba453c41e3c599e401da
Python
3,236
109
from typing import Callable, Dict, Optional, Type import torch from .blocks import ( AgnosticNonlinearInteractionBlock, AgnosticResidualNonlinearInteractionBlock, AtomicEnergiesBlock, EquivariantProductBasisBlock, InteractionBlock, LinearDipoleReadoutBlock, LinearNodeEmbeddingBlock, Li...
7b0d178dbfae5999cf6aad477a2867eb23275a758b69693b27f7be7c955633ea
Python
3,240
95
""" 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 sympy as sym import torch from torch_geometric.nn.models.schnet import GaussianSmearing from .basis_utils import real_sph_...
776d184fb16fd6924fec5cff3755d3642422f362a34755c2a78280bba43a1dd5
Python
3,242
81
import ants import numpy as np import nibabel as nib import matplotlib.pyplot as plt import scipy import imageio from skimage.color import rgb2gray from scipy.ndimage import affine_transform import cv2 from glob import glob def calculate_affine(srcPoints, dstPoints): # Add a fourth coordinate of 1 to each point ...
9bbbe42cfa8ab2c57709d6f536eb83e6d7e12817b90d6e16afcb6e26ae3bf3f6
Python
3,243
106
"""Window algebra for artifact removal. The Select Artifact Windows page asks the user to mark the periods where *artifacts occurred*, but ``coordsForPreProcessing_<recording_site>.npy`` stores the periods to *keep*. The conversion between the two lives here so it is testable independently of the Panel page. """ impo...
becdab8bbbb7405057e1527c34259ee78b5337df2791387079e537ca3844f67b
Python
3,243
100
"""Utility functions for graphs.""" from typing import List, Optional import numpy as np import torch from torch import Tensor def get_edges_index( combined_mask: Tensor, pos: Optional[Tensor] = None, edge_cutoff: Optional[float] = None, remove_self_edge: bool = False, ) -> Tensor: r""" Args...
a46c104dd1f017da57ca4186f2564767224a533e9a0bf7b6371942e819e85fa2
Python
3,244
90
#!/usr/bin/env python3 # # Calculates statistics about the means reported in the midpoints data. # import numpy as np import base nooocytes = True qand = ' and cell != "Oocyte" group by pub' # Query db with base.connect() as con: c = con.cursor() def g(x): q = f'select {x} from midpoints_wt where {x}...
4a3e4366a99ec5a647c503d50feab67c6705fb7ccc52c695bc0419218962c458
Python
3,245
115
import numpy as np import json import os # import gym import gymnasium as gym ############################### Define the functions ############################### class LunarLander: def __init__(self, dims=100, turn=1): self.dims = dims self.lb = 0 * np.ones(self.dims) ...
70c87e0d4da10485a5734689a7ed80aa1075cb7aaf4512d687daeefa5e97478f
Python
3,245
94
import os import pandas as pd from sklearn.preprocessing import StandardScaler DATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), '../CSV/Data') def preprocess_data(df, drop_cols_range, target_col='Permeability'): """ Prepares feature and target datasets. Parameters: - df (pd.DataF...
117b88abe60c1d8cd425c43bd7addb36091e2d60939e2b1787601ea59b24a09b
Python
3,246
113
from copy import deepcopy import typer from medperf import config from medperf.decorators import configurable, clean_except from medperf.utils import dict_pretty_print from medperf.config_management import read_config, write_config from medperf.exceptions import InvalidArgumentError from medperf.commands.utils import ...
6be092e5492b73a6b42112cb13c5ea3dce3c099b40db677253fa60673887dfaa
Python
3,246
77
# 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...
cd69cb6bddcb2a163df3cfce173f400da5eb4ae8043c3f99dad325ce2be8dac9
Python
3,246
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...
4f41d4656d2680bac74eeceecc04698c6b29ea0d7948e9e97e2bdf6e77c17658
Python
3,247
89
import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from scipy import stats import os from global_setting import * #################### Hyperparameters #################### mouse_name = 'S' day = 'day1' module = '1' session = 'open_field_1' # cell_id_list = [38, 7, 157, 12, 20, 14...
9885c43d3e7a8d29b13bc52cc0d570d6ee29f0b47e6ac175e93cd62d4b7d4048
Python
3,247
65
# Copyright (c) OpenMMLab. All rights reserved. # yapf: disable from .ade import ADE20KDataset from .basesegdataset import BaseCDDataset, BaseSegDataset from .bdd100k import BDD100KDataset from .chase_db1 import ChaseDB1Dataset from .cityscapes import CityscapesDataset from .coco_stuff import COCOStuffDataset from .dar...
da056e7c386dfbdf7964c832cf385f9fcca8bdfa88345fb38b03e57fdfc62f90
Python
3,247
95
""" Demo for using `process_type` with `prune` and `refresh` ======================================================== Modifying existing trees is not a well established use for XGBoost, so feel free to experiment. """ import numpy as np from sklearn.datasets import fetch_california_housing import xgboost as xgb d...
101d56a85f2896881f1f0ad991d59b9d36256084d45142be80ee3d3dce5f0ba4
Python
3,248
107
"""Isosurface geometry for volumetric data visualization.""" from typing import Self from pydantic import BaseModel, ConfigDict, Field, model_validator class Isosurface(BaseModel): """An isosurface extracted from a 3D volumetric grid. References a key in ``atoms.info`` that contains a dict with: - ``gr...
83f353d8d4aa0eb88f133aa430cfa78306379b606d4f4a149f453133a4b45eec
Python
3,249
90
import numpy as np class ReinforcementLearning: def __init__(self, num_states, num_actions, learning_rate=0.05, discount_factor=0.95, epsilon=0.05): """ Initialize the reinforcement learning module with explicit state and action value functions. Args: num_states: The number of p...
fefdcd5d8cedfb6a16742da1c303635702fa4d039ab11f9d9ef7d1ceecf780e9
Python
3,250
119
""" U-NET 3D IMPLEMENTATION """ import torch import torch.nn as nn class ConvBlock(nn.Module): def __init__(self, in_channels, out_channels): super().__init__() self.conv1 = nn.Conv3d(in_channels, out_channels, kernel_size=3, padding='same', padding_mode='reflect') self.conv2 = nn.Conv3d...
1096f5dfc51838d99d5a68a52f1221ea3bed0e7edeb73c55811c3c0a9b0112f8
Python
3,253
89
import os import glob data_path = "/Users/Gregg/Dropbox (MIT)/2021 Gregg rotation/Katya_data/BM019_longitidunal_good_examples/p28/Cell7/Dend2"#"/Users/Gregg/Dropbox (MIT)/2021 Gregg rotation/kyle_data/ASC27/Cell01/ASC27_cell01_a1-5_tseries-018"#r"/Users/Gregg/Dropbox (MIT)/2021 Gregg rotation/kyle_data" collect_summa...
4b25e606abf7dd835cc7e96f275826709ae2eeb525bef9ce60bf29693c20b370
Python
3,255
122
""" 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 ..initializers import he_orthogonal_init class Dense(torch.nn.Module): """ ...
658154a91155d1e03dbc2be699574e22e8c6a26f1d477b0015f8b245746b69ce
Python
3,255
96
# -*- coding: utf-8 -*- """ Created on Thu May 16 19:47:10 2024 @author: mbmad """ from patchanalysis.measures.measuretools import NoResultError, InvalidRecordingError, \ withinEachSweep, withinEachSweepHzXuYuCu from patchanalysis import TimeSpan, FullSpan, NullSpan from patchanalysis.signal.peaks import find_peak...
9391093a3539f068a4e64393ad19fd4c79b71328392d36ebf91c66e49c939073
Python
3,255
87
import shutil from pathlib import Path import pytest from guppy.testing import compare_output_folders from guppy.testing.api import locate_run_folder, step1, step2, step3, step4 from guppy_test_data import TESTING_DATA, event_ts_offset_for SESSION_SUBDIRS = [ "SampleData_Clean/Photo_63_207-181030-103332", "S...
e2863c1a44b0bf1e2a8f514cd3d02e21ca4779689b67aa830c892f60eb7d21c5
Python
3,255
103
"""Creates markdown github wiki from bibtex files. Use this version of pybtex for this code to work as expected: https://bitbucket.org/aurelienjaquier/pybtex/src/custom-style/ """ import re from pathlib import Path from pybtex import PybtexEngine from pybtex.style.formatting.unsrt import Style as OriginalStyle from...
9ad18f69ff72702b5aba4ba1374b8639e103dd49562025f809279284febd03dc
Python
3,256
108
import cv2 from pycocotools.coco import COCO from pycocotools import mask as maskUtils # coco id: https://tech.amikelive.com/node-718/what-object-categories-labels-are-in-coco-dataset/ all_instances_ids = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, ...
83d9adbf004b7ebf8c7bb4ac187b68a2d8517bdf19589080202d1db9a63e1ea7
Python
3,259
110
import numpy as np import pytest from tensorflow import keras from dante.neural_surrogate import ( SurrogateModel, AckleySurrogateModel, RastriginSurrogateModel, RosenbrockSurrogateModel, GriewankSurrogateModel, LevySurrogateModel, SchwefelSurrogateModel, MichalewiczSurrogateModel, ...
34c89018cd4c23c23d5afc15a1f731b09a89293fd3571521d87125f12961c987
Python
3,260
96
# Copyright (c) OpenMMLab. All rights reserved. import copy import os.path as osp from typing import List from mmengine.fileio import load from mmseg.registry import DATASETS from .basesegdataset import BaseSegDataset @DATASETS.register_module() class DecathlonDataset(BaseSegDataset): """Dataset for Dacathlon d...
3a7e9ab1bf0da0ee7558e8a7833a4c27d03c76c324609d81195af622ab60fdb4
Python
3,260
112
"""basic scatter_sum operations from torch_scatter from https://github.com/mir-group/pytorch_runstats/blob/main/torch_runstats/scatter_sum.py Using code from https://github.com/rusty1s/pytorch_scatter, but cut down to avoid a dependency. PyTorch plans to move these features into the main repo, but until then, to make i...
5a459778098106fbd8b7b6a8113f88fa340878597e529bf02f71bc383986e016
Python
3,261
88
"""Unit tests for the ``babel-clique-diff`` CLI (src/tools/clique_diff/cli.py). Only the CLI layer — argument handling and the files it writes. The diff itself lives in ``src/model/compendium_diff.py`` and is tested in ``tests/model/test_compendium_diff.py``. """ import csv import json import pytest from src.tools....
8c9e80c102726ef87feb29d74860e7369fd37ff4d0af8b06ee6ae76c4d0414bc
Python
3,261
126
from pathlib import Path from functools import partial import torch import torch.nn.functional as F from torch import sin, cos, atan2, acos from einops import rearrange, pack, unpack from equiformer_pytorch.utils import ( exists, default, cast_torch_tensor, to_order, identity, l2norm ) DATA_...
547cc22f8eb283bd8fc8f4e50f9809b88b302e3432afa52e60914a9125a22260
Python
3,262
108
from rest_framework.permissions import BasePermission from .models import Benchmark from benchmarkdataset.models import BenchmarkDataset from benchmarkmodel.models import BenchmarkModel from django.db.models import OuterRef, Subquery class IsAdmin(BasePermission): def has_permission(self, request, view): ...
5e7686c77070f66c08c04512180ad0b61ad1e1c4edcdae8af340c3c463c47d2b
Python
3,262
63
"""Related to issue https://github.com/spatialtopology/spacetop-prep/issues/110 We will remove events.tsv rows that are longer than the collected BOLD TR slices. These cases will occur, when a scan was aborted earlier than expected, but when the stimulus PC continued to collect data while scan operator was troublesho...
bf27717f00419815c4473208e4caec8ab21e492cc67bd23c04b0535b2b943844
Python
3,262
102
"""Functions to create neuroml cell""" """ 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 License version 3.0 as publishe...
82a1e5628e22b46ffc26daaa9812640442b99b4067e53c6eb04e090df4a018b1
Python
3,263
127
"""Bookmarks REST API endpoints for room frame bookmarks.""" from fastapi import APIRouter from sqlmodel import select from zndraw.broadcast import broadcast_to_room from zndraw.dependencies import ( AccessReadDep, SessionDep, SioDep, WritableRoomDep, ) from zndraw.exceptions import ( BookmarkNotF...
b232ac73e2a5d74697df6d7794bfdd2915febdefd46875325abf420f56532908
Python
3,265
130
"""Dummy cell model used for testing""" import bluepyopt.ephys as ephys class DummyCellModel1(ephys.models.Model): """Dummy cell model 1""" def __init__(self, name=None): """Constructor""" super(DummyCellModel1, self).__init__(name) self.persistent = [] self.icell = None ...
98bee3029ca0ee9018403e236c35f092f04ff30ed757b773228737e13b87f347
Python
3,267
122
import pytest from kgx.prefix_manager import PrefixManager @pytest.mark.parametrize( "query", [ ("https://example.org/123", True), ("http://example.org/ABC", True), ("http://purl.obolibrary.org/obo/GO_0008150", True), ("GO:0008150", False), ], ) def test_is_iri(query): ...
a0cd6e71fce811c7dc7ac82aa8fcb975cb0aec12722ed67904c664363b8fd187
Python
3,267
93
#!/usr/bin/env python # # Download data using http. # # Copyright (c) 2015 Polytechnique Montreal <www.neuro.polymtl.ca> # License: see the file LICENSE import os import sys from typing import Sequence import textwrap from spinalcordtoolbox.download import install_named_dataset, DATASET_DICT, list_datasets, install_d...
1166484c7dbd16485f7024af9a64b094bcaa20606061b6622a605f8bbeabbb4c
Python
3,268
112
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
b67de74437550e4e8218d4df7df646cd9f19ade6bb3b770d038d501862d1f927
Python
3,268
86
# SPDX-License-Identifier: Apache-2.0 """Prepare the ImageNet dataset""" import os import argparse import tarfile import pickle import gzip from tqdm import tqdm from mxnet.gluon.utils import check_sha1 _TARGET_DIR = os.path.expanduser('~/.onnx/datasets/imagenet') _TRAIN_TAR = 'ILSVRC2012_img_train.tar' _TRAIN_TAR_SH...
ef079b433d283645ac01b9eb12636eac1ae082ea442d878ab5c5dc7d59569953
Python
3,268
73
# For benchmark preprocessing usage: # # python Preprocessing_scFile.py --inputfile /home/wangjue/biodata/scData/allBench/9.Chung/T2000_UsingOriginalMatrix/T2000_expression.txt --outputfile /home/wangjue/biodata/scData/9.Chung.csv --cellcount 317 --genecount 2000 --split space --cellheadflag False # python Preprocessin...
b41d6ba36371be652f6d54b63788318a0e413362f025a13c74b68c695c64f663
Python
3,274
97
import os from pathlib import Path from typing import Optional import dotenv import pytorch_lightning as pl from omegaconf import DictConfig, OmegaConf def get_env(env_name: str, default: Optional[str] = None) -> str: """ Safely read an environment variable. Raises errors if it is not defined...
6a46db2a7ddae0948d26b0ff2458f5ed4762c27ba06030ca48a0d5996fd888f7
Python
3,275
85
import os import re import argparse import pandas as pd from concurrent.futures import ThreadPoolExecutor, as_completed def parse_args(): parser = argparse.ArgumentParser(description="Check poisoning success from experiment results.") parser.add_argument("--main_folder", type=str, required=True) parser.add...
8b899eff7a3af9fc67bb9f4fe8d907b22329187f997d717911828f6db0bacef6
Python
3,275
88
"""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: ...
277cad49f696df38723f4e706cc9b3d36e83c6f4c12820e51d97e408a96232d9
Python
3,276
82
""" Comparing Picard and FastICA for the task of detecting ECG artifacts in MEG =========================================================================== Picard and FastICA are fitted to MEG data, from several initializations. The scores related to the detection of ECG artifacts are displayed for each run. Picard i...
baed4fb6da7b8f228f50f8f24906d84da96a45edff6d9205a8fc08dd71e18556
Python
3,276
120
""" Helper script to combine coverage (as codecov seems to have problems...). Written in python to be cross-platform """ import argparse import os from os import chdir, environ from pathlib import Path import platform from pprint import pprint import signal from subprocess import PIPE, Popen, CalledProcessError, Timeo...
61d17d4d952732463e192e30b983cf2f2ab85ed996f103596b735db51b3327af
Python
3,277
96
import os import json from utils import get_all_secrets, safe_store def validate(secrets: dict): """main settings are expected to be a json file that contains secrets IDs of other objects""" expected_keys = set( [ "ca_config", "intermediate_ca_key", "intermediate_ca...
0a2d9208fa82b7dd7f03a47ff3e4729f8ae44d5ee66640ee356b682285e81743
Python
3,278
96
import tensorflow as tf import tensorflow_probability as tfp from tensorflow.keras.layers import Conv2D, MaxPooling2D, \ UpSampling2D, Cropping2D, concatenate, ZeroPadding2D, SpatialDropout2D import functools def create(input_shape, num_class=1, activation=tf.nn.relu): opts = locals().copy() # model = De...
6ff10946499cd0618925dfb5e94e081e44d1075cd9efaa51da1671f76af4768c
Python
3,278
84
import torch import torch.nn as nn import torch.nn.functional as F from rde.modules.common.geometry import angstrom_to_nm, pairwise_dihedrals from rde.modules.common.layers import AngularEncoding from rde.utils.protein.constants import BBHeavyAtom class ResiduePairEncoder(nn.Module): def __init__(self, feat_dim...
91bb879f17d6e9e7278015a146b01e5f6a444d801a8f8334d1881464f853ad8c
Python
3,280
85
# -*- coding:utf-8 -*- ''' Author: MrZQAQ Date: 2022-03-29 14:00 LastEditTime: 2022-11-23 15:32 LastEditors: MrZQAQ Description: Test model FilePath: /MCANet/utils/TestModel.py ''' import torch import numpy as np import torch.nn.functional as F from tqdm import tqdm from prefetch_generator import BackgroundGenerator f...
f733bba2856cfa9c119515293262094f78757055aefa7e6cd841a26dc71539f3
Python
3,280
99
from parse_cp_features import parse_cp_features import pandas as pd import matplotlib.pyplot as plt import seaborn as sns def visualize_channels(significant_features): """ Visualize the distribution of channels for significant features. Parameters: - significant_features: list, features found to be s...
56b293b27b7735bb4f651c911823e51fed6772ff98c3a7a7acf07dbd45aa583b
Python
3,281
66
import torch import torch.nn as nn import torch.nn.functional as F import dgl from dgl.nn import GATConv class GATEncoder(nn.Module): """Use multi-layer GATConv to extract graph structure node features""" def __init__(self, in_features: int, out_features: int, num_heads: int = 1, activation=F.relu, k: ...
ab872794af4f59514bc400cb3cfa09cc5a9cfaf7de4da844f450ea05a7ec6500
Python
3,281
86
"""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: ...
074395ba1b2e0a606a0fa6669d3e4de29c848b1583fa9fa95b022ac2a4b1bee3
Python
3,283
83
import pandas as pd from pathlib import Path import subprocess import os, sys def extract_bids(filename: str, key: str) -> str: """ Extracts BIDS information based on input "key" prefix. If filename includes an extension, code will remove it. """ bids_info = [match for match in filename.split('_') ...
51fcada4b044e88a79017b0576d907a3f983938638043e141e7d337bfb18514c
Python
3,283
65
# -*- coding: utf-8 -*- # Generated by Django 1.10.7 on 2017-07-26 20:49 from django.conf import settings from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class Migration(migrations.Migration): """Add a statistics summary table. This table stores aggregated d...
94a89def718c01e6207822ffc3040d57ba6debad07ed8b033c03400df906873c
Python
3,283
93
import tensorflow as tf # tf.enable_eager_execution() from tensorflow.keras.layers import Conv2D, MaxPooling2D, \ UpSampling2D, Cropping2D, concatenate, ZeroPadding2D, SpatialDropout2D import functools from evidential_deep_learning.layers import Conv2DNormalGamma def create(input_shape, activation=tf.nn.relu, num_...
a88722316f1798fc4b265adc719d5542e5c5a0cc7f38f032362094463fb88e39
Python
3,284
90
import ants import numpy as np import nibabel as nib import matplotlib.pyplot as plt import scipy import imageio from skimage.color import rgb2gray from scipy.ndimage import affine_transform import cv2 from glob import glob def calculate_affine(srcPoints, dstPoints): # Add a fourth coordinate of 1 to each point ...
cec53a72643fde2c51e46a6472d907a6caee0320e37ce1e1862b3218e021bb56
Python
3,284
132
"""Tests for multi-client synchronization via the ZnDraw Python client. Two clients connected to the same room should see each other's changes via REST API (no Socket.IO event propagation tested here — just data consistency). """ import ase import numpy as np from zndraw import ZnDraw def _make_atoms(x: float) -> ...
bc5773e519011bc4476413665d983eecdbe31eee657b6fed1201a3ceb7865909
Python
3,285
94
########################################################################################### # Elementary tools for handling irreducible representations # Authors: Ilyes Batatia, Gregor Simm # This program is distributed under the MIT License (see MIT.md) #################################################################...
cc17bb80e54264fb1383fe75334c188d3c0950939027b5209a5c74d989281efb
Python
3,285
108
import os import subprocess import tempfile import numpy as np import pytest import xgboost as xgb from xgboost import testing as tm pytestmark = tm.timeout(10) class TestOMP: def test_omp(self): dtrain, dtest = tm.load_agaricus(__file__) param = {'booster': 'gbtree', 'objecti...
cc57ac65c5fce6e4357ef98e70d8cff295ec2043e96c67d7c2f44ed8bc001d5d
Python
3,285
78
"""Test functions in heudiconv.convert module. """ import pytest from heudiconv.convert import (update_complex_name, update_multiecho_name, update_uncombined_name) from heudiconv.bids import BIDSError def test_update_complex_name(): """Unit testing fo...
565a76c4486f73297d0a4b32527f928c15b8b41508c7dd614f6f6fdacb77e31d
Python
3,287
81
# 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...
99d8ac167b550078ab54d37cb9dab8c4ce32cd1db70cb318d6e5d99dd0769753
Python
3,289
100
# -*- coding: utf-8 -*- # tests/test_moldata.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 so...
cf12c60e66914b84355f560d00e5ec1cec884ce5096c18cfa4f3437b3313cd73
Python
3,289
101
"""Test l5pc example""" import os import sys import difflib STOCHKV_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), '../../examples/stochkv')) sys.path.insert(0, STOCHKV_PATH) from bluepyopt import ephys neuron_sim = ephys.simulators.NrnSimulator() neuron...
4ebcc290f67e659b3224e35f671a3d42cbe4cc15de6a33e52f2a808fde531242
Python
3,292
98
from __future__ import annotations from typing import TYPE_CHECKING import pytest import torch from chgnet.utils import ( cuda_devices_sorted_by_free_mem, determine_device, gpu_devices_sorted_by_free_mem, solve_charge_by_mag, ) if TYPE_CHECKING: from pymatgen.core import Structure def test_gpu...
13bd7f660f1424f354cf5f9f95d39bc34ae9e2139ca0915abe9c6ed3502cf292
Python
3,294
115
""" 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 from abc import ABC, abstractmethod import torch import wandb from torch.utils.tensorboard import SummaryWriter from ocpmodel...
902eda80907af71269a896f18303bf51db3d64120b5ba852c511af242a611c66
Python
3,294
115
"""bluepyopt.ephys.simulators tests""" """ 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 publis...