sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
45ae713eafc17b9603da332a37731511bbc2beca65b5dd083f49e1c659d1ac34
Python
3,102
112
""" @Mariellapanag Created on Feb 2023 @author: mariella Functions for computing abnormalities from continuous iEEG data. Includes map_NaN_values_channel TODO: Write down comments on this script """ import numpy as np def map_NaN_values_IMFchar(data, nan_all): [n_modes, n_roi, time] = data.shape ...
3ad81d9448c0879ef2dca8c79d658f8e17e8c7a6ddd96a853afd63ce30440287
Python
3,103
75
import pandas as pd import dataset import datasets_manager import runner from base import BaseTrainer from parse_config import ConfigParser from utils.logger import get_logger def multi_train_bootstrap(config: ConfigParser): logger = get_logger('runner.multi_train_bootstrap') data = {project_id: config.init...
37be744b36136dda50ce05f5dab48670258905e522528c5f6fad74bae8a2ccf8
Python
3,104
74
""" This script reads computes the percentage of time the eyes were closed during the MRI sessions. Closure of the eyes is determined by the blink state and only microsleeps (i.e. eye closure longer than 10s) are counted. The script returns a dataframe per task with the sleep percentage. Inputs: path Outputs: csv...
630cacc5c1d4f1c2916dfa4d29fc21b9e98201dbe160a6b51158b47a3c1838f2
Python
3,104
87
from __future__ import annotations import re from typing import Any from wikibaseintegrator.datatypes.basedatatype import BaseDataType from wikibaseintegrator.wbi_config import config from wikibaseintegrator.wbi_enums import WikibaseSnakType class Property(BaseDataType): """ Implements the Wikib...
cc06a84c2866ba7b0cca7ab7475a690dd1b2f283896e8291f9d0b4a782bd032c
Python
3,105
71
import torch import torch.nn as nn import torch.nn.functional as F class LSTM(nn.Module): r''' A simple but effective long-short term memory (LSTM) network structure from the book of Zhang et al. For more details, please refer to the following information. - Book: Zhang X, Yao L. Deep Learning for EEG-Ba...
efab06afd9afb86ac385f6a5aabae1787a91f9a2e6b443f65fb4ed511d5260ab
Python
3,105
104
# Node-group asset "Contains Geometry" (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_CHEC...
6d4b019555dfae9f88943fdc92bb78fbb719554dd2ca76ae68c9c5a1bab3dd4b
Python
3,106
92
# 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...
bb47e22ac60bee2b5cce855f26fa842bb60a011da0347531651b493a30645949
Python
3,106
62
"""RUN_HERE.py 2026-10-15. Runs any script of this archive from the folder where the archive was unpacked. Every script ran on my computer from the folder D:/eucys and names that folder in its own text. I keep the scripts byte-for-byte as they ran, because MANIFEST.tsv and the pre-registrations record their SHA-256. Th...
25a878a82d7fd5d6090f69b3e49171038f645568538d4b16cde81c65694fa04d
Python
3,107
87
import os import numpy as np import pandas as pd import torch from torch.utils.data import Dataset class MultiModalDataset(Dataset): def __init__(self, datasets, transforms=None): self.datasets = datasets self._transforms = transforms all_mrns = [dataset.uids for dataset in self...
4d0d8a2de44511c5f2787cdd7ed769c555344ab06370bc8c6e0b9c33c6e82d27
Python
3,107
85
from copy import copy def update_param(name, param): if name == 'min_sdev': # create deprecated alias for 'min_sdev' threshold = copy(param) threshold['name'] = 'threshold' return [threshold, param] if name == 'eps_sdev': # create deprecated alias for 'eps_sdev' eps = copy(pa...
cda21a47443c09c08b6254ebb6402dea14e35396bae753758b6e11f5d8aff344
Python
3,107
92
""" Wrapping classes for using igraph package # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 24.02.15 """ __author__ = 'martinez' try: from globals import * except: from pyseg.globals import * try: import disperse_io except: import pyseg.disperse_io import pexceptio...
6e37ae79d6d46d06054061fb359b1e50fe61bafca46461493c4bed906475851f
Python
3,109
106
import sys import random import os import argparse import sys import pwd import time import subprocess import re import shutil from sklearn import metrics import re from sklearn.metrics import roc_curve,roc_auc_score import numpy as np import glob import logging import io import tensorflow as tf #from callbacks import...
470295e83e1835233e8056bb957df14619e0ad9a352a90e74a14be3894d70b14
Python
3,110
84
# 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...
ee8b15039139d9b07a4c280a1096bf5c4b4955ce3d3128dd47c86b1bd5194cb6
Python
3,110
75
from autograd import numpy as npa from autograd import value_and_grad from typing import Callable, List from scipy.optimize import minimize def unfilter_design( target: List[float], processing: Callable, maxiter: int = 100, regularization: float = 0.1, ): """Given a processing function, uses opti...
d82245dc9afe8de6fe9b54b4357e71d61b335dca602919655fa4675fd40f4471
Python
3,111
59
""" Query co-registered functional data from the MICrONS dataset last modified: András Ecker 09.2023 """ import numpy as np import pandas as pd from scipy.spatial.distance import pdist, squareform # follow https://github.com/cajal/microns-nda-access to be able to run this! from caveclient import CAVEclient from micron...
e140d74a85d47f68f13c5583be2ea89f0ef124f749ed9f8bf371c4f01687a832
Python
3,112
124
# Computes the diffraction orders of a 2D binary grating with # triangular lattice using a rectangular supercell and verifies # that only the diffraction orders of the actual unit cell # produce non-zero power (up to discretization error) import math import numpy as np import meep as mp resolution = 100 # pixels/μm...
31eb31c6083704bc6178b671f9d49fdf46fa80aa4e81d557c3a5befae1d2b334
Python
3,113
88
import os import sys from typing import Optional, Tuple def glibc_version_string() -> Optional[str]: "Returns glibc version string, or None if not using glibc." return glibc_version_string_confstr() or glibc_version_string_ctypes() def glibc_version_string_confstr() -> Optional[str]: "Primary implementa...
889a4182f457fd25d9b6cdf83ae4e2b39866591f743140707dbc25a128c65042
Python
3,113
124
from time import time import numpy as np import scipy.linalg as la import scipy.stats as st class GWAS: r""" Linear model for univariate association testing between `P` phenotypes and `S` inputs (`P`x`S` tests) Parameters ---------- Y : (`N`, `P`) ndarray outputs F : (`N`, `K`) n...
ed7378a2a88a1359a5be67f8f66fd8f4e620b644fdb74b25d9eebbc35d7b2925
Python
3,113
103
# Copyright 2022 HYBRID Team INCIA, UMR5287, CNRS, Université de Bordeaux # 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 b...
38299f5527abfde6681e1ce69e47b38a2ad6b0ea17f669ee359010799da6051d
Python
3,114
73
from ..region_1020 import (FRONTAL_REGION_LIST, GENERAL_REGION_LIST, HEMISPHERE_REGION_LIST) from ..standard_1020 import STANDARD_1020_CHANNEL_LOCATION_DICT from ..utils import (format_adj_matrix_from_adj_list, format_adj_matrix_from_standard, format_...
480a3c9eada320178bbf9021087f586f05f935fde3776dbc95df5c9c1f41603e
Python
3,114
92
from sklearn.model_selection import train_test_split import csv import os import shutil import numpy as np RANDOM_STATE = 123 test_size = 0.2 def create_directory(path, empty_dir=False): """ Creates directory if it doesnt exist yet, optionally deleting all files in there """ if not os.path.exists(path): ...
d5eff42649175e679f0d1d5b8d0d2400383c0c37c36a59809fd66682bec9601e
Python
3,114
63
from __future__ import print_function import argparse import os import sys import numpy as np from topaz.cuda import set_device from topaz.stats import normalize_images from topaz.torch import set_num_threads name = 'normalize' help = 'normalize a set of images using the 2-component Gaussian mixture model' def add_...
e1fd45ef2f95955f6a0dc9af7481f9fd971a53100744ac4d1bf41844dc99e47a
Python
3,114
66
"""Python function to plot folded and unfolded hippocampus Modified from jordandekraker/hippunfold_toolbox https://github.com/jordandekraker/hippunfold_toolbox/blob/main/hippunfold_toolbox/plotting.py -removed dentate gyrus label -load template point and cell data from github -view set to 'ventral' for both...
436af0676ea180de661cb12975d3de92b2bf8e666a9d77b179ff3056c87f6051
Python
3,115
80
"""Tests for Pose_detect_mmdetect3x.select_detections, APT's post-processing of detector boxes. python test_select_detections.py (or: pytest test_select_detections.py) """ import numpy as np from Pose_detect_mmdetect3x import select_detections, kept_detections def box(x0, width=100., y0=0., height=100.): "...
4bad95372f27ceb4633d5c981783b2e115ad84023b90a19947fd1f29c2d27df2
Python
3,115
91
""" Classes for implementing the visitors used by graph_tool package # Author: Antonio Martinez-Sanchez (Max Planck Institute for Biochemistry) # Date: 27.11.14 """ __author__ = 'martinez' __version__ = "$Revision: 002 $" __author__ = 'martinez' import graph_tool.all as gt #########################################...
fe953d5a797214cf8dc92c31802c82fddd09683b2f411b0f9eb437236aa33307
Python
3,115
98
#!/usr/bin/env python3 import argparse, os, sys, time #import warnings, json, gzip import numpy as np import sklearn.metrics as metrics hg19_chromsize = {"chr1": 249250621, "chr2": 243199373, "chr3": 198022430, "chr4": 191154276, "chr5": 180915260, "chr6": 171115067, "chr7": 159138663, "ch...
70dfdef3f087dff183fbb0580f535f2cdcaca9a8eb11e8b24bc7891280940fa9
Python
3,116
62
import argparse import torch import prescient.simulate as traj from prescient.train.model import * def create_parser(): parser = argparse.ArgumentParser() parser.add_argument("-i", "--data_path", required=True, help="Path to PRESCIENT data file stored as a torch pt.") parser.add_argument("--model_path", re...
7901a1c67c2eeb838b674b7bcb66bf6760cd8de0f3e9d45c09adf84af708be35
Python
3,116
94
"""Elastic constants recipes for MLIPs.""" from __future__ import annotations from typing import TYPE_CHECKING from quacc import flow from quacc.recipes.common.elastic import elastic_tensor_flow as elastic_tensor_flow_ from quacc.recipes.mlip.core import relax_job, static_job from quacc.wflow_tools.customizers impor...
b47768dcbc7d74cd9b3647a08f90aaa902cda0b435a7d78118bc73d58c327158
Python
3,117
73
from ..region_1020 import (FRONTAL_REGION_LIST, GENERAL_REGION_LIST, HEMISPHERE_REGION_LIST) from ..standard_1020 import STANDARD_1020_CHANNEL_LOCATION_DICT from ..utils import (format_adj_matrix_from_adj_list, format_adj_matrix_from_standard, format_...
fb910b6d4e6d6148cf501defeae08db6c65e113c901104c060228a5256aa56c6
Python
3,117
89
"""Smoke test for the CCF boundary editor pyqtgraph viewer.""" import numpy as np import pytest @pytest.fixture def qapp(): from PySide6.QtWidgets import QApplication app = QApplication.instance() or QApplication([]) yield app def test_viewer_constructs_and_loads_volumes(qapp, tmp_path):...
3aba5ee85e15a223b9ecc53475140fdf3ca29719f07de296c6c3941c8fbb4380
Python
3,119
105
import numpy as np from numpy.random import default_rng import random import torch import torch.nn as nn import torch.nn.functional as F class ResBlock(nn.Module): def __init__(self, conv1_filters, conv2_filters): super().__init__() self.conv1 = nn.Conv2d(conv1_filters, conv2_filters, 3, padding=1...
50e4f5645c4ebb3a9274076e5bbd78c3ac37769c03ffb731529aa4e2a3269b7e
Python
3,119
85
import warnings from os.path import exists as pexists from os.path import join as pjoin from bids import BIDSLayout class ThingsMRIdataset: def __init__(self, root_path: str, validate: bool = True): # path attributes assert isinstance(root_path, str) self.root_path = root_path sel...
ee29f9d4eb6b0fc3b87078a84763c0070e3731bd088c86150cd705a40aece6a3
Python
3,119
100
import torch from torch import nn class VAE_vae(nn.Module): def __init__(self, opt): super().__init__() self.opt = opt input_dim = opt.input_dim hidden_dim = opt.hidden_dim latent_dim = opt.latent_dim self.encoder1 = nn.Sequential( nn.Linear(in...
b62fc34fc82c956666e0c9fc1b0242bbd4e060600f61640c365eb9303b110da9
Python
3,121
74
import torch import torch.nn as nn class Score(nn.Module): def __init__(self, input_size, hidden_size): super(Score, self).__init__() self.attn = nn.Linear(hidden_size + input_size, hidden_size) self.score = nn.Linear(hidden_size, 1, bias=False) def forward(self, hidden, candi_embeddin...
5b354293c1da5def66e47a564e920b7097e8002bb2c7302fd9ea10af13e987f8
Python
3,122
98
""" Optuna example that optimizes a neural network classifier configuration for the MNIST dataset using tf.keras. In this example, we optimize the validation accuracy of MNIST classification using tf.keras. We optimize the filter and kernel size, kernel stride and layer activation. """ import urllib import optuna ...
ca8dc4015bdf28904ef6301d1db0620e5bec11116911da2dd97ad92ec3f0efe1
Python
3,122
82
#!/usr/bin/env python from __future__ import print_function import pybullet as p from pybullet_tools.utils import add_data_path, connect, dump_body, disconnect, wait_for_user, \ get_movable_joints, get_sample_fn, set_joint_positions, get_joint_name, LockRenderer, link_from_name, get_link_pose, \ multiply, Po...
01e806a122782f1630f5b278f4a7017e091a1c675d181369ba0a8775a486860f
Python
3,123
71
import os.path from collections import defaultdict from ckg.graphdb_builder import builder_utils def parser(databases_directory, download=True): config = builder_utils.get_config(config_name="signorConfig.yml", data_type='databases') directory = os.path.join(databases_directory, "SIGNOR") builder_utils.c...
8dbaf858f256ea41afcb8f2ed8281a72fe73ae49f5c0162b41fa154a6f4d7071
Python
3,123
92
import autograd.numpy.random as npr from autograd.test_util import combo_check def stat_check(fun, test_complex=True, **kwargs): # Tests functions that compute statistics, like sum, mean, etc x = 3.5 A = npr.randn() B = npr.randn(3) C = npr.randn(2, 3) D = npr.randn(1, 3) check = combo_che...
09faa5bfec59fe19c12c314536ec9ea7a0de3181750c02507ec1a73cb3af5615
Python
3,124
98
import numpy as np import pandas as pd from tqdm import tqdm import json from collections import OrderedDict def onehot_encoding( sequence: str, length: int, alphabet: str = "ACGT", neutral_alphabet: str = "N", neutral_value=0.25, dtype=np.float32, ) -> np.ndarray: """One-hot encode sequen...
215ef28a2c40c1c75db0cacadfcc845fafc214fb00130f160202c252f67a3f5b
Python
3,124
36
"""posthoc_th_candidates_2026-10-07.py (POST HOC, descriptive; not pre-registered). Avishai & Parnas (2025, Commun. Biol. 8:1555) found about three tyrosine-hydroxylase-positive (dopamine) cells per lobe among the ~65 glutamatergic ventral local neurons labelled by OK371-Gal4, and could not say which cell types they ar...
622ee5f6853a8179e077fa8092184106f042e089e057c5089ec012f7874144cd
Python
3,124
82
#!/usr/bin/env python from __future__ import print_function import pybullet as p from pybullet_tools.utils import add_data_path, connect, dump_body, disconnect, wait_for_user, \ get_movable_joints, get_sample_fn, set_joint_positions, get_joint_name, LockRenderer, link_from_name, get_link_pose, \ multiply, Po...
72045479b08bc459a7fb483b0707d687d77b0fe4523241357511c9da114e88b4
Python
3,124
90
from typing import Optional from functools import partial import torch from torch.nn.modules.loss import _Loss from ._functional import focal_loss_with_logits from .constants import BINARY_MODE, MULTICLASS_MODE, MULTILABEL_MODE __all__ = ["FocalLoss"] class FocalLoss(_Loss): def __init__( self, ...
44d3ca2e4572a9c102f2a8287b4c810cf2a3e7e202552024f7b2f74a7fb30341
Python
3,125
76
import numpy as np import pickle as pkl import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib as mpl from matplotlib import rc #rc('font',**{'family':'serif','serif':['Computer Modern Roman']}) ## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino']}) font...
42a40fcaf50fd3ab202e8c46f9ca2e1d4cd10691a4c735d547e9e39ea4cfec21
Python
3,126
67
#!/usr/bin/env python # Run this file from lis_ltamp/control_tools # That way it has the right file path for the .dae file # This specific file depends on openrave. # But once the C++ files are generated, openrave is not needed. from openravepy import * from openravepy import ikfast from openravepy.misc import InitOp...
4ccdf0e450648f18a0b59b2799efccf855d2259fc00ab835d7467ad8882152a7
Python
3,126
89
from __future__ import annotations import pytest torch = pytest.importorskip("torch") from importlib.util import find_spec import numpy as np from ase.build import bulk from quacc.recipes.mlip.core import relax_job, static_job libraries = [] if has_matcalc := find_spec("matcalc") and find_spec("matgl"): libra...
85921103e1941e84c06221532097d2796bd0e36f00c594f1ede67ec416a7fc79
Python
3,126
101
import os import toml import glob import shutil import logging from ase.io import read from ase.atoms import Atoms from quacc import get_settings from quacc import strip_decorator from typing import List, Dict, Any from quacc.recipes.mace.ts import ts_job, irc_job, geodesic_job def geodesic_ts_hess_irc_mace( ...
9f1661257125afa2874002cae3bcb8d0eb11b4bf68c47d67ad7a2ca28d9dce2a
Python
3,126
114
# Node-group asset "Set Phi Psi Angle" (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_CHEC...
c696dba5a69e5f5ac516a0fa606a252d7b7a74eacf50a66dddb1402817770f85
Python
3,126
73
""" OXASL - BASIL: Quantification using Bayesian model fitting The BASIL module is a little more complex than the other Workspace based modules because of the number of options available and the need for flexibility in how the modelling steps are run. The main function is ``basil`` which performs model fitting on ASL...
231b814d36aa0c5cd8d5ee936a580bf9905b8b538b44dcbdc02dfa58e24f554b
Python
3,127
113
# -*- coding: utf-8 -*- """ Created on Sat May 28 22:55:11 2022 @author: ftead """ import numpy as np import pandas as pd import matplotlib.pyplot as plt from numpy import trapz from scipy.signal import find_peaks import seaborn as sns #%% #testing fofr calculation of a single nucleus df1 = pd.re...
ae584a26c49d63dd01861aeda2113f85ed9bdb8d45b1e69db38ec813a6445c6c
Python
3,127
86
# Importing core packages import numpy as np import matplotlib.pyplot as plt import os global slm_pitch slm_pitch = 36e-6 def CreateBlank(img_size): # Input sizes img_dim = [np.int(np.round(img_size[0]/slm_pitch)), np.int(np.round(img_size[1]/slm_pitch))] # Creating the array img_array = np.zeros(img...
89b17f7ee094d8fc9d2b87f9e578bc8f5261a2c66804afa5451cc54fe0eab077
Python
3,128
96
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jul 4 14:54:33 2023 @author: emma data generator for passing sample weights based on bias group """ from numpy.random import seed seed(1) import tensorflow as tf tf.random.set_seed(1) import random random.seed(1) import numpy as np import pandas as...
b2346387cb8fa686f58d019b55317ea304688c55a9b90afddaf8bf36196327db
Python
3,128
83
"""WarningCollector / collect_run_notes: WARNING+ capture for the QC panel.""" import logging from regtools.registration.run_notes import WarningCollector, collect_run_notes def _logger(name): logger = logging.getLogger(name) logger.setLevel(logging.DEBUG) # let INFO reach handlers so the level fi...
d206a3e6a82da5f10de24762d733cae59280fee489760191ab74760d4dc02c9a
Python
3,128
89
import torch import scipy import numpy as np import pandas as pd from typing import ClassVar from torch.utils.data import Dataset from .utils import Seq2Tensor class SeqDatasetProb(Dataset): POINTS: ClassVar[np.ndarray] = np.array([-np.inf, *range(1, 18, 1), np.inf]) """ Sequence dataset. """ ...
2cfb3ed472ce9a9d0837d0663fca60ebce81ad4d77b3bc2e8d25b6424e987ca0
Python
3,129
76
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Marius Pachitariu. """ import os import numpy as np import matplotlib.pyplot as plt from fig_utils import * def fig7(root, save_figure=True): env_ids = ["PongNoFrameskip-v4", "SpaceInvadersNoFrameskip-v4", "Endu...
bcc50774a58a16c0374e715e8ec1b7c4a737ebe574e549bf68cdac26f4b6eb53
Python
3,129
92
import os import torch import numpy as np import importlib import torch.nn as nn from torch.nn import init import torch.nn.functional as F from torch.nn.parallel import DataParallel, DistributedDataParallel from torch.nn.init import xavier_normal_, kaiming_normal_ import functools from functools import partial import s...
e946be4bf12234498f35daebf3560e90690149ac3cf6b408afa92c3049d1ab55
Python
3,129
88
#!/bin/env python3 """ Plot wave front, wave back and phase defect line """ import ithildin as ith import numpy as np import matplotlib.pyplot as plt import sys from typing import List from scipy.interpolate import RectBivariateSpline Line = np.ndarray # shape (N, D), N number of points, D spatial dimensions sd = ith....
840c25a9422ac2ccbd3c86230c608bc67ad4467e02787cba2bbe5b01ea352bdf
Python
3,130
84
""" Preprocessing: This script imports the behavioral data """ import numpy as np import pandas as pd from en_utilities import safe_save_dataframe # Preprocessing of empirical data from O'Leary et al. # -------------------------------------------------- def preprocess_data(df_raw): """ Preprocessing of the raw ...
879be9996d74f100a211f055cb2b4fd744dcd4caf870e2f2a279c2796236115c
Python
3,130
75
import argparse import json import os import sys from constants import DATA_DIR from config_train import config as train_config from src.training.train_utils import Logger from src.models import get_regressor_v2 from src.dataloaders.semantic_transforms_dataset import TF_BRIGHTNESS, TF_PERSPECTIVE, TF_CONTRAST, TF_ROTA...
4507deac6122f53f3dce280e2bc05cc1dd32dd39fef6b228d37ba3d325b5bdbb
Python
3,131
60
#!/usr/bin/env python import os import pandas as pd import numpy as np from nltools.data import Brain_Data, Adjacency from nltools.mask import expand_mask from sklearn.metrics import pairwise_distances ## location of main project directory on HPC projpath = '/project/3011157.03/Simon/proj_2022_CABB_movie/' print('Th...
8bf6577d6dd1b6e05321a93602dd39974be0d051fa1b18d685571d29ffd5e4d9
Python
3,131
76
import numpy as np import pickle as pkl import matplotlib.pyplot as plt import matplotlib.cm as cm import matplotlib as mpl from matplotlib import rc #rc('font',**{'family':'serif','serif':['Computer Modern Roman']}) ## for Palatino and other serif fonts use: #rc('font',**{'family':'serif','serif':['Palatino']}) font...
859f2ee6d8ce06a7c416e1e7407feb340b6e8dc77f97be3cb92db80e28c8a503
Python
3,133
85
"""Unit tests for the NGF (edge-alignment) and FSC (spectral) metrics.""" import os import sys PROJECT_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), "..")) if PROJECT_ROOT not in sys.path: sys.path.insert(0, PROJECT_ROOT) import numpy as np import pytest from scipy.ndimage import gaus...
f8b64a44fe638e55173346544c7b4207e36de1f9eeebf1cc6acb07442d07ca90
Python
3,134
97
from __future__ import print_function from pddlstream.algorithms import instantiate_task instantiate_task.FD_INSTANTIATE = True from pddlstream.algorithms import instantiation instantiation.USE_RELATION = True from pddlstream.algorithms import refinement refinement.CONSTRAIN_PLANS = False from pddlstream.language.con...
2d6ac0eab7f8dcb85b4e1e2af72cfb08f565bd5aa4429aae3927123a9134949d
Python
3,135
88
from __future__ import annotations import numpy as np import pytest from ase.build import bulk, molecule from maggma.stores import MemoryStore from quacc import change_settings from quacc.recipes.lj.core import freq_job, relax_job, static_job def test_static_job(tmp_path, monkeypatch): monkeypatch.chdir(tmp_pat...
7c4178a9d37251514a133a07471b7951c7d3bf957d8467848a2f50eec0127a02
Python
3,136
133
#!/usr/bin/env python # coding: utf-8 # ## Compare model size/performance correlations using different measures # In[1]: import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns # In[2]: corr_methods = ['pearson', 'spearman', 'ccc'] quantile = 0.01 corr_methods_df = [] for c...
f3e02c94cddce7234d624f7ec578087dcb526bfa3a468294f7ee0daa0222edac
Python
3,136
83
# 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...
775a7bc874a287622366d9bfbe1ae837143980d9c6818cfda4d1acc164a1cac6
Python
3,137
73
#!/usr/bin/env python from __future__ import print_function import pybullet as p from pybullet_tools.pr2_utils import HEAD_LINK_NAME, PR2_GROUPS, get_viewcone, get_detections, \ REST_LEFT_ARM, rightarm_from_leftarm, inverse_visibility, get_detection_cone, visible_base_generator, \ DRAKE_PR2_URDF from pybulle...
2f016da78b770b3b5dae7e31ea519bc3d9245895736590749ef332a9f894d577
Python
3,138
78
# # 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,...
c1c1c5807cdf7f3d23a225e03485a6ab1c6aef757735f34b6fd0e3c345e08243
Python
3,138
100
import pytest import torch from elasticai.creator.base_modules.linear import Linear from elasticai.creator.nn.binary.math_operations import MathOperations operations = MathOperations() class TestBinaryOperations: def test_quantization_returns_1_for_0_8(self) -> None: x = torch.tensor([0.8]) x = ...
9c1bd0e819538a752a31a98d07965ca1f8720088194fb4d955cd850ae26c1f55
Python
3,139
95
# 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...
e97a02941b8f8f0980383459fd287611e5e1d1837fed649eb1c89017128d46c3
Python
3,139
90
import unittest import herdingspikes as hs import matplotlib.pyplot as plt import os from shutil import rmtree import urllib.request # raw data location DATADIR = "data/" DATA = os.path.join(DATADIR, "visapy_data.npy") URL = "https://www.dropbox.com/s/za017ro7ff88a5e/visapy_data.npy?dl=1" # detection parameters FILE...
4278abcfffc7b678198126db3237a13337362c9c9dc6d5eced173091c6d70674
Python
3,140
109
import os, sys import time import numpy as np import torch from torch.utils.data import DataLoader from rdkit.Chem import QED from rdkit.Chem import RDConfig from rdkit.Chem.QED import qed from rdkit.Chem.Descriptors import * from rdkit.Chem.rdMolDescriptors import * from .libs.models import MyModel from .libs.io_infe...
4831d2c60d4936f0ebfe9b6c28c1d26a4e5c1f9bdc76ff59c0f7aff068bd8e35
Python
3,140
94
import copy from abc import ABC from typing import Sequence from elasticai.creator_plugins.lutron_filter.nn.binarize import Binarize from torch import Tensor from torch.nn import Module from elasticai.creator_plugins.grouped_filter import FilterParameters from .lutron_module_protocol import LutronFilter as _LutronFi...
382db965e5a92baa45853eca12e46d2adac1ac5ade7113d096354b2c1bf2ded8
Python
3,141
93
"""Per-layer rotate/transpose for the napari viewer: changing one layer's transform must not touch the others. The core helpers set a single layer's .rotate / .affine and are exercised here with a fake layer; the widget wiring is checked with a mock viewer under a QApplication. """ import os import sys impor...
9ffe9c802529b28832bc1b940cf163c24531c95776d1f44977a4079ba62231a8
Python
3,141
117
import matplotlib.pyplot as plt import numpy as np import torch from matplotlib.collections import LineCollection from sklearn.metrics import roc_auc_score, roc_curve def plot_auroc_with_uncertainty( score_ls, label_ls, color="green", label="", linestyle="-", alpha_traces=0.0, alpha_uncert...
196d53b2e347e36632ed2d69d72cc02d733ae923db9c76af0beac4c290a65b54
Python
3,142
76
import argparse from matplotlib import pyplot as plt import pytorch_lightning as L import seaborn as sns import sys from statsmodels.stats.descriptivestats import sign_test # local imports sys.path.append("..") from shapelearningtheory.datasets import make_dataset from helpers import format_table, train_and_validate, u...
41176b3880fc4a3a7038670ddd6bf28511a065315a54b8d1eab938a05978627c
Python
3,142
86
# code link: https://neuralnet-pytorch.readthedocs.io/en/latest/_modules/neuralnet_pytorch/optim/nadam.html import torch as T from torch import optim class NAdam(optim.Adam): """ Adaptive moment with Nesterov gradients. http://cs229.stanford.edu/proj2015/054_report.pdf Parameters ---------- p...
07b357798c0031b81fa97339d830bdce295b49e9abe8b69859453a7ff550d5fd
Python
3,143
72
import os.path as path import numpy as np from eworm.utils import * from eworm.network import * from eworm.network.process import * import pickle import time def add_iclamp(circuit, input_cell_names): circuit.vclamp = [] for cell_name in input_cell_names: for sid in range(len(circuit.cell(cell_name=cel...
547d34ab7ed9ed34f34990e5b09b1b6671ed0aede72166647afbda9947405e38
Python
3,144
89
import argparse import matplotlib matplotlib.use('Agg') import numpy as np import random import sys sys.path.append("/media/benelot/SPACE/loci/IDSC/Physiology/projects/lagrangian-learning-the-final-nla/") random.seed(1238349532) from model.network_params import NetworkParams from model.network_params import Comput...
72d3eda11d70d3d2ec9bbc42064e1defd270a458c9a49c15dc336762c43ad6f8
Python
3,144
102
""" Copies column(s) values from a STAR file to another STAR file, if targe file already contained a set column old values are overwritten Input: - Source STAR file - Target STAR file - List with te column keys to copy Output: - A copy of target STAR file with column values i...
74f7222f018875fabea03ea4cf5a48d0ad2aeac60774b286551b2b2e473a5605
Python
3,144
91
import torch import torch.nn as nn import math from diff_frech_mean.frechetmean.manifolds import Poincare, Lorentz from diff_frech_mean.frechetmean.frechet import frechet_mean class RiemannianBatchNorm(nn.Module): def __init__(self, dim, manifold,args): # def __init__(self, dim, manifold): super(Riem...
43eabb642140661690ea80f33c5587d5282514ff2c45dfcd202318568896d221
Python
3,145
107
#!/usr/bin/env python from setuptools import find_packages, setup import os import subprocess import time version_file = 'realesrgan/version.py' def readme(): with open('README.md', encoding='utf-8') as f: content = f.read() return content def get_git_hash(): def _minimal_ext_cmd(cmd): ...
66da7da990fb0758e584141307c8b0b14caac1f1751c4c9084346f52956ebe5d
Python
3,145
93
"""Constructor for spin-echo-based frequency calibration sequence.""" from math import pi import numpy as np import pypulseq as pp from console.utilities.sequences.system_settings import raster from console.utilities.sequences.system_settings import system as default_system def constructor( n_steps: int = 10, ...
9615fdc7fd0903bd693b0858715fecfddbda242ebe67ac288ff238877662c240
Python
3,145
93
"""Randomly split the datasets in half """ # Set up dependencies import os import numpy as np from utils.array_ops import split_half from utils.data import load_data, load_meta_data, save_data from utils.visualize import plot_age_distributions if __name__ == "__main__": # Set random seed n_seed = 2023 n...
bf82b407e790fb11d1116a2b6ebeb3d1922431f8b40c53296805e3fc24c17f61
Python
3,145
111
"""Base jobs for MRCC.""" from __future__ import annotations from typing import TYPE_CHECKING from quacc import get_settings from quacc.calculators.mrcc.mrcc import MRCC, MrccProfile from quacc.runners.ase import Runner from quacc.schemas.ase import Summarize from quacc.utils.dicts import recursive_dict_merge if TY...
403bb93f3f67cbf2db4e055084ec071a8482935a65f36cad630b28bdcd3b43cb
Python
3,146
79
# coding=utf-8 # Copyright 2020, The RAG Authors and The HuggingFace Inc. team. # # 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 r...
e2df7835cafc0a5a3c74c78f7664f891111d93e580b673aef9551e97a58b7f63
Python
3,146
190
from __future__ import annotations from dataclasses import dataclass import numpy as np import pandas as pd MAD_SCALE = 1.4826 @dataclass class SizeQCResult: table: pd.DataFrame median_log_area: float mad_log_area: float robust_sigma: float z_threshold: float small_count: int large_c...
4121105402cb2751f1b553c8ad46d278700d29e4d9ffc32cc4d58f911bb3e7ff
Python
3,147
92
# 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...
74c6a68b9e39b7ab88f2e0978d46b1434cb5ba12cfffead0df6cfb160424c74b
Python
3,147
104
"""Prepare PASCAL Context dataset""" import click import shutil import tarfile import torch from tqdm import tqdm from pathlib import Path from segm.utils.download import download def download_pcontext(path, overwrite=False): _AUG_DOWNLOAD_URLS = [ ( "https://www.dropbox.com/s/wtdibo9lb2fur7...
054036d297df2ba582a63a48cbc5937436ae6ccb2acb87ef6dd550ba54887d7d
Python
3,148
92
from functools import lru_cache from codex.configuration import MIN_SYN_THRESHOLD from codex.data.neuron_data_factory import NeuronDataFactory from codex.utils.formatting import percentage, display from codex.utils.graph_algos import reachable_node_counts from codex.utils import stats as stats_utils from codex import...
3f35c87bd4ca3af6bb1b81873e0d6bdea268b8b1a91cbc696ae73bca13d256f5
Python
3,148
92
"""String constants and section identifiers for the MediaWiki HED schema format.""" from hed.schema.hed_schema_constants import HedSectionKey from hed.schema.schema_io import df_constants START_HED_STRING = "!# start schema" END_SCHEMA_STRING = "!# end schema" END_HED_STRING = "!# end hed" ROOT_TAG = "'''" END_TAG =...
480988c3e82fc811f6087b1f1409b90ccceebafea44b45d407d5531ad60cb51b
Python
3,148
88
import matplotlib.pyplot as plt import autograd.numpy as np import autograd.numpy.random as npr import autograd.scipy.stats.multivariate_normal as mvn from autograd import grad from autograd.misc.optimizers import adam from autograd.scipy.stats import norm def black_box_variational_inference(logprob, D, num_samples)...
ca44c27c6f47760390433604e9ef8c8a78ae30506b16405db6a826ceb7d0a94f
Python
3,148
113
# 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...
8334c43feae58abbd93706921d1d2efa2dcf3575b2d23032651183d6d1d54f54
Python
3,150
115
# -*- coding: utf-8 -*- """ Created on Tue Oct 24 11:42:24 2023 @author: Dustin Garner """ import os import navis from cloudvolume import CloudVolume import flycode.mapping as mapping link = "graphene://https://prodv1.flywire-daf.com/segmentation/1.0/fly_v31" cv = CloudVolume(link, progress=True, use_https=True) p...
f2d3321989de6e334b20805c738efd5120f1dae718113c448cfdda028588ac59
Python
3,150
61
"""A spreadsheet of HED tags.""" from hed.models.base_input import BaseInput from hed.models.column_mapper import ColumnMapper class SpreadsheetInput(BaseInput): """A spreadsheet of HED tags.""" def __init__( self, file=None, file_type=None, worksheet_name=None, tag_c...
a84d2992753011ac1ef70af4fc57f68706325a93e47972422b48615f9a9290b2
Python
3,151
105
import sys import random import os import argparse import sys import pwd import time import subprocess import re import shutil from sklearn import metrics import re from sklearn.metrics import roc_curve,roc_auc_score import numpy as np import glob import logging import io import tensorflow as tf #from callbacks import...
bc35e24c0258f7e10a106ba8e337f91ae7248f44e94c5695fba9427ae6cb061b
Python
3,151
103
import numpy as np import torch from pathlib import Path def mse(a, b): return np.linalg.norm(a.copy().flatten() - b.copy().flatten()) class Tokenizer: def __init__(self, observations): self.codebook = np.zeros((0, *observations[0].shape), dtype=np.int16) for o in observations: ...
0020875b24f058590c0d93392c13b4e8ceffecf46e41dfbc237d1fe16fcb179d
Python
3,152
105
# Node-group asset "Color Atomic Number" (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_CH...
00c7fdae6fb5ce6c84a31a89b5fe3e8bd7bc58f0700f63a513cc46e6b6c6829e
Python
3,152
91
#!/usr/bin/env python """ Creates a PDF figure from hexbin histogram data calculated by ex_Hexbin app (BioShell example) USAGE: ./make_plots.py data_hex [x_min x_max [y_min y_max]] """ #python make_plots.py outputs_from_test/LEU_rotamers.dat -180 180 -180 180 3.6 import math, re, sys, matplotlib import matpl...
48a175f4c07a31f00e28958c3bce9340de41593ce957afb3a9c7e4332cf530c3
Python
3,152
97
import subprocess # import pprint import re import platform # import distutils.spawn import os import shutil import sys ISPY3 = sys.version_info >= (3, 0) PrettyOutput = False def get_gpu_memory_free(): nvidiasmi = 'nvidia-smi' memtotal = [] memfree = [] # check if nvidia-smi exists # if distuti...
985bbd993e7b7de2e3c4437a7994e2773b9ffa82630297e6f0f54788a4145d3e
Python
3,153
105
# 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...