sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
e08406f76f3889084ebdfe56af091845b7c1b78e1099399c3fbcc45235004d0f
Python
5,565
172
import matplotlib.pyplot as plt import numpy as np def _enforce_ratio(goal_ratio, supx, infx, supy, infy): """ Computes the right value of `supx,infx,supy,infy` to obtain the desired ratio in :func:`plot_eigs`. Ratio is defined as :: dx = supx - infx dy = supy - infy max(dx,dy) ...
cbacc17cc3e4efd2aa6f5e4ea70f3d5e3ea30ef5df35a7bfac88eaed28443934
Python
5,566
153
from PymoNNto.Exploration.Network_UI.TabBase import * from functools import partial class sidebar_fast_forward_module(TabBase): def __init__(self, step_list=[100, 1000, 5000, 15000, 30000, 50000, 70000, 100000], title='PCA'): super().__init__(title) self.step_list = step_list def add_recorder...
1ee7c690d1ad05618c4885ed53bb48ec14a45687958e8127ae7f304b41397528
Python
5,567
142
"""The regeneration driver must stay a driver. These are the tests that keep ``regenerate.py`` free of per-family knowledge. A family of goldens is added by dropping a module into ``targets/``, and the value of that is entirely in what it prevents: two families added on two branches merging without touching a line in ...
83cf9c97fad56c230abb458cb4f9595fe45051c0c94688fafe5bb9430c1df0f4
Python
5,568
159
# 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 torchmetrics import Metric from nequip.data.stats import _MeanX class MeanAbsoluteError(_MeanX): """Mean absolute error.""" def __init__(self, **kwargs): super().__i...
95c40bc35bcefc4d8ddfd30bdb7c7b8ebfbb191c1c52255bda9348182873b813
Python
5,570
98
from PymoNNto.Exploration.Network_UI.TabBase import * class chain_tab(TabBase): def __init__(self, title='Chain'): super().__init__(title) def add_recorder_variables(self, neuron_group, Network_UI): return def initialize(self, Network_UI): if Network_UI.network['grammar_act', 0] ...
c42d5c7247169a0139b07d38f03a940ac050dc50d3c91afef5f2e8a81d881267
Python
5,572
174
# -*- 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...
8d2276b9170fb37ea8b011e2ce89a2a29ef5a47d9988a3fd43e1a1296dc311a4
Python
5,573
194
""" Estimate the time our spike detection takes. - Load an abf with lots of spikes - loop through the number of seconds in the recording - spike detect from 0 to i sec and calculate the time it takes Note: the raw data for this to run is not provided in the repo. We can provide it upon request. """ i...
406a7a5faf6a03065729dd5ae9da0767d8dfd2855ae5d1e8e9e1c2561736b53b
Python
5,574
126
# 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 import os import contextlib from typing import List, Optional, Union, Final, Callable def dtype_from_name(name: Union[str, torch.dtype]) -> torch.dt...
d15c828f8523a32714a5b17b76ff3ad5379838d3aa46ec1160c070a1f296bc32
Python
5,575
151
# Copyright 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging import queue import signal import threading import time from concurrent.futures import ThreadPoolExecutor from multiprocessing import cpu_count import grpc import psutil from flwr.proto import grpcadapter_pb2_grpc from openfl.tra...
58687997182b5d2cda3f259496f678bc0d38d84f5a6dd0cbbe2d4a75f48c6bb7
Python
5,576
163
import pytest import renderapi from test_data import (render_params, montage_raw_tilespecs_json, montage_parameters) from bigfeta.qctools.CheckPointMatches import CheckPointMatches # from bigfeta.qctools.CheckResiduals import CheckResiduals # residual has bad dep from bigf...
a305f54bcbc4b51a82b4662df3028b02730e784c323d8e29dd1ad7066fd5413c
Python
5,577
186
""" Utility functions for plotting """ import os, sys import re from pathlib import Path from typing import Optional, Sequence, Union import numpy as np import pandas as pd import matplotlib.pyplot as plt from matplotlib.colors import LogNorm import seaborn as sns from astropy.visualization import LogStretch from ast...
e285f21a22ea9078c08a92f6dfaca249f6197bb69ff5cce946e8b6e65556c8a6
Python
5,578
180
import torch as T import torch.nn as nn from Networks.network import Network class UNet5_decoder_teacher(Network): def __init__(self, base, expansion): super(UNet5_decoder_teacher, self).__init__() self._build(base, expansion) def forward(self, image, segbox): layer_0, layer_1, layer_2...
b18149442279c2315b6993e0818dc30668d968dff5a306051cba8fc90677f8f1
Python
5,579
169
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """PyTorchDataLoader module.""" from math import ceil import numpy as np from openfl.federated.data.loader import DataLoader class PyTorchDataLoader(DataLoader): """A class used to represent a Federation Data Loader for PyTorch mod...
ce1a7e3dca5e9f3088e0f65710280459c64b8bf42b8ef8019e1f46f71abe8c52
Python
5,579
120
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. """Keys for dictionaries/AtomicData objects. This is a seperate module to compensate for a TorchScript bug that can only recognize constants when they are accessed as attributes of an imported module. ...
2c0b17574f0e1f20780104191fac1f9edc7341e368b23c2d82d39908662ca7e4
Python
5,582
234
from chromadb.config import Component, System, Settings from overrides import overrides from threading import local from unittest.mock import patch import pytest import os import random data = local() # use thread local just in case tests ever run in parallel def reset() -> None: global data data.starts = [...
4d53ba87219b73d15cb134f3380172d3c921b2d29ea0fa44b125e48c0f391ddd
Python
5,583
161
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ import time, os, glob from tqdm import tqdm import numpy as np from skimage.io import imread import seaborn as sns import pandas as pd import matplotlib.pyplot as plt from skimage.metrics import structural_simil...
e8b16fdc2c55981a0201aab99450cf55848344758a56b8e0b4393319250fadc9
Python
5,584
176
"""Resolve and stream published DANDI NWB assets into SanPy.""" from __future__ import annotations from collections.abc import Iterator from contextlib import contextmanager from dataclasses import dataclass from typing import Any, ContextManager, Protocol import h5py from pynwb import NWBHDF5IO from sanpy.fileload...
1800644a46622d02e92b3ecc46d638922c42450c60f17167fa5a2f9b2c99f65e
Python
5,585
172
import random import pytest import geomstats.backend as gs from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.general_linear import SquareMatrices from geomstats.geometry.lower_triangular_matrices import LowerTriangularMatrices from geomstats.geometry.matrices import ( BasisRepresentationD...
5e796db645f9cc440143f4306b49614eebc48334456a7b5aa9e2260c4f1f46db
Python
5,589
154
import sys import time import numpy as np import torch from utils import logger from typing import Optional, Dict, Union, Any from . import SUPPORTED_STATS class Statistics(object): def __init__( self, metric_names: Optional[list] = ["loss"], is_master_node: Optional[bool] = False, ) ...
eeeff39ea0ec13979abedcb57c5d76ed635e9c8e0a0586068cab03556a664308
Python
5,589
123
""" The Kuramoto Oscillator ======================= Here, we will introduce the `Kuramoto model <https://en.wikipedia.org/wiki/Kuramoto_model>`_, a generic phase oscillator model with a wide range of applications [1]_. In its simplest form, each Kuramoto oscillator is governed by a non-linear, 1st order ODE: .. math:...
f884dd7cfb6a6b43351b6f787f3d34069740e0ae35583d31352b4261f106b512
Python
5,590
131
# -*- coding: utf-8 -*- """ Created on Fri Jul 10 18:14:19 2020 @author: Tom """ import tensorflow as tf from tensorflow import keras as k tf.config.list_physical_devices() import os #os.environ['CONDA_DLL_SEARCH_MODIFICATION_ENABLE'] = '1' # needed due to dll bug in my environment - might be unnecessary for other p...
fcf9fed85443a5f606eea20efbef083ab20505bdab6e85641a498778c3fbe32c
Python
5,591
148
"""Fixtures shared by the end-to-end contract suites. These live here rather than in each file because two of the contract suites need the same artefacts -- the committed anchors, the committed regression dataset, and one multi-head model that only a fine-tuning run can produce -- and building them twice would double ...
00d2396d844dd2e120aaf947e4385bb44db3d7918b23433784ecc6d1bb8cc5c9
Python
5,595
135
"""The Agglomerative Hierarchical Clustering (AHC) on manifolds.""" import sklearn.cluster._agglomerative as ca from sklearn.cluster import AgglomerativeClustering import geomstats.backend as gs from geomstats._sklearngs.cluster._agglomerative import linkage_tree from ._sklearn import SklearnInteropMixin class Agg...
b6fc71081eac4c14a7eb8269bed13974b16fabd4f2ebcd504213e043814bc361
Python
5,595
161
# # For licensing see accompanying LICENSE file. # Copyright (C) 2022 Apple Inc. All Rights Reserved. # import torch from torch import nn, Tensor import math from typing import Optional, Tuple from .base_layer import BaseLayer from .dropout import Dropout class SinusoidalPositionalEncoding(BaseLayer): """ T...
e557d8033b21299a196829be11b50d0d7a714bf0efb3a0c0bfa42503073ce2d6
Python
5,595
157
"""@Author: Nicolas I. Tapia-Rivas""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import os import time import numpy as np from scipy.interpolate import interp1d from sleeprnn.common import constants from sleeprnn.data.dataset import Dataset from slee...
5c83d0051bf44afaa850ee665cc27a02b473fec656e6326b0b0cb2c15db1fb86
Python
5,600
180
import csv import pytest from rdkit import Chem from reinvent.runmodes.samplers.run_sampling import run_sampling from reinvent.runmodes.utils.helpers import set_torch_device # FIXME: the problem here is that we need to read this from JSON but we can use # json_config as a parameter to a function def check_cs...
0011e7451b3d82f1a955eb221d009a3ab534847784bb6a361432caf4a28cbbdd
Python
5,604
116
import tensorflow as tf from common.models.audio_core_blocks import get_ResNet28_block from common.models.wide_resnet import get_WideResNet_block from common.models.variational_audio_core_blocks import get_VariationalResNet28_block from common.models.embedding_pooling import get_attention_global_pooling from common.mo...
b832746b6722910f70d980bdd20ffaf52dabe67a821da45db146c39fb85275c1
Python
5,604
163
"""Mol2Mol transfer learning""" from __future__ import annotations __all__ = ["Mol2Mol"] import logging import os import torch from torch.utils.data import DataLoader import numpy as np import tqdm from .learning import Learning import reinvent.models.transformer.core.dataset.paired_dataset as mol2mol_dataset from...
bff80b2edaf81a00dce5a6387d4f24d3185176572f3a69e77266d7bcd5616711
Python
5,609
122
from PymoNNto.Exploration.Network_UI.TabBase import * from PymoNNto.Exploration.Visualization.Visualization_Helper import * class isi_tab(TabBase): def __init__(self, title='Activity/ISI', param='output', mask_param='Input_Mask', timesteps=1000, mask_color_add=(-100, -100, -100)): super().__init__(title) ...
b0bfd0d675a389733ed297f85db030f779bbafdbae418d2cb978e10bb8e6fe4d
Python
5,613
181
"""Tools to manage generation and interconversion of bidsapps and snakemake outputs.""" import hashlib import json import time from collections import OrderedDict from pathlib import Path, PosixPath, WindowsPath from typing import Dict, Union import more_itertools as itx import yaml from typing_extensions import Lite...
bced415200fc2453c217db83ca1b31ee5f2a0985a0479f7612f9a15a0dfaf92b
Python
5,614
194
#!/usr/bin/env python3 import argparse import matplotlib.pyplot as plt import numpy as np import odil from odil import plotutil, printlog def get_ref_u(t, x, args): """ Returns an exact solution of the equation: u_t = u_xx """ t = np.array(t) * args.tmax_ref x = np.array(x) u = np.sin...
e9034f85a4100631cbbd35c9d8f955514474cdd7be77e610770d8734a45cedab
Python
5,615
159
import os import numpy as np import requests from collections import Counter from rdkit import Chem from tqdm import tqdm from time import sleep import logging import matplotlib.pyplot as plt import seaborn as sns def seq2rat(sequence): # dict count stores information for each sequence dict_count = dict(Cou...
bca66402b5d7d52acd0dd4d301b1c53d3822aa471d2e25721a722c9f25f4ab83
Python
5,617
133
import numpy as np from utils import load_DEAP from sklearn.model_selection import train_test_split from torch.utils.data import TensorDataset import torch from sklearn.utils import shuffle import os import matplotlib.pyplot as plt DATA_DIR = "/data/DEAP/data_preprocessed_python/" def baseline_removal(data): ""...
53e77e9b21b91c979fde234a5dad59e3e5cc0e392328f8b7df5282967a7bd247
Python
5,618
220
"""Decorator to handle vectorization. This abstracts the backend type. """ import math import geomstats.backend as gs from geomstats.metric_geometry.point_set import Point def _get_max_ndim_point(*point): """Identify point with higher dimension. Parameters ---------- point : array-like Return...
7ce535e73ce9ded2b955f8a6e7c3627d213e37994d08ffc7896deff2a028ed51
Python
5,620
143
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator from openfl.experimental.workflow.placement import aggregator, collaborator logging.basicConfig(level=logging.INFO) log = logging.getLogger(_...
c47222ca99d0139b0baebfc4f561c335072f3b7189f4dde0ede336e51b22ed9e
Python
5,620
160
# 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.""" import tensorflow as tf import keras from openfl.federated import KerasTaskRunner import logging logger = logging.getLogger(__name__) class Keras2DUNet(KerasTaskRu...
31ebb82ed2b1d930644b763b2325a1d443b1d072a582cbe6b938ef1c7e2ba1a2
Python
5,626
125
import numpy as np import matplotlib.pyplot as plt from random_orientation_utilities import * from orientation_reconstruction_utilities import * from multiprocessing import Pool import matplotlib as mpl import statistics ################################# # input data ################################# eeg_lf = np.load...
a2236440f1ae18b883bba6fcc30c4fb58863075166cc193d3980b6e1f6bbd944
Python
5,626
188
"""Matched molecular pairs""" from __future__ import annotations __all__ = ["MMP"] import logging import shlex from io import StringIO from typing import List import numpy as np import pandas as pd from rdkit import Chem from pydantic import Field from pydantic.dataclasses import dataclass from .component_results ...
54dc7c8121c86b685d900b79a776f64d7ba955d95189dd20823e14cc485205a1
Python
5,628
127
"""J calls the junction contradicts (#681): the rule, and what it refuses.""" from __future__ import annotations import polars as pl from vdjdb.curate.jcalls import MIN_RUN, contradicted, report def test_a_junction_that_ends_in_another_gene_names_it(): """`CAVSDGNAGGTSYGKLTF` is called TRAJ47 and ends in eleven...
65bd421c93be83e1f996b6057b955d4fd3e002dff6e9196a3e074a820b5e8885
Python
5,631
136
""" Calculate the spatial derivative on the time-delays of the wave triggers in each channel. The derivative is calculated using a kernel convolution. """ import argparse import numpy as np import pandas as pd import matplotlib.pyplot as plt from warnings import warn from scipy.interpolate import RBFInterpolator fro...
bb5dd743408cc1f01649b2218df4980399549b2c9ecd1d1e607db3d004e04ef8
Python
5,631
137
""" Calculate the spatial derivative on the time-delays of the wave triggers in each channel. The derivative is calculated using a kernel convolution. """ import argparse from warnings import warn import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.interpolate import RBFInterpolator fr...
48528a4905a1e564d015086cc159c225422684c494ab416bcb706c3bbf6de6ba
Python
5,632
217
"""Interpolation machinery.""" from abc import ABC, abstractmethod import geomstats.backend as gs class Interpolator(ABC): """Abstract class for interpolator.""" def __call__(self, t): """Interpolate data. Parameters ---------- t : array-like, shape=[n_time] Int...
848f866af52580e7dfe1e6fabf51a25d3d836395f239a66618dd123beb67d445
Python
5,634
174
''' Alex Crits-Christoph License: GPL3 Classifies viral metagenomic contigs using a random forest classifier built on public datasets. ''' import sys import numpy import subprocess import os import cPickle as pickle from sklearn.ensemble import RandomForestClassifier from collections import defaultdict import os.path ...
3222c531b036903678aa190c2c1383992f851dc57a75c023654da9e6912638ef
Python
5,638
147
"""Loading the committed anchors, and building the graphs they consume. `harness.py` may not import the framework, so the two operations every anchor-based test starts with -- read the checkpoint, turn an ase structure into the batch the forward pass eats -- have to live somewhere else. They live here rather than in o...
29b54e215595a256f5db51ab4eab167f6a13cf2c1476b167c4825e771ecc8b45
Python
5,639
151
# simpleCPP_sim.py - Directly simulates a model that # assumes CPP slopes are generated from drift rates # # Copyright (C) 2022 Michael D. Nunez, <m.d.nunez@uva.nl> # # 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 ...
0c620909e52ead04dbd9a1c3bdc26489546b3b5a251122fd26cd2b4cec7f3910
Python
5,640
149
"""Example experiment for the VLAAI model.""" import glob import json import logging import os # set gpu private os.environ['TF_GPU_THREAD_MODE'] = 'gpu_private' import tensorflow as tf import numpy as np import sys # add base path to sys sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..')) from task...
9f68501cf54319ffbf3ef83f3f952392ceaeaaf4d8df809433e38ce53571db7f
Python
5,643
126
import math import torch from torch import Tensor import torch.nn as nn from torch_geometric.utils.loop import add_remaining_self_loops from ..models.utils import subgraph from .base_explainer import WalkBase EPS = 1e-15 class GNN_GI(WalkBase): r""" An implementation of GNN-GI in `Higher-Or...
0cbcb6e4d78e4ced155de7bd21e156991d955cd70ffabdcac9f604a145a0c9e1
Python
5,648
135
#### binfile_parcellation.py # Copyright (C) 2010 R. Cameron Craddock (cameron.craddock@gmail.com) # # This script is a part of the pyClusterROI python toolbox for the spatially # constrained clustering of fMRI data. It performs subject level normalized # clustering of connectivity matrices. # # For more information r...
2d54d5dfabb3771adeec212b61af003493d2f5437ce9d679622a9e8b8d30d548
Python
5,648
159
import os from tqdm import tqdm import lmdb import pickle import torch import numpy as np from torch_geometric.data import Data from rdkit import Chem from ogb.lsc import PCQM4MDataset from ogb.utils.features import (allowable_features, atom_to_feature_vector, bond_to_feature_vector, atom_feature_vector_to_dict, bond_...
0a4e6da59ca5515a19442aa9ab92e808f80239c18fa31dc37b2ef071a4a91846
Python
5,649
138
# 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...
bbcfc457b6b98330db9fe434a88d3f423df7cb2b4196180ddbf1e0430f6b0c3f
Python
5,649
131
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.model_selection import train_test_split from sklearn.linear_model import RidgeClassifier from sklearn.preprocessing import StandardScaler import matplotlib from sklear...
896d464eb7c484e98e71a2f6427d45f2c78c0848368530ac8ad2f3e0bcc629c8
Python
5,653
168
'''ShuffleNet in PyTorch. See the paper "ShuffleNet: An Extremely Efficient Convolutional Neural Network for Mobile Devices" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable def conv_bn(inp, oup, stride): return nn.Sequential( nn...
4ceac08901befa1e7f8802aaef3a9f618dfd5384ae31dc8a835f294a0b2e2d7f
Python
5,656
180
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Tue Feb 8 11:23:22 2022 @author: benozzo """ import numpy as np import sklearn.metrics as metrics import pdb def get_idx_network_subSeparated(): idx_network = np.ones([37,1], dtype=int) idx_lcn = [0,1,2,3] idx_network[idx_lcn] = [[1...
6ce3cd7971a7fb6e0101b9cab961a262a87182ab97641ee6b8f159953a197ef9
Python
5,661
170
# # calculation of synthetic accessibility score as described in: # # Estimation of Synthetic Accessibility Score of Drug-like Molecules based on Molecular Complexity and Fragment Contributions # Peter Ertl and Ansgar Schuffenhauer # Journal of Cheminformatics 1:8 (2009) # http://www.jcheminf.com/content/1/1/8 # # seve...
971e8753af8257e7b1489b4da5ee3868c6efbb7f124c3a6e3e5702d24b09068d
Python
5,661
196
# -*- coding: utf-8 -*- import os import argparse import logging import random import glob import numpy as np from scipy.spatial.distance import pdist, squareform import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt from scipy.sparse.linalg import eigs from sklearn.metrics import pairwise_distan...
b0fc5935927c514d5a087748715f8d4f50aa8ce8b01f7125f94d2a762b54e3d7
Python
5,661
129
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
d5791c987c433144774721dbfd5ac179035962d948a30bc5689bcc0cdaeec8a5
Python
5,663
143
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging pass from openfl.experimental.workflow.interface import FLSpec, Aggregator, Collaborator from openfl.experimental.workflow.runtime import LocalRuntime from openfl.experimental.workflow.placement import aggregator, collaborator...
7604a9c2c1f6a216227f847dc43730e0ab3ad84204846fb1ec0a7b3fdf2f56f7
Python
5,664
157
import numpy as np import xarray as xr from numpy.testing import assert_raises, assert_allclose from xarray.testing import assert_allclose as assert_xr_allclose from gemmr.sample_size.interpolation import * from gemmr.sample_size.interpolation import proc_roots, filter_interpol_roots, _calc_n_required import gemmr.sa...
13bec2c403ee71ccd6298452fe2815d4f6c96d6678da3856a65ee7490aab8cf3
Python
5,666
121
import jax import haiku as hk import jax.numpy as jnp from deeperwin.model.mlp import MLP, get_activation from deeperwin.model.attention import Attention from deeperwin.configuration import DenseGNNConfig, MLPConfig, MessagePassingConfig from typing import Optional def _residual(x, x_old): if x.shape == x_old.shap...
73778127268b6925e81b53be8b30e09cead960786acb0461e5d99894edffb54c
Python
5,667
170
# 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 e3nn.o3._irreps import Irreps from e3nn.nn._gate import Gate from e3nn.nn._normact import NormActivation from nequip.data import AtomicDataDict from ._graph_mixin import GraphModuleM...
a7385ada53ae6ab34d723355d06d3ad61c048012754de22a4fbe2cd380f318d7
Python
5,667
178
from PymoNNto.Exploration.Network_UI.TabBase import * class info_tab(TabBase): def add_recorder_variables(self, neuron_group, Network_UI): return def initialize(self, Network_UI): Network_UI.infotabs=[] for group in Network_UI.network.NeuronGroups: self.make_group_tab(N...
fa751a89341ef3d02d7e0a457ef732f3846538148eb946c1fe1cc87bd1d5d8a8
Python
5,670
148
import numpy as np from scipy.interpolate import RegularGridInterpolator import nrrd from funcs import utils # import xmltodict def cart2fan(Z, X, Y): """ Perform a coordinate transformation from Cartesian to fanbeam (polar) coordinates. This function takes Cartesian coordinates of points in 3D space and...
14097965095deee9884ff7cc3a6c607ffc0eb52663bcbf985a513298b54cf8c3
Python
5,672
138
""" Calculate the spatial derivative on the time-delays of the wave triggers in each channel. The derivative is calculated using a kernel convolution. """ import argparse from pathlib import Path from warnings import warn import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.interpolate i...
a0ac38b39d5bac6a969e80df5eeb64d2f1589b64658eaec89c11c2ea3ba493c9
Python
5,673
138
""" Calculate the spatial derivative on the time-delays of the wave triggers in each channel. The derivative is calculated using a kernel convolution. """ import argparse from pathlib import Path from warnings import warn import matplotlib.pyplot as plt import numpy as np import pandas as pd from scipy.interpolate ...
263da8fb66ac48825c7e310ebc6514df55055e755b6ebbb46ac31da8e704f4c4
Python
5,675
129
import warnings warnings.filterwarnings("ignore") # import pickle5 as pickle # this is for local run import pickle # this is for sherlock run import matplotlib as mpl from utilityFunctions import * import pandas as pd high_res=True parent_substitutions={ 'Amyg, Amygdala': 'Middle Temporal Gyrus', 'CG, Cingula...
895da5b2dcffad3e45c7552a23aef66406e2a9c69ce6a630d5ae7a5a9c7b0810
Python
5,675
144
"""The MACELES anchor and its two references, model and calculator. Not part of ``--target all``: it needs the optional ``les`` package at the commit ``requirements/les.txt`` pins, and the numbers it writes are a property of that library as much as of this repository. Folding it into ``all`` would mean a regeneration ...
6c17aa7c1e32698c79ec8d1b30f893ca46241971ef842731dd53df2ebe5a8d29
Python
5,676
171
import dataclasses from dataclasses import asdict, dataclass from typing import Any, Optional, Tuple from reinvent_plugins.components.synthsense.endpoints import AnyEndpoint, endpoint_from_dict from ..add_tag import add_tag @add_tag("__parameters") @dataclass class Parameters: number_of_steps: list[Optional[int...
ca022309213b82b7d652b871d420918cdae864568b226311176f037fa7d91132
Python
5,679
188
"""Helper functions and classes for tests """ import functools as ft import itertools as it from collections import UserDict from pathlib import Path from typing import Any, Callable, Dict, Iterable, List, Tuple, TypeVar, Union import pytest from hypothesis import HealthCheck, settings from snakebids import bids fro...
b1ccc69b1e2ab5dd1b3fe3f716667f7fba72e91378bd4d8ce8433940d87da8c5
Python
5,681
170
from typing import TYPE_CHECKING, Optional, Dict, Any, Union from uuid import UUID import json if TYPE_CHECKING: from chromadb.api import ServerAPI # noqa: F401 from chromadb.api.models.Collection import Collection # noqa: F401 class AttachedFunction: """Represents a function attached to a collection."...
a3d9262ba20ef5de60f15b83e42909042cd89dcfa35a7d71ecc1e20500db9938
Python
5,688
210
from Purkinje_morpho_1 import Purkinje_Morpho_1 from neuron import h import multiprocessing from Purkinje_morpho_1_number import number_ind_1 import numpy as np import matplotlib.pyplot as plt Hines = h.CVode() Hines.active(0) spines_on = 1 # switch between 0 (no spines) and 1 (spines) stimdata = dict() stimdata['st...
c6c1682f5a13ec1c8797e7c7ebc276df137ae8443368a9185ebc74e57c2ca8f1
Python
5,689
274
import pytest from reinvent.models.transformer.core.vocabulary import SMILESTokenizer from tests.test_data import SCAFFOLD_TO_DECORATE, WARHEAD_PAIR @pytest.mark.parametrize( "input, expected", [ ( "CC(C)Cc1ccc(cc1)[C@@H](C)C(=O)O", [ "C", "C", ...
867ee60d24250daf5612b817b816a332ffe5aa8fc259441bf391e25199dfbb93
Python
5,690
171
# SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2020-2026, Christian Gaser. See LICENSE. """ The worked examples in docs/permutation.md, actually run. Documentation that is not executed rots, and a worked example that does not work is worse than none at all -- it is a trap for the one reader who trusts it. So ...
c752c497be3ffc0d032e298d8abc19370ea482881c03dbb4ffba3a113b38e71e
Python
5,690
203
import time import multiprocessing as mp from ._recorder import _Recorder from .. import logger from ..gui.streams import redirect_stdout_to_queue class StreamRecorder: """ Class for recording the signals coming from LSL streams. Parameters ---------- record_dir : str The directory wher...
6b4a88b3c55416043116c24ac4f0eeb55ba340d6c673f1afb63c716429ab734d
Python
5,691
180
# -*- 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,...
ac298e928ed31a8c141ec342f95d240b8b6ec3da167ca8ff793cc2ebfce5ca10
Python
5,696
167
# Copyright 2020-2024 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Cryptography CA utilities.""" import datetime import uuid from typing import Tuple from cryptography import x509 from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives import hashes from cryptograp...
d1d6db92cc36e1e7dc3cba0990c641764e4734a0deae377c3b9ebf99b4938596
Python
5,696
209
from sleepy.processing.dataset import Dataset from scipy.io import loadmat, savemat import numpy as np class MatDataset(Dataset): """Implements the :class:`Dataset` interface of getters and setters. The sleepy-properties make use of a decorator that prepares the sleepy structure in mat-file before...
117e4fa890b3227233335d470ce1b86e713812303c48c5f9799414d4fcfec9f6
Python
5,697
193
import numpy as np import matplotlib.pyplot as plt import torch import torch.nn as nn from torch.optim.lr_scheduler import StepLR,MultiStepLR import math import torch.nn.functional as F from torch.utils import data from sklearn.model_selection import train_test_split from torch.utils.data import Dataset from preproces...
b6e4c6f92b969c4c050cc6834432467ea64f31dd157984d0953ef37c276679bd
Python
5,699
153
# 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...
f9fe103fda31c58eebfc681c8a7bd74950c18ef3119b2925e9916e11d83d2321
Python
5,701
176
from typing import Optional, Iterable, Union import torch from bindsnet.network import nodes class SubtractiveResetIFNodes(nodes.Nodes): # language=rst """ Layer of `integrate-and-fire (IF) neurons <https://bit.ly/2EOk6YN>` using reset by subtraction. """ def __init__( self, ...
073903fbffcaebae55270c250f701fa62c7a8c232724e718bb5024a78c624297
Python
5,702
204
import torch import time #heating up the CPU #for i in range(1000): # temp = np.random.rand(10000, 5000)*np.random.rand(10000, 5000)+np.random.rand(10000, 5000) d = 'cuda' t = torch.float64 #for i in range(60): for i in range(1): measurements = [] steps = 1000 #######################################...
0eacde3de1ce5c7568a51835a41874b2511f2accbb197fb1600d4399a608488a
Python
5,702
217
""" Synapse partner assignment via neurotransmitter diffusion simulation """ import argparse from sys import argv import numpy as np import pandas as pd import tifffile as tif from skimage.morphology import dilation, ball from cloudvolume import CloudVolume from utils import load_volume ## Fibonacci spiral model d...
8766dd939809de98e252e095418e8c836dfbd8278c4c78b8136531fbb8e63e0a
Python
5,707
164
"""Tests for the standalone OLS helper `nltools.algorithms.regression.regress`. `regress` is public (re-exported in `nltools.algorithms.__all__`) and tutorial-facing, but its numeric output was previously unverified. These tests pin b/se/t/p/df against an independent reference (`scipy.stats.linregress`) and cover the ...
8cfe48bd724599339ff947c50006d9a1228e58f3c2c33754af9625707d5aa24c
Python
5,711
133
import gc import torch torch.set_num_threads(20) from torch import nn from torch.nn import Module, Parameter from torch_geometric.nn import GATConv class GNNLayer(Module): def __init__(self, in_features, out_features, model_type='GCN'): super(GNNLayer, self).__init__() self.in_featu...
6f79115ca8b2b10c51a7c192d93bc2d18b57fa0c280d023268aaf26b5e12289f
Python
5,712
141
""" Cross-Validation Data Classes ============================= Scikit-learn compatible classes for performing various types of cross-validation """ __all__ = ["KFoldStratified", "set_cv"] __author__ = ["Luke Chang"] __license__ = "MIT" from sklearn.model_selection._split import _BaseKFold from sklearn.utils.valida...
75a4d3c4068ae0f988913dc10b1e590ee814c9f5d846b451dc09f50cd735a6f3
Python
5,713
173
# -*- coding: utf-8 -*- import os import numpy as np import logging, argparse from data_functions import load_data, get_windows import h5py import matplotlib.pyplot as plt from calc_stats_ms import * from mpi4py import MPI import time import configparser import sys def get_feature_vector(mutation_positions, genot...
6dc87b8657a93c049d8bfa9dcd9f88affe3f2358ac4aa257aef0df95073f2c92
Python
5,716
189
from PymoNNto.NetworkCore.Behavior import * import copy class Recorder(Behavior): initialize_last = True visualization_module_outputs = [] def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.variables = {} def initialize(self, parent_obj): self.add_ta...
9c6e1548d1fa0c2325d8a1d2601ce4d556311b3d26554c9bce648401dbfed799
Python
5,716
164
from ... import logger CAP = { 'GTEC_16': ['TRIGGER', 'Fz', 'FC3', 'FC1', 'FCz', 'FC2', 'FC4', 'C3', 'C1', 'Cz', 'C2', 'C4', 'CP3', 'CP1', 'CPz', 'CP2', 'CP4'], 'BIOSEMI_64': ['TRIGGER', 'Fp1', 'AF7', 'AF3', 'F1', 'F3', 'F5', 'F7', 'FT7', 'FC5', 'FC3', 'F...
26a9c1ebf9bfe23d0682f7e3bb642138e55fdb5743dd2ef92454ce041832212e
Python
5,728
203
""" Implementation of functions for Multi Analysis of dFC. Created on Dec 3 2024 @author: Mohammad Torabi """ from copy import deepcopy from joblib import Parallel, delayed from .dfc_methods import * ################################# DATA_LOADER functions ###################################### def create_measure...
4a53868fca80b85b17cc0f25aeb555e73f2d10c47d0dd805a41466a6f3b05834
Python
5,728
193
import random import pytest from geomstats.geometry.poincare_half_space import PoincareHalfSpace from geomstats.information_geometry.normal import ( DiagonalNormalDistributionsRandomVariable, MultivariateNormalDistributionsRandomVariable, NormalDistributions, SharedMeanNormalDistributionsRandomVariabl...
3fad1e3be544d1938174f42ff857de9c004fa8c99dae2fe1308e2fd5401f595e
Python
5,729
167
#!/usr/bin/env python import json import sys from typing import List, Tuple import pandas as pd def check_eddy_s2v( eddy_s2v: bool, slspec_txt: bool, has_slice_timing: bool, json_file: str, ) -> None: """Check if slice-to-volume correction can be performed""" if eddy_s2v and not slspec_txt: ...
8537118ddd3809626b9e595ed065a063dc49023585d14fbfaec853daa060e50a
Python
5,730
131
"""Peptide duplication must not reweight the shared TCREmp geometry.""" from __future__ import annotations import os import subprocess import sys import numpy as np import polars as pl import pytest from vdjdb.motifs import tcremp as TE def test_fit_sample_is_independent_of_process_hash_seed(): code = """ impo...
54c3617afbaccc5a5f0e5d568b38dae7e1f6911b0eb8efb96aa228c734b84283
Python
5,733
124
import numpy as np import torch from torch.utils.data import DataLoader from metric import * from models import * from data import * import argparse import sys import os class Tester(): def __init__(self, smile_list, label_list, conf_tester): self.config = conf_tester self.smile_list = smile_list ...
daa7e42ff5591840aa5fdc3c11c962d518711f3d1e4d1154ef89a93d85ea9786
Python
5,733
212
import pingouin as pg import pandas as pd import numpy as N from scipy import stats as st import statsmodels.api as sm import statsmodels.formula.api as smf def mixedlm(array1, array2): mouse = N.hstack([N.ones(len(array1[d]))*d for d in range(len(array1))]) values1 = N.hstack(array1) values2 = N.hstack(...
5a5d0ef3c16b3e59a63c75d1f873e07261ece3a84c9daba30f61cd1ce00f8762
Python
5,735
189
#!/usr/bin/env python3 import argparse from pathlib import Path import matplotlib.pyplot as plt import pandas as pd import seaborn as sns from helper_functions import ( annotate_medians_single_boxplot, build_experiment_display_info, canon_task, get_default_experiment_name_map, order_by_median_dict,...
cf7d38d47df2608052c6c43947b95f9b4090ea770e21feb882242837922c7012
Python
5,736
171
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.ocl.AFMulator imp...
bdba0b2afa0e4711b2b72df0c5fca4715cd10f6c12e32e73c5bceaa9ef5056c6
Python
5,738
180
from unittest import TestCase import unittest import pytest import numpy as np from smithers.io.openfoam import OpenFoamHandler, FoamMesh openfoam_mesh_path = "tests/test_datasets/openfoam_mesh" openfoam_mesh_binary_path = "tests/test_datasets/openfoam_mesh_binary" notime_openfoam_mesh_path = "tests/test_datasets/noti...
13989f30893bb7b77232e5a3e57a483b36051c9bfa46a9b57d99fc80e60e1545
Python
5,741
162
from abc import ABC import torch import torch.nn as nn import torch.nn.utils.rnn as rnn_utils from scipy.stats import truncnorm # with dropout and bn class MLP(nn.Module, ABC): def __init__(self, input_dim, hidden_dim, output_dim, num_layers=2, dropout=0.1, bn=False): super(MLP, self).__init__() s...
ec41d2f4404aaa13c9c0c923533914f97c6097d672f522adb950e5b90605ed46
Python
5,741
162
"""Load Axon Binary Format recordings.""" from typing import Any import numpy as np import pyabf from pyabf.waveform import EpochTable as PyAbfEpochTable from sanpy.fileloaders.epochTable import epochTable as SanPyEpochTable from sanpy.fileloaders.fileLoader_base import fileLoader_base, recordingModes from sanpy.sa...
d1dac6af534593b8d9f0c9c53c0a4e3e62a991cdd12065193a00576d9a1b3032
Python
5,745
160
"""Regression on Manifolds/Geodesic metric spaces.""" import random from sklearn.base import BaseEstimator import geomstats.backend as gs from geomstats.learning.euclidean import LinearRegression from ._utils import _is_graph_space, _warn_max_iterations class AACRegression(BaseEstimator): r"""Generalized Geod...
6a393d2b08fa9aceadc05ce01e5ea74f154183e7404c0b718bde5e815b089825
Python
5,747
163
# 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 ...