sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
98b0098a08c7cd97c2711342db6b5442f37342e2d7fd3f23f695cde9dff510ba
Python
7,232
219
""" BSD 3-Clause License Copyright (c) Soumith Chintala 2016, 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 of con...
d1b4b9f78b95dc8ea15eeed296d078c9f0ceca9060ae617a129b82ff9c5906dd
Python
7,232
189
"""Unit tests for the custom pyqtgraph items in viewer_items.py. These exercise the items' headless public API + a synthetic mouse-drag on BrushCurveItem (constructing a minimal QGraphicsSceneMouseEvent) so that the Wendland C² falloff math has a real test, not just the construction smoke test from the viewer. "...
99e165d4847644a8d3dd2dfee36a695b08ade16fece028752f7548b77047fa76
Python
7,233
187
import numpy as np import tensorflow as tf class MinMax(tf.keras.constraints.Constraint): # Constraint to help set exponential smoothing within [0,1] def __init__(self, w_min, w_max): """ Constraint to set parameters in a specified range [w_min, w_max] :param w_min: Minimum value ...
dfd67a3ba7d03ff04b9004cea827de06e77808515796d7812178eb4f27c8a54c
Python
7,235
193
import h5py import numpy as np import torch import random # Add this import from torch.utils.data import DataLoader, TensorDataset import torch.nn as nn import torch.optim as optim import h5py as h5 import matplotlib # matplotlib.use('TkAgg') import matplotlib.pyplot as plt # from torchsummary import summary from MoS2...
872dbb69fce8de7c9653da5dbf37275efd3c68dee0367b96ef8353166b8aa8a1
Python
7,236
240
# 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...
16cd13668cf62337630a1bd591cc3749f2a6991e7431362f067de4a7e8940547
Python
7,239
208
# Node-group asset "Assembly Instance" (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...
bcb8e52228cbdfdc712de79c397d6472984ea0d269f437d322306a9ebc02aa5f
Python
7,242
186
# 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...
cae6f5d681ff9bdbbf0d9f7c5a49b9e61a61498e75be024b10b91f4afc9232ff
Python
7,243
207
import bpy import numpy as np import pytest import molecularnodes as mn def test_selection_string_changes(fetch): mol = fetch("1BNA") sel = mol.selections.from_string("resid 1:10") with mol.tree.reset() as (atoms, join): atoms >> mn.nodes.geometry.SeparateAtoms(selection=sel.node()) >> join ...
0ad12a26a03e9653a45df0c4d8e9ce3b5188bd2c41753ada06a45da328657673
Python
7,246
188
#!/usr/bin/env python2 from __future__ import print_function import sys import os import json import stat import argparse import subprocess import datetime import re import glob import csv import warnings def findRoundIdx(jdat): # determine round/prm/pch # # Returns roundIdx, prmfull, prmS, pchfull, ...
3c374af4d06f5b09dc63d6a1163245a4a1763c4193e52809d6a4f8106fb6aeee
Python
7,246
181
"""Summary report for HED schema compliance checking.""" from hed.schema.hed_schema_constants import HedSectionKey # Section display names for readable output _SECTION_DISPLAY_NAMES = { HedSectionKey.Tags: "Tags", HedSectionKey.UnitClasses: "Unit Classes", HedSectionKey.Units: "Units", HedSectionKey.U...
972259d4a11167b60aef49b37e0a8080f9d69b70a48c12cd7900ad2f8fb337da
Python
7,247
124
from optparse import OptionParser import os from statistics import mean import time ### help and usage ### usage = "usage: %prog [options] args" description = '''Function: merges EAA results from split BayeScEnv test jobs''' version = '%prog 7.17.2022' parser = OptionParser(usage=usage,version=version, description = ...
f4adb164581ebf300166bf395931ff01637d3fa559949ef267d51da50d3f6086
Python
7,247
232
from brian2 import * from math import exp, floor, sqrt from matplotlib.pyplot import * from setup import izzy, pos_3D, STDP1, reg_synapse, write_video, vectormap def Wave(seednum, batch, RATE): #setting the random seed based on input seed(seednum) #names for numpy '.npy' datafiles (missing numbers are...
3eda8a6b7f8c0142d62aff24851e535ab75f3ff9a72f50b45f5a9eb6da23ae05
Python
7,249
227
# A time-point module import numpy as np import scipy as sp from pyclamp.dsp.sifunc import * from pyclamp.dsp.fpfunc import * from pyclamp.dsp.dtypes import * from pyclamp.dsp.optfunc import * MAXSI32 = 9223372036854775807 def latency(_t, _r, d = 0., n = 0, o = False): # calculates latency of t wrt reference r of...
4003ca9f95f935737503c97c90c7e7c8807beee712de8c78ac8cf850cb919db5
Python
7,250
210
""" ResNet18 Difference from resnet in torchvision for higher resolution: 1. Modify the stride of first convolution layer (7x7 with stride 2) into 1 2. Remove the first max-pooling layer 3. Downsample and upsample twice in encoder and decoder respectively in FCNResNet """ import torch.nn as nn import math import tor...
7b9a0e86073ee861337d8d902ad04f36ddf247f85b16074fc695702c2b4f1932
Python
7,251
238
from datetime import datetime from logging import getLogger from numpy import (abs, angle, arange, asarray, empty, exp, linspace, pi, ptp, real, round, sin, zeros) # numpy.random.random has an empty __module__ and sphinx autodoc adds it to api from numpy import random from numpy.fft import fft, ifft...
917cb7f0797da370844ddc38679b89c1b3168e2c1302fba3a4e9ed7090cf154e
Python
7,251
173
import numpy as np import torch import torch.nn as nn import torch.optim as optim from typing import Any, Dict, Optional from models.model import Model from models.kan_layers import KAN, FastKANConv3DLayer class He3DCNN_KAN_Net(nn.Module): """ MULTI-SCALE 3D DEEP CONVOLUTIONAL NEURAL NETWORK FOR HYPERSPECTR...
6f6ea390051bcf8ad6555407730038968276e89cd43e516ac8475880a0f0d999
Python
7,252
185
# 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...
634fdbea993fc4731433fc8aa7c0eca44b1611d58396eb41900082fa7c655590
Python
7,253
204
import unittest import numpy as np from neurolib.models.wc import WCModel from neurolib.control.optimal_control import oc_wc import test_oc_utils as test_oc_utils p = test_oc_utils.params class TestWC(unittest.TestCase): """ Test wc in neurolib/optimal_control/ """ # tests if the control from OC c...
c2c12b3e241a792e6e80ae3299b96db9e818864159702c12128fc06d5ee27889
Python
7,255
214
import os import numpy as np import matplotlib.pyplot as plt from scipy.stats import ttest_rel, pearsonr import matplotlib.patches as mpatches import matplotlib.colors as mcolors import scipy.io as sio import torch def check_cuda(): device = torch.device("cuda" if torch.cuda.is_available() else "cpu") if devic...
4356f2a86e953a84b98af6eab44354f4f138b57d0cd8a78779e3231d34cb4818
Python
7,256
229
"""Tests for Mixscale continuous perturbation scoring. The `R_GOLDEN` values were produced by `RunMixscale` from https://github.com/satijalab/Mixscale on the dataset built by the `parity_adata` fixture. The same DE genes are supplied via its `DE.gene` argument so the comparison isolates the scoring algorithm from the ...
b85b24465c906dfeb97537d4a67f5e7e9f9aa3cd9ce2d4a06ac2c541d5135cff
Python
7,256
233
# # 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,...
f84727ac7048468729234522f2e1001b9d2703734422378848cf4d09f0069a91
Python
7,256
228
from json import dump from numpy import array from .brainvision import write_brainvision from .edf import Edf from ..utils import MissingDependency try: from bidso import iEEG from bidso.utils import replace_extension, replace_underscore except ImportError as err: iEEG = replace_extension = MissingDepende...
0a9cda0d45f02315b1687e79479e9192f0c1ac08303445f8cef8e768c989fa4f
Python
7,257
205
''' Modified by Mayank Kabra Adapted from original predict.py by Eldar Insafutdinov's implementation of [DeeperCut](https://github.com/eldar/pose-tensorflow) Source: DeeperCut by Eldar Insafutdinov https://github.com/eldar/pose-tensorflow To do faster inference on videos (with numpy based code; introduced in Oct 201...
7095b052c4e508338d810fab7b592369247d3746ca7d138c277cefe29355712e
Python
7,257
186
import typing from functools import partial from operator import itemgetter from .utils import metric import numpy as np class Tracker: def __init__( self, gt_count: int = 0, center: typing.Tuple[int, int] = (400, 400), sigma_l: float = .05, sigma_h: float = .5, ...
6bf6b5e5c993e4879ce2111b7b0c293e0d4bc6f2213763bb502a1851e6b94579
Python
7,258
206
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2022/9/22 9:11 # @Author : piaoyang cao # @File : subgraph_encoder.py import torch import torch.nn as nn from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set from torch_geometric.nn import GATConv ...
ba6b7d1fd10a6ba29dfd715a9da61ccfebc3d01ee87acde4cb63b185f7d4c68e
Python
7,259
197
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon May 17 01:12:51 2021 @author: mpolonenko """ import numpy as np import os from expyfun.io import read_wav, write_wav, write_hdf5, read_hdf5 from glob import glob import parselmouth from parselmouth.praat import call import matplotlib.pyplot as plt impor...
70ebd76bed01eed5ac20b07ca4549e3429b572fcf4b8a4767e9ae242a663fe5c
Python
7,260
206
#!/usr/bin/env python from __future__ import print_function import cProfile import pstats import argparse from examples.pybullet.utils.pybullet_tools.kuka_primitives import BodyPose, BodyConf, Command, get_grasp_gen, \ get_stable_gen, get_ik_fn, get_free_motion_gen, \ get_holding_motion_gen, get_movable_coll...
9443038d7848727b02600792976ff85e2a5e351fe1d0ab092a508c47a8d413e7
Python
7,264
257
import logging import numpy.testing as npt import pandas as pd import pytest from astrovascpy import bloodflow as tested from astrovascpy.utils import Graph L = logging.getLogger(__name__) @pytest.fixture def params(): return { "blood_viscosity": 0.1, "base_pressure": 1.33e-3, "max_nb_i...
62d309516d0a52132dd4a288922786332f64810fd257fe3c81a7b504efc0e138
Python
7,266
258
import pandas as pd import numpy as np from tqdm import tqdm import mmap import matplotlib.pyplot as plt from dataset import ProteinDataset def get_num_lines(file_path): '''Count the number of lines in the file at file_path''' #https://blog.nelsonliu.me/2016/07/30/progress-bars-for-python-file-reading...
bbdac2e27dc49fc2c22f3e1e59670af334eb602e8d7a9b099d81ba1821596a83
Python
7,267
224
# Node-group asset "Curve Visualize" (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...
7b5dcfdbfb7d19be8782cc10bda8856999f1e990958955f7f3212d3f68fa02b3
Python
7,268
202
import numpy as np import pickle as pkl import torch import networkx as nx import scipy.sparse as sp import sys exc_path = sys.path[0] def parse_index_file(filename): """Parse index file.""" index = [] for line in open(filename): index.append(int(line.strip())) return index def load_data(dat...
2b09ef7564dcc84ac724d2799e186c210ff72efb01c3b975fbd55d6be9be4f2d
Python
7,269
201
""" Configuration constants and diagnostic utilities for the registration module. Provides color constants for terminal output, ANTs/Elastix availability flags, binary paths, and environment checking functions. """ import os import sys import numpy as np from regtools import get_project_root from regtool...
ba20f0ea6b0ceeb102cbbd093054a798517f48dc7218c14448f5b7053ae97b94
Python
7,270
230
''' ResNet implementation from torchvision. Reference: [1] Kaiming He, Xiangyu Zhang, Shaoqing Ren, Jian Sun Deep Residual Learning for Image Recognition. arXiv:1512.03385 [2] https://github.com/pytorch/vision/blob/main/torchvision/models/resnet.py ''' import torch.nn as nn import torch from torch import Ten...
f5370ff286dd8470c08f213a0a889a8947fc8319c118e81dae7fe887f6441371
Python
7,270
212
## # \file primal_dual_solver.py # \brief Solve reconstruction problem A_k x = y_k for all slices k via # Primal-Dual solver. # # Implementation to get an approximate solution of the inverse problem # \f$ y_k = A_k x # \f$ for each slice # \f$ y_k,\,k=1,\dots,K # \f$ by using first-order primal-dual al...
88ca16b61da5cb195ebe17be80d17af4766d09621e49927131724fb899a532f0
Python
7,271
209
""" Data from a Learning Experiment """ import itertools import os.path as osp import json import datetime from typing import List, Tuple, Dict import pandas as pd from language import load_input_language # Line start that indicates start of data START_OF_DATA_HEADER = "Round\tTask\tTrial" def scenes(data:pd.DataF...
cb0077b533db1b9fae894fb7bf189c0a8c58d8610808c8fdd4652dd4199dc376
Python
7,271
203
#!/usr/bin/env python # Copyright (c) 2018-2020 Intel Corporation # # This work is licensed under the terms of the MIT license. # For a copy, see <https://opensource.org/licenses/MIT>. """ All intersection related scenarios that are part of a route. """ from __future__ import print_function import py_trees from sr...
e5c2bc979d4bf94623206538099443507e0fc00d0dfc6cd0c767fa0ddbb8f8f8
Python
7,271
156
# coding=utf-8 # Copyright 2021 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/LICENSE-2.0 # # Unless r...
606b4a9734cf190241582bab4da839519ccf241b660b460bcb012dc8f15cbdd1
Python
7,272
241
#!/usr/bin/env python3 import pysam import numpy as np import argparse import logging from numba import njit import tqdm # C+m CPG_MODS = [("C", 0, "m")] M6A_MODS = [("A", 0, "a"), ("T", 1, "a")] D_TYPE = np.int64 def get_mod_pos_from_rec(rec, mods=M6A_MODS): if rec.modified_bases_forward is None: return...
94c74e950a8eea5f6e3df1eeda6cd36b7161e0e1d07bc5c6cf8f163272f2664c
Python
7,272
192
import argparse import math import os.path import sys import anndata import numpy as np import cirrocumulus.io_util from cirrocumulus.anndata_dataset import read_adata from cirrocumulus.util import get_fs def concat_spatial(paths: list[str], output_path: str, ncols: int = 2): datasets = [] images = [] s...
c270c6ce90c3395419cff8a7d7558d4fd1663496aaf1be5ff0688d6a9fde03fd
Python
7,272
241
"""Declarative registry of every GUI module the RegTools Hub can launch. Each :class:`ModuleEntry` describes one standalone GUI module and the argv (after the Python executable) used to launch it as its own subprocess. The ``launch`` tuple for every entry is kept in sync with the corresponding root-level ``.bat`...
d3262a2045c469e33ae25756fcca7625cc33945a5912e834dbb426b3fd373a41
Python
7,273
187
# 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...
faf650cd9c1005ca144abe8e0665b792db0b6e550ae72c2082615a451ef9c6f9
Python
7,273
149
"""Capture real screenshots and an activity animation from a live Observatory session. Every image comes from the actual application: the real model generates both branches, the reservoir state is the measured state, and the animation replays snapshots recorded during that same session. Nothing is drawn synthetically....
8e5af8ddbc4b06afcfbf2de35eb0114d0c7060c1b8939e5a519847e591e0e4fd
Python
7,274
172
# from typing import Any, List from typing import Any, Dict, Optional, Tuple import torch from pytorch_lightning import LightningModule from torchmetrics import MinMetric, MeanMetric from torchmetrics.classification.accuracy import Accuracy from torchmetrics import MeanAbsoluteError, MeanSquaredError from src.da...
ed16e3acfa4dabdebc43cd98c3e6712d3ca213d2438e81b5b3f8c0ad9a9c2354
Python
7,274
230
import warnings from collections.abc import Callable, Iterable, Iterator, Mapping from dataclasses import dataclass from itertools import starmap from typing import Protocol, overload, override import elasticai.creator.function_dispatch as FD import elasticai.creator.ir as ir import elasticai.creator.plugin as _pl fro...
4d5ae5029d84449c308e3b33ccfe9242dff6f56bece118dc6a8b79bd91f2a0fe
Python
7,275
192
from __future__ import annotations from logging import WARNING, getLogger import numpy as np import pytest from ase.build import molecule from ase.calculators.emt import EMT from ase.units import invcm from monty.json import MontyDecoder, jsanitize from quacc.schemas.thermo import ThermoSummarize LOGGER = getLogger...
947aace31b6f0a6292878540cd1995574914be17a61dfa7e02093794d42249df
Python
7,275
220
# 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...
3aa1896f2be722010ebb1dd91e31f67f1ba887a15a1d4b648e0a20b3199f7692
Python
7,276
157
from __future__ import annotations import datetime import re from functools import total_ordering from typing import Any from wikibaseintegrator.datatypes.basedatatype import BaseDataType from wikibaseintegrator.wbi_config import config from wikibaseintegrator.wbi_enums import WikibaseSnakType, WikibaseTimeP...
5b60ba68d1ed44d8191397de6d93e0e7cb04579bd7aa12ee4ef8baae0110306a
Python
7,276
214
import numpy as np import csv from cv2 import imread from preprocess import preprocess, preprocess_basic import os from skimage.io import imsave import shutil from helpers import File, create_directory from sklearn.utils import shuffle import time from config import DATA_DIR, DEBUG, REDO_PREPROCESSING, LOAD_ONLY_FEW...
1cf43c1e5bb2e0053ef6b155ed7609bcf87a84e02bd57f71eb6728c71057e2d1
Python
7,279
231
"""Core recipes for the NewtonNet code.""" from __future__ import annotations from importlib.util import find_spec from typing import TYPE_CHECKING from ase.vibrations.data import VibrationsData from monty.dev import requires from quacc import get_settings, job from quacc.runners.ase import Runner from quacc.schema...
f7dc5a93025535c8402c2c6189ca08a736c4bfd80231440899125eb31c5c4227
Python
7,280
178
""" toposampling - Topology-assisted sampling and analysis of activity data Copyright (C) 2020 Blue Brain Project / EPFL & University of Aberdeen This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation...
fca3454b016bc31430c3b36ec01d2a1893b0e5f4f958c2c9602e8db39e83d43c
Python
7,280
155
# 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...
03f43759a157d7e9ee579c5f5bfe1e160f0da85e3eb4485d6d59ee0556b924b4
Python
7,282
152
# SPDX-FileCopyrightText: 2024 Blue Brain Project / EPFL # # SPDX-License-Identifier: AGPL-3.0-or-later ''' Functions to compute basic network properties for a full connectome or on its neighborhoods Author(s): Daniela Egas S. Last updated: 12.2023 ''' import numpy as np import pandas as pd import pickle from conn...
6b3b87bcf26ad2a18010bba2d2b906e2a1b93bcf69be3a25013ed3c167f2e1e6
Python
7,283
226
import os import argparse import yaml # command line arguments: # --local: 1 (run locally) or 0 (run on spaceml) # --GPU: [0-7] specifies the gpu to run it on, check with gpustat which one is available # --config: path to the config.yaml file # --runname: optional run name argument DATA_DIR = '' GPU = -1 RUN_NAME = '...
ced1d8a5d2b6559c5a0212d724c0d83c1ed1db820aa8b133ec5d49620c2517aa
Python
7,289
197
""" Script for filter a MbGraphMCF object by extracting a filament network Input: - A STAR file with a list of graphs (MbGraphMCF) as it is returned by by mb_graph.py script: + Density map tomogram + Segmentation tomogram + MbGraphMCF object ...
8ddca7e9e70f7292760783745c21fb63c8c0381f7c1214aee1cc2ca6c486d890
Python
7,290
156
from typing import Any, Callable, Dict, Tuple, Union, List import mne import numpy as np from .base_dataset import BaseDataset from ...utils import get_random_dir_path class MNERawDataset(BaseDataset): ''' Process a list of MNE Raw objects and corresponding information dictionaries. This dataset is particular...
c721fdf583c06a705444fae9a503b02c27f6d26dffa49ad8ca480f53a3dedbd2
Python
7,290
201
import math,os import torch import numpy as np import torch.nn as nn import torch.nn.functional as F from torch_sparse import SparseTensor, matmul from torch_geometric.utils import degree def full_attention_conv(qs, ks, vs, output_attn=False): ''' qs: query tensor [N, H, M] # M = D ks: key tensor [L, H, M...
007b1a7e880fad72c2c6c42f43f57e91129ef0b7bcb9645b11e8675025c80237
Python
7,291
187
""" Script for computing statistics about slices of a membrane (along different penetration values) (v0.2) -> Working with sparse spatial analysis Input: - Path to a MbGraphMCF - Parameters for thresholding the graph - Parameters for setting the statistical analysis Output: -...
5b3415a0f6cdf21f0896568ac4b439d655f58116c966937c23db9c90e3a096ef
Python
7,293
207
#!/usr/bin/env python # -*- coding: utf-8 -*- '''plotting script for figure 6 in manuscript preprint on output of example_parallel_network.py Copyright (C) 2018 Computational Neuroscience Group, NMBU. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public Lic...
6d3345af3cc741a18a7385edf4d7db5fd4c2dfc01b9ff436377a761196923752
Python
7,295
219
""" Provides default parameters used in the simulation. """ import os params = {} params['outpath'] = os.path.join(os.getcwd(), 'out') # Surface area of a microcircuit [mm^3] params['surface_area'] = 1 """ Parameters for cytoarchitecture preprocessing """ params['cytoarchitecture_params'] = { # Path to cytoarch...
b911beadeacdd96187cea7aee3659ce2abd0eae85fb3eb2fb850da1eee908309
Python
7,296
184
""" Embed sections for the pipeline-generated analysis figures under ``<output_dir>/report_figures/<kind>/`` (see ``regtools/registration/report_analysis_figures.py``, which writes them). Body-only, never-raises renderers, matching the Phase-1 section convention: each returns the section's inner HTML (or ``""`` ...
da581dde710bfcf8d5f6e90ebf33f7c150bc7c9f27c4d7d4b1bfe1ba09aa96aa
Python
7,296
233
import jax.numpy as jnp from functools import partial import jax from netket.jax import tree_ravel from netket.optimizer.qgt.qgt_jacobian_pytree import QGTJacobianPyTreeT from netket.jax._utils_tree import RealImagTuple from netket.jax._utils_dtype import dtype_real as real_dtype def smooth_svd(Aobj, b, acond=1e-4, r...
ef24f49206726863691fd6ba1462b920691c6c6de73099357415a3f3a97a27b4
Python
7,297
191
from __future__ import annotations import os.path import pathlib import pprint from Levenshtein import distance as levenshtein_distance from loguru import logger from ord_schema.message_helpers import get_compound_name from ord_schema.proto import reaction_pb2 from pydantic import BaseModel from ord.evaluation.evalu...
8e6fcbac02ef07779338489700222bac3d90e73b3bdc1f4d68b87509573f33f2
Python
7,298
211
""" ResNet18 Difference from ResNet18 in torchvision for higher resolution: 1. Modify the stride of first convolution layer (7x7 with stride 2) into 1 2. Remove the first max-pooling layer 3. Downsample and upsample twice in encoder and decoder respectively in FCNResNet """ import torch.nn as nn import math import t...
c994fbceb923edf0b305ac20bc119de2ec1f5db7cd993bdcda34337fae283852
Python
7,298
204
# # Memory profiling utilities for ACME # # Copyright © 2026 Ernst Strüngmann Institute (ESI) of the Max Planck Society # # SPDX-License-Identifier: BSD-3-Clause # # Builtin/3rd party package imports import os import shutil import time import multiprocessing import psutil import tqdm import numpy as np import logging ...
7cf22a161f7e1ca952f9610dcaacc546c66040b82cd44c825d85ae0937aa3435
Python
7,299
211
from unittest.mock import MagicMock, patch from tensorflow.test import TestCase as TensorFlowTestCase from tensorpack.tfutils.tower import TowerFuncWrapper from tgan.trainer import GANTrainer, MultiGPUGANTrainer, SeparateGANTrainer class TestGanTrainer(TensorFlowTestCase): @patch('tgan.trainer.tf.control_depen...
9f50caff00f69655b9e7577ce2b1833d0eb1486a4452e8605ab80f1fbc80e3da
Python
7,300
217
from string import maketrans import operator import random from collections import defaultdict ###Stats and math functions def weighted_sampler(pop_dict): """randomly sample a dictionary's keys based on weights stored as values example: m = {'a':3, 'b':2, 'c':5} samps = [weighted_sampl...
888f77ce4f2e69d6cf00e560605ce1bf67a1d0627496f8d9d5307446b25af00a
Python
7,301
200
from collections.abc import Callable, Hashable, Iterable, Iterator, Mapping from typing import Protocol, Self, cast, override, runtime_checkable @runtime_checkable class ReadOnlyGraph[N: Hashable, E](Protocol): @property def successors( self, ) -> Mapping[N, Mapping[N, E]]: ... @property ...
a54bd2b6724b29ee2f9f1e2b1e3c50e91f5fa50addbd51935a761212abc5e835
Python
7,301
203
"""Tests for regtools.ccf_boundary_editor.cell_remap.""" import json import numpy as np import pytest def _identity_params(): return { "transpose": False, "flip_h": False, "flip_v": False, "scale": 1.0, "dy": 0, "dx": 0, } class TestBrainX...
fc2c96aea72c5dfc500efb8df8b77f6552fb9918f25b90ed38b7deaf89f3c7a4
Python
7,301
208
#!/usr/bin/env python # # Copyright 2006, Google Inc. # 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...
167279230a30659e356b08c291ed64a0c4f7dd4681bf8b1838e9e30a9ee3f844
Python
7,302
215
# TODO # 我看以后atomic number改type得了,呵呵 import torch from typing import List, Dict from torch import nn from ..utils import EnvPara class ElementIndependentLinear(nn.Module): def __init__(self, input_dim: int, output_dim: int, bias: bool = True): super().__init__() self.linear = nn.Linear(input_dim,...
bd2fa4577451632616fe1707bbb75d8a96cb431d301fa848177baf371758ad4f
Python
7,302
194
import PoseUNet_dataset as PoseUNet from PoseCommon_dataset import PoseCommon import PoseTools import sys sys.path.append('/groups/branson/home/kabram/bransonlab/coco/cocoapi/PythonAPI') from pycocotools.coco import COCO import os import tensorflow as tf import imageio import localSetup from scipy.ndimage.interpolation...
5f282289b16df496089719b3959e68f856de66b5399530999ebbbd57786db34f
Python
7,303
180
"""--reuse_affine: seed SyNOnly from a precomputed affine, skipping affine computation. Covers the resolver, the two_stage split, antsRegistration's routing, and CLI wiring.""" import inspect import os import numpy as np import pytest ants = pytest.importorskip("ants") from regtools.registration.core.re...
a0821395220f6714e01a027ef88610b8b6e4f280141034afc2a50da07ce54185
Python
7,304
212
"""Qualitative group-level comparison of static M/EEG RSN features """ # Set up dependencies import os import numpy as np from sys import argv from utils.data import load_data from utils.statistics import fit_glm, cluster_perm_test, max_stat_perm_test from utils.visualize import (GroupDifferencePSD, ...
0c4000cbba19ac5d16fb2ef36cb5435ea61b711ad6b6bf1dd8f2dddc4e4c0fa4
Python
7,305
222
# # 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,...
b25d18d66ca724555cae81024e8763f816ce3905c1525466b1609e6afea1004b
Python
7,307
255
# %% Package Imports import sys, os sys.path.append(os.path.abspath(".")) sys.path.append(os.path.abspath("..")) import torch import torch.nn as nn import torch.optim as optim import prosper_nn.utils.generate_time_series_data as gtsd import prosper_nn.utils.create_input_ecnn_hcnn as ci import prosper_nn.models.crcn...
e2e944f53a3fba63a2e5026d7ec8b2109a6090b612d512111ea744e5de09f377
Python
7,307
164
import numpy as np import pandas as pd import pytest import scanpy as sc from anndata import AnnData import pertpy as pt from pertpy._types import cast_frame @pytest.fixture def adata(rng): labels = np.array(["control", "A", "B"]).repeat(20) centers = {"control": 0.0, "A": 5.0, "B": -5.0} X = np.vstack([...
9e9863b5eee5ca5c061e7556e8bf9cb2888145d36c12edf0c5b388caec10b760
Python
7,308
211
# 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...
c1651038f3bb15d6e2dab5c7a303b79f993793ae8df762b818a159952d14c4fc
Python
7,309
184
# Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import sys import subprocess import tempfile import requests import shutil from pathlib import Path import torch import esm def test_readme_...
d41df271f48d99293eea9136c67595e0bdc13c4e0c3adf382984b5e6f9fa466c
Python
7,309
143
import os import pickle as pkl from typing import Any, Callable, Dict, Tuple, Union from scipy import signal from ..base_dataset_perturbation import BaseDataset_perturbation class MemoryAgeDataset_perturbation(BaseDataset_perturbation): r''' Args: root_path (str): raw data files in pickled python/num...
348625e2364a1611e50b2df1ceaee0b57918f2540bb54790c47669bc443b89be
Python
7,311
246
# 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...
b1751dbc66c7b1bffa5e988bf184ffc179d12cf8d79adabb3e1659121b3bd5c6
Python
7,311
208
"""Class CGR and FCGR are from complexCGR repo""" from itertools import product from typing import Dict, Optional, List from collections import defaultdict, namedtuple from PIL import Image import numpy as np import random # coordinates for x+iy Coord = namedtuple("Coord", ["x", "y"]) # coordinates for a CGR encodi...
ff99f167a42df7ef05a4f324b12c896bf175ad14a33b62a578372b02a2dd2a2e
Python
7,311
201
import copy, time import numpy as np from collections import defaultdict from rdkit import Chem, RDLogger from rdkit.Chem import AllChem, rdMolTransforms from rdkit import Geometry import networkx as nx from scipy.optimize import differential_evolution from rdkit.Chem.rdchem import BondType as BT RDLogger.DisableLog('...
7896b81139a6daf5fe740faee66970210cddc8471c7456be2eab21e9dbab86b6
Python
7,312
188
"""Unit tests for SliceCaches. Pure-Python, no QApplication - these run in milliseconds because all they exercise is the dict / OrderedDict bookkeeping. """ import pytest @pytest.fixture def caches(): from regtools.ccf_boundary_editor.caches import SliceCaches return SliceCaches(modified_capac...
68adc002e4c9c5ed38e33de33eeee24685548a078cf7c9a3702125a0d4de080d
Python
7,313
219
# 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...
4db0913c5f32e086122e29c406c3e649e9b4e72acea85882b1bcd67e4471132c
Python
7,314
173
# %% import numpy as np from scipy.sparse import csr_matrix import matplotlib.pyplot as plt def simulate_sparse_VAR1(W, source_neurons, T=1000, laser_power=1, noise_var=1, seed=None): """ Simulates a sparse VAR1 model. Args: W (ndarray): The effectome matrix. source_neurons (list): A list ...
9edae362a37b8d3aa91182114dc5c67cbd94ee07f02e9f2ccbd06e19ab35c2c3
Python
7,315
204
from __future__ import annotations from pathlib import Path import pytest from ase import Atoms from ase.build import bulk, molecule from ase.data import atomic_numbers from quacc import Remove, change_settings from quacc.recipes.aims import _base, mad @pytest.fixture def write_inputs(monkeypatch, tmp_path): "...
0711687cf0ec1950e7d18c4707cfe9ac4609444e0dc9423ef3b3dfa9af3328e4
Python
7,317
203
# 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...
25c42b2bc47be21de7996545722f05ea156fe0d89cbd61e44e080e47fc423dbf
Python
7,321
175
""" VGG16 with BN Difference from vgg16 in torchvision for higher resolution: 1. Layer config changes from [64, 64, 'M', 128, 128, 'M', 256, 256, 256, 'M', 512, 512, 512, 'M', 512, 512, 512, 'M'] (torchvision) to [64, 64, 128, 128, 'M', 256, 256, 256, 512, 512, 512, 'M', 512, 512, 512] (acscon...
ff7d5a63b1f33de8be67e0b55ce3a102f471cb7f805063e8383d66e20c55592e
Python
7,321
205
"""Self-contained HTML report for a Cellpose SAM detection run. Bundles a run's artifacts — parameters (``cellpose_metadata.json``), measurement summary (``cell_summary_<name>.csv``), and figures (overlays, distribution + histogram PNGs) — into ONE portable ``cellpose_report.html``. Inline CSS, figures embedded a...
02a2c7ccde78e227b8c9299c9f7a6084bdf023f339d2832e6eeee5b91ccb266f
Python
7,324
169
# Copyright (c) 2020, Ko Sugawara # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # 1. Redistributions of source code must retain the above copyright notice, # this list of conditions and t...
c5ad275c270dc46bb18ecd3679312881d79d0cac14ab9871b45ab8f15a3c18b1
Python
7,327
229
# filter.py import regex from fba.utils import get_logger, open_by_suffix logger = get_logger(logger_name=__name__) def compile_regex_ref_barcodes_single(sequence, num_mismatches=1): """Compiles a regular expression pattern, returning a pattern object. Parameters ---------- sequence : str ...
dfeb54fd63d26bc3f94924435d08dce13a721b56ae008eb51d4fe092aabacc64
Python
7,328
201
#!/usr/bin/env python """Utility classes to parse SAMPL submissions.""" # ============================================================================= # GLOBAL IMPORTS # ============================================================================= import os import io import glob import numpy as np import pandas a...
e4f74aa82d3a064057db8257054da3542de5219dc7792e1dfe908c3cf7388007
Python
7,328
195
#!/usr/bin/env python3 """Aggregate metabolic scores and model associations with regional pathology.""" from pathlib import Path import numpy as np import pandas as pd import statsmodels.api as sm import statsmodels.formula.api as smf from statsmodels.stats.multitest import multipletests ROOT = Path(__file__).resol...
9512bb97b1a4a4b25e36a9c44895947c3adee2ae3047dc7a67c583ddc21a8177
Python
7,331
216
"""Utilities for extracting common archive formats""" import zipfile import tarfile import os import shutil import posixpath import contextlib from distutils.errors import DistutilsError from ._path import ensure_directory __all__ = [ "unpack_archive", "unpack_zipfile", "unpack_tarfile", "default_fil...
1bc38e6573dfea126f7614002e145016f878cca792ca73cdc39d0f317e9c56de
Python
7,332
239
# 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...
22faa0b79c960572950a26276debf2b4ca0c9a87314037a4b15ec9be38c7ea6d
Python
7,333
192
# 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...
ebf69abcd800754738961792161b3a3f93f4695671025080ef9aff5ecabb3c47
Python
7,333
217
#!/usr/bin/env python # -*- coding: utf-8 -*- from hybridLFPy import CachedNetwork import analysis_params from cellsim16popsParams_modified_regular_input import multicompartment_params from plot_methods import plot_signal_sum, plot_signal_sum_colorplot import plotting_helpers as phlp from matplotlib import gridspec imp...
ffdbb123f586b555042d70cdda2b8025e116602258ce8545b06d95aa9e331fd6
Python
7,333
197
# pylint: disable=invalid-name """Auxilary functions""" import os import glob import shutil from omegaconf import open_dict, OmegaConf, DictConfig import pandas as pd from src.settings import UTCNOW, LOGS_ROOT def set_project_name(cfg: DictConfig): """set project name and project dir based on config""" de...
2a7c6fcfb3e1b150ad921cc75804dd39ff6fbbe1db0a51c4a8f015717a416734
Python
7,334
209
""" Collections of custom data structures and types. """ import logging import random import string from collections.abc import MutableMapping from dpath.util import delete, search DEFAULT_STAR_SEPARATOR = "." FORWARD_REPLACE = {"*": "STAR", "|": "MINUS", ".": "DOT"} BACKWARD_REPLACE = {v: k for k, v in FORWARD_REPL...
30be260434e6fa619780cc15b469e5b8113ce97d4b0bf5cd2b1ab4763bd25ca8
Python
7,335
160
""" Depth Model File Currently this subclasses the Nerfacto model. Consider subclassing from the base Model. """ from __future__ import annotations from dataclasses import dataclass, field from typing import Dict, Tuple, Type import numpy as np import torch from nerfstudio.models.nerfacto import NerfactoModel, Nerf...