sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7ea69a060d12140b41dd358273c636cca725b1b9e2818c6bfeb205a1dd6de0f5
Python
2,873
76
######################################################################## class Basic: """ Add the basic parameters for your trainer modality. These parameters will be displayed on the Basic page of the GUI. This file defines the parameter type and-or its possible values displayed on the GUI, it...
f834542e6ccd7905651dcc392a6ccbd71e7b471707e1803e7e9bf052fcaffb92
Python
2,874
91
import os import argparse from tqdm import tqdm import chromadb def main( documents_directory: str = "documents", collection_name: str = "documents_collection", persist_directory: str = ".", ) -> None: # Read all files in the data directory documents = [] metadatas = [] files = os.listdi...
3ef2134e41ffc8092ecab51e9bf5227e9c0a0f94259c481880fe558c213a7b2b
Python
2,875
86
# Copyright (c) 2019 PaddlePaddle 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 appli...
9e1f2bab26e01e07b5ff545c13686a84bc4c9c23a4ebf36874cbc7e2f229c206
Python
2,875
97
"""Test for the RDKit PMI descriptor NOTE: This is a 3D descriptor and therefore the scoring component creates a conformer. However, this is not deterministic meaning that the generated 3D coordinates can vary depending on the flexibility of the molecule and the quality of the conformer generator. ...
c539da22900c6a1e5dddf1051e21d1f9a4d9ead1d48aa798cad9f9eea8b4736f
Python
2,875
80
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from typing import Union, List, Callable import torch import numpy as np from numbers import Integral from .. import AtomicDataDict class AtomicDataset(torch.utils.data.Dataset): """Base class fo...
b2830b5088a3c09b6b32bd5f0ac554daa5f1dd899f891ed5274e4835d8a97f7e
Python
2,877
78
# Generated by Django 4.1.1 on 2022-11-21 13:31 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('celsus', '0028_alter_project_cell_type_alter_project_curtain_and_more'), ] operations = [ migrations.AlterField( model_name='pro...
586d9fd9c41a9f03375f4977d1e5de748e8e7d9320b1a61ec78bdf322c162f12
Python
2,878
88
from pathlib import Path import mne from .. import io from ... import logger def set_montage(inst, montage, **kwargs): """ Set EEG sensor configuration and head digitization. Parameters ---------- inst : mne.io.Raw | mne.io.RawArray | mne.Epochs | mne.Evoked MNE instance of Raw | Epochs...
2e5befa0c31b1203bf2b6faa89fed1cd90972814a296b8f7b65e756a50dd206c
Python
2,879
95
import numpy as np import random from scipy import stats def alarm_evaluation(target, alarm): idx_preictal = np.argwhere(target==1) idx_alarms = np.argwhere(alarm==1) true_alarm = 0 false_alarm = 0 for idx in idx_alarms: if idx in idx_preictal: tru...
33a927aca03ed8463b435aef62b2f6fe90ce967abaf4f6c7b442f792732852e0
Python
2,879
76
#!/usr/bin/env python3 import tensorflow as tf class mae_ssim_loss(tf.keras.losses.Loss): """Combination of mean absolute error (MAE) and structural similarity index (SSIM). Attributes ---------- max_val_ssim : float Structural similarity index maximum value alpha : float Defines t...
69876d9f57a3049df1f9e6803ef31af2163b413a37020fa01717d5aca954679a
Python
2,881
83
"""Some EDA of the signals that compose the MODA database. Ref: Lacourse, K., Yetton, B., Mednick, S. et al. Massive online data annotation, crowdsourcing to generate high quality sleep spindle annotations from EEG data. Sci Data 7, 190 (2020). https://doi.org/10.1038/s41597-020-0533-4 """ from __future__ import abso...
aab0cdc01713e578049961f0b9924ade8663afd272f2889f2ea3a6317010ce54
Python
2,881
125
import numpy as np import torch import os, sys sys.path.append(os.path.dirname(os.path.realpath(__file__)) + "/..") from model import * from train import * from tasks.seqDS_lfp import seqDS import time print("cuda available = " + str(torch.cuda.is_available())) # Set up the output dir where the output model will be s...
1052443105faa063695e964172cdd24dbc3b50c8452f7bb1fe0d28c0c05c5868
Python
2,882
77
""" Detect trigger times (i.e., state transition / local wavefronts onsets) by applying a threshold to each channel signal. """ import neo import numpy as np import argparse from utils.io_utils import load_neo, write_neo from utils.neo_utils import remove_annotations CLI = argparse.ArgumentParser() CLI.add_argument(...
3794838c7fd8b57b9cbaa622e1652c7a2beba5db47d29392f435be9857f2c8d4
Python
2,884
99
# -*- coding: utf-8 -*- import os import requests from math import ceil import tqdm import hashlib def download_file(url, filename=None, chunk_size=1024, verbose=False, md5sum=True): """ Download file with progressbar. Based on `<https://gist.github.com/ruxi/5d6803c116ec1130d484a4ab...
fb467013c7bfd22ce86d26e808a0ddae7fd98ea3040c0b5a3a8145c5d5913f0f
Python
2,884
97
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import re import requests from urllib.parse import quote from typing import Optional, NamedTuple class ModelDownloadInfo(NamedTuple): model_id: str newer_version_id: Optional[str] web_ur...
b72271a078b3aef72c12aa62542547918a45b3fa206c55e71d03ebc959d31941
Python
2,885
89
from typing import Optional, Dict import torch import torchvision from ..encoding import Encoder, NullEncoder def create_torchvision_dataset_wrapper(ds_type): # language=rst """ Creates wrapper classes for datasets that output ``(image, label)`` from ``__getitem__``. This applies to all of the datas...
cad9b8b613f4e06a103a0e457469ec7d88b041cedca230be237d390cb3bc8284
Python
2,885
62
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. """ Model test classes composed from hierarchical test mixins. The mixins are organized hierarchically: BasicModelTestsMixin (base fixtures + basic tests) └─ EnergyModelTestsMixin (adds energy-...
cc1abc43b1cf03178cb795d94cd056509c3ab474c77d9217ce1eb47af37aa4cb
Python
2,886
90
""" Compute the maximum TM score against training set """ # NOTE this is a thin wrapper around function called in sample.py import logging import os, sys import re import json from glob import glob from pathlib import Path import argparse from typing import * import multiprocessing as mp from tqdm.auto import tqdm f...
92496175e386ae653b9b81f1e47bd049bdc3ce4f9b9e23744b32de2353d3c758
Python
2,887
84
# Copyright (c) 2020 PaddlePaddle 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 appli...
5491a209b0400c1a31762b27f38069ebd2ffd08ecfd70c4a9f04434cc7b4ff77
Python
2,888
105
import argparse import math import os from glob import glob import numpy as np import pandas as pd def get_95_CI(metrics_list, n=10): mean = np.nanmean(metrics_list) std = np.nanstd(metrics_list, ddof=1) lower_bound = mean - 1.96 * std / math.sqrt(n) upper_bound = mean + 1.96 * std / math.sqrt(n) ...
ba951376b26ee0ff50bf7fa5372a65297b7ea094671d8dc2c4e825b3f64b3cd2
Python
2,889
76
import logging import numpy as np from idtrackerai import ListOfBlobs, conf from idtrackerai.utils import track class ModelArea: """Model of the individual blob area, used for a first discrimination between blobs of single individuals and of multiple touching animals (crossings). The statistics are...
32828f01e5f7987250192fce91b5ad21d51d9eb0b20c76f87a472bb198d705fa
Python
2,890
92
import geomstats.backend as gs from geomstats.test.data import TestData from .base import LevelSetTestData, MatrixVectorSpaceTestData class LowerTriangularMatricesTestData(MatrixVectorSpaceTestData): pass class LowerTriangularMatrices2TestData(TestData): def belongs_test_data(self): data = [ ...
9df5f08983721ee91f379c80e957ff070df695c1c953099edbbcfc0b0a1a7ebd
Python
2,890
111
#!/usr/bin/env python # -*- coding: utf-8 -*- # # FileName: main # CreatedDate: 2017-11-20 14:05:59 # import argparse import os from datetime import datetime import matplotlib.pyplot as plt import numpy as np import pandas as pd def main(): # setting option parser = argparse.ArgumentParser( descri...
e3293727bf892bfd1cfcbd550874d4f6fe2fc43e9fee1d1d50fa1f3ee946bf31
Python
2,890
61
import os.path from common.experiment import experiment_run from common.common import store_pickle def run_experiments(config_dict_list): all_experiments_results_summary_list = list() all_experiments_items_summary_list = list() for config_dict in config_dict_list: single_experiment_results_summar...
1cdaf086b4167d0b3b5c80bbe9d11e61c98d1465ca7788e0d8766002e4ad4e00
Python
2,891
78
""" Detect trigger times (i.e., state transition / local wavefronts onsets) by applying a threshold to each channel signal. """ import neo import numpy as np import argparse from pathlib import Path from utils.io_utils import load_neo, write_neo from utils.neo_utils import remove_annotations CLI = argparse.ArgumentPa...
603cb73a8849c47bafa76ec8087d6a2a17bd046a6fd7a3617118cf208a88855a
Python
2,891
89
"""Checkbox panel for turning named plot overlays on and off. The widget draws the options. The owner decides what a checked name means. """ from qtpy import QtCore, QtWidgets from sanpy.sanpyLogger import get_logger logger = get_logger(__name__) class PlotOptionsWidget(QtWidgets.QWidget): """Show named overl...
c6ef64742bdeddcfd5a92b4641a1028ac377dda488b51dc8d3d656f760460dc2
Python
2,893
98
import numpy as np import torch from torch_geometric.nn import to_hetero, SAGEConv from torch.nn import Linear, Dropout, Tanh import random class GNNEncoder(torch.nn.Module): def __init__(self, hidden_channels, out_channels, p=0.2): super().__init__() self.conv_in = SAGEConv((-1, -1), hidden_c...
2818d4595d2db8ecbbbb387aa9622b8948dd8eeb9a0bc869c8f946b96d7a62f7
Python
2,896
98
import numpy as np import torch from torch_geometric.nn import to_hetero, SAGEConv from torch.nn import Linear, Dropout, Tanh import random class GNNEncoder(torch.nn.Module): def __init__(self, hidden_channels, out_channels, p=0.2): super().__init__() self.conv_in = SAGEConv((-1, -1), hidden_c...
19ef8312f1d08af9be917658ec221aaa409dc5bec022c6d020ac5544ad1e6a2e
Python
2,897
84
import numpy as np import os import numpy.random as rgn from mpi4py import MPI def input(path, t_synch_nb, dt): """ Simulate some random spike train input :param path: the file for the configurations of the connection :return: """ # Start communication channels path_to_files = path # F...
d713a54c3f80cec8895f8b567062ed20e8b73e24134e1b7e4b420fdbd4d9d391
Python
2,898
115
import functools import inspect from types import MethodType import numpy as np from scipy.interpolate import PPoly import geomstats.backend as gs def result_to_backend_type(result): """Convert np.array to gs.array within result object.""" if gs.__name__.endswith("numpy") or gs.__name__.endswith("autograd")...
3a768367352f6e028a2ef1182182556ecebb79a349e348bebfc3426fb7d5d04a
Python
2,900
78
""" Detect trigger times (i.e., state transition / local wavefronts onsets) by applying a threshold to each channel signal. """ import neo import numpy as np import argparse from pathlib import Path from utils.io_utils import load_neo, write_neo from utils.neo_utils import remove_annotations CLI = argparse.ArgumentP...
5e0c65f8e8a87ac9686a9f39203254315d4b14fd06b57663b061af5ddb59816b
Python
2,900
60
import pandas as pd, matplotlib.pyplot as plt, seaborn as sns, matplotlib as mpl mpl.rcParams['pdf.fonttype'] = 42 # ========================================== # 1. LOAD DATA (synchronized with re-run: Fig 6 accuracy + clean T4 latency) # ========================================== data = { 'Model': ['YOLOv8-Nano',...
1718948e2f05c192259873e56baf8f5824092a5c97f3276755eed21b6ee9e95d
Python
2,901
87
# Copyright (C) 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" from keras.models import model_from_json from keras_contrib.layers import InstanceNormalization from openfl.federated import KerasTaskRunner from keras import backen...
1a337b6057ccec100caa1e8b802b4431d35eafab8f7b2e2a07251b0bf809c4f3
Python
2,902
76
# -*- coding: utf-8 -*- """ Created on Thu Aug 27 11:17:18 2020 @author: Tom """ from tensorflow.keras.preprocessing.image import ImageDataGenerator import warnings from data_frame_iterator_pat import DataFrameIteratorPat class ImageDataGeneratorPat(ImageDataGenerator): def flow_from_dataframe(self, ...
891353d7d19510c3f1e29e2f37e98d3b96fcde847fa2ec5860331d5067e82b75
Python
2,902
88
import xgboost as xgb from openfl.federated.data.loader import DataLoader class XGBoostDataLoader(DataLoader): """A class used to represent a Data Loader for XGBoost models. Attributes: batch_size (int): Size of batches used for all data loaders. X_train (np.array): Training features. ...
d6276e7f77dfeedbe6870d614026a580cc65d16676ecd6d78ae4ffb9dd9517a3
Python
2,902
101
import random import pytest from geomstats.geometry.hyperboloid import Hyperboloid from geomstats.geometry.open_hemisphere import ( OpenHemisphere, OpenHemispheresProduct, OpenHemisphereToHyperboloidDiffeo, ) from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test.random import ...
69250991dbe2cf5b4ed48eb9347df5087da2759105c2939b8779e280ec5c866f
Python
2,903
74
"""Unit tests for the pure-numpy GNC backend helpers. No scanner data, no FSL/TORTOISE binaries, no scratch dir - just numpy/nibabel. """ import numpy as np import nibabel as nib import pytest from lib.gnc.backends import _sanitize_graddev_matrix from lib.gnc.backends.tortoise import _lps_disp_to_fsl_rel, resolve_is...
6eb41af8f84f80048f430a2b034a5a298463cf0aea9e5eb6dd9618f6a3061e39
Python
2,903
86
# Copyright (c) 2020 PaddlePaddle 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 appli...
dffded4a129ecf747781d8b65b090e4a3286f6775f7c9a4ce9b26097176f3e14
Python
2,903
68
import torch from typing import Union, Sequence, Dict from math import sqrt from nequip.data import AtomicDataDict class AvgNumNeighborsNorm(torch.nn.Module): def __init__( self, type_names: Sequence[str], avg_num_neighbors: Union[float, Dict[str, float]], ) -> None: """ ...
d4a2e0ba3c37c7432e3aa63b63257e2506ef8fae8cc2d71511d44fc8aabce5c2
Python
2,904
84
import experiment as exp from experiment import session_state import arena import functools class StackedFeeders(exp.Experiment): default_params = { "feeders": { "Left Feeders": ["Bottom Left Feeder", "Top Left Feeder"], "Right Feeders": ["Bottom Right Feeder", "Top Right Feeder"],...
2291505cbf2ee1dff08d6b0bf885ea9bb5df013b40e6d5d54a45ec94a1ff36de
Python
2,905
97
"""Protect the import boundary between SanPy's backend and Qt interface.""" from __future__ import annotations import ast from pathlib import Path import subprocess import sys import sanpy SANPY_PACKAGE_DIR = Path(__file__).resolve().parents[1] / "sanpy" FORBIDDEN_BACKEND_IMPORTS = ( "PyQt5", "PyQt6", ...
86be0b4e55909975480ab615c6801350fbc00be1f5be7e69c98aca0db62a1762
Python
2,910
126
import analysis_utils as au import torch import matplotlib acf2gain = { 'nn.Sigmoid()': 1, 'nn.Tanh()': 1.6666666666666667, 'nn.ReLU()': 1.4142135623730951, 'nn.LeakyReLU()': 0.9999000099990001, 'pc.NoneModule()': 1.0, } def plot_mean(df, id='test'): df = au.nature_pre(df) # input(df.lo...
0646b4ad4036e753e6107cafc4f3fd513e348c262314d32ff35d78a7503454fb
Python
2,911
97
''' the preprocessing code refers to the work(Yin, B., Corradi, F. & Bohté, S. M. Accurate and efficient time-domain classification with adaptive spiking recurrent neural networks. Nat. Mach. Intell. 3, 905–913 (2021)). ''' import os import urllib.request import gzip, shutil # from keras.utils import get_file import ma...
7490f8e2ee6d0402a29b63f11a87d5dc75db71cf5de91edd142c7065ab0beabc
Python
2,911
75
""" Downsample the input data by combining and averaging neighboring channels. """ import numpy as np import matplotlib.pyplot as plt import argparse from pathlib import Path import os import neo from skimage import measure from utils.io_utils import load_neo, write_neo, save_plot from utils.parse import none_or_path ...
81b922ad651d878ca5a974da4a232b495c8bc43ef1f3552aa624cf326aaed9a8
Python
2,912
81
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ from csbdeep.models import CARE import time, os, glob from tqdm import tqdm import numpy as np from skimage.io import imread, imsave os.environ['CUDA_VISIBLE_DEVICES']='1' #%% ''' register images and save them ...
a255c24c5ec01bdd64e49165ad89dd900647dead80019687f9d9c3c6b07bf1ee
Python
2,912
94
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import os import importlib import argparse COLLATE_FN_REGISTRY = {} def register_collate_fn(name): def register_collate_fn_method(f): if name in COLLATE_FN_REGISTRY: raise ValueError( ...
fbc467fabc9598d8c9287473a1c3dbb9e77d1601f4786b6b224fb18d24cdd1b2
Python
2,914
97
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ from csbdeep.models import CARE import time, os, glob from tqdm import tqdm import numpy as np from skimage.io import imsave #os.environ['CUDA_VISIBLE_DEVICES']='1' #%% ''' register images and save them in the ...
0c63ff799baedba77f3c07e394dd6b06e31226aa89281c19c2438e9f27db1945
Python
2,915
71
import pytest import unittest import numpy as np import numpy.testing as npt import torch import torch.utils.data as tud from reinvent.models import Mol2MolAdapter from reinvent.models.transformer.core.dataset.dataset import Dataset from reinvent.models.transformer.core.enums.sampling_mode_enum import SamplingModesEn...
914c25683c601f82a9ea2431b3ccab7a1f42357e220761c5a6cb6c1589dca3f9
Python
2,915
77
import torch.nn.functional as F import torch class gru(torch.nn.Module): def __init__(self, classes, arch=[45, 7, 5, 20, 0.23128823035454756, 71]): super(gru, self).__init__() self.input_size = 1 self.num_layers = 3 self.bidirectional = True self.arch = arch ...
b1401fd130143c466c118dc7df486613a1e8f9f2488cbbc9cd7f8bf7ae245aa4
Python
2,915
101
import math import geomstats.backend as gs from geomstats.test.data import TestData from .euclidean import EuclideanMetricTestData class MinkowskiTestData(TestData): def basis_cardinality_test_data(self): return None class MinkowskiMetricTestData(EuclideanMetricTestData): fail_for_autodiff_excepti...
db5a684a12023fa09a34ba7fcffff5ab72c8fd3498850d1b2dc837fe29555616
Python
2,916
89
import random import pytest from geomstats.geometry.general_linear import GeneralLinear from geomstats.geometry.group_action import ( CongruenceAction, PermutationAction, RowPermutationAction, permutation_matrix_from_vector, ) from geomstats.geometry.matrices import Matrices from geomstats.geometry.sp...
b3cce7e21ae98d661035be4f9a89f8639a4ab23a3b33c7e01d230258a13684dd
Python
2,917
96
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import argparse import os import importlib, inspect from .base_layer import BaseLayer from .conv_layer import ( ConvLayer, NormActLayer, TransposeConvLayer, ConvLayer3d, SeparableConv, ) from .l...
1e36b384affd2a994fec65b3299fc8bbeac968ed738a978e53a82984dd9a036f
Python
2,918
109
import glob import os from model_angelo.utils.grid import ( apply_bfactor_to_map, crop_center_along_z, get_auto_mask, load_mrc, make_model_angelo_grid, save_mrc, ) def standardize_mrc(args): if not os.path.isfile(args.input_path): input_files = glob.glob(os.path.join(args.input_pa...
6373f95076eff7a8f016d4d7eee74c68c5ebe85b2051306b82be2da1f2eab7f3
Python
2,918
82
import os import pandas as pd import sys import numpy as np #Read in the intersected narrowPeak file derived from liftover #cutoff is the argument that determines the degree of overlap required between two peaks for them to be considered partners. y = sys.argv[1] cutoff = float(sys.argv[2]) m = pd.read_csv(sy...
681ba3d7dbed1cd53d8ddc2166f79a221c8708669bb73153c9df030e8f5d52b8
Python
2,920
82
from qtpy.QtGui import QKeyEvent from qtpy.QtWidgets import QLabel, QListWidget, QVBoxLayout, QWidget from superqt import QToggleSwitch from idtrackerai import Blob, Fragment from idtrackerai.GUI_tools import GUIBase, key_event_modifier class CustomListWidget(QListWidget): """List widget that remaps W/S to Up/Do...
40622131444d8d5382cd6a3ed3b2f9b4f4451acb4d17e7bf07913bf88afac8bf
Python
2,922
86
import logging import tempfile import numpy as np import torch import torch.nn.functional from torch import nn, optim from mace.tools import ( AtomicNumberTable, CheckpointHandler, CheckpointState, atomic_numbers_to_indices, ) def test_atomic_number_table(): table = AtomicNumberTable(zs=[1, 8]) ...
e4722a5c1eaa86e615a43c65c3404223f087e3ee496a890b26cd8f8ec3d63d79
Python
2,924
86
import json import logging import os import pathlib import shlex import shutil import stat import tempfile import yaml from reinvent_plugins.components.run_program import run_command from reinvent_plugins.components.synthsense.aizynthfinder_config import ( ensure_custom_stock_is_inchikey, prepare_config, ) fr...
bd0e2c12ded33bf9bfad3ddcd95fb59dcf25b6da0118ceced4ea3ed7a9403693
Python
2,927
94
from video_stream import ImageObserver import numpy as np import video_system import data_log import experiment as exp class YOLOv4ImageObserver(ImageObserver): default_params = { **ImageObserver.default_params, "cfg_path": None, "weights_path": None, "meta_path": "image_observers/...
164a9d34a7d4be57695720e71f5ea32c6f4ef6c36f52c236ed0a40ec27bcc084
Python
2,929
87
"""Test for the integrators.""" import pytest import geomstats.backend as gs import geomstats.integrator as integrator from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.matrices import Matrices from geomstats.test.test_case import TestCase class TestIntegrator(TestCase): def setup_metho...
649a7f6af8c1fbf9dbb2cea547d6af7517f6b8244e574b8065b24799cd129133
Python
2,930
105
""" Neurodecode's logger. TODO: Add file handler. """ import sys import logging # log level options provided by neurodecode LOG_LEVELS = { 'DEBUG': logging.DEBUG, 'INFO': logging.INFO, 'WARNING': logging.WARNING, 'ERROR': logging.ERROR } def init_logger(logger, verbosity='INFO'): """ Initiali...
31eff75f71ccc4a9b2a43ba57cc04a9eecf464f00660192002ae042acf9f73b2
Python
2,931
102
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import os import importlib import argparse SUPPORTED_NORM_FNS = [] def register_norm_fn(name): def register_fn(fn): if name in SUPPORTED_NORM_FNS: raise ValueError( "Cannot...
acdf9725db369862d929f3d457af9ac94c9c9e089d8afe5f1c63e6e88f840853
Python
2,934
96
"""Tests for the standalone plot options checkbox panel.""" from typing import Any import pytest from qtpy import QtWidgets from sanpy.interface.plot_options_widget import PlotOptionsWidget def _checkbox_grid( widget: PlotOptionsWidget, ) -> list[tuple[int, int, str, bool]]: """Return checkbox row, column,...
a3037c81b497d136d094b982ea83c01bfdb8c8d72dea77ebb865516ce140689f
Python
2,935
88
import numpy as np from numpy.linalg import norm from skimage.measure import label, regionprops def colour_deconvolution(image, stains): # same as my MATLAB function, but not as efficient (ca. factor 10) if stains == 'HE': # Color deconvolution of H&E stains # RGB OD matrix for hematoxyli...
64fd8ca534d843e9e362da864053eb266e83eaa1961b427ce287bd2dc49c072a
Python
2,936
97
from abc import abstractmethod import os from typing import ClassVar, Dict, Any import uuid import chromadb from chromadb.config import Component from pathlib import Path from enum import Enum TELEMETRY_WHITELISTED_SETTINGS = [ "chroma_api_impl", "is_persistent", "chroma_server_ssl_enabled", "chroma_se...
218d0350e356ff244a61d7d29c1a87f246366d63d32d4b9ecf10c43e752e7f19
Python
2,939
113
from numba import njit, jit, objmode from numba.experimental import jitclass from numba import int32, int64, float32, float64, boolean from numba import typed, types from numba.types import pyobject import numpy as np from scipy.io import loadmat, savemat spec = [ ('nil', int32), ('capac...
e62f33d375c04e8a7fed2f66d2ad0a08a02a5d45da569da4a97c652be485599e
Python
2,939
114
#!/usr/bin/env python # # Installer for REINVENT4 # # Simple script to compute the command line parameters for pip. PyTorch # controls the version for the processor type via setting the right URL. Some # packages are optional and may need a URL of their own. # import subprocess as sp import argparse OPTIONAL_DEPENDE...
b3c2f4fcb469e50ff2f9a64b1160c90effa4aa2aa0afdc16512b659dfd04a80e
Python
2,941
94
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """openfl.experimental.workflow.runtime module Runtime class.""" from typing import Callable, List from openfl.experimental.workflow.interface.fl_spec import FLSpec from openfl.experimental.workflow.interface.participants import Aggregato...
91907377255b95576a90cfc3e721be3dd07362611321abf8f6e693ca067937cf
Python
2,942
91
"""Tanimoto similarity and Jaccard distance""" from __future__ import annotations __all__ = ["TanimotoSimilarity", "TanimotoDistance"] import warnings from typing import List import numpy as np from pydantic.dataclasses import dataclass from reinvent.chemistry import conversions from reinvent.chemistry.similarity ...
0342fb07c69b172b355ff416cd8641a16272a51488102fa1bd097ea125ad701f
Python
2,943
105
# This tests a very minimal of test_add in test_add.py as a example based test # instead of a property based test. We can use the delta to get the property # test working and then enable import random import time from chromadb.api import ClientAPI from chromadb.test.conftest import ( multi_region_test, reset, ...
161c26e464da9fd1e6245d7fd35c3ecd7eaf96ce00b016d97a21ea15040d9227
Python
2,947
79
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ from csbdeep.models import CARE import time, os, glob # from keras import backend as K # import tensorflow as tf import numpy as np from skimage.io import imread, imsave # time.sleep(60*60*6) #%% ''' register...
c675682bd29333b2f86852b3f9e1bfdb87772000602bc3ea852ae73269d4444f
Python
2,949
108
""" Randomly sample angles in the test set to construct a baselines for scTM scores We sample angles by """ import os from pathlib import Path import json import logging import argparse from tqdm.auto import tqdm import numpy as np import pandas as pd import torch from sample import build_datasets, create_new_chain...
97a6cabea7992a5031c56e0c9483f50211c867f7a0f44fae2299934d0d34efe7
Python
2,951
89
# Copyright (c) 2021 PaddlePaddle 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 appli...
3c94308bf1963f026a3ff8e24ca81cdac9fa7f02933dcbb43b9b0a2f932cc17d
Python
2,955
108
import random import pytest from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.hypersphere import Hypersphere from geomstats.geometry.spd_matrices import SPDMatrices from geomstats.learning.frechet_mean import FrechetMean from geomstats.learning.kmeans import RiemannianKMeans from geomstats.te...
e82562f014eed5f3e67797618d45232437a7e1652cf2c06cc696e88ea311c067
Python
2,960
104
"""Module containing utils""" from numpy.polynomial.legendre import Legendre import numpy as np import scipy.linalg as la def compute_tsnr(data, confounds): """Compute tSNR on data by first regressing out the following nuisance regressors: - six motion parameters and their derivatives - global signal...
90990438a16f54350c8b4d938d91331dc320d4e4aa841e4695ca408ee4853c68
Python
2,961
107
"""Compute various scores with RDKit""" from typing import List, Callable import numpy as np from rdkit.Chem import AllChem as Chem, Crippen, Descriptors, Lipinski from ..component_results import ComponentResults from reinvent_plugins.mol_cache import molcache def compute_scores(mols: List[Chem.Mol], func: Callabl...
025b3e6e31a80de96b4151c362949f13daa461705737480042df30139f72699a
Python
2,962
90
# Copyright (C) 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import pandas as pd from sklearn.datasets import load_iris from openfl.federated.data.loader import DataLoader class IRISInMemory(DataLoader): """Data Loader for IRIS Dataset.""" def __init__(self, batch_size=32, data_path=None, **...
1c5f821d9eedb13e720315d64533dc37b0b3a417cb9d53851220d8c6eb37d128
Python
2,962
74
import torch from torch_geometric.nn import global_mean_pool, global_max_pool import torch.nn.functional as F from torch_geometric.nn import SAGEConv, GENConv, GraphConv, JumpingKnowledge, GATv2Conv, GINConv from torch.nn import Linear, BatchNorm1d, ReLU, Dropout class Net(torch.nn.Module): def __init__(s...
5d04ddfadc777e80f6d6ca65aaf873a130cbf6888161fa24e11da9fd15cd109f
Python
2,964
101
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*- import os pwd = os.path.join(os.path.abspath('.'), 'src/data') import sys sys.path.insert(0, pwd) from data_functions import load_data from simulate_dros import parameters_df, normalize, writeTbsFile import glob import argparse import logging import numpy as np impo...
4f82b612603ec389caedfdb868bae0e8279115ed45b96305b54d62972100555d
Python
2,965
73
from rest_framework.permissions import BasePermission, SAFE_METHODS from rest_framework_simplejwt.exceptions import TokenError from rest_framework_simplejwt.tokens import AccessToken from celsus.models import CurtainAccessToken from celsusdjango import settings class IsOwnerOrReadOnly(BasePermission): def has_ob...
adeb37ab19a4d1db2213bb6df5efa45b49b4f7232be45c97b77bae729634de8d
Python
2,968
66
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. import torch from nequip.data import AtomicDataDict class VirialToStressTransform(torch.nn.Module): r"""Converts virials to stress and adds the stress to the ``AtomicDataDict``. Specifically ...
80880f72bca01a38e8289f885e1ff88d2c18bc654944020d87c113d628040cec
Python
2,972
92
import torch import numpy as np def get_topic_diversity(beta, topk): num_topics = beta.shape[0] list_w = np.zeros((num_topics, topk)) for k in range(num_topics): idx = beta[k,:].argsort()[-topk:][::-1] list_w[k,:] = idx n_unique = len(np.unique(list_w)) TD = n_unique / (topk * num_...
5597244f9732edef5d6a760ae8b277318159048117d54a8aafa16e2827e7c81b
Python
2,979
85
import numpy as np import scipy.stats DATA_DIR = '/media/O_o/UB/research/dataset/20newsgroups/CoEmbedding/' vocab_pt = DATA_DIR + 'vocab.txt' #embedding_pt = 'D:/UB/research/dataset/20newsgroups/CoEmbedding/results/Embeddings_K50_iter19.npz' embedding_pt = DATA_DIR + 'results_parallel/Embeddings_K50_iter19.npz...
6b88ba11b65614d5eb447e791ba0489dc945ea78d95648670093ddf4ca3afbc1
Python
2,979
122
# -*- coding: utf-8 -*- #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Feb 1 16:21:13 2022 @author: kilgoretrout """ # -*- coding: utf-8 -*- import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import numpy as np import logging import argparse import os import torch import h5...
694109ee6ce3dd41265d5ab5a5d5da98f70537e6d2a09412aaaebed4b8df6fe0
Python
2,980
87
# coding=utf-8 import torch import torch.nn.utils.rnn as tnnur import torch.utils.data as tud class Dataset(tud.Dataset): """Dataset that takes a list of SMILES only.""" def __init__(self, smiles_list, vocabulary, tokenizer): """ Instantiates a Dataset. :param smiles_list: A list with...
f8a51242e47103804c811a1a95008c9694bf17ee28add5efac460ffddf1ac3bc
Python
2,981
104
from __future__ import annotations import textwrap from typing import TYPE_CHECKING from snakebids.utils.utils import entity_to_wildcard if TYPE_CHECKING: from snakebids.paths._utils import BidsPathSpec, BidsPathSpecFile TEMPLATE = ''' def {spec}(subject_dir: bool = True, session_dir: bool = True) -> BidsPathSp...
3471686dadf39b4e8c094203da7397930bb8c599dde4a0739c72f2276e094573
Python
2,982
45
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
b357f946471911d7679fb8fcc363d5433f37a5b2ab0a06d7436efa33ba249158
Python
2,983
116
""" Get synapse info: presynaptic cell and size """ import argparse from sys import argv import numpy as np import pandas as pd import tifffile as tif from cloudvolume import CloudVolume from utils import load_volume if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--syn_seg", ...
b9eed1ffde7cf09316e1322f4dc13d9f06881d81432f71c7e3cfd9a11efbced3
Python
2,984
94
from unittest import TestCase import torch.nn as nn import torchvision.transforms.functional as FT from smithers.ml.models.vgg import VGG default_cfg = [ 64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 'M' ] #vgg16 vgg19_cfg = [ 64, 64, 'M', 128, 128, 'M', 256, 256, 256...
8ba74319d7a1bc47b7da1d385c03c8a01f0a0b2a6e8f71a06417b6493bfa6c34
Python
2,986
97
from threading import Lock from typing import Dict, List, Sequence from uuid import UUID, uuid4 from overrides import override from chromadb.config import System from chromadb.db.system import SysDB from chromadb.segment import ( SegmentImplementation, SegmentManager, SegmentType, ) from chromadb.segment....
5d1da393211f0c05fbf2ca86808d2571c1566a278e06ac6add634da96bcd6bd9
Python
2,987
108
import pytest from corgie.boundingcube import BoundingCube from corgie.stack import Stack from corgie.layers.base import BaseLayerType from corgie.block import Block, partition, get_blocks @pytest.mark.parametrize( "xrange, sz, overlap, skip, result", [ (range(4), 2, 0, [], [range(0, 2), range(2, 4)])...
07e5410e351b01a5233a7372b0fdcf2083c08fce58a53615627b8fac8ad2b175
Python
2,988
102
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """CustomAssigner tests.""" from unittest import mock import pytest from openfl.interface.aggregation_functions import GeometricMedian from openfl.interface.aggregation_functions import WeightedAverage from openfl.component.assigner.cu...
02666d168e77ee8c86294f215c13d0e29f5e01a36ca24a9b7864842f2d8d57d4
Python
2,989
89
from __future__ import absolute_import from __future__ import division from __future__ import print_function import paddle import paddle.nn as nn import paddle.nn.functional as F from ppdet.core.workspace import load_config, merge_config, create from ppdet.utils.checkpoint import load_weight, load_pretrain_weight fro...
c2f375f8f4ced805b2b7432962a614f8e64152eb9e429ec2b52f8fa80432c5fc
Python
2,992
74
import subprocess import pandas as pd import numpy as np import concurrent.futures from Bio import SeqIO from typing import List def blast_search(seq, database_path, blast_executable, species): blast_cmd = [blast_executable, "-db", database_path, "-query", "-", "-outfmt", "6 qseqid sseqid pident length mismatch g...
695faaae300063d30124387f65ee31cc69c565faac650a27ad942d253625bf4c
Python
2,993
111
import six from filters.schema import base_query_params_schema from filters.validations import DatetimeWithTZ, IntegerLike, CSVofIntegers, Alphanumeric, GenericSeparatedValidator organism_query_schema = base_query_params_schema.extend( { "id": IntegerLike(), "created": DatetimeWithTZ(), "n...
6f1c0f1c830ed44a71397eba2a0bf338314aea88a7c23b9b5368e61155c4267f
Python
2,996
79
#!/usr/bin/python # -*- coding: utf-8 -*- ##################################### # File name : gpu_mem.py # Create date : 2019-06-02 16:56 # Modified date : 2019-06-02 16:59 # Author : DARREN # Describe : not set # Email : lzygzh@126.com ##################################### from __future__ import division fr...
029e02a9ea6ac6d694e5b89e3645ce49892fd75f2562a4ed2bc664a33b602915
Python
2,998
88
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging from openfl.experimental.workflow.interface.fl_spec import FLSpec from openfl.experimental.workflow.interface.participants import Aggregator, Collaborator from openfl.experimental.workflow.runtime import LocalRuntime from open...
b244622bef2843964901b34baf6fba60b3715742435aa69ebe1a1b6709a04cb0
Python
3,000
91
from typing import Dict, List, Union import pytest from snakebids.core.filtering import filter_list @pytest.mark.parametrize( ("zip_list", "filters", "output"), [ ( { "dir": ["AP", "PA", "AP", "PA", "AP", "PA", "AP", "PA"], "acq": ["98", "98", "98", "98", ...
b93093913f3fcc4900ae88aca3717bde963bacc3eb3c33455c817e57f637a30a
Python
3,002
73
#!/usr/bin/env python import sys import subprocess import os from pprint import pprint from time import gmtime, strftime if __name__ == '__main__': if len(sys.argv) != 5: print( \ "Error expecting: " + \ "starting_fov " + \ "num_fovs " + \ "b...
7d00adb118afd0da30118e1226484a86fd0488c336b4111c0635b7c2a81ab9ee
Python
3,006
96
# ############################################################## # This file is received from # - https://github.com/czbiohub/noise2self/blob/master/mask.py # It is masking mechanisim implementation from noise2self paper. # The code is licenced under MIT licence # https://github.com/czbiohub/noise2self/blob/master/LICE...
9fc714a234ad80fd5c8e6c6d97cee3e0245ef6936f9b6f6ac0328ad7882e81e0
Python
3,009
84
from PymoNNto.Exploration.Network_UI.Network_UI import * from PymoNNto.Exploration.Network_UI.TabBase import * from PymoNNto.Exploration.Visualization.Analysis_Plots import * class Analysis_Module_tab(TabBase): def __init__(self, title='Modules'): super().__init__(title) def add_execute_btn(self, Net...
a55ae36deeb9716fe882efd018046755872bf4782f84e1e2ae63084388c4429f
Python
3,009
89
from . import register_scheduler from .base_scheduler import BaseLRScheduler import argparse import math @register_scheduler("multi_step") class MultiStepLRScheduler(BaseLRScheduler): """ Multi-step learning rate scheduler with optional linear warm-up strategy """ def __init__(self, opts, **kwargs) -...