sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
16ae17b5ab5da791d364bd4eb83bdbf0f55ebe304222256bab46102a44142767
Python
2,492
74
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
6acb20ccd30587106ed2a316a87f7d4dc02b89e7a4e9fe574592ee76febea4c9
Python
2,492
67
import numpy as np import scipy.signal def getPowerSpectrum(activity, dt, maxfr=70, spectrum_windowsize=1.0, normalize=False): """Returns a power spectrum using Welch's method. :param activity: One-dimensional timeseries :type activity: np.ndarray :param dt: Simulation time step :type dt: float ...
eb728c9bb82a2110cb9b79613aa2e75d5084b9bf5ccae6b126951b31b216790b
Python
2,492
91
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jan 30 10:37:41 2023 @author: emma code for fitting PCA model to velocity fields of specific brain regions (for disease and bias effects) """ # python imports import os import glob import sys import random import tensorflow as tf import numpy as np ...
238806dca98472bbfc97e75bf6433d80abca1c864e11595bb3ade3c4f5151a9e
Python
2,493
78
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
e7d825cd0fbd9fd4638901f8de43d9401add3ea12bd914db27d44a2ce3d39c4c
Python
2,494
66
# coding=utf-8 # Copyright 2018 The Microsoft Research Asia LayoutLM Team Authors. # # 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 # # Unles...
8e7f0642983167d0f4924eb07829d5058cf3b871d127961558e875b37c7cb17b
Python
2,495
69
from OnlineDetectors.online_nab_detector import OnlineAnomalyDetector import numpy as np class KnncadDetector(OnlineAnomalyDetector): def __init__(self, *args, **kwargs): super(KnncadDetector, self).__init__(*args, **kwargs) self.buf = [] self.training = [] self.calibration = []...
b048e182f632aef0aae2230a2d46a7151d43acf2f62a7c7045a22706e4ed40d8
Python
2,495
77
from collections.abc import Callable from typing import Any, Optional, Protocol import torch from .linear import Linear from .math_operations import Add, MatMul, Mul, Quantize class MathOperations(Quantize, Add, MatMul, Mul, Protocol): ... class LSTMCell(torch.nn.Module): def __init__( self, i...
2bca7ddfe6a8c225c36ebb88b1f1107038c80c508e0c1f12011d46750dae6e95
Python
2,496
77
from unittest import TestCase from unittest.mock import MagicMock, patch import numpy as np import pandas as pd from numpy.testing import assert_equal from tgan.research import evaluation class TestEvaluation(TestCase): def test__proc_data_continous_column(self): """_proc_data adds a dimension in colum...
e05134a1f3263e3fcebf712470d845283389f7785d4c89e882edc71bd8542a14
Python
2,496
93
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
729f535adb96bbfdfdffd1fd8834a3438cff13c5e5994f368f3e49ae1bde39af
Python
2,497
118
#!/usr/bin/env python # coding: utf-8 # ### Threshold CCLE CNV log-ratios into binary gain/loss calls # In[1]: import os import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns import pancancer_evaluation.config as cfg # In[2]: if os.path.isfile(cfg.ccle_cnv_rat...
a98d9891acee446d6f74435e7a49bf01a6a4a34c4b3960d8092bb6fb0d9e55e3
Python
2,497
73
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import pandas as pd from sklearn import preprocessing, metrics import scipy """ evaluation.py provides evaluation functions that takes in predictions and output gene-wise correlation, peak-w...
df57bbc3b975c87b90d2867861207a1d2c5debaa0e8038218b4afa3324f492e4
Python
2,497
83
# Node-group asset "Image ID" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING from...
1e29acb46ba59f94ff704289cc38f2de2b35497d6bb37a25403949e5a8e34527
Python
2,498
74
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
1ec4fe56b6077fe0fc81ee2de1680689ba52a62a71a4a622a5b1010da371dcc6
Python
2,498
79
import numpy as np def gini_index(X, y): """ This function implements the gini index feature selection. Input ---------- X: {numpy array}, shape (n_samples, n_features) input data y: {numpy array}, shape (n_samples,) input class labels Output ---------- gini: {num...
69a66f27b88630d88927a508bead70ccefa6d72129eaa1e142b1d38aca9888dd
Python
2,498
94
#!/usr/bin/env python3 import os import pandas as pd # ------------------------------------------------------------------ # paths # ------------------------------------------------------------------ proj_path = '/project/3011157.03/Simon/proj_2022_CABB_movie' # location of R output files r_path = os.path.join( pr...
99d197f305f00d62419cd8fd3927772157b644eb22b86279f1f2614a5ec8419a
Python
2,498
76
from __future__ import annotations from typing import TYPE_CHECKING import numpy as np if TYPE_CHECKING: import pandas as pd def extractor( data, cell_type, *, condition_key, cell_type_key, ctrl_key, stim_key, ): """Returns a list of `data` files while filtering for a specific `...
b3d2478ee1ce555a126254160ed41d9b00a018b4f04f751aa83473f53f4e62cc
Python
2,498
84
# Node group "Index to Factor" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are regenera...
db36ef20489ef9b7cc641f36b4ee45a76cd514f7fcef24d94d0992acac4dc252
Python
2,498
68
from pykdtree.kdtree import KDTree import numpy as np # input: # pre_points: pre neuron 3d points, shape (npoint, ndim) # post_points: post neuron 3d points, shape (npoint, ndim) # nsyn: synapse number # thresh: distance threshold # output: # pre_id: an array, pre neuron 3d point id where synapse on # post_id: an arra...
0aecf6b52e2a71e5df5aa08bdceb02afa32a4053aeeaa373f496cebbbbfa6f73
Python
2,499
71
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 3 17:31:13 2023 @author: felipe """ #Load KuramotoNetworksPackage repository import sys import os sys.path.append(os.path.abspath('../../')) import analysis.frequency as frequency import analysis.synchronization as synchronization import numpy as ...
603a4c1abc2e93fefff2f6e69a0472bab8507452d428392267d01601ce43e7c6
Python
2,499
99
from typing import Union import matplotlib.pyplot as plt import numpy as np import torch from matplotlib import colors from pylab import cm from .utils import _plot_to_image def plot_3d_tensor(tensor: torch.Tensor, color: Union[colors.Colormap, str] = 'hsv'): r''' Visualize a 3-D matrices...
60f653a6989074418de205a2fb9494c48c23415463bc9dc3ddd3b87d9e1b65e1
Python
2,499
76
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
7bf9ba4195730d74bddb688b8e0ef122d8a40b3ee6dca325c01fd845ac3c34c1
Python
2,499
80
import gc import main_config as conf import online_buffer as obuff from OnlineDetectors.online_nab_detector import OnlineAnomalyDetector from OnlineDetectors.AnDePeD.ReRe import ReRe class ANDEPEDDetector(OnlineAnomalyDetector): def __init__(self, buffer_size: int, algorithm: str, *args, **kwargs): supe...
850cfb4e03ce3a07d454197b48482169302a53b781c712f6883046f71aa8c186
Python
2,499
73
import os import tiffile import h5py import matplotlib.pyplot as plt import numpy as np import cv2 from PIL import Image, ImageOps from tiffile import imsave from skimage.measure import label from skimage.color import label2rgb #output_dir = '/mp/nas3/Margaret_mouse/' def retrieve_output(output_dir): ''' arg...
004e58fc9f5fba034ddafdc51eef934d9b8761aff42c4fef4142c53306ea631b
Python
2,500
80
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import numpy import nest def dict_of_numpyarray_to_dict_of_list(d): ''' Convert dictionary containing numpy arrays to dictionary containing lists ''' for key,value in d.items(): if isinstance(value,dict): # if value == dict ...
08b94d8323e246671a565dddb9e12b109b760e8f6b1abfe0adf6968ed150911d
Python
2,500
61
# Copyright 2019 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://w...
138183b7b45c7707dcf58276f917dea60384d4edf0ea05f52ccfdce0b2f42219
Python
2,500
115
#!/usr/bin/env python2.7 from __future__ import print_function from pddlstream.algorithms.focused import solve_focused from pddlstream.algorithms.incremental import solve_incremental from pddlstream.language.constants import PDDLProblem, Or, print_solution DOMAIN_PDDL = """ (define (domain debug) (:requirements :...
4ef794f31fd936a39765e965c2220ab97f36a45e15658ee198cea903e300a660
Python
2,500
64
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from common_setup import IssueConfig, IssueExperiment, is_test_run BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["issue684-base", "issue684-v1"] CONFIGS = [ IssueConfig( ...
09133906c2c2a55d0633eb9c2c0693c836aec95dad997852c2559e210042701b
Python
2,501
80
# Wrapper class for sesread.WCP and sesread.EDR to be used with Pyclamp # Gary Bhumbra import os import numpy as np from pyclamp.dsp.sesread import WCP, EDR from pyclamp.dsp.channel import chWave class SES (WCP): # WCP inherits from EDR edr = None wcp = None IntData = None ADCData = None def __init__(self...
1b430008897f871eb765355798118a09a2a19c8baaff4bd41809329176d2c40f
Python
2,501
71
""" Created on Tue May 2 17:32:22 2023 @author: trianaa1 This script visualize the FD for all the MRI tasks """ import os import pandas as pd import matplotlib.pyplot as plt ################################ Modify these ################################# path = "/m/cs/scratch/networks-pm/pm_preprocessed" tasks = ['...
4fded502ea3af55a9777305698d5dd21552990cbb33cf1db33bdd991ccc8ae8e
Python
2,501
81
from __future__ import annotations import os import tempfile import time from typing import NoReturn import optuna from optuna.trial import TrialState from optuna_dashboard import ChoiceWidget from optuna_dashboard import register_objective_form_widgets from optuna_dashboard import save_note from optuna_dashboard.art...
6c86e70892afde50581a00929582cc113b6ff8c35d138334718fc3e58fbbf4b7
Python
2,501
99
import torch.nn as nn import torch from bio_attention.attention import TransformerEncoder from bio_attention.embed import ContinuousEmbedding class MLP(nn.Module): def __init__( self, n_inputs=6000, n_outputs=512, layer_dims=[512, 512, 512], layer_or_batchnorm="layer", ...
a264c5f5ab1a027b0ce322d8f78791ffd7604514a6d651d4b335f6d03d726024
Python
2,501
96
import sys from typing import TYPE_CHECKING, Optional, Union from .jupyter import JupyterMixin from .segment import Segment from .style import Style from ._emoji_codes import EMOJI from ._emoji_replace import _emoji_replace if sys.version_info >= (3, 8): from typing import Literal else: from pip._vendor.typin...
aadcbdd6bc77c774815b2fe9a58b77b2245a16215fa1a05d71e4d833c73739b4
Python
2,501
49
import pathlib import os alphaSeedsDir = r'C:\Users\ICN_guest\Charité - Universitätsmedizin Berlin\Interventional Cognitive Neuromodulation - PROJECT ECoG Atlas Connectomics\data\original_data\seeds\alpha_seeds' alphaSmapDir = r'C:\Users\ICN_guest\Charité - Universitätsmedizin Berlin\Interventional Cognitive Neuromodu...
fedac3a61e615a881ddb1b67ec5ebd1c28aa68afee041846f4c2b3f9cfb220fa
Python
2,501
92
""" Run an encoding model of our behavioral dimensions on the BOLD 5000 imagenet data. This script uses fracrional ridge regression for obtaining regularized and more stable dimension tuning maps. """ from os.path import join as pjoin import os import argparse import numpy as np from scipy.stats import zscore from di...
565de3686bb7272a20b4cd43af4d29d739f87afff9ca4f9b9ae49d6034293f28
Python
2,502
125
from wonambi.viz import Viz3 from wonambi.attr import Surf, Channels from .paths import (surf_path, chan_path, VIZ_PATH, ) def test_plot3d_surf(): surf = Surf(surf_path) v = Viz3() v.add_surf(surf) v.save(VIZ_PATH / 'viz3_01_surf.png') ...
f4ba2d904df48b6c70f1cfff1577ae4b6d3358dc2ab49eb7b9c39c6beff6a334
Python
2,502
71
import math import numpy as np import pytest import sympy as sym import smart def test_Parameter_initialization(parameter_kwargs_k3f): """Test that we can initialize k3f SpeciesContainer""" k3f = smart.model_assembly.Parameter(**parameter_kwargs_k3f) assert k3f.name == parameter_kwargs_k3f["name"] a...
1692b2f8f59310e7d353965c3e0600c1801ba5f2362add3226e7609a117b4005
Python
2,503
66
""" Interaction tests for MediaInfoEntity against the simulated Wikibase instance. """ import pytest from wikibaseintegrator import WikibaseIntegrator wbi = WikibaseIntegrator() @pytest.fixture def mediainfo_budapest(wikibase): return wikibase.add_fixture('mediainfo_M75908279') class TestGet: ...
34d99d0fd1c8fb94390550219a7e2502abaf832422bd967b9f45d025d68d0071
Python
2,503
82
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
6e90b0257c81dd2a3cff7daf8ec4ca38324096955dd34a55e4ff515320190745
Python
2,503
104
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
7409ca4b356df21fd221b0edd9aa52d7fa52bf6097d6bab204f46f6f6d761235
Python
2,503
65
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, MaiaEnvironment from common_setup import IssueConfig, IssueExperiment, is_test_run, get_repo_base from relativescatter import RelativeScatterPlotReport BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REPO = g...
b064404e8e488ff9c2186657bef1a199d9a2e27fb66f4323eb448716ec8dd358
Python
2,503
65
import torch.utils.data from torch.utils.data.dataloader import default_collate from batch import BatchSubstructContext, BatchMasking, BatchAE class DataLoaderSubstructContext(torch.utils.data.DataLoader): r"""Data loader which merges data objects from a :class:`torch_geometric.data.dataset` to a mini-batch. ...
49bde025dea1c328cc2c7231d031d104f7564a9cadd152baecd0b8594c6ca0f2
Python
2,504
61
# -*- coding: utf-8 -*- from pinn.models.AC import AC_dipole_model from pinn.models.AC_AD import AC_AD_dipole_model from pinn.models.AC_BC_R import AC_BC_R_dipole_model from pinn.models.AD import AD_dipole_model from pinn.models.AD_BC_R import AD_BC_R_dipole_model from pinn.models.AD_OS import AD_OS_dipole_model from ...
577eb599de09af8c02de5529b1c4c041ca9e17f2f27d95d3c501e1d923b6f081
Python
2,504
73
import torch from .combined_scheduler import CombinedScheduler from .components import ( ConstantScheduler, CosineScheduler, ExponentialScheduler, LinearScheduler, ) from .multistep_scheduler import MultistepScheduler from .sgdr import SGDRScheduler def _create_warmup(config, warmup_steps): warmu...
a6db532b5552f2232272f0c9330f4b0fea26b4239b63ce0a6fbea55dbe3b92a7
Python
2,504
99
# Node-group asset "OKLab Offset LCh" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECK...
6ffa8fd83451b319c3b597dc03a4f7b64e6cdde5d66b75397d3f4327f45425b0
Python
2,505
70
import scipy.stats import autograd.numpy as np from autograd.extend import defvjp, primitive from autograd.numpy.numpy_vjps import unbroadcast_f pdf = primitive(scipy.stats.multivariate_normal.pdf) logpdf = primitive(scipy.stats.multivariate_normal.logpdf) entropy = primitive(scipy.stats.multivariate_normal.entropy) ...
8bf217950c5bfd127f94ec16ab756b8fb09440922311b41d74158ab121d52119
Python
2,505
41
# -*- coding: utf-8 -*- import argparse from supar import TetraTaggingConstituencyParser from supar.cmds.run import init def main(): parser = argparse.ArgumentParser(description='Create Tetra-tagging Constituency Parser.') parser.set_defaults(Parser=TetraTaggingConstituencyParser) parser.add_argument('-...
ca9b2e08db566d67fdd6edbb58ffbbcac0fb2e833a0fc0fd23b80f9643f72ef8
Python
2,505
72
import matplotlib matplotlib.use("Agg") import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") import yaml, io with open("./config/DryBean_config.yaml", 'r') as stream: config= yaml.safe_load(stream) config["default_path"]= str(config["default_path"]) config["split"]= float(config...
e731b5702ee6e1c6a3c9f6ef93ae6f15ecea295e429711acb3233215c9aca6ec
Python
2,506
73
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 31 14:10:27 2023 @author: felipe """ import numpy as np import matplotlib.pyplot as plt #Load pre-calculated metrics file=np.load('sd_T_matrix.npz') var_tensor=file['var_tensor'] var_vector=file['var_vector'] sq_var_tensor=file['sq_var_tensor'] s...
a374fba2ced3b4ad205e4ab69323dd316aefab338442cc7cdd74d2f59757e243
Python
2,507
61
"""A 2D custom annotation must be halved to match a halved 2D template. Regression for the tilt-slice / custom-2D-atlas path: `_load_and_orient_2d` halves the 2D template by `half_mode` but historically left the paired 2D annotation full-size, so a non-'whole' half_mode silently skipped region counting (grid mism...
b9497f6d6b6af9f85a0c404c3930c179a395d61dd71edf5c928596f46429225a
Python
2,507
67
# Script to actually run CCA on the data # Using the meet package https://github.com/neurophysics/meet.git to run the CCA import numpy as np from meet import spatfilt import pandas as pd def run_CCA_restingstate(window_times, epochs): # Crop the epochs window = epochs.time_as_index(window_times) epo_cc...
a20db3d50e53e6e7817a90e93badc867733bd3c4e1939e43c220c1b1787fef3a
Python
2,508
75
import os import numpy as np import deepdish import argparse import scipy.io as sio import torch from torch_geometric.data import InMemoryDataset,Data from os.path import join, isfile from os import listdir import numpy as np import os.path as osp from networkx.convert_matrix import from_numpy_matrix import networkx as...
f5f4cb00f080c079815dd46feca654d7de234a036b45be96c7b448a0182a78a6
Python
2,508
89
# coding: utf-8 """Functions for reporting filesizes. Borrowed from https://github.com/PyFilesystem/pyfilesystem2 The functions declared in this module should cover the different use cases needed to generate a string representation of a file size using several different units. Since there are many standards regarding ...
15bee27a6f97fc3c2c33ce73a5b8fbe65b36b7c6af9e91e2dd1a240c99ea4194
Python
2,509
66
# coding: utf-8 import pandas as pd roc = pd.read_csv('../data/roc_data.csv') roc.head() roc[fpr >=0.9] mask = roc.loc[:,['fpr']] >= 0.9 roc[mask] roc.loc[mask,:] mask[0:5] roc.loc[mask, [:]] roc.loc[mask, :] a = roc.loc[mask,:] a.head() roc.head() mask = roc.loc[:,['fpr']] >= 0.9 roc.shape roc.loc[mask, :].shape ...
27b3cbc253c986cb8f625e4b64a3a2a03ba33078aa1668123c4b8b917f4cec0f
Python
2,509
85
import os import csv import pandas as pd from typing import Dict class MetaInfoIO: r''' Use with torcheeg.io.EEGSignalIO to store description information for EEG signals in the form of a table, so that the user can still analyze, insert, delete and modify the corresponding information after the generation i...
9d1b72f832da23117ccf3fbfa5abfd4b1199e4a7577436ca56a8fc5c869e0487
Python
2,509
89
# pylint: disable=invalid-name, missing-function-docstring, no-member """ MeanLSTM model module """ from random import uniform, randint import torch from torch import nn from omegaconf import OmegaConf, DictConfig def get_model(cfg: DictConfig, model_cfg: DictConfig): return MeanLSTM(model_cfg) def default_HP...
c7533b67e84b2abc05cf05c5416eb1902d382e0d30d383466f23685edc3df59c
Python
2,509
74
import nibabel as nib import numpy as np from ref_tumor_seg import calculate_distance_map ''' Regions of Interests: 2 & 41: Left and Right Cerebral White Matter 16: Pons 10 & 49: Left and Right Thalamus ''' def region_selection(subject): tumor_MRI_hd = nib.load(subject.volume_MRI) tum_flair = np.rint(tumor_...
5cca4f569d532d6b98d52841480aac50cca914b7570487eaef852789c049bee3
Python
2,510
88
# Node-group asset "Bond Count" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated from it on the next dump. from typing import TYPE_CHECKING fr...
66561d06661f0d35f82163b9d75b407f2b33a835b71715cc01633fdf8d5222a3
Python
2,510
83
"""EK 5-point velocity tests.""" from __future__ import annotations import numpy as np import pytest from msfeature.velocity import ek_velocity, ek_velocity_2d def test_constant_position_zero_velocity(): v = ek_velocity(np.full(20, 3.14), dt=1e-3) assert np.all(v[2:-2] == 0.0) assert np.all(np.isnan(v[...
208fd642a5d6844b2e9efc92fab1c650e1d170a5b1386d0cf8cc3fa2d4c1ddf8
Python
2,511
63
from ..region_1020 import (FRONTAL_REGION_LIST, GENERAL_REGION_LIST, HEMISPHERE_REGION_LIST) from ..standard_1005 import STANDARD_1005_CHANNEL_LOCATION_DICT from ..utils import (format_adj_matrix_from_adj_list, format_adj_matrix_from_standard, format_...
44fc20272625447e79cb01f34447498777245cf61096ef10512d39f41a0982d6
Python
2,512
45
import scanpy as sc import pandas as pd import matplotlib.pyplot as plt # Data reading input_file = "Dementia/Dementia_processed.h5ad" adata = sc.read_h5ad(input_file) # Add APOE contribution adata.obs['APOEContr'] = 0.0 adata.obs['APOC1ContrDementia'] = 0.0 adata.obs['SPP1ContrDementia'] = 0.0 adata.obs['MCC'] = 0...
c54ad3eec6732b36780f57c77f49ca1a4cb38199a335f3bce3a1fb1fd421a0f1
Python
2,513
99
""" Inferring a function from a reproducing kernel Hilbert space (RKHS) by taking gradients of eval with respect to the function-valued argument """ from itertools import chain import autograd.numpy as np import autograd.numpy.random as npr from autograd import grad from autograd.extend import Box, VSpace, defvjp, pr...
69e96bb497de4a3f0acac4923610922cc3c30e97fd93ffc502dbfd97fb61dfd1
Python
2,516
57
''' Description: Utility functions for figure plotting. Author: Jiaqi Zhang <jiaqi_zhang2@brown.edu> ''' import numpy as np from umap import UMAP from sklearn.decomposition import PCA # ====================================== def computeVisEmbedding(true_data, model_pred_data, embed_name): if embed_name =...
b8b8cf085816f8fa742608fd50be9be3f793753568f821cd954096225187f7b2
Python
2,516
69
""" Calculate the rates of phrases, syllables, words and phones for each stimulus. """ import numpy as np import pandas as pd import textgrid from pathlib import Path from helpers import load_config from scipy.io import wavfile if __name__ == '__main__': config = load_config('speech_config.yaml') # Create ou...
22881834163bb66b1c7e6a98ab82c75d18c680ecbbfd176d2fc099a30be366e4
Python
2,517
79
# # MIT License # # Copyright (c) 2022 GT4SD team # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge,...
439f6131caae0fee5315daff22c6378578492fbe26ad4cbd0efd30875c02f435
Python
2,517
74
# from scripts import * import argparse from deepsramp.inference import inference_warpper parse_dict = { # 'preprocess': { # 'help': 'prepropcess the data', # 'func': preprocess_data, # '--gtf': 'the path of GTF file', # '--fasta': 'the path of the chromosome-level FASTA file that a...
9b01057c69f371e29ffdc70f756de9900a207ffb8ac4a995133bc5fd23f704fb
Python
2,517
70
#!/usr/bin/env python from __future__ import print_function import argparse from examples.continuous_tamp.primitives import get_pose_gen, distance_fn, inverse_kin, \ get_region_test, plan_motion, MOVE_COST from examples.continuous_tamp.run import display_plan, initialize, create_problem, dump_pddlstream from exa...
8edf98d398ec23b6d62a8b7da5d137d14e4db4c9e7ea233591fc0851771c01f5
Python
2,518
98
#!/usr/bin/env python import pickle import numpy as np import syncopy as spy import matplotlib.pyplot as plt plt.rcParams['pdf.fonttype'] = 42 # Parameters saveFig = 1 # 0:not savefigs 1: save figs freq_range = [15, 90] # frequency range fs = 1250 # sampling rate areas = { "V1L": ['V...
32d6a75087b99aecad6794c6ae0cdf006fe74af9542699874881a0e5229dc25d
Python
2,519
79
#!/usr/bin/env python import sys import re from datetime import datetime,timedelta import argparse parser = argparse.ArgumentParser(description='summary iostat log.') parser.add_argument('log_file') parser.add_argument('-s', '--start_time', help='start of effective time') parser.add_argument('-e', '--end_time', help=...
6b2291d404e30214490db49e6fcd427c2624981a9250dd4cc71e7bb13e8cfb2c
Python
2,519
63
# import numpy as np # # from imutils import rotate_bound # from skimage import transform # from scipy.ndimage.interpolation import map_coordinates # from scipy.ndimage.filters import gaussian_filter # # # from constants import CANVAS_SIZE # # # def elastic_transform(image, alpha=0, sigma=0, random_state=None): # "...
c4c78e0ad63901071ccc8beb03c2768388028f464c3d0ce1af39eebabee59907
Python
2,519
114
from collections.abc import Callable import torch.nn as nn handlers: list[Callable[[nn.Module], dict]] = [] def _register(fn): handlers.append(fn) return fn @_register def conv1d(module: nn.Conv1d) -> dict: return { "in_channels": module.in_channels, "out_channels": module.out_channels...
0c9a4c623c5e60a29077035c30bdbf174bed021faa9ca4d87be0a94f141efb88
Python
2,520
80
from typing import FrozenSet, Optional, Set from pip._vendor.packaging.utils import canonicalize_name from pip._internal.exceptions import CommandError class FormatControl: """Helper for managing formats from which a package can be installed.""" __slots__ = ["no_binary", "only_binary"] def __init__( ...
7ea21eae60277f2f29041b6f0adc8fa2a3db7c06bb5d39dcc3349efa1826a2bb
Python
2,520
58
import pysam import argparse #chromosomal locations of gene in different annotations #currently, Ensembl human annotation... gapdh_location = {'grch37': ("12", 6643093, 6647481, '+'), 'grch38': ("12", 6533927, 6538374, '+'), 'hg19': ("chr12", 6643585, 6647537, '+'),} def main(sam, genome): """Finds the st...
905c44f78d9b0b5ddb3ae6189d7b0eab4068a8008f968a061baf50ea1657cf0f
Python
2,520
65
import sys, os import numpy as np import pandas as pd import pickle from scipy.io import loadmat, savemat import concurrent.futures sys.path.append('/m/cs/scratch/networks-pm/effects_externalfactors_on_functionalconnectivity/src/analysis') from utils import get_behav_data_15days #####################################...
412278d5912ee07fc35701c7291098245b9bfaac7bd3a7c6adc5ce68b233095a
Python
2,521
65
import os import argparse def generate_slurm_script(input_dir, output_dir, output_filename): # Ensure output directory exists os.makedirs(output_dir, exist_ok=True) # Find all .bam files in the input directory bam_files = sorted([f for f in os.listdir(input_dir) if f.endswith('.bam')]) # Generate...
607c42ddedd42b5ab1c01f509917c924214031614a4821e9c60681f604452fc9
Python
2,521
83
#! /usr/bin/env python # Time-stamp: <2021-03-23 22:02:10 christophe@pallier.org> # License: Creative Commons Attribution-ShareAlike CC BY-SA """ Implementation of Posner endogeneous attention cueing task (see https://en.wikipedia.org/wiki/Posner_cueing_task) """ import random import numpy as np from expyriment impor...
6e71fb1af2403b55e0729a4a23ab6f0f06808a6856bf1b5e0e51bb708752ab04
Python
2,521
60
"""Re-order the smartphone files and name it following the pre-established criteria This script will unify the different measurements splitted in several files into one dataframe that includes all days. The dataframe is stored as a csv file. The input should be done in the following order: ...
f6cad62a5731d772cb04c545017fbb4e8833492a2c6677728ecf99f00d4d092e
Python
2,521
80
# -*- coding: utf-8 -*- """ Created on Fri Apr 30 19:41:08 2021 @author: divyoj """ import matplotlib.pyplot as plt import matplotlib.animation as animation from matplotlib.animation import FuncAnimation import numpy as np import seaborn as sns sns.set_style("ticks") start=100; stop=100; step=10 def plots_at_rho(aL...
091f3dc622566d3ac6da2106475a907e21640ae1b5eaaa69b6d488b122a6ef30
Python
2,522
55
#!/usr/bin/env python ## this script visualizes the results of the anova movie comparison of the ISC values ## it reads in the results of the anova and visualizes the results on a glass brain ## it also writes the results to nifti files (if needed) ## import libraries import os import pandas as pd import matplotlib.py...
2df57668fe5e450e10c619cd518e4d152f3b6c084018f7a8eb7f43b06a7f1cc8
Python
2,522
78
rest_api_version = 99 extensions = dict( required_params=['training_frame', 'x'], validate_required_params="", set_required_params=""" parms$training_frame <- training_frame if(!missing(x)) parms$ignored_columns <- .verify_datacols(training_frame, x)$cols_ignore """, with_model=""" model@model$aggreg...
5626a1e999f923062ba7728096cf38ef66946d74bd88d7269d187264dda8d9a2
Python
2,522
89
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
88a3edd903df2926984302f35d688121bcf68870eb51d73ee46942858bd447cb
Python
2,522
75
# coding=utf-8 # Copyright 2026 The Google Research Authors. # # 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 applicab...
95d636a2eb5464d64849fb1eb70b064989d526998a1120470966785a972c38c4
Python
2,522
82
"""""" """ Prosper_nn provides implementations for specialized time series forecasting neural networks and related utility functions. Copyright (C) 2022 Nico Beck, Julia Schemm, Henning Frechen, Jacob Fidorra, Denni Schmidt, Sai Kiran Srivatsav Gollapalli This file is part of Propser_nn. Propser_nn is free softw...
fb4f85f290b6d613e918b1e06a61352b80153fe6165c99f96a6ce74a9a8f8784
Python
2,522
75
# Node group ".MN_constants_atom_name_peptide" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and access...
4055d3a69473c230b21f29b0e179f5a35434cb392957a94ab78cd82c0fac8c61
Python
2,523
77
import argparse from pathlib import Path import multiprocessing as mp import cv2 import pandas as pd def is_bg(crop, box, acc): x1, y1, x2, y2 = box return (x2 - x1) * (y2 - y1) > 5000 or (acc < .5 and crop.std() < 30) def filtered(args): image_dir, annot_dir, output_dir, bg_dir = args print(f...
7f517e74a2672d865a899aed48571407d2773ac0cc4a3c049d6a405611f6c15f
Python
2,523
72
from collections import OrderedDict from dictor import dictor import copy from srunner.scenarioconfigs.route_scenario_configuration import RouteScenarioConfiguration from leaderboard.utils.route_parser import RouteParser from leaderboard.utils.checkpoint_tools import fetch_dict, create_default_json_msg, save_dict ...
bf4d298fb37a5cb8caa534a5322245dfff832eaab3dc07b0176df8062918e963
Python
2,523
78
import numpy as np import os from wsilearn.compress.encoders import PytorchEncoderWrapper from pathlib import Path histossl_enc_pathes = [ "~/.cache/torch/hub/checkpoints/histossl_tenpercent_resnet18_state_dict.ckpt", "~/.torch/models/histossl_tenpercent_resnet18_state_dict.ckpt...
7af42d7356ec9b77678d51800f394123100525a8910dcbeafab9f8be4ebba5ba
Python
2,524
106
from __future__ import annotations import pytest prefect = pytest.importorskip("prefect") from ase.build import bulk, molecule from quacc import flow from quacc.recipes.emt.core import relax_job, static_job from quacc.recipes.emt.slabs import bulk_to_slabs_flow def test_tutorial1a(tmp_path, monkeypatch): monke...
9af3e4ec53638c82ca44b21d33147b22f275ba080b802b33a3e2fdae37e98b43
Python
2,524
80
"""PEP 656 support. This module implements logic to detect if the currently running Python is linked against musl, and what musl version is used. """ import functools import re import subprocess import sys from typing import Iterator, NamedTuple, Optional from ._elffile import ELFFile class _MuslVersion(NamedTuple...
a188740a07d84808398854b7c8ddde2957671615bb499ab8c888c586022ccf6a
Python
2,524
65
# Imports from tqdm import tqdm import numpy as np import torch import matplotlib.pyplot as plt import sys sys.path.append("/data/MEAprojects/DLSpikeSorter/src") from model import ModelSpikeSorter from meta import SI_MOUSE RECORDING = np.load(SI_MOUSE[2] / "traces.npy", mmap_mode="r") SAMP_FREQ = 30 MODEL = ModelSp...
591dcdfeb5a4c4f26c836287a68bb5a75548e1791125ea375cbadd3d9ed41c36
Python
2,525
85
# Plots neuron positions for Fig 3B from os.path import join from get_paths import * import matplotlib.pyplot as plt from colors_paultol import colors import pickle plt.rcParams["mathtext.default"] = "regular" save_flag = 0 # Load data fpath = join(dir_data, "data_network_locations.pickle") with open(...
5e250ff70c7c7f0a1fca82d939fd139ef1ba4c7f49a4bb3486babae908439e38
Python
2,527
86
# # Main package initializer # # Copyright © 2020-2025 Ernst Strüngmann Institute (ESI) for Neuroscience # in Cooperation with Max Planck Society # Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society # # SPDX-License-Identifier: BSD-3-Clause # # Don't spam GIL warnings about msgpack not being t...
c9f28b6418f21f443cd72e36d3cd3e567d9592650e22afd3082b3d57a09df8d4
Python
2,527
87
# pylint: disable=invalid-name, missing-function-docstring, no-member """ Transformer model module """ from random import uniform, randint from torch import nn from omegaconf import OmegaConf, DictConfig def get_model(cfg: DictConfig, model_cfg: DictConfig): return Transformer(model_cfg) def default_HPs(cfg: ...
6bdc1066a948b7f323e3e15c03cff0fa5aa25295b7011db6fc07a79ca0328e9e
Python
2,528
65
import numpy as np import pandas as pd import pytest import scanpy as sc import scipy.sparse as sp from anndata import AnnData import pertpy as pt @pytest.fixture def adata(rng): labels = np.array(["control", "target1", "target2"]).repeat(30) centers = {"control": 0.0, "target1": 5.0, "target2": -5.0} X ...
b46663ef8acb12350e62c3ca103c0fdc9f947731de42af03281400fe340970c2
Python
2,528
55
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # ht...
9ddcb8098f372d7e0d051c32eda908f10055fc6e6fa2790ed8a1ff6b969fe713
Python
2,529
80
#!/usr/bin/env python # Written by Minh Nguyen and CBIG under MIT license: # https://github.com/ThomasYeoLab/CBIG/blob/master/LICENSE.md from __future__ import print_function, division import argparse import pickle import cbig.Nguyen2020.dataloader as dataloader import cbig.Nguyen2020.misc as misc def get_data(args,...
6d27ba82ef448a945f862e77275928aacb3ab63e86313dc9d679f15ec94c08e7
Python
2,530
64
# -*- coding: utf-8 -*- """ANI-1, A data set of 20 million calculated off-equilibrium conformations for organic molecules. (https://doi.org/10.6084/m9.figshare.c.3846712.v1) Please cite the original paper when using this dataset. The dataset is splitted by molecules while loading, meaninig the same molecule shows up...
7766397eff05ef219b404e8e104d6e2764a7e1bb1f7bc6d78e0fe4cd5ca17426
Python
2,530
53
"""Taken from the libsonata lib.""" import h5py import numpy as np def write_element_report(filepath, units): population_names = ["default", "default2"] node_ids = np.arange(0, 3) index_pointers = np.arange(0, 4) element_ids = np.zeros(3) times = (0.0, 1.0, 0.1) data = [node_ids + j * 0.1 for...
78e05992763ea1f66f499e14b32db3b2cbff21266b5bb150dbf1e0d95fda42fa
Python
2,531
67
################################################################################ # Import, Set up MPI Variables, Load Necessary Files ################################################################################ import os from os.path import join import sys import matplotlib import matplotlib.pyplot as plt from matp...
bbb460f4ddbd329fed836dd98910550cf76dbe628008ba012e3b2667f27755c2
Python
2,531
100
# %% Package Imports import sys, os sys.path.append(os.path.abspath("..")) sys.path.append(os.path.abspath(".")) import torch import torch.nn as nn import torch.optim as optim import prosper_nn.models.dhcnn as dhcnn import prosper_nn.models.ensemble as ensemble from prosper_nn.utils import visualize_forecasts impor...
e9cb635c018ed885db045646659f45033d25b9348b27021801b74fba0edc6b94
Python
2,531
105
from __future__ import annotations import csv from pathlib import Path from ..metadata.config import NomenclatureConfig from ..metadata.files import NomenclatureScan def save_nomenclature_csv( output_dir: str | Path, scan: NomenclatureScan, config: NomenclatureConfig, ) -> Path: """ Save the c...