sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
160bf06b06b39945b1af22f8157c732048dcd0ad99a9ed4b11e0393b4ec77804
Python
6,893
199
import geomstats.backend as gs import geomstats.datasets.utils as data_utils from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.hypersphere import Hypersphere from geomstats.geometry.landmarks import Landmarks from geomstats.geometry.spd_matrices import SPDMatrices from geomstats.geometry.specia...
070dce13b4bae271c4f22bcbd592253521e7fb89e7a1733ffeec7670ecc38e69
Python
6,898
221
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
2f9f7e8b3eddeea222da54ca1142ce026e00b945de2d632d3e95c28509a899d4
Python
6,901
148
"""Rewrite with train for folder name""" from pathlib import Path def write_launch_file(file_path: Path, function_call_str: str): assert not file_path.exists(), 'launch file already exists' print(f'{file_path.stem}: {function_call_str}') with open(file_path, 'w') as f: f.write('#!/bin/bash \n\n') ...
537b66bc5d88b5c32980a8f6329f54e90b15aad403bd95dc428a93f988bd8d38
Python
6,905
170
import os import collections import yaml from common.metadata_util import process_metadata # Edit these. PROJECT_FOLDER = '/path/to/sample-free-uncertainty-label-smoothing/' DATA_FOLDER = '/path/to/osa_smw_dataset/' # No need to edit these. TFRECORDS_FOLDER = DATA_FOLDER + "/tfrecords_osa" OUTPUT_FOLDER = PROJECT_...
a7f89c6606883af83d4e5a18400f136223c03e4471cc7c0508d6b8685036a2ec
Python
6,905
179
""" Bar visual feedback class Kyuhwa Lee, 2015 Swiss Federal Institute of Technology (EPFL) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any ...
e7fa70b5030ca93d3ba02ee05c8cb683a13518f011c358e39ca52f9f0a6688fc
Python
6,906
163
import numpy as np import os from captum.attr import IntegratedGradients from captum.attr import DeepLift # from openpyxl.worksheet.table import Table, TableStyleInfo # from openpyxl.styles import Alignment from nilearn import plotting,image,surface,datasets from scipy.spatial.distance import squareform, pdist def res...
6087027cddd57ef490cfef824326b68b10d2d8fe6b818c85beb971b8247c969b
Python
6,910
135
# Copyright 2020 Forschungszentrum Jülich GmbH and Aix-Marseille Université # "Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements; and to You under the Apache License, Version 2.0. " from mpi4py import MPI import os import json import time import numpy as np from nest_el...
453020f80c684fc2172c09bdf3ab4047532655e0ccdbe07f69205e334afdb79d
Python
6,915
193
"""Compute scores with ChemProp v2.x Single-task model (target_column is optional): [[component.ChemProp2.endpoint]] name = "ChemProp Score" weight = 0.7 param.model_path = "best.pt" param.featurizers = ["V1RDKit2D"] # disables scaling! param.featurizers_options = [{}] transform.type = "reverse_sigmoid" transform.hi...
c3ce742c0eb6020fc4706a371562253901f6c634744b0f41508ae088681ead8e
Python
6,918
209
"""Tests of the foundation-model constructors (mace_mp / mace_off / mace_omol / mace_polar) through the ASE calculator. Everything here downloads pretrained models (capability `network`, auto-marked by directory). Split out of tests/test_calculator.py; the trained-from-scratch calculator tests live in tests/workflows/...
057a499b848fad61ab77f43070a73f8c25494378244d72c40b8eaec09b9e831a
Python
6,920
169
r""" Delay Coupling ============== In this tutorial, we will go through the different options you have to define delay-coupled dynamical systems in PyRates. As an example, we will use a model of :math:`N = 2` interconnected leaky integrator units, the evolution equations of which are given by .. math:: \dot x...
e36c3cb0398c453120d787f5da67ba24d28e322246a13165c1f4c0ccdf532726
Python
6,927
159
import random import numpy as np def data_gen(train_img, train_mask, batch_size, flips=False, rotate=False): '''Generator of training images and masks from an array dataset that can be non-square. Used for CNN training. Inputs: train_img(3D numpy.ndarray of float32, shape = (T,Lx,Ly)): the ...
34e5c9c9f5d286408afbf24dee5e063ccb515aa0ef6afe2e043b2db513777f57
Python
6,930
179
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import tqdm from openfl.federated import PyTorchTaskRunner from openfl.utilities...
4f6fbf32c004a2970cfb47950d4f15fc7dfbf3019fee36fba6f2fdb19eb870f0
Python
6,933
192
from plasticity.utils import generate_gaussian, standardize_coeff_init import jax import jax.numpy as jnp import numpy as np import re def volterra_synapse_tensor(x, y, w, r): """ Functionality: Computes the Volterra synapse tensor for given inputs. Inputs: x, y, w, r (floats): Inputs to the Volterra syna...
c8c1cc5e37f71c91ee0a4bdc9439bb9ad1b82d96c3f7b31bd5a375997d3cfb56
Python
6,933
207
import numpy as np import pyabf import matplotlib.pyplot as plt import sanpy def _demo_deltaT(abf): """Demonstrate delta duration.""" import matplotlib.pyplot as plt # abf = pyabf.ABF(PATH_DATA+"/2018_04_13_0016a_original.abf") epochTable = pyabf.waveform.EpochTable(abf, 0) print('epochTable') ...
71b6b39536325106e083acdbb9733d6343f18dc3fd30cd9a795e91d8eead2076
Python
6,948
107
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
e45fe1d82891c42fb6074ddef3e9135dc18ac6c0e2a29221440514f9f1e44e1c
Python
6,948
219
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: MIT-0 """ # Convert DiffDock's output into the same format with CASF-2016 Docking data. The output from DiffDock is a PDB file, which contains a single chain representing the pose of the small molecule ligand. Example usag...
ce7f82e5f011e896f5972881a19691c8996a18c9ee37e4da73e80591b8025a3c
Python
6,949
208
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # from .base_cls import BaseEncoder import os import importlib import argparse from utils.download_utils import get_local_path from utils import logger from utils.common_utils import check_frozen_norm_layer from util...
ca32c7a3b0ad05e6e3e532943fd1f2c8f9e46612ce1cb2d87c600616e15b3971
Python
6,954
182
"""Methods to compute feature attributions. Compute: SHAP Integrated Gradients LIME Gradient SmoothGrad """ from typing import Callable, Optional, List import numpy as np import shap as third_party_shap import tensorflow as tf def shap(model: Callable[[np.ndarray], np.ndarray], example: np.ndarray, ...
6afff89d3d7e21a431f4bf7112160f3e2e246150ee961ef63593cee19ba11ce1
Python
6,959
154
# Author: Youzhi Luo (yzluo@tamu.edu) # Updated by: Anmol Anand (aanand@tamu.edu) import torch import random import torch.nn.functional as F from torch.distributions.bernoulli import Bernoulli from torch_geometric.data import Data from torch_geometric.utils.dropout import filter_adj from torch_geometric.utils.num_node...
ce963485be92bb8dfad1cde8143cd86151c4baf293d0d8c2c9db040afeec8291
Python
6,959
213
# convert VOC xml to COCO format json import xml.etree.ElementTree as ET import os import json import argparse # create and init coco json, img set, and class set def init_json(): # create coco json coco = dict() coco['images'] = [] coco['type'] = 'instances' coco['annotations'] = [] coco['cat...
fef278bf0cac266d66b80022964622ea77a7c8f70195de447ee37cfb9b53f5e5
Python
6,960
226
# copyright (c) 2021 PaddlePaddle Authors. All Rights Reserve. # # 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 applica...
403d72fd839ceadc94ae4b875b4acb9865f8a0a243794adac192c4e2a024b002
Python
6,967
210
"""`info_keys` and `MACECalculator.check_state`. Two parts of the calculator's contract that nothing exercised. `info_keys` maps a PROPERTY NAME to the `atoms.info` key it is read from, the same direction as `arrays_keys` (see tests/unit/test_calculator_charges_key.py). Its default is not empty, so a caller who overr...
6345bc3ace562606e99e8276b0da30961aeb721cf86aa2512ba3066729024ad7
Python
6,968
195
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Aggregator tests module.""" from unittest import mock import pytest from openfl.component import aggregator from openfl.component.assigner import Assigner from openfl.protocols import base_pb2 from openfl.utilities import TaskResult...
55a731583a12b321f544d1606b9cc1c1f52dc87f49ec1f20d9003376e7e67d6b
Python
6,974
220
import io from contextlib import redirect_stdout, redirect_stderr from queue import Queue import pytest from hnn_core import Network from hnn_core.mpi_child import MPISimulation, _str_to_net from hnn_core.parallel_backends import ( _gather_trial_data, _process_child_data, _echo_child_output, _get_data...
a51feb5ef363e7e74b6722c40660d86a5205dfb53ee235a6b7a753a86b37145a
Python
6,974
182
import shutil from dig.sslgraph.dataset import get_dataset def test_get_dataset(): ## semisupervised # NCI1 root = './dataset/TUDataset' dataset, dataset_pretrain = get_dataset(name='NCI1', task='semisupervised', feat_str='deg+odeg100', root=root) assert len(dataset) == 4110 assert len(dataset...
9f5e76de9c5acce066f16864cc20456a158d6774aac3e63b03d86bfd249ac1ff
Python
6,976
201
import numpy as np import torch as T from monai.data import (DataLoader, Dataset) from monai.metrics import compute_meandice from monai.transforms import ( AddChanneld, Compose, LoadImaged, NormalizeIntensityd, ToTensord, Resized, RandFlipd, RandRotate90d, ThresholdIntensityd, Sc...
ab5cec7e850b23bdb2bd1e70a2fa8ffda722c19687adb0042eb638329179cd54
Python
6,976
209
import logging import os from pathlib import Path import pytest from qtpy import QtCore, QtWidgets from sanpy.interface import sanpy_app, sanpy_info_widget from sanpy import sanpyLogger from sanpy.sanpy_paths import SanPyPaths def test_logger_text_combines_retained_logs( monkeypatch: pytest.MonkeyPatch, tmp_pat...
2e1207dbf5e2549839ab5fab8804fa729bc40e090e751b01f2a4993f7765cb18
Python
6,981
186
"""Sphinx directives that read the field registry at doc-build time. .. vdjdb-schema:: vdjdb :columns: name, title, comment .. vdjdb-vocabulary:: species .. vdjdb-score-rules:: **There is no generated ``.rst`` in the tree, and that is the whole point.** A column table written out by a script is c...
810170c0e5a07da3fc4db0f4ea2a7a330c361e940c35bff815787e530dafe7b3
Python
6,984
261
import pandas as pd from uniprotparser.betaparser import UniprotSequence curtain_ptm_de_form = { "_reverseFoldChange": False, "_comparisonSelect": "", "_comparison": "", "_primaryIDs": "", "_geneNames": "", "_foldChange": "", "_transformFC": False, "_significant": "", "_transformSig...
dab9dd200ead559ea2ba1b4d57c094edfb1b00dc6751c01aa0ebbda773878d27
Python
6,990
235
# this is the same script as before but we use more data. import numpy as np import matplotlib.pyplot as plt import torch import h5py import torch.nn as nn from torch.utils import data # number of available gpu ngpu = 1 batch_size = 128 decayRate = 0.95 lr = 0.001 dataRoot = "../../data" # this is a for loop to l...
b4f0017ec822a3ee9d2e8118092637e887d49da641385c97aef1e199828d6935
Python
6,991
249
#!/usr/bin/env python3 import argparse import pickle import numpy as np import odil from odil import printlog from odil.runtime import tf def get_exact(args, t, x): t = tf.Variable(t) x = tf.Variable(x) u = tf.zeros_like(x) with tf.GradientTape() as tape: ii = [1, 2, 3, 4, 5] for i ...
f2dcc47405ac15781c205baf0a7fc0c35864ed924411e0b01a1723d1cb8c24ce
Python
6,992
204
"""Tests for the frozen structural `PredictResult` result record. The spec's shape table (`development/specs/braindata.md`, "Prediction and decoding") is the contract: one record class, a required ``spatial_scale`` discriminator, and exactly one legal field combination per spatial scale. """ from dataclasses import F...
2867d0b8815acc0d4ca25a6b64c08dc9aa912f7d8452c8dba4cb1badcde67d40
Python
6,997
171
# 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 Any, Dict, List, Optional import torch from e3nn.o3._irreps import Irreps from e3nn.o3._spherical_harmonics import SphericalHarmonics from nequip.data import AtomicDataDict from ne...
3578afe0dea77cfdebc60b04128399a03461da5e9574f5e9c88dabc868a541ff
Python
6,997
159
import torch.nn as nn from .contrastive import Contrastive from dig.sslgraph.method.contrastive.views_fn import Diffusion, DiffusionWithSample class MVGRL_enc(nn.Module): # MVGRL includes projection heads and combines two views and # encoders when inferencing graph-level representation. def __init__(sel...
33beb15cae5533f08e12356a39da0a8b9ffa1366770329faa6c9d34aeff6b2ea
Python
7,006
177
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import torch import torch.nn.functional as F from fairseq import metrics, utils from fairseq.criterions import FairseqCriterion, ...
791f612b55d436c43bda4c93e17a5c04c9394456d5952703e8890d9c7ab521d2
Python
7,007
129
import os import torch import numpy as np from .model import SphGen class G_SphereNet(): r""" The method class for G-SphereNet algorithm proposed in the paper `An Autoregressive Flow Model for 3D Molecular Geometry Generation from Scratch <https://openreview.net/forum?id=C03Ajc-NS5W>`_. This cla...
cbc2a0737a8dfbb9f2132957de3ec004d7a597e15a0a87ec2bb86c68baadf63a
Python
7,014
235
from datetime import timedelta as t import numpy as np from sklearn import preprocessing, feature_selection, svm, metrics import pandas def splitting(data_list, datetimes_list, seizure_info_list, n_seizures_train): data = {} datetimes = {} seizure_info = {} # Train data['tra...
55ac00fc99e408e7e91fa5eeea4e6c3f7401a888653d5b798d1b60b3ab8fb920
Python
7,023
197
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """ This file contains utility functions for Secure Aggregation's cipher related operations. """ import random from typing import Union import numpy as np from Crypto.Cipher import AES # nosec B413 from Crypto.Util.Padding import pad # ...
eaf1a9d1008c5500a69eb26ec95acad47c6a8935977fa0ee54e0f898d4355acf
Python
7,025
203
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Implementation of FedCurv algorithm.""" from copy import deepcopy import torch import torch.nn.functional as F def register_buffer(module: torch.nn.Module, name: str, value: torch.Tensor): """Add a buffer to a module. Args: ...
ec2b3807b58ea51c6877d3ca94de63eda5db4397eeb7b6227f4e6ef87c889d13
Python
7,025
216
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Workspace utils module.""" import logging import os import shutil import sys import time from contextlib import contextmanager from pathlib import Path from subprocess import check_call # nosec from sys import executable from typing imp...
536c3447f67db95e45be95aa8c173ba2ac5b3ca73aeaa8d3288ecbc300733912
Python
7,029
224
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates 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 C...
78f355e8cd5c453fae6ddfd71202c37e5afb32795753a2ccbda2e9df43f8f001
Python
7,036
148
import haiku as hk import jax import numpy as np from jax import numpy as jnp from deeperwin.configuration import EnvelopeOrbitalsConfig, MLPConfig from deeperwin.model import WavefunctionDefinition, MLP from deeperwin.model.orbitals.utils import _determine_n_output_orbitals, _determine_elec_idxs from kfac_jax import ...
0ea9dff7aedd8b72c0975993015ce6a64042236404f4c5f9142f7bbdedae6bcc
Python
7,041
218
"""Tests for constructing an ``analysisDir`` from stable test data.""" from pathlib import Path from unittest.mock import MagicMock import pandas as pd import pytest import sanpy def test_dir(test_data_dir: Path) -> None: """Discover supported recordings in the test data directory. Args: test_data...
cafecb029d5a85551f7b486ab65555b05c0e3605916e72e1f49c262df1dfa1af
Python
7,042
199
# Copyright (C) 2020-2021 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """You may copy this file as the starting point of your own model.""" from collections.abc import Iterable from logging import getLogger from os import makedirs from pathlib import Path from urllib.request import urlretrieve from zipfil...
627d987896fcadf93a308d6b6834b4d16b718fc7938b5f61525b7d1f0a96cabe
Python
7,045
198
# Authors: Mainak Jas <mainakjas@gmail.com> # Blake Caldwell <blake_caldwell@brown.edu> import json from pathlib import Path from urllib.request import urlretrieve import pytest import hnn_core from hnn_core import read_params, Params, convert_to_json from hnn_core.hnn_io import read_network_configuration f...
a1343cae2ab4d94b37bbfb39f2707df856eab541b406432cbc35cc8a02f32281
Python
7,045
196
"""Tests for MACE-MDP (AtomicDielectricMACE) fine-tuning support. Covers: - test_mdp_finetune_updates_params: verifies that a short fine-tuning run completes without error and that at least some model parameters change. - test_mdp_finetune_wrong_model_type_raises: verifies that passing a non-MDP model type...
78ceb6e8f101d9ab0b021807aee136e40fc3f46d4f48b7cbb1efde2dcac0966f
Python
7,046
147
from PyQt5 import QtCore, QtWidgets from PyQt5.QtCore import QRect, QSize from PyQt5.QtWidgets import (QWidget, QCheckBox, QLabel, QComboBox, QPushButton, QSpinBox, QDoubleSpinBox, QFrame, QLineEdit, QTableWidget, QStatusBar) from ._scope import _BUFFER_DURATIO...
b820ec8298990ca808b4f9de18ae9906dabd1529284688d5a4a280203a3c9eaf
Python
7,046
197
# Method signatures differ between Qt bindings, so overrides can't match them all # pyright: reportIncompatibleMethodOverride=false import logging from collections.abc import Callable from qtpy.QtCore import Signal # type: ignore[reportPrivateImportUsage] from qtpy.QtCore import QEvent, QSize, Qt, QTimer from qtpy.Qt...
2829992c4f3cb03c6af4d5979f55c18cdc3cb91fd91d03303f4dc733004541c3
Python
7,051
208
from sklearn.cluster import BisectingKMeans, AgglomerativeClustering, KMeans, DBSCAN from sklearn.model_selection import KFold from umap import UMAP import numpy as np import pandas as pd def umap_cluster(data, z_score=False, n_clusters=None, umap_params_in=None, cluster_params_in=None, random_state=999): """ ...
57e306cfd1cc14f61d2903b11829867c30451fab36c99dcc0714e1d723561612
Python
7,053
199
""" Detect and characterize critical points in the optical flow vector field at each time point. """ import argparse import numpy as np import neo import matplotlib.pyplot as plt from shapely.geometry import LineString from utils.io_utils import load_neo, write_neo, save_plot from utils.neo_utils import analogsignal_t...
6567c70e747a8cf5f5b7531739fb71d524b8ddb9c92388186396ad3ecc46bbfc
Python
7,058
200
""" Detect and characterize critical points in the optical flow vector field at each time point. """ import argparse from pathlib import Path import numpy as np import neo import matplotlib.pyplot as plt from shapely.geometry import LineString from utils.io_utils import load_neo, write_neo, save_plot from utils.neo_ut...
bfe27d520e673552d44f7452b9a0cdef4755bb78e99d76d8384dcd79a632c461
Python
7,059
199
""" Detect and characterize critical points in the optical flow vector field at each time point. """ import argparse import numpy as np import neo import matplotlib.pyplot as plt from shapely.geometry import LineString from utils.io_utils import load_neo, write_neo, save_plot from utils.neo_utils import analogsignal_t...
e880115bbceea1decb9d02a33c629f94151d3e2c7a45c4ca779b6bed72727d00
Python
7,060
156
""" Determine the threshold between Up and Down states for each channel by fitting the respective amplitude distributions. """ import numpy as np import argparse import os import scipy as sc import warnings from scipy.optimize import OptimizeWarning import matplotlib.pyplot as plt from utils.io_utils import load_neo, ...
bd62119ff8239958b785497cbe97c85f1f9e4f114b554ae7436a3e51a3ecbef9
Python
7,063
187
from PymoNNto.Exploration.Evolution.common_UI import * from PymoNNto.Exploration.Evolution.PlotQTObjects import * from PymoNNto.Exploration.Network_UI.Basic_Tabs.Helper.syntax import * class Execute_UI(Execution_Manager_UI_Base): def get_folder(self): return 'Plot_Project_Clones' def get_title(self):...
2ee52b0dd201c764bd136e4173c87bc6e4d2109aff4f9454f334387c632418e0
Python
7,064
318
# %% [markdown] # # Preamble # %% import numpy as np from joblib import Memory import dgamem.grid as dga import dgamem.grid_ref as ref memory = Memory("data/cache") # %% [markdown] # # System # %% shape = (80, 80) # grid shape size = 80**2 # number of states temperature = 0.5 sep = 0.05 # grid spacing area = se...
b946600b8ba37e51c23ac23578022f384e208403d6e20292f3a711bc26f9cb22
Python
7,065
170
r""" Delay Coupling ============== In this tutorial, we will go through the different options you have to define delay-coupled dynamical systems in PyRates. As an example, we will use a model of :math:`N = 2` interconnected leaky integrator units, the evolution equations of which are given by .. math:: \dot x...
5f77cb45afe0f5e8d6a2dda68db8358cc28eeb6c427a15a1c42571fd057df3e2
Python
7,069
210
# ------------------------------------------------------------------------------ # Copyright (c) Microsoft # Licensed under the MIT License. # Written by Bin Xiao (Bin.Xiao@microsoft.com) # Modified by Ke Sun (sunk@mail.ustc.edu.cn) # ------------------------------------------------------------------------------ from ...
4c6d0c2d25a5098b2ff7165b5f79ccc9ac2f173ee4d749daacb73ae6135a97b1
Python
7,070
228
import numpy as np import torch import torch.nn as nn import progressbar import time import copy def initialization(init_method, W, is_tensor=True): """ Initializes the provided tensor. Parameters: ----------- * init_method : str (default = 'glorot_uniform') Initialization method to use....
458ea6ba28b608fd15250e633c803a8c0fc6b7b4ae8adddef1761c93131bbc58
Python
7,072
135
"""Queries use a reference fit and its retained DBSCAN cores without changing either.""" from __future__ import annotations import numpy as np import polars as pl import pytest from vdjdb.motifs import tcremp as TE def rows(sequences, epitopes=None): n = len(sequences) return pl.DataFrame({"species": ["Homo...
25673417c4199cd5622fe249933c68c306af7ffc91d7a40a3d9fbba79b48fb81
Python
7,073
192
import utils import train import torch from torch.utils.data import DataLoader import math import database import load_save import random import argparse import Networks functions_nn = {'gru2_bohb': Networks.gru2_bohb.gru, 'gru_bohb': Networks.gru_bohb.gru} def init_all(model): for p in model.par...
443480a63232ad089547a652b723b2e36bec145fbb24033d03172d7c83395942
Python
7,074
184
import tdt import time import os import numpy as np from scipy.signal import butter,filtfilt import matplotlib.pyplot as plt def get_online_api(config): """Function for returning the desired online API""" if config.online_api == 'synapse': return SynapseAPI() else: raise NotImplementedErr...
9ae5435c06f1454feace9b42c3ee103ddb180256426b93e603feb7b9be3d7392
Python
7,076
221
import logging import os from pathlib import Path from typing import Any, List, Optional, Union import torch from torch.utils.data import ConcatDataset from mace import data from mace.tools.scripts_utils import check_path_ase_read from mace.tools.torch_geometric.dataset import Dataset from mace.tools.utils import Ato...
0f1da985298370d7e5c596cddbadbabfef981f1c8c3e8c81bf72968d76b31f38
Python
7,077
218
import numpy as np import xlsxwriter as xw import pickle from aux_fun import get_selected_features # --- Creates an xlsx file with the training results of approach A --- def save_train_results_A(general_information, train_information, approach): # Create xlsx path = f'Results/{approach}/Train_r...
6959bff6c23ec6b866ee44d430c4606862988b1d7bcae3d623ab6d4e6fbb78c3
Python
7,078
207
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import torch from torch import nn, Tensor from typing import Optional, Tuple from torch.nn import functional as F from utils import logger from .base_layer import BaseLayer from .linear_layer import LinearLayer fr...
20678dfcb9a4ce9ed5f5f302c9d0b33734bf13924469a5c560484b3ebae1009e
Python
7,080
200
""" Detect and characterize critical points in the optical flow vector field at each time point. """ import argparse from pathlib import Path import numpy as np import neo import matplotlib.pyplot as plt from shapely.geometry import LineString from utils.io_utils import load_neo, write_neo, save_plot from utils.neo_ut...
cb7a124e3873d663c39f0f0a7dc774f75ebc773ac48f063c730bb364583fc075
Python
7,083
198
import random, csv, pickle import numpy as np import rdkit.Chem as Chem from rdkit.Chem.Scaffolds import MurckoScaffold import logging, os def get_splitted(path): if path is None or not os.path.isfile(path): return None, None smile_list, label_list = read_data(path) X = np.array(smile_lis...
3282347ad2569a44cbc44602417e7fe760a190cbf24484b34baa8389a995a7b2
Python
7,084
156
"""w Determine the threshold between Up and Down states for each channel by fitting the respective amplitude distributions. """ import numpy as np import argparse import os import scipy as sc import warnings from scipy.optimize import OptimizeWarning import matplotlib.pyplot as plt from utils.io_utils import load_neo,...
c1b8ccfe1f7c40f04c2bd0c4351d41f052f2f726dd618801cb7fe5d1ef848e63
Python
7,085
114
import time import numpy as np def get_configs(parser): # Parse commandline arguments parser.add_argument("--data_dir", default='hyper_dti/data/', type=str, help='Path to data directory.') parser.add_argument("--name", default='run', type=str, help='Experiment name.') parser.add_argument("--wandb_us...
fa34072a120e973efc5bfbac5cf61a610d85b66b588a5da01e567890ddd0dadb
Python
7,087
168
# 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...
8a5b3e9faf4ce31315a711df94117e225a80ffe63e68b09b67e2c795e15eb141
Python
7,088
157
""" Determine the threshold between Up and Down states for each channel by fitting the respective amplitude distributions. """ import numpy as np import argparse from pathlib import Path import os import scipy as sc import warnings from scipy.optimize import OptimizeWarning import matplotlib.pyplot as plt from utils.i...
64c2e27c57b2c3b51147b9bbb7c141f5d24d6523d761ad0aff5c1c7b55f4e01b
Python
7,094
235
""" Generic utilities for online analysis. """ import asyncio import functools import logging import os from pathlib import Path import time from datetime import datetime from glob import glob import json import warnings import numpy as np import pandas as pd import scipy.io as sio from ScanImageTiffReader import Sca...
cd1063dc3b07a3fb3ea18fbb746fc931f6763de43bdbcb1d9e592e7be99df2ef
Python
7,096
188
# 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. from typing import Dict, List, Optional, Tuple import torch import torch.nn as nn from torch import Tensor from fairseq import utils from fa...
fd4f16cb3258fa25a38316ea65d8d188b88b37cd137ddbc1a524520d0baab981
Python
7,096
208
import os import cv2 import numpy as np import tensorflow as tf ### importing required packages import pathlib from PIL import Image import matplotlib.pyplot as plt from skimage import io from sklearn.metrics import precision_score from sklearn.metrics import recall_score from sklearn.metrics import confusio...
cd81d7e8de8455c353a0a0f6a5969bb84102ac6cb42a3e660bda17def3f70b35
Python
7,097
220
from neuron import h, load_mechanisms from neuron.units import ms, mV import numpy as np import os import sys load_mechanisms(os.path.dirname(__file__)+'./detector/') # initialisation MPI h.nrnmpi_init() # define dt for the simulation h.dt = 0.1 print("############### dt", h.dt); sys.stdout.flush() pc = h.ParallelCont...
ff9d7b246f0173e2e1c1a49a483b394e5ab06425f194d681769d821a4ece2869
Python
7,098
220
# -*- coding: utf-8 -*- import h5py import numpy as np from collections import deque import copy import random import torch import os, sys import glob from scipy.spatial.distance import squareform from data_functions import load_data_dros import pickle from sklearn.neighbors import kneighbors_graph class H5DisDat...
5e5e2fe8995d0f7b4faaa2f8d9eccf3ed5b617c1ed8e784b9b963a15e8b2f81d
Python
7,103
163
#!/usr/bin/env python ############################################################################# ## ## Copyright (C) 2017 Hans-Peter Jansen <hpj@urpla.net> ## Copyright (C) 2016 The Qt Company Ltd. ## ## This file is part of the examples of the Qt Toolkit. ## ## $QT_BEGIN_LICENSE:BSD$ ## Commercial License Usage ##...
6d892bb957cf07fa00d0e27bf2e4489ae4b380238b544a02b8c075fb5cfc21d7
Python
7,107
184
import pytest from chromadb.config import DEFAULT_DATABASE, DEFAULT_TENANT from chromadb.test.conftest import ClientFactories from chromadb.errors import InvalidArgumentError from chromadb.api.types import GetResult from typing import Dict, Any import numpy as np def test_database_tenant_collections(client_factories:...
6f53f5b877d69e2b96236d6b428ebe3f642567b6704c8337b69b3ef290303fae
Python
7,108
179
import pandas as pd from Bio import SeqIO import numpy as np import tensorflow as tf import os, subprocess, shutil from itertools import product class Seq: def __init__(self, fasta_dir, encoding, k): self.fasta_dir = fasta_dir fasta_files = [fasta_dir + file for file in os.listdir(fasta_dir)] ...
a6144ad8594dc8c6cb42f5a8324947302a40b015b5f389007dabdcaab0161a4d
Python
7,114
224
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import os import numpy as np from vedo.utils import sort_by_column from scipy import signal ################################################################################# class Limb: def __init__(self, source="", author="unknown"): self.author = author.lo...
4e4c6fdf03e8d4d8890c18b60a591d36c2d1e68710ce88b470f3a91a3c99f096
Python
7,117
135
"""Antigen nomenclature patches. ``patches/antigen_epitope_species_gene.dict`` maps an epitope to its canonical parent gene and species. The legacy build applied it per chunk with ``chunk_df.T.apply`` -- transpose, then a Python call per row; it is one join here. Coverage, measured: the dictionary covers 245 epitopes...
5245e24cce3ff45ae0e58065de12f595adaf3ec08182f80bf3622ead6eac0a41
Python
7,117
205
"""Invariant metric test data. Given the slowness of these tests, I've decided to separate the data that computes a method at identity (because the normal tests will call those methods). Just use such data if interested in more detailed tests (notice the tests are already defined). """ import geomstats.backend as gs ...
3398ef306cbf1e9bdbe6c4127a3766a6ee7bb21dbf0ef95f6181e2df67120b14
Python
7,128
198
# -*- coding: utf-8 -*- """ Created on Thu Apr 22 14:27:39 2021 @author: nicol """ import os, glob, tqdm from skimage.io import imread, imsave import numpy as np import matplotlib.pyplot as plt from matplotlib import rc import matplotlib as mpl from skimage.metrics import normalized_root_mse as nrmse import scipy.ndi...
7c1a689e01b9c0511876712c9bde56323d6f12092c25abcafd4ab159ab9ac41c
Python
7,129
179
import pathlib import numpy as np from openeye import oechem, oeomega, oeshape, oequacpac from typing import Optional, List class ROCSOverlay: """ This class contains all methods needed for running OpenEye ROCS based on the OE python API. Env variable "OE_LICENSE" must be set before running this code....
7b230bc23ad239eef03122d7700d1276233e13bff7e055bfe4fe30675d0f43b2
Python
7,130
157
import logging import os import pickle import re import ruamel.yaml from deeperwin.configuration import Configuration, build_flattend_dict, CheckpointConfig, ConfigBaseclass, PhisNetModelConfig from deeperwin.mcmc import MCMCState import jax import numpy as np import haiku as hk import zipfile from dataclasses import...
5c2c3bcf5155578512f8863cd99a819d55747a7a208a94f1d6e6f2b515eb1d9c
Python
7,131
177
import numpy as np from sklearn.decomposition import PCA from jPCA.util import ensure_datas_is_list, preprocess from jPCA.regression import skew_sym_regress __all__ = ['JPCA'] class JPCA: def __init__(self, num_jpcs=2): assert num_jpcs % 2 == 0, "num_jpcs must be an even number." self.num_jpcs =...
8d206bc80aa617df618e1cd42c74d9d1c6be50d715e6d038065640e827ca7417
Python
7,138
132
"""The ProductPositiveRealsAndComplexPoincareDisks manifold. The ProductPositiveRealsAndComplexPoincareDisks manifold is defined as a product manifold of the positive reals manifold and (n-1) complex Poincaré disks. The positive reals and complex Poincaré disks product has a product metric. The product metric on the p...
a458cb57520783cd76d39f1b9e94b78ad268486ddaef4f412609538f6e3c7e76
Python
7,141
167
""" NeuroLearn File Reading Tools ============================= """ __all__ = ["onsets_to_dm"] __author__ = ["Eshin Jolly"] __license__ = "MIT" import pandas as pd import numpy as np from nltools.data import Design_Matrix import warnings from pathlib import Path def onsets_to_dm( F, sampling_freq, run_...
c115045843b844119aff508498c65627b2e97e32dab1d026bc0f9c8ba00f8d42
Python
7,141
190
#!/usr/bin/env python3 # Copyright 2020 - 2021 MONAI Consortium # 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 applicable...
520981349aa27974fb286c6d643301402388a98b26639b64c4bd1e90524fb4e8
Python
7,146
183
from dataclasses import dataclass from typing import Dict, Tuple import scipy from jax import numpy as jnp from deeperwin.configuration import Configuration, PhysicalConfig, DistortionConfig from deeperwin.loggers import LoggerCollection, WavefunctionLogger from deeperwin.mcmc import MCMCState from deeperwin.run_tools....
2fa68c16ae9a2266e6a6d83cf615facea7795a91748e349804ece13a707e3680
Python
7,148
266
from __future__ import annotations import functools as ft import importlib.resources import json import re from typing import Any, Callable, Dict, Iterable, TypeVar import attrs import more_itertools as itx from typing_extensions import Protocol from snakebids.utils.sb_typing import UserProperty T = TypeVar("T") ...
96a83f8bbb21058c1dd80ab704ae647116fc7322e971e23513e4eeb54e600d32
Python
7,148
173
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Federated averaging with secure aggregation module.""" import numpy as np from openfl.interface.aggregation_functions.weighted_average import WeightedAverage from openfl.utilities import LocalTensor class SecureWeightedAverage(Weight...
a94d67063a4dc575263c9db1c6bf2452662829fce3242c81f9b0f86e50f29e83
Python
7,148
173
import os import tables import numpy as np import nibabel as nib import shutil from tqdm import tqdm from glob import glob from config_trans import cfg # Input shape: 240x240x155 def read_brain(brain_dir, mode='train', x0=29, x1=221, y0=29, y1=221, z0=2, z1=146): """ A function that reads and c...
abb14d8063043e8ebf59810bab411296fd8ba340576a6ad5c723f91838327c8c
Python
7,149
225
""" Created on Sat September 16 21:15:06 2023 Description: Additional utilities functions for Paper url: https://www.biorxiv.org/content/10.1101/2023.09.11.557230v2 @author: Ekaterina Kuzmina, ekaterina.kuzmina@skoltech.ru @author: Dmitrii Kriukov, dmitrii.kriukov@skoltech.ru """ import numpy as np from sklearn.deco...
8ebeb3cb5095db15b184c71880d019b870a9590aa869df45fa579ab8447ed4a9
Python
7,154
210
# -*- coding: utf-8 -*- import os import random import numpy as np import tensorflow as tf from sklearn.model_selection import KFold from JSLib.JSLog import JSLog from JSLib.JSData import JSData from JSLib.JSModels import JSModel_MH_DSCNet from JSLib.JSExperiment import JSExperiment def JSCreate_Experiment(jsData,...
94351f6d3330e5be6402a3f1d210899adcf2db6af279019a20992ee40f4f03c5
Python
7,154
182
"""Tests for timeseries permutation tests and helper functions.""" import pytest import numpy as np from nltools.algorithms import circle_shift, phase_randomize class TestCircleShift: """Tests for circle_shift() function.""" def test_random_shift_never_identity_1d(self): """A random 1D shift must n...
f454d5fb38412b8626ce75a280ddb97e5e1e3beaa693c89925f40f39c9f58c7d
Python
7,157
191
import string from pathlib import Path import matplotlib.pyplot as plt import numpy as np import ppafm.ml.AuxMap as aux import ppafm.ocl.field as FFcl import ppafm.ocl.oclUtils as oclu import ppafm.ocl.relax as oclr import torch from matplotlib import cm from ppafm.ml.Generator import InverseAFMtrainer from ppafm.oc...
26581cf662994807b9c2299d69b3ba3c4c324b0da16bd2e18b94712670e6de6b
Python
7,159
213
# Copyright (C) 2020-2023 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import sys from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator from openfl.experimental.workflow.runtime import LocalRuntime from openfl.experimental.workflow.placement import aggregator, collaborator cl...
68044778d1aefb888f772bda8c2a6032246601df8bb122e30eb11bda6e01e31a
Python
7,162
199
# -*- coding: utf-8 -*- # # # PyRates software framework for flexible implementation of neural # network model_templates 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 Cogn...
9fa56641faa43b1a3309502ac0f595f0cb3495862d577a363a4701edd84cd19a
Python
7,163
155
""" Differential Evolution ====================== In this tutorial, you will learn how to optimize PyRates models via the `differential evolution <https://en.wikipedia.org/wiki/Differential_evolution>`_ strategy introduced in [1]_. It will be based on the same model and the same parameter as the single parameter grid ...
1d360bb94c34bd5cf95262d7fc90b68fe80d5b58fae75ccb9e3d5550dbf0c515
Python
7,166
157
from DeepPurpose import utils, dataset from sklearn.model_selection import train_test_split from DeepPurpose.utils import * import itertools import torch import numpy as np from AutoEncoder import AutoEncoder from torch.utils.data import DataLoader, Dataset from torch import nn import random import wandb from tqdm impo...