sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
5dccee429ce49ffb690497b22d78bdaf3be58ba1b3f7c399dd37b5b0c4cf8e77
Python
11,317
276
from sklearn.metrics import accuracy_score, precision_score, recall_score, f1_score, confusion_matrix from matplotlib import pyplot as plt import numpy as np import random import pandas as pd import seaborn as sns from scipy.stats import pearsonr import os from data.loader import * import h5py #from models import mode...
60a1f59e528572a908af358e44e9a4172bbccf8fedf02ce862661aa0443d8fe8
Python
11,325
314
# ------------------------------------------------------------- # Subgrid Optimization # Copyright (c) 2026 # Dirk Keller, Nick Ramsey's Lab, University Medical Center Utrecht, University Utrecht # Licensed under the MIT License [see LICENSE for detail] # ----------------------------------------------------------...
72c779e936c76c26f62c39ed0af17ec58a6679380d9bf01a08024efc631b3505
Python
11,327
338
from collections import defaultdict import itertools import json import os import posixpath import re import requests import numpy as np from tqdm import tqdm from cloudfiles import CloudFiles from ....lib import red, toiter, Bbox, Vec, first, nvl from ....mesh import Mesh from .... import paths from ..sharding imp...
a054f8f013c3d8b8229c25385f032b53c1f467a6f20fb7ee38192df6984c1915
Python
11,387
314
from PyQt5.QtCore import QTimer, Qt from PyQt5.QtWidgets import ( QApplication, QWidget, QMainWindow, QDockWidget, QVBoxLayout, QGridLayout, QPushButton, QLabel, QProgressBar, QFileDialog, QCheckBox, ) from state import ExperimentState, ScanningParameters, frame_duration from...
d8c3fa94868adde27362dccce1157b175b69cf76744ac3ebc9af73dfc4680a6b
Python
11,392
286
# -*- coding: utf-8 -*- """ Created on Tue May 20 13:11:58 2025 @author: Usuario """ #Librarires import os #For importing images and saving figures import errno # for checking whether the montage direcotry already exists from cellpose import models, io #Cellpose ML model for single cell segmentation from c...
ef1000d34e61a8a837b68962a3630e4ea7e924ef857db207a25938085f88ecf1
Python
11,453
307
import json import pathlib import typing from dataclasses import asdict, dataclass from enum import Enum class TestResult(str, Enum): ABORTED = "aborted" FAILED = "failed" COMPLETED = "completed" @dataclass(slots=True) class TestFile: name: str subfolder: str | None exists_in_ref: bool e...
a467aa3d884977ebc8e73382b2cb0d82ffccc5e91e4b2f23f5339581fcd882a1
Python
11,462
323
import argparse import json import matplotlib.dates as mpd import matplotlib.pyplot as plt import os import pathlib import typing from datetime import datetime, timedelta from tetra.database import DBWrapper from tetra.utilities import get_env_or_raise def download_results(project: str, graph_history: int): # Ma...
9bc41b8875ef580200f6d7ea4f2125720343177ed87c9a5fb45a3a5ad0672d3c
Python
11,759
362
#!/usr/bin/env python """ TODO: - define __all__ or limit available functions in some other way. """ import numpy as np import pandas from argparse import ArgumentParser try: # python < 3.3 from collections import Iterable except ImportError: # python >= 3.3 from collections.abc import Iterable from ...
5b0f41c9cdfd4641bc0d14f6660e21a4578ad93383301a43fbf28d4756beb35c
Python
11,897
354
""" Precomputed Annotation Reader code adapted from a mixture of these two repositories: https://github.com/fcollman/precomputed_python https://github.com/google/neuroglancer/ """ from typing import Optional, Union, Iterable import os import posixpath from cloudfiles import CloudFiles import numpy as np import nump...
5837dee3077d295d7609333e5f397782b8b7be7de7a798e526512493c3d554b8
Python
12,083
332
# -*- coding: utf-8 -*- """ Created on Tue Nov 5 17:19:50 2024 @author: simon """ import numpy as np import matplotlib.pyplot as plt from plotting_functions import my_style import seaborn as sns; sns.set_theme() import pickle import pandas as pd import pathlib # Get the path of the current script ba...
3f87dbb5ecf25f34fd2a7d845a3765431f97559d1c2c1712343ea9fd844230cd
Python
12,107
295
""" Cerebellar normalization and isolation using ANTsPy @authors: Yaping Wang, Jorn Diedrichsen """ import sys import argparse import os import nibabel as nib import ants import numpy as np import pandas as pd from nibabel.affines import apply_affine import nitools as nt from SUITPy.isolation import img_read def nor...
33a42a35d17e0b7d62a39e9918c6bacef787c16a71b435a5286f54294a7c9070
Python
12,357
396
"""nonlinear case.""" import os os.environ["JAX_PLATFORM_NAME"] = "cuda" os.environ["XLA_PYTHON_CLIENT_MEM_FRACTION"] = "0.4" import jax jax.config.update("jax_enable_x64", True) import jax.numpy as jnp import jax.random as jr import equinox as eqx import sys sys.path.append('..') from utils.sde import SDEIntegrator...
4813d3c0110ca4d1faa7ca2bb48663abf630d8739db200bff6992ba68a37d392
Python
12,441
361
# This script is part of mousebrains (http://www.github.com/schlegelp/navis-mousebrains). # Copyright (C) 2020 Philipp Schlegel # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, ei...
de634b292ce6737acffd785dcfebe54990cef5685c3d0032acb8b4f549a632d7
Python
12,520
306
import argparse import pathlib import shutil from dataclasses import dataclass from enum import Enum from tetra.reformat_files import reformat_files from tetra.regression_manager import ManagerData, RegressionManager, TestResult """ To update regression test reference data: 1) Run the regression test(s) to produc...
7a53a7f3864fe8da9bfa8e9a5cd9c9e2079d50f9ad295e4d14d8a10e290a30f1
Python
12,542
349
from __future__ import print_function, unicode_literals, absolute_import, division import numpy as np import os from skimage.measure import regionprops from csbdeep.utils import _raise from tqdm import tqdm from ..utils import path_absolute, _normalize_grid from ..matching import _check_label_array # from ..lib.stard...
c242207a234b40ef37e97d43c86db0066c4fa9f3f273cef59c62561290c73d9f
Python
12,647
411
from typing import Optional import copy import re import os import numpy as np from cloudfiles import CloudFiles import cloudfiles.compression from .. import ( autocropfn, readonlyguard, ImageSourceInterface, check_grid_aligned, generate_chunks ) from ...types import CompressType, MipType from ... import com...
a9d9eb5e1c69319b822b3969ab8e070ec3a238a6e9b8b56bd6281710d945e84d
Python
12,713
323
from dataclasses import dataclass import os import pathlib import contextlib import subprocess import shutil import typing import unittest from copy import deepcopy from data_paths import ( PLATFORM, INPUT_FOLDER, OUTPUT_FOLDER, REFERENCE_FOLDER, ) from utilities import DEBUG, run_dorado, make_summary...
98bcc0b1fb9aedf4ac6ca7fea275219fe41d9e016a5d075c0345db57b9442350
Python
12,809
319
#! /usr/bin/env python3 import pathlib import shutil import unittest from tetra.data_checker import DataChecker from tetra.regression_manager import TestData, TestFile from tetra.sequence_utils import USE_PYSAM class TestDataChecker(unittest.TestCase): KEEP_OUTPUT_DATA = False # Set to True to keep files for ...
33932d7850646d9241f0ce56d70a2a7ef128bbb3b3fe0cafad76a57635a55481
Python
12,987
467
# -*- coding: utf-8 -*- """MRI non-linear operators. This module contains these non-linear operators: * Nlinv, joint coil sensitivity maps and image content. * Diffusion, exponential diffusion modelling and parallel imaging sampling. * MGRE, multi gradient echoes. Author: * ...
2d3f309cadc245a3a534444ae706c9e2e69d3c2489656d921b366c1c6b395d22
Python
13,002
297
################################################################################ # 1. INITIATE ENVIRONMENT # ################################################################################ import streamlit as st from streamlit_extras.stylable_container import stylab...
d244913be4b7babfc2224c923913d58d935621bd7d9b2406eac836b48e1fd856
Python
13,062
421
"""20D nonlinear case. The target uses one double-well coordinate coupled to the remaining coordinates through a nonlinear 20D potential. """ import os os.environ.setdefault("JAX_PLATFORM_NAME", "cuda") os.environ.setdefault("XLA_PYTHON_CLIENT_MEM_FRACTION", "0.48") import jax jax.config.update("jax_enable_x64", Tr...
e8a990ba6c853041b644766bcf6f6522a181a11cc20214772f5518bb96339694
Python
13,081
346
# ------------------------------------------------------------- # Subgrid Optimization # Copyright (c) 2026 # Dirk Keller, Nick Ramsey's Lab, University Medical Center Utrecht, University Utrecht # Licensed under the MIT License [see LICENSE for detail] # ----------------------------------------------------------...
8569c57035aaa0141b49f93fdfd5161348dfdb3a4391a1ef16b100c6526b8401
Python
13,166
359
""" Read all CSV log files from /dls_sw/i23/logs/GoniOwl, run fresh GoniOwl inference on each ECAM_6 image, and produce: - Annotated images saved as {confidence}_{decision}_{original}.png - A CSV summary of all results - Confidence histograms split by human decision (pin on vs pin off) Example: python infer_al...
e7a083774f088d8fb195291583d03d543d05330e87fc5b8d5285b5589d99e51b
Python
13,179
343
import pathlib import typing from collections import defaultdict from Bio import SeqIO from tetra.utilities import get_platform USE_PYSAM = True try: import pysam except Exception: USE_PYSAM = False def compare_fastq_files(file_a: pathlib.Path, file_b: pathlib.Path) -> tuple[bool, str]: record_dict_a =...
04353e2ec49f97d1c6378aba381f44a59379ca662c112fe4373f746356ec052e
Python
13,205
358
############################################################################### # This library provides utilities for duplicating two-sided and exchange # reactions in a SBML model. Examples of use are given in the notebook # Duplicate_Model.ipynb # Author: Leon Faure, leon.faure@inrae.fr #############################...
5e310c8d2a482a7d3a45aea96a4cee232fdb308bf6cbebc26c48fe34d4a1d56e
Python
13,288
332
"""Drosophila developmental stage""" import requests from pydantic import BaseModel, ConfigDict from aind_data_schema_models.registries import Registry """Drosophila developmental stage""" class DrosophilaDevelopmentalStageModel(BaseModel): """Base model for drosophila developmental stage""" model_config ...
a1355fd6d5ae9ca4d1a911232fb2c163e9410f89c6818324b9adb8e39b11d9a7
Python
13,364
556
import pytest import operator from functools import reduce from cloudvolume import CloudVolume, Skeleton from cloudvolume.storage import SimpleStorage from cloudvolume.datasource.precomputed.image.common import ( gridpoints ) from cloudvolume.datasource.precomputed.common import ( compressed_morton_code ) from cl...
6f6f7cf3d31e0f045b43fa541f48594368258a61918a359ccf48717d51ee4e2d
Python
13,473
327
#! /usr/bin/env python3 import pathlib import shutil import subprocess import unittest from datetime import datetime from tetra.sequence_utils import USE_PYSAM def run_with_timeout(cmd_args: list[str], timeout: int, verbose: bool): try: if verbose: print("Command line:", " ".join(cmd_args)) ...
37bdce0bc1012fd7197096eca6c59510d5d4a6716ceceb817407bbb447d266e8
Python
13,733
394
import os import shutil import json import socket from time import sleep from docker import APIClient as Client from docker.types import Mount import docker from airflow.exceptions import AirflowException from airflow.plugins_manager import AirflowPlugin from airflow.models import Variable from airflow.providers.docker...
75460ee123536b3e08508158190bf9b42a6ce7134c625f1f827505fd7b1d1df3
Python
13,762
475
from functools import partial import fastremap import numpy as np import psutil from tqdm import tqdm from cloudfiles import CloudFiles, reset_connection_pools, compression from cloudvolume import lib, chunks from cloudvolume.exceptions import AlignmentError from cloudvolume.lib import ( mkdir, clamp, xyzrange, V...
1c4d06ff8f91c04e28a22d61c7dea5055ce4661aa9a04f497efe8c81c2b193d8
Python
13,891
480
from typing import Literal, NamedTuple, Optional, Union, Any, cast, Iterable from collections import OrderedDict from dataclasses import dataclass import posixpath import os from cloudfiles import CloudFiles import numpy as np import numpy.typing as npt from ....types import CacheType, StrEnum from ....lib import ...
aab548c9b041945f5b4ce4fe84ad0f15c94716a2a3d45cd6da34c32e6769949a
Python
14,165
451
''' pymmh3 was written by Fredrik Kihlander and enhanced by Swapnil Gusani, and is placed in the public domain. The authors hereby disclaim copyright to this source code. pure python implementation of the murmur3 hash algorithm https://code.google.com/p/smhasher/wiki/MurmurHash3 This was written for the times when y...
4cc7a40684ed207fc8ee1ebad47769abdb0cf542fd8517437f104fe695f3baa1
Python
14,172
465
import posixpath from collections import namedtuple import json import re import requests import urllib import numpy as np from ...lib import Vec, Bbox from ... import exceptions from ... import paths from ...secrets import cave_credentials from ..precomputed import PrecomputedMetadata VERSION_ORDERING = [ '1.0'...
2f68e82aa1c02c2346b3f51495af1f00ea57810a6859b48b2db178dcc7fb476a
Python
14,273
364
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 26 11:09:21 2025 @author: joaquin """ import os import errno # for checking whether the montage direcotry already exists import matplotlib.pyplot as plt import skimage.morphology as morph from skimage.filters import threshold_local, threshold_otsu, ...
d2acf6b6170841ecc801d448ba140438b8f61fca30220a19cefc497337e1d3b7
Python
14,616
343
""" Quality control for ecephys pipeline """ import os import sys import argparse import json import numpy as np import time import logging from pathlib import Path import spikeinterface as si import spikeinterface.preprocessing as spre # AIND from aind_data_schema.core.processing import Processing from aind_data_s...
8a3cc540784ef81b0434cb9fb3f5aa69ce52831bc716bc3ee2fd8cf0714a6832
Python
14,907
355
import opensoundscape from opensoundscape.preprocess.preprocessors import SpectrogramPreprocessor from opensoundscape.ml.datasets import AudioFileDataset from opensoundscape.ml.utils import collate_audio_samples_to_tensors import torch import torch.nn as nn import numpy as np import pandas as pd import sklearn import ...
1a7c61d16609a11623f1cb4709fdfd62278ed7588d925602aa6ebeab86d88bdc
Python
14,968
361
"""Human developmental stage""" import requests from pydantic import BaseModel, ConfigDict from aind_data_schema_models.registries import Registry """Human developmental stage""" class HumanDevelopmentalStageModel(BaseModel): """Base model for human developmental stage""" model_config = ConfigDict(frozen=...
f01e341091742426828d555ca2c715589985cbad73538fc11ea6308b0aa96a47
Python
14,996
375
#!/usr/bin/env python """ Automated state annotation using a combination of linear discriminant analysis (LDA) and hidden Markov model (HMM). """ import pickle import numpy as np from pomegranate import ( MultivariateGaussianDistribution, HiddenMarkovModel, ) from sklearn.discriminant_analysis import LinearDi...
5d85bb48b0b71c4a98a20e3cd38570971db8f26433730c23555b6a8e2570b597
Python
15,044
405
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Module to importing cerebellar atlases and templates from the [cerebellar atlas repository](https://github.com/DiedrichsenLab/cerebellar_atlases) @authors: Jorn Diedrichsen, Vahid Ashkani """ import os import json import numpy as np import nibabel as nib import pandas...
45fd72aafbb296ec2b4c943d3c7e1c9bd5b4a1fa317a838bf87a28d50cd3ce01
Python
15,086
525
from collections import defaultdict import json import os.path import posixpath import re import boto3 import botocore from glob import glob import google.cloud.exceptions from google.cloud.storage import Batch, Client import requests import tenacity from cloudvolume.connectionpools import S3ConnectionPool, GCloudBuc...
851ec23449831acda158ac666268fcde8c787e2d4ae786618caba61af1e0d673
Python
15,110
344
import math import random from sklearn.base import TransformerMixin from sklearn.preprocessing import StandardScaler, RobustScaler, MinMaxScaler, LabelEncoder from torch.utils.data import Dataset, DataLoader, TensorDataset, ConcatDataset import matplotlib.pyplot as plt import scipy import statistics as st import os imp...
8f17b0bb4e615e104f962c5cfbf6eada064420ab4ecef0e18bec7eef8c400712
Python
15,153
547
# -*- coding: utf-8 -*- """ Created on Fri Jul 14 23:28:15 2017. @author: spiros """ import numpy as np import sys import pandas as pd from scipy import signal def spatial_info(rate_matrix, time_bin): """ Spatial information index. Parameters ---------- rate_matrix : np.ndarray Firing-r...
12241edea1637687e761021421415812b07e0d63628f107689b5dba0865837cb
Python
15,455
513
from functools import partial import tempfile import cloudvolume import numpy as np import shutil import posixpath import pytest import os from scipy import sparse import sys import json import re tempdir = tempfile.mkdtemp() TEST_PATH = "file://{}".format(tempdir) TEST_DATASET_NAME = "testvol" PRECOMPUTED_MESH_TEST_...
00992e40dc428e41a780bd3518f90530dda62c894df2a230274c27b3eab4d218
Python
15,551
476
""" MUSE Reconstruction. Author: Zhengguo Tan <zhengguo.tan@gmail.com> """ import numpy as np import sigpy as sp from sigpy import backend from sigpy.mri import app, retro, sms from sigpy.mri.dims import * # %% def _denoising(input, full_img_shape=None, use_iter=True, max_iter=5): """ Args: input: ...
91339c2a188e31912f63671856efbcf3ae5e862fc0edc52d4a238f6009e9f4c9
Python
15,605
493
import copy from typing import Dict, Tuple, Sequence, Union, Optional import numpy as np from tqdm import tqdm from cloudfiles import CloudFiles, compression from cloudvolume import lib, exceptions from ....types import CompressType, MipType from ....lib import Bbox, Vec, sip, first, BboxLikeType, toiter, xyzrange f...
1956361c647b09ca270263372c48169bdd6151e696baccfca4afabfb93e5d64a
Python
15,848
382
import numpy as np import os import time import sys import argparse import errno from collections import OrderedDict, defaultdict, Counter from tqdm import tqdm import random import torch import torch.nn as nn import torch.optim as optim from torch.utils.data import Dataset, DataLoader, TensorDataset, ConcatDataset ...
e31c957f4665dea86cbbcbd2a4b71a13e5c1d4bc170682a6699628d038a0a914
Python
15,891
527
import copy import re import struct import sys import numpy as np from .exceptions import MeshDecodeError from .lib import Vec, Bbox def is_draco_chunk_aligned(verts, chunk_size, draco_grid_size): """ Return a mask that for each vertex is true iff it is within half a draco_grid_size from a chunk border. """ ...
3244d1b0590e8bc3d1d1b3190e7c9e5067b01812a7cc7ce06d877823a609f076
Python
16,107
363
import torch import torch.nn as nn import math import warnings import random import numpy as np from collections import OrderedDict from functools import partial from itertools import repeat from models.drop import DropPath def _no_grad_trunc_normal_(tensor, mean, std, a, b): # Cut & paste from PyTorch official ma...
4d40c82187e9d8f3f34d216e8e00f17c03d895185c63d4b8785a3e67a2733ddf
Python
16,158
345
# -*- coding: utf-8 -*- """ Created on Tue Aug 5 11:15:40 2025 @author: simon """ import numpy as np import os, sys import pickle import pandas as pd import pathlib from scipy.signal import find_peaks from scipy import cluster # Get the path of the current script base_path = pathlib.Path().resolve...
47e0ac4ebb32922f463f854c0d10723a2934067ee6b536332009fe4b8191b64d
Python
16,316
543
#!/usr/bin/env python # coding: utf-8 # # P0 Het and Ko analysis Replicate 1 # AT Updated 8/8/24 # ## Section 1: Load in data and concatenate datasets if applicable # Import libraries import numpy as np import pandas as pd import scanpy as sc from sklearn.cluster import KMeans from sklearn.metrics import silhou...
2f847cd432c9cdaee3926cf303fdfe3db120add17b01110da848ce6b409b26d1
Python
16,399
470
""" grouped_pattern.py GroupedPatternDataset --------------------- Purpose ^^^^^^^ This Dataset loads **pre-saved PyTorch tensors** (`.pt`) and groups samples by a shared **Pattern ID (PID)** so you can build pattern-aware batches (e.g., batches containing multiple different patterns instead of many samples from one ...
a18cf59482f649e0d7e4a1778a3f37f23dcf49a0b7c8a372f53bb0e8774e6c61
Python
16,461
517
#!/usr/bin/env python # coding: utf-8 # # P0 Het and Ko analysis Replicate 2 # AT Updated 8/8/24 # ## Section 1: Load in data and concatenate datasets if applicable # Import libraries needed import numpy as np import pandas as pd import scanpy as sc from sklearn.cluster import KMeans from sklearn.metrics import...
7216759a63e399faf160e6c13983eaa54febdb634f3ca990adf37a24b8ef4120
Python
16,620
408
import warnings warnings.filterwarnings("ignore") # GENERAL IMPORTS import os import sys import argparse import json from pathlib import Path import time import logging from copy import deepcopy from datetime import datetime, timedelta import numpy as np import pandas as pd # SPIKEINTERFACE import spikeinterface as...
f9a5fbb589d3a0d0250940ae2e036996e9d63c770270fcad9fd017d9e29dffd5
Python
17,003
614
# -*- coding: utf-8 -*- """This module contains an abstraction class Prox for proximal operators, and provides commonly used proximal operators, including soft-thresholding, l1 ball projection, and box constraints. """ import numpy as np import random import torch import torch.nn as nn from sigpy import backend, util,...
43f0f179313b1eca1c56cdff1f122b93b551799d7e818862b9c01b005b7f90e2
Python
17,067
434
# -*- coding: utf-8 -*- """ Created on Tue Oct 7 15:03:11 2025 @author: simon """ import numpy as np import matplotlib.pyplot as plt from plotting_functions import my_style from matplotlib.gridspec import GridSpec from matplotlib.colors import LogNorm from opt_ import make_maps_spikes import seaborn as ...
dcc8face0fefbc48f24ff3abdcb734570578eb9aa606ce48b39219f6c5a89f34
Python
17,113
533
# -*- coding: utf-8 -*- """Block reshape functions. """ import numba as nb import numpy as np from sigpy import backend, config, util __all__ = ["array_to_blocks", "blocks_to_array"] def array_to_blocks(input, blk_shape, blk_strides): """Extract blocks from an array in a sliding window manner. Args: ...
e4e9060a3ff240b39950a93b3f590d2ba2b31729e014502ffbfc8dbcc3a69bae
Python
17,159
550
# -*- coding: utf-8 -*- """Convolution functions with multi-dimension, and multi-channel support. """ import numpy as np import scipy.signal as signal from sigpy import backend, config, util __all__ = ["convolve", "convolve_data_adjoint", "convolve_filter_adjoint"] def convolve(data, filt, mode="full", strides=No...
f859988e69256d8146f535731c6eee05b58692e3cf3753565c336926dbc753bf
Python
17,355
396
#!/usr/bin/env python3 """Verify that a pipeline run produced the expected outputs. The sample dataset contains 3 recordings (main, short, unsigned): - all 3 are preprocessed - all 3 have quality control run on them - the "short" (10s) recording is too short to be spike sorted, so only 2 recordings produce a...
04bfa606edfd88cb8ba3bb84073030bb5bc58fc858aa859fce508982345a31e4
Python
17,536
393
import warnings warnings.filterwarnings("ignore") # GENERAL IMPORTS import os # this is needed to limit the number of scipy threads # and let spikeinterface handle parallelization os.environ["OPENBLAS_NUM_THREADS"] = "1" import sys import numpy as np from pathlib import Path import shutil import json import argpars...
b0a6d6d56291d471380e7ee2ff2610d5b96aed7fd810239edcd13e98028f1495
Python
17,670
538
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Mar 14 09:37:20 2021. @author: spiros """ import os import brian2 import pathlib import numpy as np import matplotlib.pyplot as plt def poisson_spikes(t1, t2, N, rate=10, dt=0.1): """ Poisson spike generator. Parameters ---------- ...
d1146283e0d96d5444e5bec3c4d1123f912d4a4b2c8de96b1ce58fe8959d5f13
Python
17,912
427
# -*- coding: utf-8 -*- """ Created on Wed Oct 16 10:59:33 2024 @author: simon """ import numpy as np import matplotlib.pyplot as plt from plotting_functions import my_style import seaborn as sns; sns.set_theme() import pickle import pandas as pd import pathlib # Get the path of the current script ba...
48cbc730bdfedd0e068b627c7fa20d76bf565e78e0fffcef2ea576a2a851d514
Python
17,914
485
r""" # Basic trainers for SDE models This module implements basic training routines for SDE models. The base class is `SDETrainer`, which provides the base training logic. The sub-classes are required to implement the `SDETrainer.loss_func` that is used to train the model. ## Training routines We provide here two tr...
c11e6ee8c7652a762ac697963b1291bdcdfe57202b31c3ccbeb089ad0e3fa1e1
Python
17,985
528
from typing import Union, Iterable from collections import defaultdict from functools import partial import re import struct import numpy as np from cloudfiles import CloudFiles from .common import apply_transform from .unsharded import UnshardedLegacyPrecomputedMeshSource from ..sharding import ShardingSpecificati...
ac8ba5d014b4dc72270d3e2bcdab47136f8d9f7e93703433ac0fce412ae69b32
Python
18,268
446
import sys import time from typing import Optional, Union, Tuple, Any import multiprocessing as mp import numpy as np from tqdm import tqdm from cloudfiles import CloudFiles from cloudfiles.paths import normalize from .exceptions import UnsupportedFormatError, DimensionError, InfoUnavailableError from .lib import ge...
2992b38d702d49ec5e7c808b0366e5e3248ca1d7d38788e89bd78b1674f36417
Python
18,395
741
import re import os import numpy as np from cloudfiles import CloudFiles from cloudvolume.datasource.precomputed.metadata import PrecomputedMetadata from cloudvolume.lib import jsonify, Vec, Bbox, spatial_unit_in_meters, time_unit_in_seconds from ... import exceptions from ...provenance import DataLayerProvenance ...
7a6ac69b7430ec9417fe6afe9bc9099406fc1028aea00b92d53d1485772e7dd7
Python
18,529
418
# -*- coding: utf-8 -*- """ Created on Mon Sep 30 15:03:26 2024 @author: simon """ import numpy as np from scipy.ndimage import gaussian_filter1d import matplotlib.pyplot as plt from plotting_functions import my_style from opt_ import make_maps_spikes from matplotlib.gridspec import GridSpec from matplot...
2a4569931f2d5129a873acf10df6cfcbc83bc6fcc46afbf3e19af734fec6727e
Python
18,533
657
from functools import partial import json import os import posixpath import shutil from . import scheduler from .provenance import DataLayerProvenance from cloudfiles import CloudFiles, compression from cloudfiles.interfaces import COMPRESSION_EXTENSIONS from .lib import ( Bbox, colorize, jsonify, mkdir, toabs,...
c4d85b2e71d3cfdcf1fe1e561bf098f84eafba78094918452fbce322f2e63129
Python
19,077
449
from airflow import DAG from airflow.operators.python import PythonOperator from worker_op import worker_op from airflow.utils.weight_rule import WeightRule from datetime import datetime, timedelta from cloudvolume import CloudVolume from cloudvolume.lib import Bbox from airflow.models import Variable from param_defaul...
7a4fada7a1016e0ad03b19d70831a85cdf58da8d75eaabccd38015cdaf788d14
Python
19,096
601
# @license # Copyright 2017 The Neuroglancer 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 applicable law or...
1edb99fe5b5024c52ea9f8738e0d886e7c2dd7e7e0496a5bfd0f86b898c91b9c
Python
19,243
444
import unittest import numpy as np import numpy.testing as npt from sigpy import backend, config, conv, util if __name__ == "__main__": unittest.main() dtypes = [np.float32, np.float64, np.complex64, np.complex128] class TestConv(unittest.TestCase): def test_convolve_valid(self): mode = "valid" ...
5bf3c8f6745b61991ddeaa06dfc8613f7c6e7e7b1b0a1d91df10430bb39a916c
Python
19,656
388
import streamlit as st import pandas as pd import joblib from rdkit import Chem from rdkit.Chem import AllChem, Descriptors import tensorflow as tf from keras.layers import TFSMLayer import numpy as np import chardet # For automatic encoding detection import hashlib # For generating fixed accuracy and error from abo...
56704bc06ee39ae8011312f71b765173fa179b801498cc36f87ad6a3fe2b8279
Python
19,991
584
r''' Dynamical models ``` The `sde` instance can then be used to simulate the dynamics of the system or perform training. - Some simple definition of the potential, dissipation, conservation, and diffusion functions are provided in `UIDD.models` - The `ReducedSDE` class includes both an `SDE` component and a dimens...
5d7ed77cc589e1391c112a6d1a65c30c083dd086b363d63baa9917bee41f4cd8
Python
20,093
430
""" top level run script """ # GENERAL IMPORTS import os # this is needed to limit the number of scipy threads # and let spikeinterface handle parallelization os.environ["OPENBLAS_NUM_THREADS"] = "1" import argparse import warnings import json import pickle import numpy as np from pathlib import Path import probeint...
630401c2039231834d995c9bb5c34dc50562ceb7ffab8b96cedf0c1671c321b0
Python
20,128
616
""" %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % Performs Current-Based Decomposition (CURBD) of multi-region data. Ref: % % Perich MG et al. Inferring brain-wide interactions using data-constrained % recurrent neural network models. bioRxiv. DOI: https://doi.org/10.1101/2020.12.18.42...
32af04843436ee11ee251813fbba753cb5857e19aa0fabd87a3d3095cc3ccc31
Python
20,526
494
from pathlib import Path try: from importlib.metadata import requires except ImportError: from importlib_metadata import requires from zipfile import ZipFile import numpy as np import tempfile from packaging.version import Version from csbdeep.utils import axes_check_and_normalize, normalize, _raise DEEPIMAGE...
f1cfa9b41f6be1e1b3e27de17bc300e308f688f4bf2d6d27d02d4527a6de6f99
Python
20,897
488
import numpy as np import sys import os import argparse import csv import pandas as pd import nibabel as nib from collections import OrderedDict import torch import torch.nn as nn import torch.nn.functional as F from torch.nn import ModuleList, ReplicationPad2d, Dropout from torch.utils.data.sampler import Sampler, Seq...
93f19ce24e40e923e22bed0a96f923a8a69a9877e3e9b6695f7afbf83538583a
Python
20,937
822
import pytest import copy import gzip import json import math import numpy as np import os import shutil from cloudvolume import CloudVolume, chunks, Storage, Skeleton from cloudvolume.storage import SimpleStorage from cloudvolume.lib import mkdir, Bbox, Vec, jsonify from cloudvolume.datasource.precomputed.sharding ...
1a93e0aa12beb49bbd81b4979fc5e99d263d8a0882137e6bb831655997600eaa
Python
20,942
706
import queue as Queue from collections import defaultdict import itertools import json import os.path import posixpath import re from functools import partial import types from tqdm import tqdm from cloudvolume import compression from cloudvolume.exceptions import UnsupportedProtocolError from cloudvolume.lib import ...
a2600192eec4a73b115caea3282f815dbbdcb895509969fa18b55a128d1b57f2
Python
21,090
491
# -*- coding: utf-8 -*- """ Created on Fri Sep 20 16:20:34 2024 @author: simon """ import numpy as np import matplotlib.pyplot as plt from plotting_functions import my_style from matplotlib.gridspec import GridSpec import seaborn as sns; sns.set_theme() import pickle import pandas as pd import pingouin ...
c81378c6d613b3bfe610cf89e4f76c58631766503c1ac88834c5dc4fbb3e479a
Python
21,808
470
# -*- coding: utf-8 -*- """ Created on Fri Sep 5 16:28:55 2025 @author: simon """ import numpy as np import os, sys import pickle import pandas as pd import pathlib from scipy.signal import find_peaks from scipy.interpolate import interp1d from scipy import cluster from opt import make_maps from plac...
eae8e0f90738c872d05d3e9dc7c295b9aeab4bd6226e9b546ec225cc86e84dfa
Python
21,920
504
# %% """ fem_plane_stress.py 2D plane-stress finite element model of the cranial neural tube cross-section. Model summary ------------- - Geometry : half-annulus cross-section (exploits dorso-ventral symmetry). Inner radius r(θ) and wall thickness t(θ) are parametrized by three measurements (dorsal, lateral, vent...
ad471ca18ad7cb6f6f3716cac6d6cf419fc7f5ad71b2d6e22a042b053305cda2
Python
22,024
540
# -*- coding: utf-8 -*- """ Created on Thu Oct 9 10:43:56 2025 @author: simon """ import numpy as np import matplotlib.pyplot as plt from plotting_functions import my_style from matplotlib.gridspec import GridSpec from matplotlib.colors import LogNorm from scipy.ndimage import gaussian_filter1d import s...
f69b1cd1dcc524e1445d6aee188726b0974ff5956b22c462c91b83b7edd33279
Python
22,031
643
import pickle import unittest import numpy as np import numpy.testing as npt import random from sigpy import backend, config, fourier, linop, util if __name__ == "__main__": unittest.main() dtypes = [np.float32, np.float64, np.complex64, np.complex128] devices = [backend.cpu_device] if config.cupy_enabled: ...
01ac9cabfe50db67f26196ba6212d9eedfee0d5f6b28d94642b6a4b97cf49299
Python
22,159
639
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Classification (supporting evidence) with nested CV + CI + permutation test. UPDATED FIGURES: - ROC figures PER CLASSIFIER: Figure5_ROC_LogReg_L2.png Figure5_ROC_LinearSVM.png Each figure contains ROC curves for all feature sets: (1) topology-only (+ opt...
f7cb60a36d95f3c99282fbb8bd2bb563d32b1bb4341613c5f6c00dceb24144c4
Python
22,628
530
from time import sleep from datetime import datetime, timedelta, timezone from requests import Response from airflow.models import Variable from airflow.hooks.base_hook import BaseHook from slack_message import slack_message import json from common import google_api def list_managed_instances(instance_group): re...
f816bba14d1159fe3db6f57d149f1b46e20bcac6e646823c386d0bad1775e087
Python
22,842
588
# -*- coding: utf-8 -*- """ Created on Thu Feb 15 17:47:04 2024 @author: simon """ from neuron import h from neuron.units import mV, ms from Class_CA1_Pyr_standardized import Cell import matplotlib.pyplot as plt import numpy as np import pickle import pandas as pd import random from functools import wr...
977ac32582d5042eaae4655a9172d665f2fee0930dfabe6c4d08b371b2183c7a
Python
23,659
799
import copy import re import os import numpy as np from cloudfiles import CloudFiles from cloudvolume.datasource.precomputed.metadata import PrecomputedMetadata from cloudvolume.lib import jsonify, Vec, Bbox, spatial_unit_in_meters, time_unit_in_seconds from ... import exceptions from ...provenance import DataLayer...
af875406d65fc4027d8c24e1ce9e346138128b584f68bef5ebb1416464b853d8
Python
24,162
554
"""Evaluate trained nonlinear-case models via MMD vs time. For every (seed, model) pair, loads `outputs/nonlinear<seed>_<Model>_dt<dt>/<ckpt>`, simulates trajectories from both the trained model and the exact target SDE on freshly drawn (independent) initial conditions, and computes the time-evolution of the Gaussian-...
6aa251150e0abfec89a2a37b4201ee87238262b43c507ba0ca6d4c99b5aff993
Python
24,248
556
"""Evaluate trained 20D nonlinear-case models via MMD vs time. For every (seed, model) pair, loads `outputs/20Dnonlinear<seed>_<Model>_dt<dt>/<ckpt>`, simulates trajectories from both the trained model and the exact target SDE on freshly drawn (independent) initial conditions, and computes the time-evolution of the Ga...
d29d77b9a51e60ff98c39f1cf82d5dc32bf79ea16688e6122910ce217ebad5ba
Python
24,408
778
# -*- coding: utf-8 -*- """This module contains an abstract class App for iterative signal processing, and provides a few general Apps, including a linear least squares App, and a maximum eigenvalue estimation App. """ import time from tqdm.auto import tqdm from sigpy import backend, linop, prox, util from sigpy.alg ...
8e857129f9f2ef24dccf8480e728650e32136a1c0670fefa07aed8bdb45ebed0
Python
24,539
545
# -*- coding: utf-8 -*- """ Created on Tue Oct 14 15:55:22 2025 @author: simon """ import numpy as np import os, sys import pickle import pandas as pd import pathlib from scipy import cluster from scipy.signal import find_peaks from sklearn.ensemble import RandomForestRegressor from sklearn.multioutput...
632213594d7342ac5e773be83a670e6636ea12e18df91d37b84ef0775e8eff60
Python
24,869
521
# -*- coding: utf-8 -*- """ Created on Wed Apr 24 12:22:55 2024 @author: simon """ import numpy as np import pickle import pandas as pd from scipy.signal import find_peaks from functools import wraps import os import pathlib # Get the path of the current script base_path = pathlib.Path().resolve()....
85390c50e77a3102482eb7c6d4fc87fab070caae845de00891e755e5c3383832
Python
25,283
624
import numpy as np import warnings import math from tqdm import tqdm from skimage.measure import regionprops from skimage.draw import polygon from csbdeep.utils import _raise, axes_check_and_normalize, axes_dict from itertools import product from .geometry import polygons_to_label_coord, polyhedron_to_label OBJECT_...
8704282277bbe17f5a24f498c8dcbec8a02d2906212c6c11203b341aa6217ed1
Python
26,485
575
import warnings warnings.filterwarnings("ignore") import os import re import sys import argparse from pathlib import Path import shutil import json import time from datetime import datetime, timezone, UTC from packaging.version import parse import numpy as np import pandas as pd import logging import zarr import numc...
e0030b4de6c0f3defefddef9e0014b677c0fd9d355d3ad506ef259131e0b6ff9
Python
27,034
842
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Compare GLM results with and without node-number adjustment for both: 1) global topology metrics 2) local-distribution summary metrics Main outputs: - global_metrics_per_subject.tsv - local_metrics_per_subject.tsv - global_glm_compare_node.tsv - local_glm_compare_nod...
86f5146552db9e628eb233054de8aefb295d02862529cdbc621020302da1eb86
Python
27,348
885
from typing import List from collections.abc import Iterable from functools import reduce import json import operator import os import posixpath import json5 import multiprocessing as mp import numpy as np from tqdm import tqdm from cloudfiles import CloudFiles from ... import exceptions from ...provenance import ...
50ed6cdbd73ebc150675ccf768d068b28d9cffae1d0ab797c1901f0a050845c7
Python
27,939
820
""" Downloading NeuroImaging datasets: utility functions source: Nilearn https://github.com/nilearn/nilearn/blob/main/nilearn/datasets/utils.py """ import os import numpy as np import collections.abc import contextlib import fnmatch import hashlib import pickle import shutil import time import sys import tarfile import...
3b6069b7a0231cd1656b4829d306a02af5d0ef0175393c9b0111ee104ad324f2
Python
27,977
890
""" The Precomputed format is a neuroscience imaging format designed for cloud storage. The specification is located here: https://github.com/google/neuroglancer/tree/master/src/neuroglancer/datasource/precomputed This datasource contains the code for manipulating images. """ import copy from typing import Dict, Tup...
2ec2d83e952c994f1658e4bfed49bfd71e8a2ea5ae1aa031ac970c88a3c75775
Python
28,112
748
# ------------------------------------------------------------- # Subgrid Optimization # Copyright (c) 2026 # Dirk Keller, Nick Ramsey's Lab, University Medical Center Utrecht, University Utrecht # Licensed under the MIT License [see LICENSE for detail] # ----------------------------------------------------------...
eb34e3f55c89da78672031773bc0106475426925db6f1301a1907582b60de651
Python
28,313
888
# -*- coding: utf-8 -*- """MRI RF excitation pulse design functions, including SLR and small tip spatial design """ import numpy as np import scipy.linalg as linalg import scipy.signal as signal import sigpy as sp from sigpy.mri.rf.util import dinf __all__ = [ "dzrf", "dzls", "msinc", "dzmp", ...