sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
9bb5352a820fb3eca78295373e4adc4f65c535b8cd021ca0a4f18e6c8bf4aaeb
Python
2,185
72
"""Average classification accuracies.""" from __future__ import annotations import pathlib from collections.abc import Sequence from typing import Annotated import pte import pte_decode from pytask import Product import motor_intention.project_constants as constants CHANNELS = ("ecog", "dbs") INPATHS_STIM_OFF = tup...
afe2ea9f8622434595bd6648c1efb56f3145f005d984de41f165d10eec06b7fd
Python
2,185
81
import cocotb import numpy as np import pytest from cocotb.triggers import ReadOnly, Timer from elasticai.creator.arithmetic import FxpArithmetic, FxpParams from elasticai.creator.testing import CocotbTestFixture, eai_testbench from elasticai.creator_plugins import linear def model(x: int, bitwidth: int, frac_width:...
ed1b430441805a80276b13d267696e2e5a306fc9962581720ab8cba651ee921b
Python
2,185
76
# Node group "MN Units" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated fro...
add12c957a60a1c2c4bc636079d33db5bcd8aca62b8991eab02b1f3af0453398
Python
2,186
64
from pandas import CategoricalDtype class DotPlotAggregator: def __init__(self, var_measures, dimensions): self.var_measures = var_measures self.dimensions = dimensions def execute(self, df): results = [] # {categories:[], name:'', values:[{name:'', percentExpressed:0, mean:0}...
951a6b1bd45675c6b4be1a76a418ffb20b1ca444a904ff6697e1060ae1701b56
Python
2,187
53
# 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...
0c1c319563cf6375e91ffb3da9d6c0ba529ed90a8026e1c7bb18afbfe259d2b6
Python
2,189
67
import os import toml import logging import jobflow as jf from ase.io import read from quacc import get_settings from quacc.recipes.newtonnet.ts import ts_job, irc_job, neb_job # Load configuration from TOML file config = toml.load('inputs_using_newtonnet.toml') # Constants from TOML file REACTANT_XYZ_FILE = config['...
711dd3573ab589a543e32d25d654a44c3f1a9125f2801d3c0d4007fe768178c7
Python
2,189
46
import pickle import numpy as np from scipy.stats import norm if __name__ == '__main__': with open('../data/ID2NODE.pkl', 'rb') as handle: ID2NODE = pickle.load(handle) handle.close() CpG_island_rwr = np.expand_dims(np.loadtxt('../data/CpG_island_imputation_0.6.txt', delimiter = '\t'), axis = 1)...
05ba5e1bbcdd4178fc6b0e26543070d4c6d4bdef5a02268d84a6c2fb572d7269
Python
2,190
62
from typing import Union, Dict import numpy as np from spectrum import aryule from ..base_transform import EEGTransform class ARRCoefficient(EEGTransform): r''' Calculate autoregression reflection coefficients on the input data. .. code-block:: python transform = ARRCoefficient(order=4) ...
3ea033b7d280ad2f9fc347ebb69f86d467ac9ed44c80c757d3ce56310f1c5c90
Python
2,190
54
# coding=utf-8 # Copyright 2020 The Facebook AI Research Team 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/LIC...
aebd2bd02baa5286f93970474e6a5ca75c96ddfb409ca17d47b0d0b622b8c7ce
Python
2,190
81
class ArrayParams(): def __init__(self): self.OperationType = 0 self.OpArrayType = 0 self.OpPlsType = 0 self.TIAFeedback = 0 self.AddrArray = 0 self.BLStart = 0 self.BLCnt = 0 self.SLStart = 0 self.SLCnt = 0 self.WLStart = 0 ...
d7fd6ebccd3a5f344c2a6003b442168d0d914969a9b92f4eb64d8a19b0885484
Python
2,190
29
"""posthoc_lineage_draws_2026-10-08.py (POST HOC, descriptive). H6 of SIGN_WORLDS used 4 lineage draws. With 2,000 draws (same rule: every local neuron FlyWire leaves uncalled takes an inhibitory sign with its hemilineage's share of GABA/Glu calls), how often does the law say the antennal lobe works, and how does that ...
299c83e2445a7db4710e74e451eee4e4a58cf7491e40ca77040d19d703d5ddca
Python
2,191
106
_CODEX_DATA_SCHEMA = { # one row per id "neurons": [ "root_id", "group", "nt_type", "nt_type_score", "da_avg", "ser_avg", "gaba_avg", "glut_avg", "ach_avg", "oct_avg", ], # one row per id "classification": [ "roo...
3fd89671bc6791f3b644f49232753114b58ace560bf25651d79f976bddfafb38
Python
2,191
52
import pickle import numpy as np from scipy.stats import norm if __name__ == '__main__': with open('../data/ID2NODE.pkl', 'rb') as handle: ID2NODE = pickle.load(handle) handle.close() CpG_island_rwr = np.expand_dims(np.loadtxt('../data/CpG_island_imputation_0.6.txt', delimiter = '\t'), axis = 1)...
59361969eae733ea654af3f73c0471eab479619e0285fb2e7f4fd4213580fe4b
Python
2,191
48
import unittest import torch import torch.nn.functional as F from torch_geometric.data import Batch, Data from torcheeg.models import RGNN class TestRGNNNormalization(unittest.TestCase): def test_signed_graph_outputs_and_gradients_match_dense_reference(self): torch.manual_seed(42) adj = torch.te...
ffff2f3931a5d61281dbe5eb308eaf4891d97ff239a276616c237cc7792f9f7c
Python
2,191
98
import autograd.numpy as np import autograd.numpy.random as npr from autograd import make_vjp dot_0 = lambda a, b, g: make_vjp(np.dot, argnum=0)(a, b)[0](g) dot_1 = lambda a, b, g: make_vjp(np.dot, argnum=1)(a, b)[0](g) dot_0_0 = lambda a, b, g: make_vjp(dot_0, argnum=0)(a, b, g)[0](a) dot_0_1 = lambda a, b, g: make_...
69a79dade133c87e1e09860e023b5c6dbf920278f679da28d398edfb940ea18e
Python
2,192
55
import numpy as np import torch from specs import * from boltons.cacheutils import cachedproperty from typing import Dict class CameraSimulator: KERNEL_REPEATS = 5 def __init__(self, cam_specs: CameraSpecs): self.cam_specs = cam_specs self.rng = np.random.default_rng() @cachedpro...
ae9ab9d55f3f8a97cd1ee8b9b21e95e052c46367f3ba092e8bf47ecb1c4241b2
Python
2,192
65
from __future__ import absolute_import, division, print_function, unicode_literals import argparse import logging import os import sys import io import tensorflow as tf #import matplotlib.pylab as plt import numpy as np from PIL import Image import glob #output_dir="/projects/shart/digital_pathology/data/TCGA_MAYO/FIN...
d8c9a92c7c4e1afe89595b13fe6c36e4e4c4eef0fbe65adb3a4cf3fa401b40d9
Python
2,192
59
from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt import torch from wsilearn.compress.mtdp_encoder import MtdpEncoderWrapper from wsilearn.utils.cool_utils import can_open_file from wsilearn.dl.torch_utils import print_model_summary from wsilearn.compress.encoders import ...
f05e8b84771933ee4648994f5ba42a08263993c6313fd42e31e08432aeccfcda
Python
2,192
60
# 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...
2e8090df2f6e7e11e1d84d4727fb6b8315f0f75cea4a258fcdad1b00a1a1fa52
Python
2,193
91
import os import pandas as pd from calvados.cfg import Config, Job, Components import subprocess import numpy as np from argparse import ArgumentParser cwd = os.getcwd() sysname = 'mixed_system' # set the side length of the slab box Lx = 15 Lz = 80 # set the saving interval (number of integration steps) N_save = 100...
31e4e1e22845a6f3cfa90984f676391955565411c752a142e992c7ba056c737a
Python
2,193
54
import numpy as np from sklearn.model_selection import KFold import matplotlib.pyplot as plt from model import CNN from dataloader import DATA from config import DEBUG, RUN_NAME from datetime import datetime import os from sklearn import linear_model from sklearn.metrics import mean_squared_error, r2_score from helpers...
45c6d198a9965244bd606d16761b0f9c54e8e2872e66e39b3a96de7a1fbdd232
Python
2,193
69
# 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...
94d517324664e6ce95f0b50c04999fe8d16314dbd2c6d3ff93f332e7934d438b
Python
2,193
50
import os import scipy.io from Functions.f_ComplexNetworks import * import pandas as pd Data_dir = './../Data/EEGFeatures/' Out_dir = './../Data/ComplexNetworks/' if not os.path.isdir(Out_dir): # Create the path if this doesn't exist os.mkdir(Out_dir) df_AllInfo = pd.read_csv('./../RawData/data_info....
df5bf49589a0574c992b156f5ff3709379b8f2c80b0c878a74aa9e285afa3735
Python
2,193
72
"""DetachableTabWidget: pop a tab into its own window (moved, not duplicated) + dock back.""" import os os.environ.setdefault("QT_QPA_PLATFORM", "offscreen") import pytest from PySide6.QtWidgets import QApplication, QWidget from regtools.registration.gui.detachable_tabs import DetachableTabWidget @p...
32e1761d2f07928c2377867f8e8668ea9cf7fe1bc80a97305fc44dcfecf5424c
Python
2,194
64
"""Brush-radius cursor preview tests.""" import pytest @pytest.fixture def qapp(): from PySide6.QtWidgets import QApplication app = QApplication.instance() or QApplication([]) yield app def _two_region_volumes(tmp_path, shape=(3, 20, 30)): import nibabel as nib import numpy as n...
52698f17d1a2709f29e9cb6727c6b7ca0d489ca1217fcb569b279ff50ab00380
Python
2,194
74
from PyQt5.QtWidgets import QPushButton from wonambi import Wonambi from .test_scroll_data import (channel_make_group, find_in_qt, ) from .paths import (GUI_PATH, gui_file, SAMPLE_PATH, ) def t...
ca399bae57b893761872772dfa66b6d562fae000dc38645babfa6766bb86af4a
Python
2,194
65
import numpy as np import pytest from biotite import InvalidFileError import molecularnodes as mn from molecularnodes.entities.molecule import corecif from .constants import data_dir CRYSTAL_FILE = data_dir / "mn_test_crystal.cif" SF_FILE = data_dir / "structure_factors.cif" def test_is_core_cif(): assert coreci...
e6c03be530733965d6f9e031119a7d59be84173b8984bd9aef6a8f0a414f75bc
Python
2,195
56
import matplotlib matplotlib.use("Agg") import torch device = torch.device("cuda" if torch.cuda.is_available() else "cpu") from utilities.script_func import init, post, ScikitFeat_pre import pickle import logging logging.info("") def main(): import Models.model_func as Model_Func from Models.ScikitFeatBaseli...
0139089d45aa3a192514b7d7f2124bb80d05df563fd6f753a44db664aa16463a
Python
2,196
70
import warnings warnings.filterwarnings('ignore') import os import sys import argparse import random import joblib import json import tqdm import torch import numpy as np import pandas as pd import sklearn from types import SimpleNamespace from collections import Counter def simulate(xp, tps, celltype_annotations, w...
0c22de5809f83af7f77808dd83de928c09d941b43cbadc9e98c1e07b6a3815c3
Python
2,196
82
from pathlib import Path from types import SimpleNamespace import mdtraj as md import numpy as np import pandas as pd import pytest from calvados import analysis def test_cmap_traj_normalizes_selected_frames( monkeypatch: pytest.MonkeyPatch, ) -> None: universe = SimpleNamespace(trajectory=list(range(10))) ...
224fd653c5b1ab31310e9a1a59e35294e39f5d3ab59953a0aab61bf71339d6d0
Python
2,196
61
import torch from sklearn.preprocessing import MinMaxScaler import pickle import numpy as np import pandas as pd from utilities.preproc_func import * from io import StringIO def convert_categorical_labels(df:pd.DataFrame, column="y"): count=0 for i in np.unique(df[column]): df.loc[df[column]==i, column...
5416df72c83650f9c6639d7b70d418635871701a89ac53ad0934e7f616d4cc0d
Python
2,196
62
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment from downward.reports.compare import ComparativeReport import common_setup from common_setup import IssueConfig, IssueExperiment from relativescatter import RelativeScatterPlotReport DIR = ...
def9d4f788859b7586dff0424f48ee5f5b0ea548085f09d66fcbe9770da90238
Python
2,196
63
#! /usr/bin/env python # -*- coding: utf-8 -*- import os from lab.environments import LocalEnvironment, BaselSlurmEnvironment import common_setup from common_setup import IssueConfig, IssueExperiment DIR = os.path.dirname(os.path.abspath(__file__)) BENCHMARKS_DIR = os.environ["DOWNWARD_BENCHMARKS"] REVISIONS = ["8...
36f33381d821d09e0e9d42e0383b142f904fae9d39586a0fb27282e4bd316aa7
Python
2,197
57
""" FEATHER_PASS_A.py - full single pass over all 130,107,424 synapses. Builds one row per presynaptic neuron: n synapse count sum_<class> sum of that class's posterior over the neuron's synapses (mass rule) cnt_<class> number of the neuron's synapses whose argmax is that class (modal rule) ...
af1a1cf4f3960334e174140031c7cbddc0e4213655f23ff78ac9c7b8e3b9c96b
Python
2,197
56
from learn_tools.uncertain_learner import UncertainLearner from learn_tools.active_nn import rf_predict, RF_CLASSIFIER, RF_REGRESSOR, get_sklearn_model, retrain_sklearer from learn_tools.active_learner import THRESHOLD import numpy as np BATCH_RF = (RF_REGRESSOR, RF_CLASSIFIER) BATCH_MAXVAR_RF = 'rf_batch_maxvar' BA...
40c2297a56813a9eee245012c39f145a3fe1756581b3b3f945309e95afc0418e
Python
2,198
61
import warnings from elasticai.creator.ir2vhdl import Instance from elasticai.creator.ir2vhdl import Node as VhdlNode from .clocked_combinatorial import ClockedInstance from .node_factory import ( InstanceFactoryForCombinatorial, ) @InstanceFactoryForCombinatorial.register() def shift_register(node: VhdlNode) -...
a3e794db502cd7be610c2edd96e3357c927f16aa244c84a1c96a6329a2291d9c
Python
2,198
74
"""Metadata generation logic for legacy source distributions. """ import logging import os from pip._internal.build_env import BuildEnvironment from pip._internal.cli.spinners import open_spinner from pip._internal.exceptions import ( InstallationError, InstallationSubprocessError, MetadataGenerationFaile...
2c6b0c35c6f4e56f1524c074725852f22509b4e20df9b26a6cb7bddced428684
Python
2,199
44
# 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...
9ca6c1ce195b5ab0787686598b0c28a858a5e8a9725b1fa51b7ec38438618670
Python
2,199
68
# Node group ".Is Extra Bonds" (GeometryNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are regenera...
a28ba8a5e0800742da96b9e2c083b4aaff78060c5aa958ea36a174252f6d8082
Python
2,199
66
import numpy as np from common import * from gzip import GzipFile as gz from sklearn.neighbors import NearestNeighbors def sort_min_diff(amat): '''this function takes in a SNP matrix with indv on rows and returns the same matrix with indvs sorted by genetic similarity. this problem is NP-hard, so here we use ...
b7e1f97916f50d0fd71e0de8fb6d646f8bd4b8c7ee5ba10bfaed4425beac1cf7
Python
2,199
57
# 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...
ed4b0b1a0516182f98862c83ce206bb7f0ef8de0483144b0e4054df0e5c2e369
Python
2,199
85
# From the Meep tutorial: plotting Faraday rotation of a linearly polarized plane wave import meep as mp ## Parameters for a gyrotropic Lorentzian medium epsn = 1.5 # background permittivity f0 = 1.0 # natural frequency gamma = 1e-6 # damping rate sn = 0.1 # sigma parameter b0 = 0.15 # magnitude of bias vector s...
7a49648bbf675949d13d15efb54fc19e8bf3527b7fce2cc256f84b5e5422963e
Python
2,200
63
import numpy as np from scipy.sparse import * from scikit_feature.skfeature.utility.construct_W import construct_W def fisher_score(X, y): """ This function implements the fisher score feature selection, steps are as follows: 1. Construct the affinity matrix W in fisher score way 2. For the r-th featu...
c5989d089c79552aa3e100e4027a25b0531715e9cbb4308c23bb41004a5d91ac
Python
2,200
69
# coding=utf-8 import numpy as np import scipy.sparse as sparse def adapted_rand(seg, gt, all_stats=False): """Compute Adapted Rand error as defined by the SNEMI3D contest [1] Formula is given as 1 - the maximal F-score of the Rand index (excluding the zero component of the original labels). Adapted f...
0de144481ad806a6213ed8283dc62779f9ae5c66d68e2cb1914bdb2ed85e7e24
Python
2,201
66
# 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...
aeae6aedeb83e0ecb5c536fc65ce0b812e7e6424b72f1b2e2b2fd5d1ff2a65ca
Python
2,201
50
import torch from elasticai.creator.nn.integer.quant_utils.Observers import ( GlobalMinMaxObserver, ) def setUp1_for_GlobalMinMaxObserver(): # range gets larger tensor1 = torch.tensor([-1.0, 2.0, 3.0, 4.0], dtype=torch.float32) tensor2 = torch.tensor([-5.0, 6.0, 7.0, 8.0], dtype=torch.float32) te...
0ce5d1d4cc6ef3b245bc6e49a26947773fade738829715e7fba8b461e414d5e3
Python
2,202
109
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np import sys outdir = sys.argv[1] observations= sys.argv[2] df=pd.read_csv("../Data/Wavelets/W_neut_align_0.csv",index_col=0) #df # In[8]: d=np.asarray(df) d=np.transpose(d) d # In[9]: np.shape(d) # In[10]: np.savetxt...
48b6b551a883cf033f050a634975f16fb90466740d394ddb3d7e09322ad1206b
Python
2,202
62
"""Summarize the unique column names in a dataset.""" import json class ColumnNameSummary: """Summarize the unique column names in a dataset.""" def __init__(self, name=""): self.name = name self.file_dict = {} self.unique_headers = [] def update(self, name, columns): ""...
0b1eb552cbfd1d1e9dca40c3c0f0e60d32bed010b8acf1398b46c4c7fe786ada
Python
2,203
61
""" This script integrates Comet ML and Optuna to optimize a Random Forest Classifier on the scikit-learn Breast Cancer dataset. It performs the following steps: 1. Initializes a Comet ML experiment for logging. 2. Loads the Breast Cancer dataset and splits it into training and testing sets. 3. Defines an evaluation f...
d03ee5b4274d8f53236a393b4331d62298f7bd78b99f5902123912389af78ab0
Python
2,203
42
# 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...
3ece17e0c83a5bf0b1d95089027180203b0050e61c3951d4e65faf6a6b2e4d28
Python
2,204
54
import datasets import lightning.pytorch as pl from classification_model import ClassificationModel from lightning.pytorch.callbacks import ModelSummary import os import shutil from lightning.pytorch.loggers import WandbLogger import time import argparse from lightning.pytorch.callbacks import ModelCheckpoint import wa...
42ece300c3445ebfc8f081d8d66e5cbd26d2590280dd510aa38767e118ffdecc
Python
2,204
58
import tensorflow as tf from tensorflow.keras.models import Model from tensorflow.keras.layers import Conv2D, Input, MaxPooling2D, Dropout, \ concatenate, BatchNormalization, Conv2DTranspose, PReLU def conv_block(inputs, num_features, kernel_size, params): x = Conv2D(num_features, kernel_size, activation=None...
e48a8da10433065797308a771464b8a728a692bbaeacbe6a06f9874e7ef70c80
Python
2,205
66
from collections.abc import Callable, Iterator from typing import Protocol import elasticai.creator.function_dispatch as FD from elasticai.creator.graph import bfs_iter_down from .datagraph import DataGraph as _DataGraph from .datagraph import Edge, Node class DataGraph[N: Node, E: Edge](_DataGraph[N, E], Protocol)...
014c138f0ea7c49d36d71240038766641427834fe1b91d30c566baecb587ed56
Python
2,206
76
'''Some helper functions for PyTorch, including: - get_mean_and_std: calculate the mean and std value of dataset. - msr_init: net parameter initialization. - progress_bar: progress bar mimic xlua.progress. ''' import errno import os import sys import time import math import torch.nn as nn import torch.nn.i...
a40d9fcf8a4c43ca15b45dbcae6dbaf1e865e631933a265799daf0e7c5f693ff
Python
2,207
62
"""HED exceptions and exception codes.""" class HedExceptions: """HED exception codes.""" GENERIC_ERROR = "GENERIC_ERROR" # A list of all exceptions that can be generated by the hedtools. URL_ERROR = "URL_ERROR" FILE_NOT_FOUND = "FILE_NOT_FOUND" BAD_PARAMETERS = "BAD_PARAMETERS" CANNOT_PA...
d325060d3b4a0ec9125f58eb68b4db18aab94abf824be9bef5c54f6dd6b8138f
Python
2,208
79
#!/usr/bin/env python3.9 # train an AI model, track runtime for epochs and save the best models (loss/accuracy) from ownutil import ParseArgs, PrepareData # read command line arguments (data set, epoch number, train/validation size) args = ParseArgs() #model specific wired setup args.modelnum = 7 # model 7 arg...
63392d978b5148703d6ffc8195e60565cb528187d347049f4e5bb4f41e582c9c
Python
2,209
54
#!/usr/bin/env python # # Copyright 2019 Google LLC. All Rights Reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list o...
995a85109c6d90acfb14772f426dc7b372b54019ee6c64b34807655a85c58e7c
Python
2,209
60
import os import shutil import numpy as np from scipy.stats import gamma from hmp import simulations def create_data(): sfreq = 100 n_events = 3 # Data creation/reading ## Simulation parameters n_trials = 2 cpus=1 times_a = np.array([[100, 100, 200, 100], [100, 100, 200, 100...
17e99dd01071d2eca4d76d60bb18a2bab2f38dd91a3b28fc92830c4e1215f8b6
Python
2,210
77
# Node group "MN Fresnel" (ShaderNodeTree), dumped by nodebpy.assets.dump_library. # Rebuild the library with nodebpy.assets.build_library (nodebpy build). # Shared by several assets, which import it; not an asset itself. # _build_group() is the source of truth: the docstring, __init__ and accessors are regenerated fro...
1c25d4c91a2fde4f22b614a484db698d85190b8223e67e6dc400c2daba8b6754
Python
2,210
64
import torch.nn as nn import torch import torch.nn.functional as F import math device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") def cal_gmm_widthC(Y, K, times, widthC): mu, cov, alpha = GMM_EM(Y, K, times) _, prob_sum = getExpectation_widthC(Y, mu, cov, alpha, K, widthC) r...
2ef0e27008f5bc3df5acfd13af98a7de408b91a2737e18b4d6a6dbfdce291fec
Python
2,210
71
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
7397456d37f304a6b56e5147001661c6598bf7d17011fb70d1c42d620511022f
Python
2,211
80
#! /usr/bin/env python # -*- coding: utf-8 -*- import os import suites from lab.reports import Attribute, gm from common_setup import IssueConfig, IssueExperiment try: from relativescatter import RelativeScatterPlotReport matplotlib = True except ImportError: print 'matplotlib not available, scatter plots...
7bf5945e96f238727962bdd373081ccf1c9099fde4f88a470efa1bcf6ec96abc
Python
2,211
73
# 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...
a288f25beda63f385bea03b1fd185946b80a8f570571e2db323c74ac133e2881
Python
2,211
53
''' rename-relative-links-to-posts.py This script renames relative links in posts to point to new, canonical post names. ''' import os filenames = [ 'posts/8020-pandas-tutorial/post.ipynb', 'posts/hello-pyspark/hello-pyspark.ipynb', 'posts/get-down-with-gradient-descent/get-down.ipynb', 'posts/how-to...
f550ecee90f8020f42b256b9ce8948b67b3a5a9456b6620c7b7cea4db74a3ee6
Python
2,211
71
"""Launcher for the Geometry Registration GUI. Builds the Qt application, embeds :class:`GeometryRegistrationViewer` in an ``AppScaffold`` window, and starts the event loop. pyqtgraph is PyQt5-native, so napari's subprocess rule does not apply here. Usage ----- python -m regtools.geometry_registration ...
75a3a1595699a6d061dffade711e7dc24af15d6cc63413e3f3a57067ccc76b0c
Python
2,212
44
import os import sys relative_ref_path = sys.argv[1] sam_dir_path = sys.argv[2] bam_dir_path = sys.argv[3] vcf_dir_path = sys.argv[4] data_dir_path = sys.argv[5] samtools_bin_path = '/mnt/batty-shared/tools/bin//samtools ' config_sam_path = '../utils/configure_sam.py ' dir_list = os.listdir(sam_dir_path) for dir i...
7905d6a5386f18be47a54f03896865200cb1e374e6b2f526d435dd057e97e1ae
Python
2,212
64
from smart import mesh_tools import numpy as np def test_circle_curv(): """Test calculation of curvature for unit circle""" cell_marker = 1 bound_marker = 10 circle_mesh, mf1_circle, mf2_circle = mesh_tools.create_ellipses( 1.0, 1.0, hEdge=0.1, outer_tag=cell_marker, outer_marker=bound_marker ...
91791c6ef0b7c1dc9e568d984af4727a127e332f3ccc4822eedf834210d29642
Python
2,212
72
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. """Argument parser functions.""" import argparse import sys from cfg.defaults import get_cfg def parse_args(): """ Args: shard_id (int): shard id for the current machine. Starts from 0 to num_...
e8b2a741cf32878f5ff34d9b174b0fbdbcdc938422bcc62aaa85c03da60ff2e5
Python
2,212
83
""" pygments.formatters.pangomarkup ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Formatter for Pango markup output. :copyright: Copyright 2006-2023 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ from pip._vendor.pygments.formatter import Formatter __all__ = ['PangoMarkupForma...
412f97ca4ea0969592a48d4f2e57e623cba1b6f614aa25e599b69e8330823682
Python
2,213
45
# 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...
aed88801a3af466c299c4da96c7dee8d46d5847d9f1a47d305fd066c3fc9f695
Python
2,214
68
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @author: A.Akdogan """ from utils import * import torch import pickle from helper import utils from dataset_builder import NailDataset from torch.utils.data import DataLoader import os class Evaluator: def __init__(self, select_class_rgb_values, device): ...
1e7c911efa4422fdd8779573c685f897b4f74497c5c2e7a808cfe19ecc1d31e9
Python
2,215
77
#!/usr/bin/env python from __future__ import print_function import time import numpy as np from pybullet_tools.utils import add_data_path, connect, enable_gravity, wait_if_gui, disconnect, create_sphere, set_point, Point, \ enable_real_time, dump_world, load_model, wait_if_gui, set_camera, stable_z, \ set_co...
4ef4a6bc5bd046fca36046a482ef264a9fef52154ccb8a050005b6e8895ef362
Python
2,215
79
#!/usr/bin/env python3.9 # train an AI model, track runtime for epochs and save the best models (loss/accuracy) from ownutil import ParseArgs, PrepareData # read command line arguments (data set, epoch number, train/validation size) args = ParseArgs() #model specific wired setup args.modelnum = 6 # model 6 arg...
9ed660f2fc67d3326f6e9fd4c8907f6ae1ea618223fc136127b5dfd67938ce18
Python
2,215
82
import pytest import numpy as np from pyrelimri.conn_icc import (triang_to_fullmat, edgewise_icc) def test_triangtomat_valid(): size = 3 corr_1darray = np.array([1, 2, 3, 4, 5, 6]) expected_output = np.array([[1, 0, 0], [2, 3, 0], [4, 5, 6]]) output = triang_to_fullmat(corr_1darray, size) assert n...
b04cddb9f5dd32763618c327bab3956ee579d63a2da68b52641ab1304cbf92cd
Python
2,215
106
# --- # jupyter: # jupytext: # formats: ipynb,py:light # text_representation: # extension: .py # format_name: light # format_version: '1.5' # jupytext_version: 1.15.1 # kernelspec: # display_name: Python 3 (ipykernel) # language: python # name: python3 # --- # + # this e...
f35dfabfa4ba6a061e68feeea4f9e4f68d8dc5d9384866fe02df0d2e61abb084
Python
2,215
72
import nibabel as nib import numpy as np import os import csv import argparse # Define the class labels CLASS_LABELS = { "SV": 1, "V3": 2, "V4": 3 } def calculate_volumes_per_class(mask_path): try: # Load the NIfTI file nifti_img = nib.load(mask_path) data = nifti_img.get_fdata...
33d7bf45ca716a6e09c80783992bfbbcf628820f549e2472a7f2ff3db6c7a612
Python
2,216
77
""" Script for applying statistical test to a pattern so as to check its heterogeneity Input: - Path to the input UniStat objecto of the pattern - Parameters for setting the statistical tests Output: - Plot graphs for testing heterogeinity """ __author__ = 'Antonio Martinez-Sanchez' ############...
564f29a489dbb500b9fa513a260a67a7640de5233ca8f12b85b10a1a2e011983
Python
2,216
42
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 if __name__ == "__main__": np.random.seed(42) main_dir = path.join(path.dirname(__file__), "config") config_dir = path.join(main_dir, "000_circuit_se...
7d1aa86a05f64aec613a198db3dc3fe991cad9a2fdb451b278889c7133ddd256
Python
2,216
70
import os import datetime import json import logging def add_timestamp_to_filename(filename): """ Adds a timestamp for versioning to the filename. Args: filename (str): The filename to be versioned. Returns: str: The versioned filename. """ # Get current timestamp timestamp = date...
3ce14793608ee208d5bbc026606c3e44af8c3671cb17ef3924f6f07ee0033bdb
Python
2,217
60
import pickle import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages def drawGraph(patientsFile, tissueType): cancerPointsX = [] cancerPointsY = [] normalPointsX = [] normalPointsY = [] with open(patientsFile, 'rb') as loadFrom: patients = pickle.load(loadFrom)...
ca5ec4ed5a0d9f7dbbe430f968fe8552c9ad48e837ac92d9e899d3c635505215
Python
2,217
75
"""Slab recipes for EMT.""" from __future__ import annotations from typing import TYPE_CHECKING from quacc import flow from quacc.recipes.common.slabs import bulk_to_slabs_subflow from quacc.recipes.emt.core import relax_job, static_job from quacc.wflow_tools.customizers import customize_funcs if TYPE_CHECKING: ...
1d10806526095d8f2c0a9db42ea3f9d3ba96e2cfb3a4597b1a8f9a7ef724afd0
Python
2,218
79
#!/usr/bin/env python3.9 # train an AI model, track runtime for epochs and save the best models (loss/accuracy) from ownutil import ParseArgs, PrepareData # read command line arguments (data set, epoch number, train/validation size) args = ParseArgs() #model specific wired setup args.modelnum = 9 # model 9 arg...
88c1a72d2eec91b9e213c97545d3057dff53344ae25a339b325de887c766e168
Python
2,218
45
""" Modelling support for the QUASAR ASL sequence --------------------------------------------- Like pCASL, the QUASAR sequence consists of a set of label-control image pairs acquired at single or multiple delay times, and with the potential for repeated measurements at each PLD. However each label-control pair is add...
c45fbafab25f88fe1a0abbed5c51b2b6eff85977aac94ed29bb4a402ac19d012
Python
2,218
79
#!/usr/bin/env python3.9 # train an AI model, track runtime for epochs and save the best models (loss/accuracy) from ownutil import ParseArgs, PrepareData # read command line arguments (data set, epoch number, train/validation size) args = ParseArgs() #model specific wired setup args.modelnum = 8 # model 8 arg...
4681d4452ed5d1f1c05d3311a35d9ca92196dcddb84228e72a520db7a5e65c7d
Python
2,219
47
import pickle import pandas as pd import numpy as np from connalysis.network.classic import closeness_connected_components from connalysis.network import topology import sys sys.path.append('../../../library') from structural_basic import load_connectome # Load pre-computed simplex counts root="/gpfs/bbp.cscs.c...
e3a4b6a7b2fcf729978967275dacdeaaddfbccb4666ed2912c6cb9f28a908ae6
Python
2,219
87
import typing from functools import partial import numpy as np BOX = typing.Union[ np.ndarray, typing.List[typing.Union[int, float]], typing.Tuple[typing.Union[int, float], ...], ] def center(bbox: BOX) \ -> typing.Tuple[float, float]: x1, y1, x2, y2 = bbox return (x2 - x1) / 2 + x1, (y...
3c51efad729059e7536d7ee21a80492da467bfe47e8b2bff70ba4855ad472fbd
Python
2,221
79
#!/usr/bin/env python3.9 # train an AI model, track runtime for epochs and save the best models (loss/accuracy) from ownutil import ParseArgs, PrepareData # read command line arguments (data set, epoch number, train/validation size) args = ParseArgs() #model specific wired setup args.modelnum = 10 # model 10 ar...
704b00c1ae27833bf7348cf855130571e51431fe9ee09c9560103a52be07015a
Python
2,221
79
#!/usr/bin/env python3.9 # train an AI model, track runtime for epochs and save the best models (loss/accuracy) from ownutil import ParseArgs, PrepareData # read command line arguments (data set, epoch number, train/validation size) args = ParseArgs() #model specific wired setup args.modelnum = 1 # model 1 arg...
d5b0f689198787dc6677f883119ce72fc3239a62856a063f80ba9c02cebd27d2
Python
2,221
67
# 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...
2011ee62c0180f4b889a87d5cafa2d3add61c3a1b5cd55c75641ab02ffec047b
Python
2,222
75
from functools import partial from itertools import repeat from autograd.tracer import Node, trace from autograd.util import subvals, toposort from autograd.wrap_util import wraps class ConstGraphNode(Node): __slots__ = ["parents", "partial_fun"] def __init__(self, value, fun, args, kwargs, parent_argnums, ...
4779174621dd80da6c896722068832a8fc05520b762aebbbb01531be622e0e19
Python
2,225
58
import cv2 import numpy as np import os import pandas as pd import shutil from skimage.color import rgb2gray as skimage_rgb2gray from skimage import io from tqdm import tqdm from typing import * from tabulate import tabulate from constants import * _CLUSTER_DATA_ROOT = '/cluster/work/zhang/webermau/rocf/psychology/'...
564d6291a4df5d47be3df9bd56bc3128386bec8e661266118c048cce59a8c6ad
Python
2,225
45
# 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...
6008dc1ea01f9205187017167133e98323dd958d34e1cb18bcc6acd89bba3cac
Python
2,225
94
#!/usr/bin/env python #****************************************** # # SHARC Program Suite # # Copyright (c) 2023 University of Vienna # # This file is part of SHARC. # # SHARC is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by #...
b3af8de142eb28bd8893fbe83d5960929bb7ef68e447a627624d2723dc41d28b
Python
2,225
48
from ckg.graphdb_builder import builder_utils from collections import defaultdict import re def parser(ontology_files): terms = defaultdict(list) relationships = defaultdict(set) mappings = defaultdict(set) definitions = defaultdict() for obo_file in ontology_files: with open(obo_file, enc...
e30804327d8541e1187017c393b8287fe80baa916ea43934e0ec25a2b7a719c2
Python
2,225
69
from typing import Protocol from elasticai.creator.file_generation.savable import Path from elasticai.creator.vhdl.design.design import Design from elasticai.creator.vhdl.system_integrations.env5_constraints.env5_constraints import ( ENV5Constraints, ) from elasticai.creator.vhdl.system_integrations.middleware.mid...
0f47fddc825f22d7b9a0944674d286b7eb489e7fa3351f36ee0f0bd68078e417
Python
2,226
86
import torch import numpy as np from dataset import ProteinDataset from utils import average_structures import autoencoder as autoencoder def main(): train_range = range(170, 175) val_range = range(175, 176) data_path = './data/' latent_dim = 40 epochs = 250 lr = 0.0001 p_enc = .8 ...
5c2eec82b7f3994fd716cc8fa11f25ecd100d9d9b6fe325daf760aca0f24834e
Python
2,226
64
from typing import Union, Dict import numpy as np from spectrum import aryule from ..base_transform import EEGTransform class ARRCoefficient(EEGTransform): r''' Calculate autoregression reflection coefficients on the input data. .. code-block:: python from torcheeg import transforms t...
cf29ef166f0de112c9a57f7177be9874a6de17aac40915796b6910b18fbfa1f6
Python
2,226
78
import pickle import numpy as np from matplotlib import pyplot as plt name = 'stephen' in_file = '/home/mayank/Dropbox (HHMI)/PoseEstimation/Results/stephen_gt_numbers.p' db = with open(in_file,'r') as f: D = pickle.load(f) ## P = {} all_t = {} for net in D.keys(): cur_out = D[net] V = [] n_out = min...
42b5362ee723e43572bb9f45f1c7aa803935e0634290e07ce466e65e327fffcb
Python
2,227
79
#!/usr/bin/env python3.9 # train an AI model, track runtime for epochs and save the best models (loss/accuracy) from ownutil import ParseArgs, PrepareData # read command line arguments (data set, epoch number, train/validation size) args = ParseArgs() #model specific wired setup args.modelnum = 5 # model 5 arg...
45e02ad161c78d28fe8b7df2da3707b1b2cad445353293afbbe917cff8964cff
Python
2,227
66
# flake8: noqa # There's no way to ignore "F401 '...' imported but unused" warnings in this # module, but to preserve other warnings. So, don't check this module at all. # Copyright 2021 The HuggingFace Team. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...