sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
10c2de744ce76578eea299bf2ca10808dd43c1c01529144d4d64fc7e0c48fe2c
Python
6,648
129
"""Project the motif tables into the two files ``vdjdb-web`` parses. ⚠ Both files are parsed positionally. ``app/backend/server/motifs/Motifs.scala`` hands Tablesaw a fixed ``Array[ColumnType]`` with no header check -- 27 entries for ``motif_pwms.txt``, 19 for ``cluster_members.txt``. An inserted, removed or reordered...
1e907699f0b5362cbbd6ee71d4dc4cdaa308f1da1b6abd8f3ce9b2c8965150fb
Python
6,648
221
import os import sys from pathlib import Path import sanpy from sanpy.interface.sanpy_window import SanPyWindow from sanpy.sanpyLogger import get_logger logger = get_logger(__name__) TEST_DATA_DIR = Path(__file__).resolve().parents[1] / "data" # @pytest.fixture # def sanpyAppObject(qtbot): # return SanPyWindow()...
e543432944eb8de5168bf0dcf10e44d213265cc9c2521ab013d9388cdf5c4394
Python
6,649
198
from PymoNNto.NetworkCore.Base_Attachable_Modules import * import copy class SynapseGroup(NetworkObjectBase): def __init__(self, net, src, dst, tag=None, behavior={}): if type(src) is str: s=src src = net[src, 0] if src is None: print(s, 'src not found...
8c9c8ecdf87731af222a19ad17d15ff144982eb8b9e8b4f8aaac41da266d189f
Python
6,654
177
from warnings import warn from functools import partial from tqdm import tqdm import torch import numpy as np from torch.optim import Adam from torch.nn import MSELoss from odl.contrib.torch import OperatorModule from dival.reconstructors import IterativeReconstructor from dival.reconstructors.networks.unet import U...
f407a98f00ff5244eda324a46a281aeb85b0a1ae74d1153a66ae503763f2008d
Python
6,654
209
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...
9058c5a71353b7f471c38cdf17a0264679552e9ffbe55f272577593fbc1fdb82
Python
6,655
193
import torch import torch.utils.data import torchvision import CustomDataset import pdb from typing import Iterator, List, Optional, Union from collections import Counter import logging from operator import itemgetter import random import numpy as np from torch.utils.data import DistributedSampler from torch.utils.dat...
8ab29c3ce99d394190c41ac499a7dd6afa4c0effe81211e1095c42472d888d8e
Python
6,667
187
""" A data logger for logging experiment events. Author: Tal Eisenberg, 2021 """ import multiprocessing as mp import functools import threading import mqtt import time import json import managed_state from data_log import DataLogger from json_convert import json_convert class EventDataLogger(DataLogger): """ ...
4bee6488a619d6d18111aa0e81cda0735213c83a98e43513015280c9fa1caf94
Python
6,669
167
"""Reshape deposited ITRAP counts into the committed caller. No cutoff grid.""" from __future__ import annotations import gzip import importlib.util from pathlib import Path import polars as pl import pytest _SCRIPT = Path(__file__).resolve().parents[1] / "processing" / "itrap_reprocess.py" _spec = importlib.util.s...
c8ba77658b80e360c19fadfe6ff4e87f26c5c1b628ae18b30a2782cf158e9144
Python
6,669
188
""" A data logger for logging experiment events. Author: Tal Eisenberg, 2021 """ import multiprocessing as mp import functools import threading import mqtt import time import json import managed_state from data_log import DataLogger from json_convert import json_convert class EventDataLogger(DataLogger): """ ...
2f4808a916920dc8200828f610475ec007af0aa45989c3fce55ceff9a95d92ed
Python
6,670
191
import pickle from pathlib import Path import matplotlib.font_manager as fm import matplotlib.pyplot as plt import numpy as np from matplotlib.offsetbox import AnchoredText from mpl_toolkits.axes_grid1.anchored_artists import AnchoredSizeBar from ScanImageTiffReader import ScanImageTiffReader from skimage import expos...
97b4374b6fc4695831d1c3a5a3d1c194dc7d7fb3ab44940937d70b41f9f2eb13
Python
6,672
169
"""The publication-year resolvers, with the network stubbed. `summary/references.py` was 57 % covered: the offline resolvers had tests, the three that call an API did not, so nothing checked that a PubMed, RCSB or GitHub payload is read correctly. The dashboard stops rather than plotting an incomplete year axis, so a ...
0bb1fdf00705d0d37e556ec4fd0983106f990a72bc671d036bcd0463dc2bc83f
Python
6,677
158
import numpy as np from sklearn.linear_model import LinearRegression from sklearn.metrics import mean_squared_error sam_size = 2048 sam_size_test = 2048 X_train = - np.pi + np.multiply((np.pi + np.pi),np.random.rand(sam_size,1)) X_test = - np.pi + np.multiply((np.pi + np.pi),np.random.rand(sam_size_test,1)) y_train =...
367c94b875de336299d5d47c048385c71c8de5e1c20ce01b2f383d155ae81d88
Python
6,677
186
from PymoNNto.NetworkCore.Base_Tagable_Object import * from PymoNNto.Exploration.Evolution.Interface_Functions import * class Behavior(TaggableObjectBase): initialize_on_init = False initialize_last = False attached_UI_Tabs = [] def initialize(self, neurons): return def iteration(self...
1ca9aeeac57ec1fd092151ba969d720c3c2b2d115b90f2f5bf265d3f897463eb
Python
6,679
175
import argparse from math import ceil from typing import Optional, Sequence import pytorch_lightning as pl import torch from pytorch_lightning.callbacks import LearningRateMonitor, ModelCheckpoint from torch.utils.data import DataLoader, ConcatDataset from data.dataset import GanBrats, GanBratsFromFolder, MrSliceDatas...
d099412c3eb9f7c04ca6b8350a0ad6e1b0f315236a49010aac592f9b17e40ffc
Python
6,679
186
"""Affine-based template matching and background-image selection.""" import warnings from dataclasses import dataclass import numpy as np from nibabel.affines import voxel_sizes from nltools.utils import ResamplingWarning, _find_stack_level from .config import get_brainspace from .paths import _resolve_paths from ....
dc418777b02ce907aab276090e9be45e54725bdeb0624775eb3ed11114979e10
Python
6,679
172
""" Create frames showing the input data on the spatial grid for each time step. """ import os import sys import argparse from pathlib import Path import matplotlib.pyplot as plt import numpy as np from utils.io_utils import load_neo, save_plot from utils.neo_utils import analogsignal_to_imagesequence from utils.parse...
e50bb7c4a9e5bee1d45dc50982b017ac02cced8e6455dd96ac62ba7029f6c81d
Python
6,680
147
"""Coordinate conversions. The only module that may do this. Four coordinate spaces meet in this codebase and three of them disagree with AIRR on two axes at once (origin and closedness), so an ad-hoc `+1` in a call site is indistinguishable from a correct one until a motif is plotted two residues off: ==============...
84d450e0666da1c09f86fec5d6e1aae62e86588fb05c12607627f46fb1607646
Python
6,686
173
""" Create frames showing the input data on the spatial grid for each time step. """ import os import sys import argparse from pathlib import Path import matplotlib.pyplot as plt import numpy as np from utils.io_utils import load_neo, save_plot from utils.neo_utils import analogsignal_to_imagesequence from utils.parse...
a0beeab98f27eea46e97fa59a3dabf646f51aee5388117cb6d7f49077b27d274
Python
6,691
209
""" Task scheduling of dynamically loaded task functions. Author: Tal Eisenberg, 2021 The config module attribute `tasks_modules_dir` determines where tasks will be loaded from. Any non-private function (which does not start with an underscode _) that is defined in a module inside this directory will be added to the t...
ea0a5e72e7961604e344cb43e9a873442893049aedf07c0d29cf34a4424cb1cd
Python
6,693
126
""" Adjacency Class =============== Nltools has an additional data structure class for working with two-dimensional square matrices. This can be helpful when working with similarity/distance matrices or directed or undirected graphs. Similar to the Brain_Data class, matrices are vectorized and can store multiple matri...
a846bcb51a820239495cdb47b54536031624315a053945cf5a700150eb5d340a
Python
6,695
186
# 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 logging from pathlib import Path from argparse import Namespace from fairseq.data import Dictionary, encoders from fairseq.data.audio....
da37ce4a00aa46cac0c33353d70a7d5718fbd11cdcbf0f11cfb3394f6e451b30
Python
6,696
234
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # # QMCTorch documentation build configuration file, created by # sphinx-quickstart on Wed Apr 22 17:16:01 2020. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # a...
88d77aef65e303196e9509089a85a332e17185702ba5af7907da82ec1c7d85d9
Python
6,699
182
import torch import torch.nn as nn import numpy as np def get_unet_model(in_ch=1, out_ch=1, scales=5, skip=4, channels=(32, 32, 64, 64, 128, 128), use_sigmoid=True, use_norm=True): assert (1 <= scales <= 6) skip_channels = [skip] * (scales) return UNet(in_ch=in_ch, ou...
e17da6a84ded29b4514898575121094918f813dae59224d4fd98ed810ae9f361
Python
6,700
196
# -*- coding: utf-8 -*- # /usr/bin/env python3 # # This software and supporting documentation are distributed by # Institut Federatif de Recherche 49 # CEA/NeuroSpin, Batiment 145, # 91191 Gif-sur-Yvette cedex # France # # This software is governed by the CeCILL license version 2 under # French law...
9be841e76c943e748a58d73479170dfc76c7495132b65a079f893f45f1529c7c
Python
6,701
162
# Copyright 2020-2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 """Notebook Tools module.""" import shutil from importlib import import_module from pathlib import Path from shutil import copytree from typing import Any, Dict, Tuple from openfl.experimental.workflow.federated.plan import Plan from openf...
452b2d194c4de24464107330897307557567526c0dd49bab5038b7e0f6fae3c8
Python
6,704
202
import math import numpy as np import torch import torch_geometric from torch_cluster import radius_graph from torch_scatter import scatter from utils import get_iso_permuted_dataset from utils import get_scalar_density_comparisons from e3nn.nn.models.gate_points_2101 import Network from e3nn import o3 import wandb imp...
c1a7539f837aaff36e2588acc068184adbef5a14d97fd140bf711e97cc89bf51
Python
6,707
186
"""Four flags whose effect is visible in the model or in the resolved arguments. All four are MERGE rows in the inventory: they survive the rewrite in some other form, and a MERGE promises the same behaviour under a different name, so today's behaviour is what the merge gets judged against. `--use_last_readout_only` ...
b12d1d35ae23e07f79eaf22a54e8136e681309e1218823f96e2f1c592af01fa9
Python
6,711
250
from pylab import * import scipy.stats as st import torch from torch import optim from matplotlib import animation, rc from tqdm import tqdm rc('animation', html='html5') set_printoptions(precision=4) def run_multiple(xs, ny = 9, eta_adam = 0.02, w0 = None, mb = 100, nt = 100000, rule = 'bcm', hyk ...
03a24ab148cc86f62b321764e02ef201ec840e2a61342dc2ddebbf7745311fdd
Python
6,712
202
"""Tests for file-table column visibility.""" import shutil from pathlib import Path from typing import Any from unittest.mock import Mock import pandas as pd import pytest from PyQt5 import QtWidgets import sanpy from sanpy.interface.bFileTable import pandasModel from sanpy.interface.bTableView import ( DEFAULT...
736b2c8a9cfe3ef586d91a429402e02bef1c715b9eaf361553c270e49880231c
Python
6,712
185
''' Module focused on the implementation of the Polunomial Chaos Expansion Layer (PCE). ''' import torch import torch.nn as nn import scipy.misc from sklearn.linear_model import LinearRegression import numpy as np class PCEModel(nn.Module): ''' Class that handles the implementation of the PCE layer as given ...
b1620793515711ff265badb95ccf8681c4b38b6fcc1b682ec7a54d651a49aec5
Python
6,713
166
# allowable multiple choice node and edge features allowable_features = { 'possible_atomic_num_list' : list(range(1, 119)) + ['misc'], 'possible_chirality_list' : [ 'CHI_UNSPECIFIED', 'CHI_TETRAHEDRAL_CW', 'CHI_TETRAHEDRAL_CCW', 'CHI_OTHER' ], 'possible_degree_list' : [0,...
90e9470314fb8c0b47e4fd6d8ea0e208a37bee3f531293ef424b6531b9713ffb
Python
6,714
145
from plotly import graph_objs as go import numpy as np import json import pickle5 as pickle from scipy.io import savemat # bn_atlas_file = '/Users/zhangyuan/Desktop/Sherlock/projects/sryali/2019_DNN/scripts/features/bnatlas_tree.json' with open(bn_atlas_file) as f: bn_atlas=json.load(f) def generate_radial_pl...
c8bb3bb05675a71ef5972ea7722af0f4e194597b89f9add17e9d7f370607a47a
Python
6,716
219
# 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...
599a7765b6ef5831d4dbaa184c2697399d0dcc7f4d1fcc705c58167b90974f74
Python
6,718
213
# 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...
2db908932a6db7e883a65b8863f27224660734c354af395aedb6d6c7c60f6553
Python
6,725
225
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import math from functools import partial __all__ = ['ResNeXt', 'resnet50', 'resnet101'] def conv3x3x3(in_planes, out_planes, stride=1): # 3x3x3 convolution with padding return nn.Conv3d( in_planes,...
b8b65a57eaaeaf979528409fa9f4d74889b20c61210e9cd5a4369ad8a0a6f60d
Python
6,726
172
"""Tests for nltools.algorithms.inference.intersubject — ISC, ISFC, ISPS.""" import numpy as np import polars as pl from numpy import sin, pi, arange import pytest from nltools.algorithms.inference.intersubject import isc, isc_group, isfc, isps class TestISC: """Test intersubject correlation calculation.""" ...
4f8c186f392e879c4ca66262c3a882ab08cd99862d0f83652ff27720ad25fac1
Python
6,727
157
import os import glob import json import torch import pickle import numpy as np import os.path as osp from torch_geometric.data import Data, InMemoryDataset import traceback def undirected_graph(data): """ A pre_transform function that transfers the directed graph into undirected graph. Args: data ...
95418a50f4482477392114d7658b268b62ef3d09186eb4b4bff14c947e2fd510
Python
6,727
188
import torch import torchvision import numpy as np import skimage import six import copy class Augmentor(): def __init__(self, augmentations=[]): transform = [] for a_spec in augmentations: t = a_spec['type'] del a_spec['type'] if t == "warp": ...
7577d78cc8a5762eb2ea38693196a4859e2ce1d90ff36fd84b7f6f1859978c8d
Python
6,730
166
from copy import deepcopy import logging import torch import torch.nn as nn import torch.nn.functional as F import pdb logger = logging.getLogger(__name__) class ModelEMA(nn.Module): def __init__(self, model, decay=0.9999, device=None): super().__init__() self.module = deepcopy(model) se...
49ef8d77ad7df45e0c8c18c72e64b71dd47c3bddd115feafaad083609ebd4899
Python
6,738
194
from __future__ import division import warnings from pycircstat import CI from pycircstat.iterators import index_bootstrap import numpy as np from scipy import stats import pandas as pd class BaseRegressor(object): """ Basic regressor object. Mother class to all other regressors. Regressors support indexi...
9679626120f458af64fbd66cdc9cafe44d1cde553c4fa31f5834b28b5c2c643c
Python
6,750
171
# SPDX-License-Identifier: BSD-3-Clause # Copyright (c) 2020-2026, Christian Gaser. See LICENSE. """ The permuted GLM. The point of this module is one piece of algebra. A permutation test refits the same model thousands of times, and the obvious way to do it -- build the permuted dataset, then regress -- costs an ``n_...
a1f6e42bd0147554f368f25bf375e242093f065be9a7fad4a78506f52f332262
Python
6,750
178
import logging from typing import Dict, Optional, Tuple import pytest from chromadb.api import AdminAPI import chromadb.api.types as types from chromadb.config import DEFAULT_TENANT from chromadb.test.conftest import ( ClientFactories, DEFAULT_MCMR_DATABASE, MULTI_REGION_TOPOLOGY, multi_region_test, ) ...
4b40fb093b26e184caf1b4e7bcabf1a3b1cb038547507566edbb663bffe1bd28
Python
6,752
153
"""Two adapters that let a non-energy model reach the golden harness. The harness accepts three shapes (``harness._evaluate``), and for an energy model the middle one -- "an ase calculator" -- is the whole story: hand it the calculator and it drives ``get_potential_energy`` / ``get_forces`` / (for a periodic structure...
40aa46522da78e14eb161bd74f64c15bc904b56deabf7338d1429bfa6e263373
Python
6,757
190
# 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 logging from collections import defaultdict from dataclasses import dataclass, field from typing import Dict, Any, List, Optional impo...
d9d61cee9c7c5d3e2a22e755c0eb30401538b4505892805c5cd369b8751f3be5
Python
6,760
222
from dataclasses import dataclass from typing import List, Dict, Optional import pytest from rdkit import Chem from rdkit.Chem import Descriptors import numpy as np from reinvent.scoring.compute_scores import compute_component_scores, compute_transform from reinvent.runmodes.samplers.sampler import validate_smiles fr...
3e2e07e2d1a6ecbfd922ce0ee8c0903aaa788bb92307362e876c7543181fd0da
Python
6,761
216
from PymoNNto.Exploration.Network_UI.TabBase import * from PymoNNto.Exploration.Visualization.Visualization_Helper import * import os from io import StringIO from contextlib import redirect_stdout from PymoNNto.Exploration.Network_UI.Basic_Tabs.Helper.syntax import * class code_execution_tab(TabBase): sample_cod...
93a5c1273b240edb00fa094582a48ba03dfb924a05846ba36c623174e600b02b
Python
6,762
227
# execute using the same docker to have everything in the same torch version # and pyg version # bslins # baseline random forest # docker run -dt --gpus all -v /home/uveleiro/data/uveleiro/ALL_GENNIUS:/wdir/ --name bslins genniusdoc import numpy as np import torch import torch_geometric.transforms as T import seabor...
47d3ee77c6346915bf1e37a8b973b956e43a37df13b580901345d874229b3647
Python
6,763
152
""" Implementation of the BFGS 2nd-order optimizer. """ import jax import numpy as np from jax import numpy as jnp from jax.flatten_util import ravel_pytree from deeperwin.configuration import BFGSOptimizerConfig, OptimizationConfig from deeperwin.mcmc import MCMCState, MetropolisHastingsMonteCarlo from deeperwin.uti...
0f3aa4ce68946611e3b1a40604e3f80af3d259abc9fb52026ea4deb895cf7602
Python
6,765
198
import numpy as np # allowable multiple choice node and edge features allowable_features = { 'possible_atomic_num_list' : list(range(1, 119)) + ['misc'], 'possible_chirality_list' : [ 'CHI_UNSPECIFIED', 'CHI_TETRAHEDRAL_CW', 'CHI_TETRAHEDRAL_CCW', 'CHI_OTHER' ], 'possibl...
505473ab24a33ad3ae914484672a5eee594db7d5d4ff0677e2d90cfcda801163
Python
6,766
180
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Dec 12 15:25:17 2018 @author: ngritti """ # from csbdeep.models import CARE # from deeprest.rawDataClass import rawData # from deeprest.modelClass import modelRest # from deeprest.timeLapseClass import sampleTimeLapse import time, os, glob import shutil...
51570b73f34d3cf96a88f6a08cd3bdfd791e97f29a8f9df23b8d3e7b1e285d13
Python
6,769
203
import geomstats.backend as gs from geomstats.geometry.base import ComplexMatrixVectorSpace from geomstats.geometry.euclidean import Euclidean from geomstats.geometry.general_linear import SquareMatrices from geomstats.vectorization import get_n_points def get_random_quaternion(n_points=1): # https://stackoverflo...
e116e60509bf41dba9145035c806d513fa4d13da611072171cc8f1378ce56801
Python
6,771
170
import numpy as np import matplotlib.pyplot as plt import seaborn as sns import analysis_utils as au import fit_data as fd def fit_data_and_plot(df, kind='bar'): config_columns = [ 'init_std', 'lr', 'memory_lr', ] mean_columns = [ 'seed', ] metric_column = 'valu...
5ca6144343f5199f22c9f7f63eb8fa60436bb43551d20cdecebb6207578a79a7
Python
6,776
236
#!/usr/bin/env python """This script will run part of the movie, and will let the subject choose the volume. It will then save the volume and use it for the experiment""" from psychopy import prefs prefs.general['audioLib'] = ['pygame'] from psychopy import visual, gui, event, logging from psychopy import sound, core i...
9658233c27a0147dccacd0112d79c59a0f113bc6f8b989b90133e327fecf6a01
Python
6,779
234
import flammkuchen as fl import numpy as np from joblib import Parallel, delayed from skimage.measure import block_reduce from split_dataset import Blocks, SplitDataset, EmptySplitDataset def _time_percentile( dataset, block, out_file, method="mean", percentile=50, time_slice=None ): if time_slice is None: ...
4a23b032cd71d7a47c670d85169f44cba9a5cbe5b8622c31d343d5a686d369c8
Python
6,783
204
"""Classical multi-dimensional scaling (classical MDS).""" # Authors: The scikit-learn developers # SPDX-License-Identifier: BSD-3-Clause from numbers import Integral from sklearn.base import BaseEstimator, _fit_context from sklearn.metrics import pairwise_distances from sklearn.utils import check_symmetric from skl...
ba3816edb268d39958b48341f6814a3ed75dbdf4c9ebf7c2978f5f7a4f127e2e
Python
6,783
227
import math import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class LayerNormNoBias(nn.Module): """ From nanoGPT: LayerNorm but with an optional bias. PyTorch doesn't support simply bias=False """ def __init__(self, ndim: int): super().__init__() ...
6515671408ba1193c92f82b7810a4205c2aab9487a8d2c983896ce266824d9d1
Python
6,785
185
import ase import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import Embedding, Linear, ModuleList, Sequential from dgl.nn.pytorch import GraphConv, AvgPooling class SchNet(torch.nn.Module): def __init__(self, sch_n_interaction, sch_hidden_dim, sch_n_gaussian, sch_n_...
ce7767ac12451c901b89fe75227804044fd162641e152c11681f52939a282342
Python
6,787
158
import argparse from sklearn import svm from sklearn.model_selection import KFold from sklearn.metrics import precision_recall_curve, roc_curve, auc from sklearn.model_selection import train_test_split import pandas as pd import numpy as np import joblib # Calculate and update the best metrics, fold index and results...
ac0764712a9f96d9d81b964d80e414eebd0710baa5b75c2e99bbaa2b6dd23e98
Python
6,789
181
import math import random from PIL import Image import blobfile as bf from mpi4py import MPI import numpy as np from torch.utils.data import DataLoader, Dataset import cv2 def load_data( *, data_dir, batch_size, image_size, class_cond=False, deterministic=False, random_crop=False, rand...
bae7b3b5c710cc800956863c192dd279911fcccab71f62ed42c0d969a423625d
Python
6,791
192
import numpy as np import xarray as xr from scipy.spatial.distance import cdist from numpy.testing import assert_raises, assert_array_almost_equal, \ assert_equal from xarray.testing import assert_allclose as assert_xr_allclose import gemmr.generative_model from gemmr.data import generate_example_dataset from ge...
baa2db35334bbff6146224e787a98b0b2a536d8819d2ab407405a9c9886f990d
Python
6,797
191
import torch import torch.nn as nn import torch.nn.functional as F import torch_geometric.transforms as T from torch_geometric.nn.conv import MessagePassing from torch_geometric.nn.glob import global_add_pool, global_mean_pool, global_max_pool from typing import List, Optional, Union, Callable from torch import Tenso...
069a3f684660d888016bca7820e5a94340aed52d6bae4d1f3b967404e7d1ef94
Python
6,798
163
"""Build the tiny ``AtomicDipolesMACE`` anchor by direct instantiation. Same discipline as ``build_mace_anchor.py`` and for the same reason: a seeded untrained network exercises the readout assembly exactly as a trained one does, so the anchor is initialised and saved rather than fitted. What it exists to pin is the d...
d7afb3b55f8ab420a61845c02981390cd9c55ac8b1f0d2cb1cc1c62c27d56b00
Python
6,798
143
"""Merging Fingerprinting output The goal of the current package is to extract functional connectivity data from already scrubbed and cleaned fMRI data. The goal is simply to extract the data using specifical parcellations. To do: - WARNING: Bug when running in variance data. For some reason, the index columns ar...
8bdc34a104e071b81e7be8ce5372108a3d595c8e108dc9b0f2dd05418a27a87a
Python
6,802
168
"""Tests for Adjacency core operations: init, type inference, properties, indexing, arithmetic, copy, squareform, append, aggregation, distance.""" import numpy as np import polars as pl import pytest from scipy.spatial.distance import correlation from scipy.stats import pearsonr from nltools.data import Adjacency ...
0b25b56de19fea54e7ac145bb04c414b1c5616252ba7eb397a39efc01ce46445
Python
6,803
184
import numpy as np from scipy.spatial.distance import cosine as cosdist from numpy.testing import assert_raises, assert_allclose, assert_equal, assert_warns, assert_array_almost_equal from unittest.mock import patch, create_autospec from sklearn.utils import check_random_state import gemmr.generative_model from gem...
2a7e688f25ed77867818e812367cecfc6165bc69a0f2201bbf33eb46e968aaff
Python
6,803
203
import geomstats.backend as gs from geomstats.metric_geometry.bhv_space import Split, Tree from geomstats.test.data import TestData from .point_set import PointSetMetricTestData class TreeTopologyTestData(TestData): def raises_empty_splits_test_data(self): data = [ dict( inval...
a50b5ab7b6ad42a6dcb82c8fb3d78c786107ad6efd9704d642b8a3bb2cfbccc6
Python
6,805
129
""" Quadratic Integrate-and-Fire (QIF) Neuron Mean-Field Model ========================================================== Here, we will introduce the QIF population mean-field model, which has been derived from a population of all-to-all coupled QIF neurons in [1]_. The model equations are given by: .. math:: \\...
4557635e3cf86d81bc88159d53654e1a5601dea7719b25d4f1d136ece762e83c
Python
6,807
186
# pyright: reportIncompatibleMethodOverride=false import logging from collections.abc import Iterable, Sequence from dataclasses import dataclass from math import sqrt from qtpy.QtCore import Signal # type: ignore[reportPrivateImportUsage] from qtpy.QtCore import QPoint, QPointF, Qt from qtpy.QtGui import ( QColo...
797325f0d189d8be41c1d1fd71fcdbc764134bbcb99a64d0e6b87775f22ef580
Python
6,808
181
from chromadb.api.types import ( SparseEmbeddingFunction, SparseVector, SparseVectors, Documents, ) from typing import Dict, Any, List, Optional from enum import Enum from chromadb.utils.embedding_functions.schemas import validate_config_schema from chromadb.utils.sparse_embedding_utils import normalize...
5693186d35296cf3540a96f1977ab966486ee1eb4de7bb0f588fd2bb836d5e05
Python
6,812
215
# -*- coding: utf-8 -*- # # BigFeta documentation build configuration file, created by # sphinx-quickstart on Mon May 20 10:03:21 2019. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # A...
5fa7205892dab0ed6d2dde9f40fe3b4df1834068dbcb43c1c4f65821f5e42513
Python
6,812
195
from brian2 import * def visualise_connectivity(S): Ns = len(S.source) Nt = len(S.target) figure(figsize=(10, 4)) subplot(121) plot(zeros(Ns), arange(Ns), 'ok', ms=10) plot(ones(Nt), arange(Nt), 'ok', ms=10) for i, j in zip(S.i, S.j): plot([0, 1], [i, j], '-k') xticks([0, 1], ['...
695ea297857eef465e8d3cb1b803b733370f9592cbeeaf7493768eaea267f965
Python
6,825
178
"""`--multi_processed_test`, which is a statement about a directory layout. Both branches read `--test_dir`, and they disagree about what is in it: without the flag the directory holds files whose names end `_test.h5`, one dataset each; with it the directory holds one *folder* per test set, each holding the shards a m...
ce22a0c1e8f08644c6c3e47499f5280daa99583d51f668fa1acea69ef469f3bf
Python
6,828
134
# 2026-09-26 Shared scoring harness for the clustering bake-off (VDJdb motif stage). # # Every candidate algorithm is scored through ONE code path: produce a label vector in the # tcremp contract (-1 noise, otherwise unique across epitopes), push it through clusters() so the # legacy length-split and the min_cluster p...
6699c22397be045c70a4b848ee0902b3de8d878818d27bc4fbb9b3eb8dca5cc6
Python
6,830
206
"""Mixin for manifolds of probability distributions.""" import math import geomstats.backend as gs from geomstats.vectorization import get_batch_shape class InformationManifoldMixin: """Mixin for manifolds of probability distributions.""" def __init__(self, support_shape, **kwargs): self.support_sh...
bb5bb27e71761a99eddc0d727c14da369e26cbdfb82c6e476d4dc0e539e94956
Python
6,832
136
# 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...
4a39c8c99f7893c3b85eb0e8249be2cc95b99ee9725786287c6e970e80aa9355
Python
6,833
213
"""Spatial neighborhood computation for neuroimaging analyses. This module computes spatial neighborhoods (spheres) around brain voxels. It is designed to support searchlight analyses, ISC, and other operations that require iterating over local brain regions. Examples: ```python import nibabel as nib from...
74073ce98188953528f64d4943871bbb4ac475bfc790125c828c7de81ba2fbd0
Python
6,835
208
# -*- coding: utf-8 -*- import argparse import sys import math import csv import copy import scipy import numpy as np import scipy.stats as sp import sklearn.cluster import sklearn.metrics.pairwise import warnings warnings.filterwarnings("ignore") def min_dist_ref(genotypes, ref_genotypes, focal_idx): f = np.ar...
22d01d7894ecd0c0622d55be5f4611005a3d8141a8beec782d93417105f93bf1
Python
6,837
194
# 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...
38cb98d683f9d173576a74c0d640a8a16af9ac90af39bff15e8ad0501f8b4ee2
Python
6,838
166
import numpy as np from rdkit.Chem import Descriptors from reinvent_plugins.components.RDKit.comp_linkinvent import FragmentQed from reinvent_plugins.components.RDKit.comp_linkinvent import FragmentMolecularWeight from reinvent_plugins.components.RDKit.comp_linkinvent import FragmentTPSA from reinvent_plugins.compone...
8b9ebfbbb590cf1d10960234edc8e6189551c58087a98891cb55643eb24ed354
Python
6,840
248
import json import six import copy import cachetools import cloudvolume from cloudvolume import CloudVolume, Storage from corgie.log import logger as corgie_logger def jsonize_key(*kargs, **kwargs): result = "" for k in kargs[1:]: result += json.dumps(k) result += "_" result += json.dum...
54395c6627fa190b2892bea7adac43791d6849bf6d02a3b99fdbf4404d4577ed
Python
6,843
193
"""Visualization for Geometric Statistics.""" import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # NOQA import geomstats.backend as gs from geomstats.geometry.hyperboloid import Hyperboloid from geomstats.geometry.poincare_half_space import PoincareHalfSpace H2 = Hyperboloid(dim=2) POINCARE_HAL...
3bdb39faacd34ac4ea6d0f2ae7c3bd62dc0ce896ee9ddcf255e4530c32eb7265
Python
6,848
194
import numpy as np import torch import torch.nn as nn class ST_Net_Sigmoid(nn.Module): def __init__(self, input_dim, output_dim, hid_dim=64, num_layers=2, bias=True, scale_weight_norm=False, sigmoid_shift=2., apply_batch_norm=False): super(ST_Net_Sigmoid, self).__init__() self.num_layers = num_laye...
bbabc374e723d7cb3410f223a2636fca786b8d1c1e4a54f3aa8f888ee1225da1
Python
6,848
134
import torch import numpy as np from dig.ggraph3D.utils import xyz2mol, collect_bond_dists, compute_mmd, compute_prop class RandGenEvaluator: r""" Evaluator for random generation task. Metric is the chemical validity ratio (represented in percentage) and the MMD distances of bond length distribution between ...
dec71bd774264423e8f0ce6533435b37d4ae70d93d7d83480faa1615b1c45f07
Python
6,848
158
import argparse from sklearn.ensemble import RandomForestClassifier from sklearn.model_selection import KFold from sklearn.metrics import precision_recall_curve, roc_curve, auc from sklearn.model_selection import train_test_split import pandas as pd import numpy as np import joblib # Calculate and update the best met...
12a234fa7a7a0c702eb98b44f24c45aec73fbe05917677c44a9c5c0b0033343b
Python
6,855
196
""" original author : __author__ = https://wiki.python.org/moin/PyQt/Python%20syntax%20highlighting """ __author__ = "Seounghun, Chung <4uwingnet@naver.com>" __license__ = "License:BSD 3Clause" import sys from PyQt5.QtCore import QRegExp from PyQt5.QtGui import QColor, QTextCharFormat, QFont, QSyntaxHighlighter from...
27805765b98abd215e57cce465fe0b68f98859f6ebd504321c7bd063894f9aae
Python
6,855
166
"""References for the two published non-energy models. Needs a download. Not part of ``--target all``: regenerating these fetches published releases, and MACE-Polar additionally needs the ``graph_longrange`` extra. Folding it into the default sequence would mean ``--target all`` fails on a plain development box that c...
2d20bbd9131fafba2131cc626e4be29afec65027dbba66b6c60d5e84bfa49195
Python
6,859
196
"""Plot every analyzed file in the open folder with NicePool.""" from __future__ import annotations from functools import partial from typing import Any import pandas as pd from PyQt5 import QtCore, QtGui from sanpy.interface.plugins.nicepool_plugin import NicePoolPlugin from sanpy.interface.window_state import Win...
6d051f01969bdb95353fcd04884c972675c6eadf6780275a88f94fdc0e605531
Python
6,862
117
#*----------------------------------------------------------------------------* #* Copyright (C) 2024 ETH Zurich, Switzerland * #* SPDX-License-Identifier: Apache-2.0 * #* * ...
819afb45caf24dedabc03f53b04d2cdeed9866574a8a9de704a97249dabae249
Python
6,862
235
import time, h5py, logging, itertools from tqdm.auto import tqdm, trange from typing import Union, List, Tuple import numpy as np, pandas as pd from sklearn.neighbors import RadiusNeighborsClassifier, RadiusNeighborsRegressor from anndata import AnnData import scanpy as sc import torch def config_logger(logger, le...
47f7ba15a81b6ea9ebc3d4a6c7bce70b7983f730e9fb08e0362296cb02389dc8
Python
6,866
210
import numpy as np class coupled_oscillators: """ Simulate coupled oscillators, with parameters extracted from trained LRRNNs """ def __init__(self, tau, freq, m, n, I_orth, alphas, rad, amp,n_osc=1): """ Initialise coupled oscillators Args: tau: time constant of ...
98a75eb5ff8b0deec74b63bec88628e2b1e61951ea10b6339f3ae450fd5ca26e
Python
6,866
174
# Copyright 2025 Intel Corporation # SPDX-License-Identifier: Apache-2.0 import logging from azure.storage.blob import BlobServiceClient from pathlib import Path import tests.end_to_end.utils.defaults as defaults import tests.end_to_end.utils.docker_helper as docker_helper import tests.end_to_end.utils.exceptions as ...
3dd15ac2e73d8fb15491bb338b8251a509b30b433a7d7431383170a000dd3037
Python
6,867
168
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 import pandas as pd import seaborn as sns import scipy.ndimage as ndi from skimage.metrics import structural_similarity as ssimi from skimage.metrics import n...
261c1e02c68beb675f17e59ac719c31c3dea83ea0a5b62cc0d8e3e93cf74a486
Python
6,870
160
# This file is a part of the `nequip` package. Please see LICENSE and README at the root for information on using it. from typing import Union, Callable, Dict, List import torch from ase import Atoms from ase.calculators.calculator import Calculator, all_changes from ase.stress import full_3x3_to_voigt_6_stress from ...
5b6c1e4f8921ef15ef7cccc2768bf58151b6ea9c92596b860a966fc4fc16c60b
Python
6,875
223
# ruff: noqa: PLR2004 from __future__ import annotations import argparse from typing import Any import pytest from pytest_mock import MockerFixture from snakebids import bidsapp, plugins from snakebids.bidsapp.args import ArgumentGroups class TestRunner: def setup_method(self): self.hooks_run = 0 ...
fd5ea40acd57149c6512d75406094fdb40da06ce6c003891e170c7af343d6941
Python
6,875
259
import click import procspec import math from corgie import scheduling, helpers from corgie.log import logger as corgie_logger from corgie.boundingcube import get_bcube_from_coords from corgie.argparsers import ( LAYER_HELP_STR, create_layer_from_spec, corgie_optgroup, corgie_option, create_stack_...
070b7a94c3700612fb12a1d9e06ac918f556f7f7c9db1e11dd17939c72167276
Python
6,876
205
from __future__ import annotations import argparse import sys from collections import defaultdict from typing import TYPE_CHECKING, Any, Iterable, Protocol, Sequence, TypedDict import attrs import pluggy from attrs.converters import default_if_none from typing_extensions import TypeAlias, Unpack from snakebids.bidsa...
f8da2e16654116392f7ddb90bda194324e61aa544103d4628a8c535830e6615f
Python
6,886
230
# /// script # requires-python = ">=3.11" # dependencies = [ # "marimo", # "nltools>=0.6.0", # ] # /// # Decomposition — marimo notebook. Source of truth for the docs page; rendered to the docs page by scripts/marimo_to_zensical.py. import marimo __generated_with = "0.24.0" app = marimo.App(width="medium") ...
538802f12ac99f5f0674cb5b8c39f92deab1b0ec1ec291606067aa2156e00b8a
Python
6,889
173
""" A script to run many motion estimation method. The run many combinaisons of peak localization x estimation from spikeinterface. This done using the BenchmarkMotionEstimationMearec class from spikeinterface.sortingcomponents.benchmark.benchmark_motion_estimation """ from configuration import * from spikeinterface...
f3ac28230ae9e20aa47b10e6c4cca614becdaad819e9c6a7a21f90b6e748cde4
Python
6,890
170
"""Tests for the file-path / events-DataFrame paths in DesignMatrix. The old standalone `nltools.io.onsets_to_dm` was folded into `DesignMatrix.__init__` (file path) and `nltools.io.events_to_dm` (in-memory events DataFrame). """ import os import numpy as np import pandas as pd import polars as pl import pytest fro...
7f7b4b96956ed65680eb8d643f80ec5d6b0965ed10ce390ad9ff67737add060b
Python
6,891
203
# 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 torch import torch.nn as nn import torch.nn.functional as F class GumbelVectorQuantizer(nn.Module): def __init__( self, ...