sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
7cb02f8d7fe572129f1ae9d77ae5faa7d23a1e5a6b1d43fdb716875482121435
Python
3,212
117
# Node-group asset "TEM Rotation" (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 ...
d238b359c08930444c853ff80183825589bd120ab6861cb63ff8fbec328e13e8
Python
3,213
70
import argparse from matplotlib import pyplot as plt import pandas as pd import pytorch_lightning as L import seaborn as sns import sys # local imports sys.path.append("..") from shapelearningtheory.datasets.multi_shape_dataset import * from helpers import train_and_validate, unpack_results, \ create_save_path, get...
83a919c6b76249ee0ca0b69c2b1b4bb542e0b097e39721a6337bd5b77ddc64ad
Python
3,214
134
import os from logging import root import numpy as np from topaz.utils.data.loader import (ImageDirectoryLoader, ImageTree, LabeledImageCropDataset, LabeledRegionsDataset, SegmentedImageDataset, load_image, ...
9497e9d9aa488404adccd78d6726f4a14f95a6a272db6e20df374f580dbc54aa
Python
3,214
77
# By Shuran Liu, 2023 import numpy as np import torch def interval_confidence(mu_list, b_list, epsilon, num_dropout_ensembles=1): mu = np.mean(mu_list,axis=0) mu_stack = np.tile(mu, (num_dropout_ensembles, 1, 1)) mu_stack = np.stack(mu_stack, axis=0) left = laplace_cdf(mu_stack - epsilon, mu_list, b_li...
dda22ccb581b39d264ebd26a15b2b9bb5ee7da181a0e1f87d699802ef482be60
Python
3,216
92
# # 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,...
cb4bebd8870c9982de0d8bd9b65f49ff554c6f1be2b3d8587ad4293348a76890
Python
3,217
112
from typing import Callable, Protocol, runtime_checkable import torch from torch import Tensor from torch.nn import Conv1d as _Conv1d from torch.nn import Module def _create_weight_for_conversion_as_twos_complement(bits: int) -> Tensor: return torch.tensor( [[-(2 ** (bits - 1))]] + [[2**i] for i in rever...
0421ce8485810464e2e33a88ff39a3e7814e5d7c2204bae0d908174f61c12d11
Python
3,218
82
"""Portable session recordings and offline replay, requiring no model load.""" from __future__ import annotations import json import math from copy import deepcopy from datetime import datetime, timezone from pathlib import Path from typing import Any FORMAT = "liquidaion-observatory-v1" def _validate_finite(value:...
f7ae33067a923a019006e09c17b6bf9679686497098f66a725294f69602e59b3
Python
3,218
98
# 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...
5f7de54cc30a73df20467e90755eee0c1ba2d36cda8ff4ea7e23383addfef333
Python
3,219
99
"""Tests for conformer generation. Author: Seth Axen E-mail: seth.axen@gmail.com """ import os DATA_DIR = os.path.join(os.path.dirname(__file__), "data") SDF_FILE_COMPRESSED = os.path.join(DATA_DIR, "ritalin_nonplanar.sdf.bz2") SDF_FILE_UNCOMPRESSED = os.path.join(DATA_DIR, "ritalin_nonplanar.sdf") class TestConfor...
ddc5d051b1058c40fc3837d537a0620e090f82d9daee2d24302122f753180378
Python
3,219
127
from __future__ import division # coding: utf-8 # In[2]: # In[1]: from builtins import range #from past.utils import old_div from operator import floordiv as old_div import numpy as np import scipy from scipy import ndimage import math import cv2 import copy from cvc import cvc import sys import os # In[ ]: ...
1060ca4b453af562d5d36f2a59c3674e78bc02372c17176ef3341b7d61cd210c
Python
3,220
99
import os import requests import hashlib from tqdm import tqdm def check_sha1(filename, sha1_hash): """Check whether the sha1 hash of the file content matches the expected hash. Parameters ---------- filename : str Path to the file. sha1_hash : str Expected sha1 hash in hexadecimal...
23fa1601a7c03cb981e13d64a1c07e5929a22bf80b6509b51420c56a45820711
Python
3,220
101
from hed.schema import from_string library_schema_start = """HED library="testcomparison" version="1.1.0" withStandard="8.3.0" unmerged="true" '''Prologue''' !# start schema """ library_schema_end = """ !# end hed """ default_end_lines = """ !# end schema """ required_non_tag = [ "'''Unit classes'''", ...
35870cf362798d96bf201521f5f52575c602b210ded4be2bc263c8ca0d24466b
Python
3,220
87
import gzip import shutil from pathlib import Path import pytest from nodebpy.nodes.geometry import RealizeInstances import molecularnodes as mn from molecularnodes.nodes.geometry import EnsembleInstance from .constants import data_dir from .utils import round_significant cellpack_dir = data_dir / "cellpack/petworld" ...
3a8999bcd10facb3bffb45ef4cf03b38525eb3a3706d66ec72afe111bf5b74eb
Python
3,220
51
"""MF_AUDIT.py 2026-09-30. Pre-registration: 04-NOTES/PREREG-2026-09-30q-MF-AUDIT.md The parameter-free rate theory of MEANFIELD.py on the whole brain (Shiu et al.'s file): does it reproduce the spiking BRAIN_AUDIT (13 senses x 4 sign sets)? usage: python MF_AUDIT.py""" import sys, os, time, hashlib sys.path.insert(0...
8a6651fd419a022fbd1f559e0c035b8486a20f297fded57eeee70896e17e19ec
Python
3,220
128
from __future__ import print_function import glob import os import sys from skimage.transform import resize from skimage.io import imsave import numpy as np from keras.models import Model from keras.layers import Input, concatenate, Conv1D, MaxPooling1D, Conv2DTranspose,Lambda from keras.optimizers import Adam from ker...
78bcb5f99d3f8fea4efd1ca15fbfac8086cc390391af1690c8b6c15d2b171711
Python
3,221
88
from torch.optim.optimizer import Optimizer, required import torch class SGLD(Optimizer): """ RMSprop preconditioned SGLD using pytorch rmsprop implementation. """ def __init__(self, model, params, lr=required, norm_sigma=0, alpha=0.99, eps=1e-8, centered=False, addnoise=True, Exp=None): wei...
f48d794b6061d36851ad7fb2ae1a75cb046d1ed8f9099c2a22562c39f661bf07
Python
3,221
93
import os.path from src import settings import src.data.handler as data_handler import torch import itertools import numpy as np def sigmoid(z): return (1 / (np.exp(-z))) - 1 def calc_weigths(fmri_data, min_weight=0.0, max_weight=2.0): weight = sigmoid(np.abs(fmri_data)) # calc 0 based sigmoid weight...
42467c217aac6788b70d36ed2f9b2e2d86aa4cfc5a5edb174bc37faa473ecd42
Python
3,222
96
"""Perform and save time frequency analysis of given files.""" from __future__ import annotations from pathlib import Path from typing import Annotated, Literal import numpy as np import pte from pytask import Product import motor_intention.project_constants as constants STIM = ("Off", "On") OUT_DIRS = {stim: const...
48413f688cef06fd00c92167599ed75cc8322d9735e533968d34c98f1e62370d
Python
3,222
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...
a42778dac112523fdef5c25b09b401377bb6e577310c6cd32180777afaf5d2b0
Python
3,223
61
# 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...
b90378a89fe5e40465bdb18542d4ecd32cd3bf1e07e557ea849e5f01060d86bd
Python
3,223
81
"""Shared random-weight tiny-transformer fixtures: software tests, not scientific evidence.""" from types import SimpleNamespace import pytest import torch from transformers import Qwen3Config, Qwen3ForCausalLM from liquidaion_fly.observatory_engine import ObservatoryConfig, ObservatoryEngine QWEN_REVISION = "c1899d...
c596968f1b3028fa471c96dc40091070d22cbd27066d7992618e0562c062a3cd
Python
3,223
103
import h5py import numpy as np import torch from torch.utils.data import DataLoader, TensorDataset import torch.nn as nn import torch.optim as optim import torch import torch.nn.functional as F from torch.optim import Adam # I copy Variational_autoencoder_train.py to this, and save the model as MoS2_model.pth for cle...
3bb863db8b549863a45826dc483ccd47834e936c1ffbfc725f8eee86d7d10ba5
Python
3,224
88
#! /usr/bin/env python3 import os import subprocess import logging import APT_interface class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path): self.path = path def __enter__(self): self.old_path = ...
993996a4097d7978694f80f236ebf3173176c6e0c4078ebfba8f26eeadc1a100
Python
3,224
92
""" Functions computing similarity & dissimilarity between spike trains @author Iris Yoon iris.hr.yoon@gmail.com """ import math import numpy as np import random from itertools import combinations from scipy.signal import correlate # compute distance between neurons from raster def pair_similarity(raster, neuro...
eefa5f5444112dc254a6daf2a67cca2736132e0520e36f742b19848523d5f620
Python
3,224
82
from pathlib import Path def load_deepmd(fdict_or_fpath, type_map=None, pbc=True, shuffle=True, seed=0): """This is loader for deepmd input data. It takes a dict of key and file path or a directory path which contains the data files. If `type_map` is provided, it will be used to convert the type id to atomic num...
8fd80f599ce4578a9be018292a339c69a72dc7e9774e1520ae75b7b1fa8d3487
Python
3,225
99
from pathlib import Path import tempfile from unittest.mock import MagicMock import pytest import numpy as np import pandas as pd from scipy import sparse import nibabel import nilearn from nilearn.datasets import _testing from nilearn.datasets._testing import request_mocker # noqa: F401 def make_fake_img(): r...
e9d702a6b31e1ea8108ddbaacaf9a83935fa3f2afb832d6d6bb2c5b288832b92
Python
3,225
102
# 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...
fbdcc10405d4ed7e5cf83c0a2ed30aa4ce690404df17897c87a029a03665406b
Python
3,225
88
import os.path import zipfile from ckg.graphdb_builder import mapping as mp, builder_utils from collections import defaultdict import pandas as pd ############################### # Exposome Explorer # ############################### def parser(databases_directory, download=True): directory = os.path.join...
9b1ce1d3bba6657dc30eae8bd3dba0581136b6152b90dbc0ace19187c407c749
Python
3,226
65
#!/usr/bin/env python import os import pandas as pd import matplotlib.pyplot as plt from nltools.data import Brain_Data from nltools.mask import expand_mask, roi_to_brain from nltools.stats import threshold from nilearn import plotting as nplot ## location of main project directory on HPC proj_path = '/project/30111...
c109e960d36a0f27a2b6034e75add2d0e1222f32ee493f2ea3cf7cc0e1237454
Python
3,226
78
import os import numpy as np import SimpleITK as sitk from tqdm import tqdm from .sitk_tile import sitkTile from yacs.config import CfgNode from tiffile import imread, imsave def computeTform(cfg: CfgNode): ''' Compute a transformation map for the anchoring channel ''' # basic settings m_trans...
c90563ca1585854a7327a3383bf142d3cbf8de197b1a4ac262efd867a98418c7
Python
3,227
96
""" MoCHI misc module """ import sys from numbers import Number from collections import deque from collections.abc import Set, Mapping from matplotlib import pyplot as plt import numpy as np import itertools def getsize( obj_0): """ Recursively iterate to sum size of object & members. :param obj_0: ...
718c9c0a5881575b20ec1dc5b2d7cc754f8643885f3b3bf864a465894dcd59d5
Python
3,228
75
import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable class FCLayer(nn.Module): def __init__(self, in_size, out_size=1): super(FCLayer, self).__init__() self.fc = nn.Sequential(nn.Linear(in_size, out_size)) def forward(self, feats): x = s...
e1501f3fbe89d563e4ea31f9b1b297cc003be4e9414bde2077211cd76cda9667
Python
3,228
111
import torch from diff_frech_mean.frechetmean.utils import (EPS, arcosh, arsinh, artanh, cosh, divsinh, sinh, sinhdiv, tanh) from .manifold import Manifold class Lorentz(Manifold): def __init__(self, K=-1.0): super(Lorentz, self).__init__() assert K < 0 if...
66c6143a1152230f1d74dc16ce28276cdef3b0c317594079d45dbe77a527473a
Python
3,229
75
"""Read metadata provided as a dataframe. This module provides functions for reading metadata """ import pandas as pd import xarray as xr def add_metadata(epoch_data: xr.Dataset, df: pd.DataFrame, recording_id: str = 'recording', epoch_id: str = 'epoch' ...
a34f8f158b460820bef0a75b907a68cea8e7f3e9abb077179833921d831c653b
Python
3,229
80
"""Analysis parameters ---------------------- A dictionary with parameters defining the network analysis. """ import numpy as np ana_dict = { # dtypes for reading ASCII files from NEST, file extension: .dat 'read_nest_ascii_dtypes': { 'spike_recorder': {'names': ('nodeid', 'time_ms'), ...
1fb9219e226282590d6ebdc521404ff858e41e058f0ddd0849abd3d2d33879bf
Python
3,230
84
from elasticai.creator.file_generation.savable import Path from elasticai.creator.file_generation.template import ( InProjectTemplate, module_to_package, ) from elasticai.creator.vhdl.auto_wire_protocols.port_definitions import create_port from elasticai.creator.vhdl.code_generation.addressable import calculate...
649e7076dba4df9ea2de2a61de8ab6633b4aa129d4aa4887fb6e0aec1d6cb061
Python
3,230
92
#!/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]] """ import math, re, sys, matplotlib import matplotlib.pyplot as plt from matplotlib.collections import PolyCollection import mat...
ed878830bd43a4d5df401870c269ecbbe6a88c65b5b4d9531defb3786d1a8b2e
Python
3,230
97
import sys,argparse from pybioshell.core.data.io import find_pdb, read_scorefile from os.path import expanduser, join home_dir = expanduser("~") # It is assumed VisuaLife library is installed in your $HOME/src.git/visualife/src/ directory sys.path.append(join(home_dir, "src.git/visualife/src/")) from core.Plot impo...
ba6465aae78ed71cf9708d68163a84890f7a02fbd66d113fc8208bb6f21f1ea2
Python
3,231
43
"""MEASURE_NEXT.py 2026-10-01. Descriptive (no test, no pre-registration): which antennal-lobe local-neuron types should a laboratory stain next? Types without a laboratory transmitter label, ranked by output synapses, with the published sign, the classifier's call and the margin left before the balance line (PHASE_MAP...
ca31a19a1d320457e1455cfa7a2769ec61ba5f5c4b72e09d7b78bf825b6ac1a3
Python
3,231
80
''' Description: Pre-processing of Waddington-OT/Schiebinger2019 (SC) data. ''' import scanpy import numpy as np import pandas as pd import matplotlib.pyplot as plt # Change file directory to the raw SC data days_df = pd.read_csv("./raw/cell_days.txt", index_col='id', sep='\t') adata = scanpy.read_h5ad("./raw/Expr...
e5f8e40cc54a182cdca8338a54b3bd8a0bda417ba9159e1bb68876f2f1c88a09
Python
3,231
76
import nibabel as nib import glob import argparse import matplotlib.cm as cm import matplotlib.colors as mcolors import matplotlib.pyplot as plt import matplotlib.ticker as ticker import numpy as np # Argument parsing parser = argparse.ArgumentParser(description='Plot lesion frequency maps.') parser.add_argument('--t...
f0b0d14b7808fc1c1177b3c89befba9b5215c66ec610ab54c22f63e296b3dfce
Python
3,231
114
import h5py import click import numpy as np import pandas as pd @click.command() @click.option('--score', 'score_file', required=True, type=click.Path(exists=True, readable=True), help='Score h5 file sequences') @click.option('--satmut', 'satmut_fi...
27434c195b17ccd3f4d6d57d55c72e323b4989b8eb529e1584d53a719e11bf82
Python
3,232
88
import sys sys.path.append("../../../../pylib") from pathlib import Path import os import numpy as np import pickle from scipy.spatial import distance_matrix import matplotlib.pyplot as plt from multiprocessing.pool import Pool def get_matrix(pts): pts = np.array(pts) # make a grid, points in the grid and ne...
425b21b31adf0b488c7dad6cd824770bd29976b50d7a44580cf38323b38f737c
Python
3,232
75
import sys import gzip chro_order=[] for i in range(1,24): chro_order.append('chr'+str(i)) chro_order.append('chrX') chro_order.append('chrY') chro_order.append('chrM') chro_order='1 2 3 4 5 6 7 X 8 9 10 11 12 13 14 15 16 17 18 20 Y 19 22 21'.split() fn1=sys.argv[1] fn2=sys.argv[2] sample_name1=fn1.split('_')[...
e43fa89be10a36f664a89c50ade98307c9de4dd397151be343b17f8842cf1b0e
Python
3,232
90
""" Create saliency map of training samples to visualize what model looks for in input """ import matplotlib.pyplot as plt from matplotlib.collections import LineCollection import numpy as np import torch from src.model import ModelSpikeSorter from src.data import MultiRecordingDataset from src import plot, utils MO...
5ea2c9838292e9d39e2cbc3a3c129a0c9abb57e14e8b3fec3fb0f0e107ffbdab
Python
3,233
101
# Node-group asset "Fallback Matrix" (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_CHECKI...
68c2b08477f6eedb923821ebfda0373436844441235cfea9f2dce426d055a5ee
Python
3,234
115
# ---------------------------------------------------------------------- # Copyright (C) 2014-2015, Numenta, Inc. Unless you have an agreement # with Numenta, Inc., for a separate license for this software code, the # following terms and conditions apply: # # This program is free software: you can redistribute it and/...
01b73730b7a9892872b4b1f0fcf60e3d6a797e752fbbe77b83fb69b966e8bd4b
Python
3,235
93
import numpy as np import matplotlib.pyplot as plt import pandas as pd import seaborn as sns sns.set_theme(context="talk") def xavier (Nout,Nin): return np.random.rand(Nout,Nin) * np.sqrt(6/(Nout+Nin)) #Setting seed to produce the same figure as in the paper np.random.seed(0) #Setting network size ...
8639b4514c5e203a2f7475218f1c78a7b5123732e8f08cb260dcf743d6e0f0a1
Python
3,236
102
import os import pandas as pd from calvados.cfg import Config, Job, Components import subprocess import numpy as np from argparse import ArgumentParser from scipy.constants import Avogadro def get_number_PEG_chains_wv(wv_fraction, mw_peg, volume_simulation_box): """ wv_fraction: weight/volume fraction in g / 100 m...
072f6399788d5f47781d7085e679896925125545bfb67dd9a5940360e2077c95
Python
3,237
83
import os import netCDF4 import numpy as np from simtk import unit DATA_DIR_PATH = os.path.join('..', 'SAMPLing', 'Data', 'BarostatData') YANK_VOLUMES_DIR_PATH = os.path.join(DATA_DIR_PATH, 'YankVolumes') EE_VOLUMES_DIR_PATH = os.path.join(DATA_DIR_PATH, 'EEVolumes') # =============================================...
6c77e34c1e4eb24506f9c48a64937e8473262c2f55a068c57cad0d74d208c127
Python
3,238
100
"""Module to reject bad channels and bad epochs. """ from logging import getLogger lg = getLogger(__name__) def rejectbadchan(): """Class to reject bad channels. """ pass def remove_artf_evts(times, annot, chan=None, name=None, min_dur=0.1): """Correct times to remove events marked 'Artefact'. ...
7c59a2122995870b6ca7d2214b2901377801e34e5d670362da1af075840d3e86
Python
3,238
145
import pickle import scipy.io as sio import matplotlib.pyplot as plt import os import pandas as pd import json def format_global(value): if (value >= 0.8): return "{}d".format ( round ( value, 1 ) ) elif (value < 0.8) and (value >= 1 / 24): return "{}h".format ( round ( value * 24, 1 ) ) ...
6ee69ab8d144316eb420e46c22492dd221f4ec8b6906e5a295df1ff5716fa686
Python
3,239
72
import urllib.request import argparse from tqdm import tqdm import zipfile import shutil import os class DownloadProgressBar(tqdm): def update_to(self, b=1, bsize=1, tsize=None): if tsize is not None: self.total = tsize self.update(b * bsize - self.n) def download_url(url, output_pat...
a7efd355532e24aa1733012b3a94a2772842a6dae9e5bd68f8baab9eac25ef52
Python
3,239
111
'''MobileNet in PyTorch. See the paper "MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications" for more details. ''' import torch import torch.nn as nn import torch.nn.functional as F def conv_bn(inp, oup, stride): return nn.Sequential( nn.Conv3d(inp, oup, kernel_size=3, stri...
aec7fd71f918cadba72d659b4d9898c11839b5a5adf44427019f5406dd9009e4
Python
3,239
102
# -*- coding: utf-8 -*- # # Test spy.concat function # import pytest import numpy as np # Local imports import syncopy as spy from syncopy.shared.errors import SPYTypeError, SPYValueError class TestConcat: nTrials = 10 nSamples = 100 nChannels = 2 nFreq = 5 nTaper = 4 def test_ad_concat(s...
bcca94c2cbde14c04ec296ed3807aa265fa10dab9b5f6fb3c0c04e3bfc78cceb
Python
3,239
88
#! /usr/bin/env python3 import os import subprocess import logging import APT_interface class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path): self.path = path def __enter__(self): self.old_path = ...
20596ead6e2690288a8180faaf02eac2e8b36ea4c9e487117da8764aa5638a87
Python
3,240
114
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Initialize LDS model Created on Thu Jun 13 2019 @author: jmagraner """ # %% import autograd.numpy as np import autograd.numpy.random as npr def initparams_random(specs,*unused): sc=0.01 ndim, tdim, mdim, cdim, cxdim = specs['data dims'] udim, ...
d743740a37b86e2c34213a7cf92c14094bfb66059cb4f6ea083c26dad1c1a601
Python
3,240
77
import argparse from matplotlib import pyplot as plt import pytorch_lightning as L import seaborn as sns import sys # local imports sys.path.append("..") from shapelearningtheory.datasets import make_dataset from shapelearningtheory.networks import make_vit_b_16 from helpers import format_table, train_and_validate, unp...
4b1a69c80b374e22f9bfb2b1e4b214e8d00545c195e420157976eac9dfa2a87b
Python
3,241
103
"""Utilities for k-point handling.""" from __future__ import annotations from typing import TYPE_CHECKING import numpy as np from pymatgen.io.ase import AseAtomsAdaptor from pymatgen.io.vasp.inputs import Kpoints from pymatgen.symmetry.bandstructure import HighSymmKpath if TYPE_CHECKING: from ase.atoms import A...
abf3989afa380e2c63da35474e97cc247e084ac61dcea4243722bf4bb59bc365
Python
3,241
98
# -*- coding: utf-8 -*- """Evaluate detected communities using NMI and element-centric similarity.""" import sys import numpy as np import pandas as pd from scipy import sparse from sklearn.metrics.cluster import normalized_mutual_info_score if "snakemake" in sys.modules: detected_group_file = snakemake.input["d...
191dda77e23fc6ed348e29d3f41670fc828a0adf76de90a58869b287eca2d567
Python
3,242
97
"""Constructor for spin-echo sequence to measure global T2 relaxation.""" 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( echo_time_range:...
ce26cc560e51a4a6fe304f7fec4606e1933649fd3b347710cd9d7653ead8261a
Python
3,242
112
""" Script which takes one or more file paths and reports on their detected encodings Example:: % chardetect somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 If no paths are provided, it takes its input from stdin. """ import argparse import sy...
da50bd404811da8ce2cf4271add33afc03f52b190062432edaf06da89b4b873e
Python
3,242
102
import pytest from elasticai.creator.testing.cocotb_func import ( all_within_tolerance, error_count_outside_tolerance, is_mae_within_tolerance, ) @pytest.mark.parametrize( "result, expected, tol, passed", [ ([1, 2, 3], [1, 2, 3], 0, True), ([1, 2, 3], [0, 3, 4], 1, True), ...
10a6cd2cb0b141de8aef16864f961aa4edff0cb40436de22544af9523e571cf7
Python
3,243
101
#test that commands can be imported and arguments parsed def test_main(): from topaz import main try: main.main() except SystemExit: #no commands are passed, so we call sys.exit pass def test_train(): from topaz.commands import train parser = train.add_arguments() args...
f4ac88de15ae1699103f8445977ba288cbb12355ee55322b9bb5b252f0c158bc
Python
3,243
77
# # 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,...
0ebfbc4dd3d1645c61ac1d9b7ce014dd51b8dd81eae8d483d37abbf40098aa99
Python
3,244
83
"""Test Robust Reference.""" from unittest import mock import mne import numpy as np import pytest from pyprep.reference import Reference @pytest.mark.usefixtures("raw", "montage") def test_basic_input(raw, montage): """Test Reference output data type.""" ch_names = raw.info["ch_names"] raw_tmp = raw.c...
1f469f2565bb538ac39e8e96b273de1cda1469002c775278001d4d39cf13e45a
Python
3,244
110
from typing import Any class MWApiError(Exception): """ Base class for MediaWiki API error handling """ error_dict: dict[str, Any] code: str info: str messages: list[dict[str, Any]] messages_names: list[str] @property def get_conflicting_entity_ids(self) -> list[...
df4dac81c4e9a0b65d8e74bca9c3febc45b835f3b825fbdf5bff74a17920c760
Python
3,244
77
# SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL # # SPDX-License-Identifier: AGPL-3.0-or-later ''' Utitly functions in ordder to add activity based node property conn ConnetivityMatrix objects for BBP and MICrONS Author(s): Daniela Egas S. Last update: 02.2024 ''' # General import numpy as np import pand...
5f0f41c7115839f8be814da1f9cba186320407d209e016120ef552f1d4e7ce4e
Python
3,245
112
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Aug 11 10:45:28 2023 @author: felipe #WC-Kuramoto """ import numpy as np import matplotlib.pyplot as plt from numba import jit,float64, vectorize from numba.core.errors import NumbaPerformanceWarning import warnings warnings.simplefilter('ignore', ca...
eac555671160b6dffea4488e659ed028f2daddbc29c902b6ea9f6d84861f37d6
Python
3,246
92
"""The 2D preview applies the enabled intensity preprocessing (what ANTs sees).""" 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) os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") i...
63a18e135093f1aa9fb7736fba495c61202a0da377c0885e7248aba02b49adb7
Python
3,247
121
# 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...
0d56eef98f7724482ea4d064b2255fb400c7609573eefb3f5188e9d88327b547
Python
3,248
96
from __future__ import annotations import re from typing import Any from wikibaseintegrator.models import Claim from wikibaseintegrator.wbi_enums import WikibaseSnakType class BaseDataType(Claim): """ The base class for all Wikibase data types, they inherit from it """ DTYPE = 'base-dat...
88b4bb3c31ffc32ca2d9f50ed5ffd6c1e92cca26741eb581b2f3c6019b707475
Python
3,248
118
""" Script for growing a binary segmentation the specified nm Input: - Segmentation - Distance to grow Output: - Grown segmentation """ __author__ = 'Antonio Martinez-Sanchez' # ################ Package import import sys import time import getopt import operator import scipy as sp impor...
9b598c736aacc389a7f9eda685024cd29363fd9f5b3cfbedd1f42f85c731a549
Python
3,249
90
# this set of functions primarily developed as utilities for the cryovesnet package import numpy as np import napari import mrcfile from .unetmic.unetmic import interactive import sys from pathlib import Path def query_yes_no(question, default="yes"): valid = {"yes": True, "y": True, "no": False, "...
714fbee15c51df37d788001e20e9d582d9c62863e0535f77f4d94d211cdb7a3f
Python
3,250
122
# Node-group asset "Flat Internal" (ShaderNodeTree), 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, ...
96f08000e9ff29bebd8e3c79d491db2deffd39c5eb69c2a4be344fb6569e09f8
Python
3,250
39
"""FIG_TWO_WAYS.py 2026-10-08. Report figure F19 (two ways to fail), from REST_STATE (prereg 08e): (a) the phase diagram — background drive b (x Hallem resting rates) against the excitatory share s of the local neurons' synapses onto uPNs; each sign set marked fly-like (quiet rest and >= 40/50 channels), spread (quiet ...
57763fc68ed73d454dfe55d534145094da04e3e48bdf74becc2b6383f6f043b0
Python
3,251
61
def set_up_net_connection(self, connect_file): self.input_synapse = [None, None, None, None] circuit = pickle.load(open(connect_file, 'rb')) for post_neuron in circuit.neurons: # for each post neuron id_post_cell = post_neuron.index if (id_post_cell > 0) and (str(id_post_cell) not in self.c...
a20d9c36e4491dccf9ed7bbcca65cffc8fce0274edac81eb24e7c93ef7566d92
Python
3,251
74
import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from skimage.transform import resize import matplotlib import numpy as np import comparison_datasets import torch plt.rcParams.update({'font.size': 20}) color_map = matplotlib.colors.LinearSegmentedColormap.from_list("", ["blue", "white","red"]) ...
24ac5632714d865e3c8be62a2cb36128fd96e83c893608a09cc80da8e4e039a5
Python
3,252
102
""" Filter rows in a STAR file by column Input: - STAR file - Column filter setings Output: - A copy of input STAR file where some rows can be filtered """ __author__ = 'Antonio Martinez-Sanchez' ###### Global variables import pyseg as ps key_col, key_img = '_rlnClassNumber', '_rlnImag...
841802655718ce7a164aac64222a4b1d600d6a8c47bdff77bdc5d2784deccade
Python
3,252
82
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import suites from lab.reports import Attribute, gm from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport def main(revisions=None): benchmarks_dir=os.path.expanduser('~/projects/downward/benchmarks') ...
d9aabcfd0f9261d8fd2beeb8f0cbdaba7af8e7ead9fdd58182d7af162975cbcb
Python
3,252
82
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import suites from lab.reports import Attribute, gm from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport def main(revisions=None): benchmarks_dir=os.path.expanduser('~/projects/downward/benchmarks') ...
ec416fbf27ed15e7e03f03f4fc0978db90891973a9a554af7230eacfe49b2d67
Python
3,252
91
import numpy as np from scipy.stats import gamma def ridge_regress_deconvolution(BOLD: np.ndarray, TR: float, alpha: float = 0.005, NT: int = 16, xb: np.ndarray = None, ...
052c449da7ac76be7ea483e634a1fa00230adf834f3b702a6f34aa70e32b2604
Python
3,253
114
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...
d5eadf45472e97a5dcc88aade7fe929f0317794618a1ea499a3b665efd3a0c9c
Python
3,253
98
"""Plotting methods.""" import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np from console.interfaces.unrolled_sequence import UnrolledSequence def plot_unrolled_sequence( sequence: UnrolledSequence, time_range: tuple[float, float] = (0, -1), ) -> tuple[mpl.figure.Figure, np.ndarray]: ...
e2e893ae70736a387e92c6f3297a95a4441a280b11bad3fb60c19d17c39d70e6
Python
3,253
108
# 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...
300e3424498e1e17b554d84483012b7dd31aa4b61d67f307960d2a2546c5fb2f
Python
3,254
115
# %% import sys import os sys.path.append(os.path.abspath("../..")) sys.path.append(os.path.abspath("..")) sys.path.append(os.path.abspath(".")) # %% import torch import pandas as pd import numpy as np from pathlib import Path import matplotlib import matplotlib.pyplot as plt import seaborn as sns from prosper_nn...
43877ffbf63ff06c5a10e9e074144367e089e9b83add5040e2b40cd7eab783e5
Python
3,254
80
#!/usr/bin/env python from __future__ import print_function import argparse import os import numpy as np from examples.pybullet.utils.pybullet_tools.pr2_problems import create_floor, create_table from examples.pybullet.utils.pybullet_tools.pr2_utils import get_top_grasps, get_side_grasps from examples.pybullet.utils...
8df5ad4b11689764fe45ad4bc86a2079327aa24d60d8e143f2cf809c30b2d1af
Python
3,254
52
def extract_params_f(df, filter_by): param_cols = None if filter_by == 'BDLMapper' or filter_by == 'NeuMapper' or filter_by == 'EucNeuMapper': df['K'] = df.apply(lambda x: int(x['Mapper'].split('_')[1]), axis=1) df['R'] = df.apply(lambda x: int(x['Mapper'].split('_')[2]), axis=1) df['G'...
fd36ae0c18c13fc23c2c2dc701547be8cd81c6b6f31d86fc4c36ac75cf765dce
Python
3,254
119
""" Script for running object detection inference on a directory of images using a pre-trained Tensorflow Hub detector and saving to CSV in either: - Tensorflow Object Detection API format - Open Images Kaggle Competition format | Copyright 2017-2022, Voxel51, Inc. | `voxel51.com <https://voxel51.com/>`_ | ""...
b432973615b4a5de1a392e2d6de595df3756f971d4480ff397d64111d062755e
Python
3,255
124
import sys, os from pandas.io.parsers import read_csv import numpy as np import pandas as pd from collections import Counter try: bedintronfile=sys.argv[1] bedexonfile = sys.argv[2] output = sys.argv[3] except: sys.exit("Please, provide input bed (1) intron and (2) exon files; (3) output file") def ge...
db0128e5adb1647ddf7dc67e1edac890839c0f0442a5490b072823e0f236ea21
Python
3,255
103
""" Shared utility functions for schema tests. Provides helper decorators and functions for creating temporary files and schema folders in tests. """ import functools import os import shutil import tempfile from hed import schema def get_temp_filename(extension): """ Create a temporary filename with the gi...
409ebad80fc432ede66f3f12fab7cd458c5112c2894fbe2418e8b6036ebcf0fc
Python
3,256
96
import torch import torch.nn as nn import math class InstanceLoss(nn.Module): def __init__(self, batch_size, temperature, device): super(InstanceLoss, self).__init__() self.batch_size = batch_size self.temperature = temperature self.device = device self.mask = self.mask_co...
69ed96f41aa4a38f387bf4abe5a0a869995b2f7c77f88fa319cb76591d2d7ef5
Python
3,256
92
"""""" """ 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...
8e8adbb3e89f0444ce42277aa215fcfb999d710872c5e3f948a77eb0ae28fe27
Python
3,256
58
"""D02_RADIUS_X_SIZEMATCHED.py - written 2026-09-04. VERIFY V-62. Does the optic/central gap still grow with the clustering radius after matching on synapse count? Reads tmp/d02/radiussweep.parquet (build it with D02_DECAY_AND_ORIENTATION.py sample, scan, radiussweep first). Output: 06-OUTPUT/d02_radius_x_sizematch...
b20307118171a7fd060652a1fd2558a57c4ab7836ba836baa5302c06881896e5
Python
3,256
91
# coding=utf-8 # Copyright 2021 The Facebook Inc. and The HuggingFace Inc. team. 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/LI...
5c9d8b3abc85a3186a28b4dfb88892acd6240db4ed383cd089072212c3eee824
Python
3,257
97
import subprocess import logging import shutil import re import glob import shlex def find_files_with_string_in_name(directory_path, string_in_name): # This pattern will match any files that include the specified string in their names # '**' allows for searching recursively in all subdirectories pattern = ...
991fb3b284ded07622b68814e928901b3dda561824f0e8b7242f53cf145ea7bb
Python
3,257
94
import numpy as np from bayes_opt import BayesianOptimization, acquisition from sklearn.ensemble import GradientBoostingClassifier from sklearn.datasets import load_digits from sklearn.model_selection import KFold from sklearn.metrics import log_loss import matplotlib.pyplot as plt N_FOLDS = 10 N_START = 2 N_ITER = 25...
1af1e0e8f4aacddd01924d9b8f5d4eb55f5f3c0e508d9e4630bc63917069433c
Python
3,259
89
#! /usr/bin/env python3 import os import subprocess import logging import APT_interface class cd : """Context manager for changing the current working directory, and automagically changing back when done""" def __init__(self, path): self.path = path def __enter__(self): self.old_path = ...
62c16334174d1aaf9ed3d48cfb93256e3d96a5a1648a77e4efcdc6919fe54cc8
Python
3,259
96
from collections import defaultdict from functools import lru_cache from codex.utils.graph_algos import pathways def sort_layers(node_layers, cons): # layers: {i: [nodes in layer i]} layers = defaultdict(list) for node in node_layers: layer = node_layers[node] layers[layer].append(node) ...
635bbc0bc8f76b22b13d235cf7d657e4905703abfc0d1e20551bfc1696bd6630
Python
3,259
107
from vtk import vtkPolyData, vtkCellArray, vtkPoints, vtkPolygon from vtk import vtkPLYWriter, vtkDecimatePro, vtkSmoothPolyDataFilter, vtkPolyDataNormals import numpy as np def ndarray2vtkMesh(inVertexArray, inFacesArray): ''' Code inspired by https://github.com/selaux/numpy2vtk ''' # Handle the points & ver...