sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f42e85c9dc88f9670e2d344cfa272519406ec139d35de146965b9bbab905b41b
Python
1,528
56
import random import pytest from geomstats.geometry.complex_matrices import ComplexMatrices from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.complex_matrices import ComplexMatricesTestCase from geomstats.test_cases.geometry.hermitian import HermitianMetricTestCase fro...
16985ca7657c2cb8a7b899fd07209b162fd25e8b3a3f959e89f5cf052615d6b9
Python
1,529
74
from __future__ import print_function from os import environ as env URL = 'https://storage.yandexcloud.net' class Progress: def __init__(self): self.size = 0 def show(self): mb = self.size / 1024 / 1024 print('%.2fMB' % mb, end='\r') def __call__(self, chunk): self.si...
537696065ce7998167d7e1283d4be41b19d22234370791e32402db663678cdcb
Python
1,530
44
from data.dataset import Brats184, Brats2021Train, Brats313, GanBratsFromFolder from learning.train_from_folder_name import train_experiment if __name__ == '__main__': split_using_instances = True base_dataset = 'Brats2021' include_original = True include_synthetic = False single_channel = True ...
087073cd4164fe1d7f2109e30aeaa5ee2610025c65a3bb83735d90b91b235a1d
Python
1,534
37
import json import argparse from rdkit import RDLogger from dig.ggraph.method import GraphDF from dig.ggraph.evaluation import PropOptEvaluator RDLogger.DisableLog('rdApp.*') parser = argparse.ArgumentParser() parser.add_argument('--prop', type=str, default='plogp', choices=['plogp', 'qed'], help='property name') par...
5f6006ce9c3709286cf6d3d95eacec9267af2f5c251d7d72a1d4a43db6f60865
Python
1,534
63
from sleepy.processing.processor import Algorithm from sleepy.processing.parameter import Parameter import numpy as np class Relative(Algorithm): def __init__(self): self.name = "Relative Amplitude" self.durationLow = Parameter( title = "Lower bound for duration interval [sec]", fieldType = float, de...
a3d1ffac50dacda34da20162c374be5292a154ab77f77b0d1c9d30f03ae2ed57
Python
1,537
42
"""Tests for complete ABF extraction through the public PyABF API.""" from pathlib import Path import numpy as np import pyabf from sanpy.io.zarr_export.pyabf_adapter import snapshot_abf def test_snapshot_reads_every_sweep_and_adc_channel(small_abf: Path) -> None: """Read raw and command values for every sweep...
4d524fd6e3363d1cf8036277c7d2851bd66b29d216a59687c4ed5cf6b88805d1
Python
1,538
60
import pytest from torch import nn from reinvent.models.transformer.core.network.encode_decode.model import EncoderDecoder from reinvent.models.transformer.core.vocabulary import build_vocabulary from reinvent.models.transformer.libinvent.libinvent import LibinventModel from reinvent.models import meta_data from tests...
9204bb2eace44064e08e21bb5b7ac1b9f9308ab5d8984277382ce22156184ac6
Python
1,539
48
import numpy as np import xarray as xr from numpy.testing import assert_allclose, assert_raises from gemmr.estimators import SVDPLS from gemmr.data import generate_example_dataset from gemmr.sample_analysis.macros import * class MockEstr(): def fit(self, X, Y): self.assocs_ = np.arange(2) return...
b621510163a47747647232f90ccb2232148837c3a51212dbfcad6c440814055e
Python
1,539
45
""" Calculate the number of triggers involved in each wave. """ import numpy as np import argparse from pathlib import Path import pandas as pd from utils.io_utils import load_neo, save_plot from utils.parse import none_or_path CLI = argparse.ArgumentParser() CLI.add_argument("--data", nargs='?', type=Path, required=...
574a7605a710699bb1847067bb2d1b230de79562098ecc204a6b5a9a7344a13d
Python
1,540
44
from dival import get_standard_dataset from dival.measure import PSNR from dival.reconstructors.tvadam_ct_reconstructor import TVAdamCTReconstructor from dival.reference_reconstructors import ( check_for_params, download_params, get_params_path) from dival.util.plot import plot_images import matplotlib.pyplot as pl...
ca827931bc09c3aa886e2e78386b0aee1aa5e19d93a05d0506c2f6c6324b7412
Python
1,540
48
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Project information ----------------------------------------------------- # https://www.sphinx-doc.org/en/master...
110712aa4113368a4d45cf02019c47588f949ab6a331a2acb48b8290dcf82600
Python
1,541
67
import torch.nn as nn from . import base from . import functional as F from ..base.modules import Activation class JaccardLoss(base.Loss): def __init__(self, eps=1.0, activation=None, ignore_channels=None, **kwargs): super().__init__(**kwargs) self.eps = eps self.activation = Activation(a...
850683f105ea140c8fb1b1bb1f4799f79cf45b66e98ad98e0f6f433e7ac73ae0
Python
1,542
45
# Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the Creative Commons Attribution-NonCommercial # 4.0 International License. To view a copy of this license, visit # http://creativecommons.org/licenses/by-nc/4.0/ or send a letter to # Creative Commons, PO Box 1866, Mountain ...
c43028eae6443e48887c42bd2641e6a2684dddda4650686a7b893a68dac5d8bd
Python
1,542
49
"""Statistical Manifold of categorical distributions with the Fisher metric. Lead author: Alice Le Brigant. """ from geomstats.information_geometry.multinomial import ( MultinomialDistributions, MultinomialMetric, ) class CategoricalDistributions(MultinomialDistributions): r"""Class for the manifold of ...
0508d2159ca29f52a87cd429c2622aeb7fc80758f7866b9fccd2fc90756a6e8f
Python
1,544
40
from rdkit import Chem from reinvent.chemistry.library_design import bond_maker, attachment_points from reinvent.chemistry.library_design.reaction_filters import ReactionFiltersEnum from tests.chemistry.fixtures.test_data import ( SCAFFOLD_SUZUKI, DECORATION_SUZUKI, SCAFFOLD_NO_SUZUKI, DECORATION_NO_SU...
cad1d38278ae7560ccb37a36e303a581d6b7db861889842ae5a4e7d70af9dc09
Python
1,544
62
import os import numpy as np import scipy.signal as sig import matplotlib.pyplot as plt # Parameters T = 10 ms = 1e-3 dt = 0.1*ms fs = int(1/dt) tv = np.arange(0, T, dt) # file path datadir = 'results_PRC_new/None/22-06-2022 12H35M46S/data' datadir = '/home/nikos/Documents/projects/Python/memstim-hh/results/new_test/...
cc965fcdf56eb9344e8f0555acb34dd246715c0cbcb80e1f3777eca75cce9bec
Python
1,545
37
from deeprank_gnn.GraphGenMP import GraphHDF5 from deeprank_gnn.NeuralNet import NeuralNet from deeprank_gnn.ginet import GINet from deeprank_gnn.tools.CustomizeGraph import add_target import glob #path to the docking models in pdb format pdb_path = '../DC/pdb/' #path to the pssm files pssm_path = '../DC/pssm/' #pat...
111875b7976c78d2264e47a186c9bacc5adf21877a1b7f570298fecbf1426386
Python
1,546
40
"""Neighbour queries own one OpenMP allocation and restore the caller's pools.""" import numpy as np import pytest from threadpoolctl import threadpool_info, threadpool_limits from vdjdb.motifs import tcremp @pytest.mark.parametrize('operation', ['radius', 'dbscan']) def test_neighbour_queries_own_allocation_and_res...
1f91e99f2c81eb6ba50d05d1b24be6ff41b36554b1a54dcbfdfcec650d467fdf
Python
1,546
49
import geomstats.backend as gs from geomstats.test.data import TestData from .base import ComplexVectorSpaceTestData from .complex_riemannian_metric import ComplexRiemannianMetricTestData from .mixins import GroupExpMixinsTestData class HermitianTestData(GroupExpMixinsTestData, ComplexVectorSpaceTestData): def e...
224d5a2ff07bd2ba3e95c4995a6b843c51468dd53aa782f02d1d8e085a7b3d0f
Python
1,546
52
import numpy as np from sleeprnn.common import constants from sleeprnn.data import utils def get_inta_eeg_names(signal_names): result = [] for single_name in signal_names: if len(single_name) == 5 and single_name[2] == "-": result.append(single_name) return result def get_inta_eog_e...
378426a912b5806c71484af4d15d42b80a69dd19841ff97b0e0ea0db8079d223
Python
1,546
75
from tempfile import NamedTemporaryFile import numpy as np import pytest from navec import Navec from navec.meta import Meta from navec.vocab import Vocab from navec.pq import PQ @pytest.fixture def emb(): meta = Meta( id='test_1B_3k_6d_2q' ) pq = PQ( vectors=3, dim=6, q...
c32f1331a6cfb0cd2d54f9be01aa51ff9632228215e76b4d1ac65747564be7e4
Python
1,546
37
import anndata as ad import pandas as pd import scanpy as sc from scETM import scETM, UnsupervisedTrainer, evaluate, prepare_for_transfer sc.set_figure_params(dpi=120, dpi_save=250, fontsize=10, figsize=(10, 10), facecolor="white") data_raw=pd.read_csv("Adult-Brain_Lake_dge.txt",sep=",",index_col=0,header=0) df...
7079946f2a331fe24ab693c2777b3df66d4d3a434d2bb8a65dfb779e655c2463
Python
1,552
55
# -*- coding: utf-8 -*- import os import argparse import logging import numpy as np # use this format to tell the parsers # where to insert certain parts of the script # ${imports} def parse_args(): # Argument Parser parser = argparse.ArgumentParser() # my args parser.add_argument("--verbose", action...
9ab60955ebfe465db0e1df3edb17ee1b1f56e266b174ec1b7e411ca598eb8d99
Python
1,554
35
"""Build, proofread and release the VDJdb T-cell receptor specificity database. Layout mirrors the pipeline stages; see ``ROADMAP.md`` for which are implemented. schema/ the column registry every output format projects from io/ chunk reading, release bundling qc/ chunk validation cura...
9b1bd0f496174c80c05dd5d2923db1a910cdb700d19448468b8cd52de23faf86
Python
1,555
28
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import argparse from examples.auggraph.GraphAug.conf.generator_conf import generator_conf from examples.auggraph.GraphAug.conf.reward_gen_conf import reward_gen_conf from dig.auggraph.method.GraphAug.runner_generator import RunnerGenerat...
9e7ef9ad63125143897f8eb8dc26207b05d5f4007866325a48cd557f1265d4bf
Python
1,555
132
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. """ Relevant chunk from ASE https://gitlab.com/ase/ase/-/blob/master/ase/data/__init__.py to reduce dependencies for nn modules """ chemical_symbols = [ "X", "H", "He", "Li", "Be", ...
c288eb9777f0546d57ba9b80109d66c39645146fcbeea58ce29bf03f08426aca
Python
1,556
59
"""Benchmark metric logarithm.""" from importlib import import_module import pandas as pd import pytest def read_benchmark_log_data(): """Read benchmark parameters from file benchmark_params.pkl.""" data = [] ids = [] df = pd.read_pickle("benchmark_params.pkl") params = list(df.itertuples(index=...
676a883695012ffddc1f77477a35e0aeae67e1c4f0911a7f689a89055380f978
Python
1,557
49
import numpy as np import nibabel as nib import pandas as pd def get_atlas_rois_from_mask(mask, atlas): mask_data = mask.get_fdata() atlas_data = atlas.get_fdata() mask_rois = (np.setdiff1d(np.unique(atlas_data[mask_data == 1]), 0)).astype(int) return mask_rois def get_module_vol(atlas, rois, value=...
025d47f62a64407f4b5a40d99ffa4bc29c58fce8c1880ad94aa030b7804e74f7
Python
1,558
50
# 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 # # Un...
6a2920e2ac2460cbd437c035e2eb83231140e32412b816d67e31bba1f81445b7
Python
1,558
40
"""WebLabelling URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-...
0d77699bd35adf3d8f626c0b9c5efdd07cbf225a59f0bcf286b9c556e981cf3b
Python
1,559
59
#!/usr/bin/env python3 # ruff: noqa W291 import os text = """<!--- DO NOT EDIT THIS FILE. Generated by [[GEN]]--> # Inferring conductivity from temperature """ def add_subdir(subdir, title, cmd, img=True): global text text += f""" ### {title} ``` {cmd} ``` Output directory `{subdir}`: * [`train.log`]([...
804539f206fe7f3738f337f402b60b796afb88ee9d6c17ad12c8374bbb64b09b
Python
1,560
73
import os import argparse import numpy as np from bindsnet.environment import GymEnvironment parser = argparse.ArgumentParser() parser.add_argument("-n", type=int, default=1000000) parser.add_argument("--render", dest="render", action="store_true") parser.set_defaults(render=False) args = parser.parse_args() n = ar...
d392c3ca02e34214acec5819250cb5c9538d9796900ab3188ea6a37ee5511621
Python
1,560
48
import numpy as np class DataSource: """A :class:`DataSet` loads the data initially and converts it into a useable form. It further creates a dictionary of dataSources, the epochs of the data. Each epoch contains information about the sampling-rate, the interval of the epoch and maintains an in...
e7322355b84319870e9781f2aaa56f609c16456acc3edeb960bdaf1a3a6c6e98
Python
1,561
38
import argparse from data.dataset import GanBrats, get_brats_diff from learning.train import train_experiment if __name__ == '__main__': split_using_instances = False parser = argparse.ArgumentParser(description='Train BRATS 2D segmentations model.') parser.add_argument('fraction', type=float, nargs=1, ...
ed1f95dffe07ff009be0c0763a1381dd55ae3408bdbda891a0d3b50def2d7abc
Python
1,561
48
import os os.environ['OPENBLAS_NUM_THREADS'] = '1' import pandas as pd import sys import numpy as np #Retains the lowest q-value associated with a peak (max log value). a = sys.argv[1] prev = [] qs = [] o = [] z = pd.read_csv(a, sep = "\t", header=None) #z = z.sort_values([0,1]) merged_peaks = [] print...
5479c78487f0ce382a785f28ec9816cfc708531f799c57e9c5a3e08d386dd794
Python
1,562
37
import json import argparse from rdkit import RDLogger from dig.ggraph.method import GraphAF from dig.ggraph.evaluation import PropOptEvaluator RDLogger.DisableLog('rdApp.*') parser = argparse.ArgumentParser() parser.add_argument('--prop', type=str, default='plogp', choices=['plogp', 'qed'], help='property name') par...
d967bf0d7ecefbd40c137b7e5fafc53c30f4fecf7ac9e59260a4bcbe58efe059
Python
1,562
39
"""Built chains are complete, and incomplete input stops publication.""" import polars as pl import pytest from vdjdb.assemble.master import FIX_FIELDS, assert_complete_chains def master(): row = {'record_id': 'r1'} for gene in ('alpha', 'beta'): row.update({f'cdr3.{gene}': 'CASSF' if gene == 'beta' ...
6fad418cbbebf175623d5f28cd9f3b5a9e61f168ff48e9342c5facf3e4a1fb80
Python
1,563
71
import numba as nb import numpy as np import pytest @nb.njit def ou_process(n, dt): """Simulate an OU process. Simulates the OU process .. math:: dX_t = -X_t dt + \sqrt{2} dW_t Parameters ---------- n : int Length of trajectory. dt : float Sampling time. Re...
a2f00f223c1635343458a0bf52db517637fc602b1a306ec4678235e019ab5104
Python
1,563
28
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import argparse from dig.auggraph.method.GraphAug.runner_aug_cls import RunnerAugCls from dig.auggraph.method.GraphAug.constants import * from examples.auggraph.GraphAug.conf.generator_conf import generator_conf from examples.auggraph.Gr...
9270f939204ccd028e1090b2f3f17eecae25a36ac27d4a5a25b6b83603886d6e
Python
1,564
60
import pytest from pathlib import Path import torch from reinvent.runmodes.TL.run_transfer_learning import run_transfer_learning from reinvent.runmodes.utils.helpers import set_torch_device from reinvent.models.meta_data import check_valid_hash @pytest.fixture def setup(tmp_path, json_config, pytestconfig): dev...
ca48e09efb9a429c8e081445886cdd3157210d03c5e3a417a2cbd598dda6ee46
Python
1,564
41
import os.path as osp import pickle def get_white_list(): root = '/mnt/dive/shared/kaleb/Datasets/PubChemQC/utils' with open(osp.join(root, 'list_of_mol_dirs.pkl'), 'rb') as f: mol_dirs = pickle.load(f) mol_dirs = [d.decode('UTF-8') for d in mol_dirs] mol_dirs.sort() print('Al...
39aeb1ed2111ff2d1c71e7c7f5dbf63177f81fc70e2229646f5e68abe1c851ad
Python
1,565
52
from pymonntorch.NetworkCore.Behavior import Behavior from pymonntorch.NetworkBehavior.EulerEquationModules.Helper import ( eq_split, remove_units, ) from sympy import symbols import torch class Equation(Behavior): def __init__(self, *args, eq=None, step_size="1*ms", **kwargs): super().__init__(*a...
862f9b28c6a76e8ee3ae52b1d8a0b2a19856c7daa2d4230ce06e6106282728ef
Python
1,565
63
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from torch import nn from typing import Optional from utils import logger from .activation import ( ReLU, Hardswish, Hardsigmoid, PReLU, LeakyReLU, Swish, GELU, Sigmoid, ReLU6, ...
a1f61724828833ba47567cac6a712291996d33c1aad7e3d734a04c28ad38fe24
Python
1,565
46
from omegaconf import DictConfig from navidiv.reinvent.InputGenerator import InputGenerator class model_params_rdkit_physchem: def __init__(self, cfg, id): self.property_name = cfg.params_list[id] self.lower_bound = cfg.lower_bound[id] self.upper_bound = cfg.higher_bound[id] self...
a6320fdb9c9307a4ac99bccbc1bb55c2a356839ede8447b96886fb83b75f03c0
Python
1,566
55
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 = [ ('distComputation', int32) ] @jitclass(spec) cl...
a715ea770982a4dba41201e4d504dfb7cdcc27b1a6a6482a4c046ab3bde2769c
Python
1,566
42
"""The run-or-raise device policy: explicit GPU requests never silently degrade. GPU execution in nltools means Himalaya ridge fitting (``_Ridge(device='gpu')``) and the ridge bootstrap (``BrainData.bootstrap(device='gpu')``); nothing else runs on a GPU. Both resolve their backend through ``_resolve_backend``, so an e...
d9637b8a039010417c92bb6e5e8c5e5af25b02e1a9adaf2efd098a3a785201b6
Python
1,566
46
import os import cv2 import time import pyfftw import multiprocessing as mp ''' This script is used to learn 2D wistom used to speed up FFT-based spatial homomorphic filtering 2D wistom is only used in SUNS online. ''' folder = 'train_3_test_1' dir_wisdom = os.path.join(folder, 'wisdom') if not os.path.exists(dir...
1d0363fce37a38ef21bdf0412f821fb37474f8dad01834f8337c39345e38cec5
Python
1,567
59
""" This module contains some test cases. """ import string import numpy as np import pytest from rbo.rbo import RankingSimilarity TESTS = [ # Sanity checks (string.ascii_lowercase, string.ascii_lowercase, 1.0), (string.ascii_lowercase, string.ascii_lowercase[:7], 1.0), ("abcde", "fghij", 0.0), #...
e9f049e3ea80d690d40543b19f562eda2baa239ce97b232afbf24d8d4eddeea9
Python
1,568
45
from dival import get_standard_dataset from dival.measure import PSNR from dival.reconstructors.dip_ct_reconstructor import ( DeepImagePriorCTReconstructor) from dival.reference_reconstructors import ( check_for_params, download_params, get_params_path) from dival.util.plot import plot_images import matplotlib....
be08ac12d6b43ed1fc3a8fa63c3597eddfe6f6c79eae839f4b188ae16ab1e26d
Python
1,570
59
"""Benchmark metric distance.""" from importlib import import_module import pandas as pd import pytest def read_benchmark_dist_data(): """Read benchmark parameters from file benchmark_params.pkl.""" data = [] ids = [] df = pd.read_pickle("benchmark_params.pkl") params = list(df.itertuples(index=...
ceb5c08455ab30387a56e33334d62699c0d8063261924379862eca155d94013d
Python
1,571
36
import numpy as np from torchvision.models import resnet50 from torchvision import transforms from model_tools.activations.pytorch import PytorchWrapper, load_images from utils import properties_to_id def get_gcl_fig5_models(): resnet50_pt_layers = ['conv1', 'bn1', 'relu', 'maxpool'] + \ ...
f75a2d8b534f1750178992b709b513f5d130f91640838aeeffc1cb857702f76f
Python
1,572
44
def smooth_signal(x,window_len=10,window='flat'): """smooth the data using a window with requested size. This method is based on the convolution of a scaled window with the signal. The signal is prepared by introducing reflected copies of the signal (with the window size) in both ends so that tra...
fdc650376a985df60b0fe3dc8898e32d2f074f3bfb199e10d5ba51af24083e00
Python
1,572
46
from abc import ABC class PointTransformer(ABC): def transform_point(self, point): raise NotImplementedError("`transform_point` not implemented") def transform_tangent_vec(self, tangent_vec, base_point): raise NotImplementedError("`transform_tangent_vec` not implemented") def inverse_tra...
1578cbd6ef9337266db79ee2a81b48aadc8be4af672b2fe0998617f985933f1e
Python
1,574
60
import random import pytest from geomstats.information_geometry.dirichlet import DirichletDistributions from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test.random import RandomDataGenerator from geomstats.test_cases.information_geometry.dirichlet import ( DirichletDistributionsTestC...
2ed9c2be1d04aa3f80e714114cb4fcd61329fda18aafaeb5d224b9638bed0c7d
Python
1,575
72
import sklearn.metrics as metrics from torch.nn import BCEWithLogitsLoss, MSELoss, L1Loss from hyper_dti.utils.metrics import mcc_score, ci_score, rm2_score, re05_score, re1_score, re2_score, re5_score METRICS = { 'classification': { 'AUC': metrics.roc_auc_score, 'AUPRC': metrics.average_precisi...
2b2c86f121bbb03ffa6de3d69f6b420ee199f9a572eb8579bdb38a5793605b6b
Python
1,577
43
"""Apply light/dark display colours to generated documentation SVGs; no data changes. Run after Graphviz or gnuplot. The embedding page supplies the colour scheme. """ import re import sys from pathlib import Path STYLE = """<style id="figure-theme"> :root { fill: var(--ink); --ink: #253444; --line: #526375; --panel:...
bc08f0ff0b3965e5377d31942b7efb4eb50a8142bc2478d36d6be7a59b042ca3
Python
1,577
51
#!/usr/bin/env python3 __description__ = \ """ Test that sends 10000 floats as fast as possible back and forth to the arduino. It uses random number floats, so this should cover a wide variety of possible characters in the binary strings that could (possibly) be mangled. Works with arduino sketch in rapid-float direc...
194bd1c28c445a117a515bf02d78c47b2d687424b73a9b4768b74ce5c644e656
Python
1,581
41
# Copyright (c) 2022 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 # # Un...
eaad14381c716f6177759b9284c2ade4816af0034c9fe1440c47dadec6cbc38b
Python
1,582
49
import pytest from geomstats.information_geometry.exponential import ( ExponentialDistributions, ExponentialDistributionsRandomVariable, ExponentialMetric, ) from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.riemannian_metric import RiemannianMetricTestCase f...
84d0ed7d79ff9068a209551153fa94233ba9c7a333bba33bd544db5c1566d0c8
Python
1,583
45
import experiment as exp import arena import schedule import video_system class HeatImagesExperiment(exp.Experiment): default_params = { "image_src_ids": ["top", "thermal"], "video_src_ids": ["thermal"], "on_time": 30*60, "off_time": 30*60, "$inter_trial_interval": 5, }...
a9a81511d467480a90ad8db909c3ad57cc86d1a1b101b3c6913308b0adccec84
Python
1,583
56
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import os import importlib import argparse from .base_transforms import BaseTransformation SUPPORTED_AUG_CATEGORIES = [] AUGMENTAION_REGISTRY = {} def register_transformations(name, type): def register_trans...
665f5237346f53537f500ad094eff346636510ec45aea8c2671c6ac2a930449f
Python
1,585
49
import pytest from geomstats.information_geometry.poisson import ( PoissonDistributions, PoissonDistributionsRandomVariable, PoissonMetric, ) from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test.random import RandomDataGenerator from geomstats.test_cases.geometry.riemannian_me...
fd27e448f8302caecc0c6bc328b633f5e11afe8182c32c2dc6c68ba4c7f08f85
Python
1,585
57
import experiment as exp import asyncio # TODO: add async action class AsyncPhasesExperiment(exp.Experiment): default_params = { "run_msg": "TestExperiment is running", "end_msg": "TestExperiment has ended", } async def setup(self): self.log.info("setup") await asyncio.sle...
2bc052c72c575a590094371a7aea73a641025782f12359657a685fb574d02023
Python
1,586
43
from reinvent.models.linkinvent.link_invent_model import LinkInventModel from reinvent.models.linkinvent.model_vocabulary.paired_model_vocabulary import ( PairedModelVocabulary, ) from reinvent.models.linkinvent.networks import EncoderDecoder from reinvent.models.model_mode_enum import ModelModeEnum from reinvent.m...
9eb0028e876385beead8b20bfbfaa9df04daa577ad031a90bdaf20bdb89814cf
Python
1,587
45
import sys unmaskedFracsFileName, winSize = sys.argv[1:] winSize = int(winSize) unmaskedFracs = [] if unmaskedFracsFileName != "None": with open(unmaskedFracsFileName) as unmaskedFracsFile: for line in unmaskedFracsFile: unmaskedFracs.append(float(line.strip())) line = sys.stdin.readline() fi...
d6adf5d1c14d24ae23302b59c80d4e52544ed5e7e7942c2df4861d5ef25e4e35
Python
1,587
58
"""Topological polar surface area (TPSA) descriptor from RDKit This implementation allows to include polar S and P as described in https://www.rdkit.org/docs/RDKit_Book.html#implementation-of-the-tpsa-descriptor """ from __future__ import annotations __all__ = ["TPSA"] from typing import List, Optional from rdkit ...
9cb4f455483bb4202140ee8fd65d9815e7e19320c2cd210569dbb4543a90f909
Python
1,589
55
"""Declare runtime-owned mappings from analysis results to trace overlays.""" from __future__ import annotations from dataclasses import dataclass @dataclass(frozen=True) class TraceOverlayDefinition: """Describe one analysis-result overlay without prescribing GUI styling. Attributes: id: Stable ma...
8722188ccc56106ab39d1fa22d5c50b1caf357e5d66078647f7c8d8d8bcc8b35
Python
1,590
65
import logging from torchmin import minimize as torchmin_minimize from geomstats.numerics._common import params_to_kwargs from ._optimization import Minimizer class TorchminMinimize(Minimizer): """Wrapper for torchmin.minimize. Check out https://pytorch-minimize.readthedocs.io/en/latest/api/index.html...
00ae17afe4d6fce11d0d2e99c7b7efe60d22d42cb34f0c0579606e71b4e55af3
Python
1,592
59
"""Benchmark metric exponential.""" from importlib import import_module import pandas as pd import pytest def read_benchmark_exp_data(): """Read benchmark parameters from file benchmark_params.pkl.""" data = [] ids = [] df = pd.read_pickle("./benchmark_params.pkl") params = list(df.itertuples(in...
ca597dabe3ab36942d6a7d3c95260462ccacca4219922b0f38d3e42c1d9d7204
Python
1,593
43
import unittest from rdkit import Chem from reinvent.chemistry.library_design import bond_maker, attachment_points from reinvent.chemistry.library_design.reaction_filters import ReactionFiltersEnum from tests.chemistry.fixtures.test_data import ( REACTION_SUZUKI, SCAFFOLD_SUZUKI, DECORATION_SUZUKI, SC...
499c96aaa00ba83db100905af77f3a2d4e636999fdcee47ac38b3f6e3378a991
Python
1,594
46
import pandas as pd import glob import seaborn as sns import matplotlib.pyplot as plt # path_files = 'Results/inferring_dtis/' # fileslist = glob.glob(path_files + '*_statistics_results.txt') # fileslist[0] # datasets = [file.replace(path_files,'').replace('_statistics_results.txt', '') for file in fileslist] data...
a5df3a921bdb7f8117aff9d76cad65750c0566da6ad00b317f1e9b7982e9f30c
Python
1,594
46
import os import cv2 import time import pyfftw import multiprocessing as mp ''' This script is used to learn wistom used to speed up FFT-based spatial homomorphic filtering ''' folder = 'train_3_test_1' dir_wisdom = os.path.join(folder, 'wisdom') if not os.path.exists(dir_wisdom): os.makedirs(dir_wisdom) Dimens ...
22d8d35a1616e57f450cfddc69df3b3e71b802b7ced73ca0f5256a48268bc30b
Python
1,595
44
import rdkit import rdkit.Chem as Chem from scipy.sparse import csr_matrix from scipy.sparse.csgraph import minimum_spanning_tree from collections import defaultdict from rdkit.Chem.EnumerateStereoisomers import EnumerateStereoisomers, StereoEnumerationOptions import torch def get_mol(smiles): mol = Chem.MolFromS...
693699fde3b14ebc02308b4b1900c20c10169ecb7c32d1817afc86cb15f4faac
Python
1,595
77
import factory from factory.django import DjangoModelFactory from celsus.models import Author, TissueType, Disease, Organism, OrganismPart, Instrument, \ QuantificationMethod, Keyword from celsus.models import CellType as ct from faker_biology.physiology import CellType, Organ from faker_web import WebProvider f...
0b7fbee38b14200d80c7396de794bf8d29d657bc777be52a10484b3fb1ffb311
Python
1,597
61
from pathlib import Path import click import numpy as np import SimpleITK as sitk from tqdm import tqdm def _process_patient(input_files: list[Path], output_file: Path): images = [sitk.ReadImage(f) for f in input_files] arrays = [sitk.GetArrayFromImage(i) for i in images] output = np.zeros_like(arrays[0...
1d831de784de0df446980e589ed07df634232f92cdb8acedf19c19915a852f67
Python
1,598
41
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network models and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cognitiv...
42a5083b6bd347ad4f4eb52d8b158115b2b1d1279a6f73945a9c9ca07f24c380
Python
1,598
43
from idtrackerai import ListOfBlobs, Session from idtrackerai.utils import create_dir from .crossing_detector import detect_crossings from .model_area import compute_body_length def crossings_detection_API(session: Session, list_of_blobs: ListOfBlobs) -> None: """Generates the identification images and classifie...
61c7cb70d647714afade6dd8b3507180b2ce9204f2617f9426fcc225bc89d78a
Python
1,598
52
import pytest import numpy as np from reinvent.runmodes.RL.intrinsic_penalty.identical_murcko_scaffold_rnd import ( IdenticalMurckoScaffoldRND, ) from reinvent.models.model_factory.sample_batch import SmilesState, SampleBatch from reinvent.runmodes.RL.validation import SectionIntrinsicPenalty from tests.runmodes....
8c50a02bdcb1aea995188c41604abe918342a65a2f4653bda0d8cca1e231cd5b
Python
1,598
48
# 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 import contextlib import contextvars import torch from e3nn import set_optimization_defaults, get_optimization_defaults from nequip.utils.versions.torch_versions import _TORCH...
b96eddc04961d76b17c1ad28273451fb900393b05eb11c004cd5aae988040e0e
Python
1,598
40
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network models and simulations. See also: # https://github.com/pyrates-neuroscience/PyRates # # Copyright (C) 2017-2018 the original authors (Richard Gast and # Daniel Rose), the Max-Planck-Institute for Human Cognitiv...
b0c4eaa30c68b8af145dd44e2c8057a20584840259e3abf045421e697be3a78d
Python
1,599
49
# coding=utf-8 """ Implementation of a SMILES dataset. """ import torch 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): """ :param smiles_list: A list with SMILES strings ...
f100b3cb40341f3a7ff6d08e5f823fecc5f7b961c9afceaf560f56ba02e60ee0
Python
1,600
43
import unittest from rdkit import Chem from reinvent.chemistry.library_design import bond_maker, attachment_points from reinvent.chemistry.library_design.reaction_filters import ReactionFiltersEnum from tests.chemistry.fixtures.test_data import ( REACTION_SUZUKI, SCAFFOLD_SUZUKI, SCAFFOLD_NO_SUZUKI, D...
73c1e6a4089ae5f33630b631f0eba6451673971979849981a33ff48d992dc5ff
Python
1,603
65
import pyNN.nest as sim from pyNN.utility.plotting import Figure, Panel from pyNN.random import RandomDistribution, NumpyRNG import time from globparams import * import os sim.setup(timestep=1, min_delay=1, max_delay=1, threads=os.cpu_count()) rng = NumpyRNG() cell_type = sim.Izhikevich(a=A, b=B, c=C, d=D, i_offset=O...
909d6e7e5c42cb79d90a6b3599be9ad990de2dba23a0c339c164aef340909ad7
Python
1,604
109
configs = {} configs['example_config'] = { "n": 10, # Parameter in the subsequence kernel. "lambda": 1, # Parameter in the subsequence kernel. "n_iters": 3, # Iteration of WL kernel. "norm": False, # Whether to normalize kernel. "base_k": 'subtree' # Base kernel, choose from subtree, sp } delaney...
34a57806aedf4edd9e847367aecf9dc71f1539c5a5990c2e7143bddd95620f3a
Python
1,607
37
import rdkit import rdkit.Chem as Chem import copy def get_slots(smiles): mol = Chem.MolFromSmiles(smiles) return [(atom.GetSymbol(), atom.GetFormalCharge(), atom.GetTotalNumHs()) for atom in mol.GetAtoms()] class Vocab(object): benzynes = ['C1=CC=CC=C1', 'C1=CC=NC=C1', 'C1=CC=NN=C1', 'C1=CN=CC=N1', ...
8d8508a1b37a30558fbcbc7c01e9fe0901880fed72e2abdfb2c50385d81b47b5
Python
1,607
59
#!/usr/bin/env python3 __description__ = \ """ Test ability to send duplex data (e.g. read args while sending them out with an unterminated command). """ __author__ = "Michael J. Harms" __date__ = "2016-06-04" __usage__ = "./duplex.py serial_device (like /dev/ttyACM0)" import random, sys import PyCmdMessenger def mai...
4fbe45187df9d0dc22e35d818041beb4b875d748306c153951fd1bc5532bb172
Python
1,608
59
import pytest from pathlib import Path import torch from reinvent.runmodes.TL.run_transfer_learning import run_transfer_learning from reinvent.runmodes.utils.helpers import set_torch_device from reinvent.models.meta_data import check_valid_hash @pytest.fixture def setup(tmp_path, json_config, pytestconfig): dev...
fabc4c15e034a0c528a4bfb1be52158e892a1fe8e8cf7db8f0e4acc829cebd50
Python
1,608
52
import random import glob import matplotlib.pyplot as plt import numpy as np from skimage.io import imsave from skimage.transform import radon, iradon from sparse_ct.tool import plot_grid from sparse_ct.data import image_to_sparse_sinogram, ellipses_to_sparse_sinogram from sparse_ct.reconstructor_2d import IRadonRecon...
2a1d9aae87b50de0a8b65f7ae34f851c1b20121e5cfcdda35711387d214a0788
Python
1,610
70
import torch import pandas as pd import matplotlib.pyplot as plt import seaborn as sns names_drug = [ 'MolLogP', 'MolWt', 'NumHAcceptors', 'NumHDonors', 'NumHeteroatoms', 'NumRotatableBonds', 'TPSA', 'RingCount', 'NHOHCount', 'NOCount', ...
0f34994b076e9bf6da11b667afbec5a08d2d29121cad3920f5d31313a10f2b93
Python
1,611
56
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Logs utilities.""" import logging from rich.console import Console from rich.logging import RichHandler from openfl.utilities import add_log_level def setup_logger(log_level=logging.INFO, log_file=None): """Configure loggers. ...
92593a852730e1749bc5df0ac0b9ec9b0c5bd7119d49ab4ecb79788f8bbac657
Python
1,611
54
"""app-pytorch: A Flower / PyTorch app.""" import torch from flwr.client import ClientApp, NumPyClient from flwr.common import Context from app_pytorch.task import Net, get_weights, load_data, set_weights, test, train # Define Flower Client and client_fn class FlowerClient(NumPyClient): def __init__(self, net, ...
c476be9d4c8ee44d4f6fd98193319830e16b5052383508e33b07fc7b11067e0b
Python
1,611
54
from PymoNNto.NetworkCore.Behavior import * from PymoNNto.NetworkBehavior.EulerEquationModules.Helper import * class Variable(Behavior): def initialize(self, neurons): n = neurons eq_parts = eq_split(self.parameter('eq', None)) if eq_parts[1] == '=' and len(eq_parts) >= 3: se...
e1a69e719e09cef57b0bbaeff5f49e2d35e451da1ac3768a9c9d3d7ff796f324
Python
1,611
42
import argparse import os import pandas as pd from common import most from common import oai from common.oai import build_jsw if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('--oai_meta', default='/home/hoang/data/X-Ray_Image_Assessments_SAS') par...
6f1b1827e283350645ceef3257d997945972a39961f7c320fd9819828dcac97d
Python
1,614
55
# 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. """isort:skip_file""" from .transformer_config import ( TransformerConfig, DEFAULT_MAX_SOURCE_POSITIONS, DEFAULT_MAX_TARGET_POSITIO...
cbb504d788ccad8f5ba98eb5e9d720aeb710224c477da9b9a8c86ebe0367d4c6
Python
1,616
45
#!/usr/bin/env python3 import sys import json # Better to use dedicated package to write JSON from peds import open_ped # pip install peds from peds import get_probands # MAIN: families = open_ped(sys.argv[1]) # Extract 'status' of each family = casIndex, members_list, father, mother and affected_list: status_l...
d688c3a554a3cbfa987d309d25920ddd34bab7826ae244174db99af5ad3e0399
Python
1,616
53
import matplotlib.pyplot as plt import matplotlib.lines as lines class draggable_lines: def __init__(self, ax, xPos, yPos, hLength=5, vLength=20, linewidth=3, color='m', doPick=False): self.ax = ax self.c = ax.get_figure().canvas self.hLineLength = hLength self.vLineLength = vLength # horz line x = [xPo...
ead35a472203f055bbc7be5882e71c9e81b9e67aeb6b50e6a56d053649582525
Python
1,616
52
import pytest from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.hyperboloid import Hyperboloid from geomstats.geometry.hypersphere import Hypersphere from geomstats.geometry.minkowski import Minkowski from geomstats.geometry.spd_matrices import SPDMatrices from geomstats.geometry.special_ortho...
904e24f29c48c3aaeb534c321ec38cef38c1cc09a2ed3ec1e8ffe3c2ba8be5b8
Python
1,620
60
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ This file contains utility functions for Secure Aggregation for key operations. """ from Crypto.PublicKey import ECC # nosec B413 def generate_key_pair(curve: str = "ed25519") -> tuple[str, str]: """ Generates a public-priva...
a8b203d28d9ea2216cdc76362185937c875be27298a20838fb29f1a7f25e5e3c
Python
1,620
57
import torch from nequip.data import AtomicDataDict from ._graph_mixin import GraphModuleMixin from .model_modifier_utils import replace_submodules, model_modifier class GhostExchangeModule(GraphModuleMixin, torch.nn.Module): """Base class for ghost atom exchange modules.""" def __init__( self, ...
f451aecb93be0574f9f9807384e0636db309a9691e6f40e82cd33b8445ccf1ad
Python
1,621
66
import random import pytest from geomstats.geometry.poincare_ball import PoincareBall, PoincareBallMetric from geomstats.test.parametrizers import DataBasedParametrizer from geomstats.test_cases.geometry.poincare_ball import ( PoincareBallMetricTestCase, PoincareBallTestCase, ) from .data.poincare_ball impor...