sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
77994e14f0ead64c26f5a75e3861bc69f3c2ac34c953b782c04093ad930b7a2e
Python
13,417
301
""" apply_SDC - Susceptibility Distortion Correction for diffusion MRI Part of the micaflow processing pipeline for neuroimaging data. This module applies susceptibility distortion correction (SDC) to diffusion MRI images by using a pre-calculated displacement field to unwarp geometric distortions caused by ma...
e6b1687ad5ceec0eedbe493975aee919c2b7830bc9e62c5bec439257ec4e6c9b
Python
13,423
338
# Copyright (c) Facebook, Inc. and its affiliates. import copy import glob import json import os import random import tempfile import unittest import zipfile import torch from torch import Tensor, nn from detectron2 import model_zoo from detectron2.config import get_cfg from detectron2.config.instantiate import dump_...
82d189c1b377967aa05fc3f1f53356b4d36c4a83ae5040ea065f83d3fc01318f
Python
13,424
403
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Data Transformation and Feature Engineering Script This script applies the final transformations to prepare data for model training: 1. Load scaling parameters and vocabularies 2. Apply min-max scaling to numeric features and embeddings 3. Convert categorical features...
9ba2159ca51a2e6b775bb4a536705ddb91dac6a288ada41008a39a26070066fa
Python
13,442
380
""" Leave-One-WSI-Out (LOWO) Cross-Validation Runs LOWO cross-validation for axon segmentation by iteratively leaving out one whole-slide image (WSI) from training and evaluating with stratified per-tile metrics on the held-out test set. Usage: python train_lowo.py --config model_config_lowo.yaml # all ...
0db2d212090c2199fd24c90fd29cc1442b87b3404fec09e486d2261f78b9dedd
Python
13,460
291
############################################ # ---------- Core NBS Functions ---------- # ############################################ import random import networkx as nx import pandas as pd import scipy.stats as stats import numpy as np import numpy.matlib as matlib from scipy.optimize import nnls from multiprocessin...
f60061396488cb6bf08ab8737edbd9904b9c99afd4d2a153c70f053c5f043c27
Python
13,466
281
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2020-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ############################################################################ ...
73939d29546cbc429c06c6e635aa1d98f4e876076096afd64337f7ab5da1020a
Python
13,476
287
from copy import deepcopy from typing import Literal, Tuple, Union, List import torch from batchgenerators.utilities.file_and_folder_operations import isfile from dynamic_network_architectures.architectures.abstract_arch import AbstractDynamicNetworkArchitectures from torch._dynamo import OptimizedModule from nnunetv2...
5b39b1a375cff41a01fe66209dc4cdbfc3981bb37ab13a74f4f6c3e6bb806f03
Python
13,481
333
############################################################################ # Copyright (c) 2023-2026 University of Helsinki # # All Rights Reserved # See file LICENSE for details. ############################################################################ """ Dict-based flexible detection result for universal molec...
145ff806c6a3fca44b88dee2d2a4eee996d4953df5e6d48670dae9867a475e2a
Python
13,494
238
# flake8: noqa import sys import numpy as np import pytest from rdkit import Chem from chemprop.featurizers import ( MorganBinaryFeaturizer, MorganCountFeaturizer, RDKit2DFeaturizer, V1RDKit2DFeaturizer, V1RDKit2DNormalizedFeaturizer, ) @pytest.fixture def mol(): return Chem.MolFromSmiles("F...
593c445c114e25ebb9cbe5eb506775c444be2df7f1dae4e59aa87eb7736266ef
Python
13,503
322
"""YouTube → mp3 downloader for the TAPA pipeline. Two-library fallback chain to maximize success on Colab / cloud IPs that YouTube routinely bot-checks: 1. yt-dlp (default) — alternate player_client list to dodge most bot checks, plus optional cookies file / browser cookies for stubborn videos. 2. pytubefix...
dd0db3902d58833532bd025ced3c8874b77cc85483848e44decaab588530d5b8
Python
13,509
307
# -*- coding: utf-8 -*- """ Supplemental analyses """ import numpy as np import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.colors import ListedColormap import seaborn as sns from netneurotools import datasets, plotting from scipy.stats import zscore, pearsonr from sklearn.linear_model...
4ffb5c3695622daabf6cf62fc5aa8d2b495b38fe02589a701b28bbaf5b81151c
Python
13,516
341
import torch import torch.nn as nn import torch.nn.functional as F import random from Contrast import Contrast from freq_encoder import FreqEnco, FreqHenco from wave_evolution import WEL import numpy as np import pandas as pd from sklearn.metrics.pairwise import cosine_similarity import dgl random.seed(2025) torch.man...
c050a7d1cc2547d95cd6a7812a6aea687661478d246df5f9416da9aff4585c65
Python
13,534
307
"""Reproduce Supplementary Tables S8 and S9 (SAGAT reliability analysis). Table S8: Cronbach's alpha for the SAGAT perception scale (Q1-Q4) and its AV-state (Q2, Q4) and world-state (Q1, Q3) subscales, computed both classically and ordinally. Because the items are binary, the ordinal alpha uses tetrachoric inter-item ...
ba76963bd5b4b8233e6c299d0c52b98963730ef6fbda1415b696024653403a9d
Python
13,539
388
from __future__ import annotations import abc import functools as ft import re from collections.abc import Iterable, Mapping, Sequence from typing import TYPE_CHECKING, Any, Final, TypeAlias, cast import attrs import more_itertools as itx from bids.layout import BIDSLayout, Query from bids.layout.models import BIDSFi...
e223ae102a611da646d60e33162d87c4773d9dab165b3a2202af583e6ce967b6
Python
13,539
417
# %% # System Libraries from __future__ import annotations import contextlib import io import math import os import os.path as op import shutil import sys import warnings from collections import defaultdict from pathlib import Path import matplotlib.patches as patches import matplotlib.pyplot as plt import mne import...
4eef356caa261aeccccf4187278d01da1aeab82e36db0387930da9fccd3089c7
Python
13,544
334
import os import numpy as np from sklearn.base import BaseEstimator from .alignment import ProcrustesAlignment, aligned_lambdas as _aligned_lambdas from .kernels import compute_affinity from .embedding import PCAMaps, LaplacianEigenmaps, DiffusionMaps def _is_path_like(x): """Return True if `x` looks like a fi...
7d00634bed9b2e20e1c5fd284306826274a16ddb84aebce55fc2bcffdbf87149
Python
13,566
343
from inits import * import tensorflow as tf import sys flags = tf.app.flags FLAGS = flags.FLAGS EOS = 1e-9 # global unique layer ID dictionary for layer name assignment _LAYER_UIDS = {} def get_layer_uid(layer_name=''): """Helper function, assigns unique layer IDs.""" if layer_name not in _LAYER_UIDS: ...
8d8a2af1986c11cf3946f5abe8bf11019b56f1db1d8c30d6d848427512c785a6
Python
13,566
289
import glob import os import shutil import numpy as np import tifffile import torch from albumentations import ( ShiftScaleRotate, GaussNoise, RandomBrightnessContrast, Compose, RandomRotate90) from skimage import morphology, transform from torch.utils.data import Dataset class DataProcess(Dataset): """ ...
9ba1377f3cb7923abb2ec53570890be64cd44bcf2aacc4fedae6f4ac2bef6eed
Python
13,581
332
############################################################################ # Copyright (c) 2023-2026 University of Helsinki # # All Rights Reserved # See file LICENSE for details. ############################################################################ """ Shared memory k-mer indexer for parallel processing of l...
719523cd569ffff742e7b13e6ecf346b09d0daff5516024f800c7208e5da6a66
Python
13,583
425
# %% from __future__ import annotations import contextlib import io import math import os import os.path as op import shutil import sys import warnings from collections import defaultdict from pathlib import Path from pprint import pprint import matplotlib.patches as patches import matplotlib.pyplot as plt import mne...
f375efaca55a665cf76f2c05d9d69a2f9024d47e206bc5676b9bfb9317c46dee
Python
13,628
376
## By Anoushka Joglekar ## Created 2018. Edited AS 2019. Edited AJ 2020 import sys import argparse import gzip import pandas as pd import os import multiprocessing as mp import re from traceback import print_exc def revComp(my_seq): ## obtain reverse complement of a sequence base_comp = {'A':'T', '...
56791e1d5c789167a0121f9347f44248828d682ce1c621db19a8cc7b03e77799
Python
13,646
360
# uv run evidenceIntSum.py $HOME/promec/promec/Animesh/Download/BSA/evidence.txt $HOME/promec/promec/Animesh/Download/BSA/proteinGroups.txt # Usage: # python evidenceIntSum.py evidence.txt proteinGroups.txt # python evidenceIntSum.py evidence.txt proteinGroups.txt mqpar.xml # # This script keeps the corrected max...
82f5fdd54995f9af52d7ce3a8cc06966d6376b90ff9c54a7f5d80dc76c4f446c
Python
13,679
299
import os import sys import json from typing import Optional from argparse import ArgumentParser import numpy as np import pickle from pathlib import Path from tempfile import mkdtemp import datetime import scanpy as sc import scvelo as scv import umap import matplotlib.pyplot as plt import seaborn as sns import torch ...
19c9e47e48629e8aa8dd0ec4ef06d3f9c1f08cf20d60f35b79ee4f1b249c9d83
Python
13,711
269
from typing import Dict, Tuple, Union import torch from torch import nn class FirstVGGBlock(nn.Module): """VGG block with Instance Normalization for the first layer""" def __init__(self, in_channels, middle_channels, out_channels, dropout=0.): super().__init__() self.relu = nn.LeakyReLU(nega...
1a358d7a562697cb13e4cbece3f31eae942fe8db1d65b5c5e139d8dcc8382027
Python
13,711
441
""" Test mesh operations """ import pytest import os import numpy as np import shutil import gzip import vtk from vtk.util.vtkConstants import VTK_TRIANGLE, VTK_LINE, VTK_VERTEX from brainspace.vtk_interface import wrap_vtk from brainspace.vtk_interface.wrappers import BSPolyData from brainspace.mesh import mesh_io...
821afc4164d458f205ea1ecf1ad055b2228feadc81e0af65046efac726f4d7ca
Python
13,713
365
# Stabilized HiDe-MK import time import math import csv import sys, os import pickle import random import pandas as pd import numpy as np import tensorflow as tf print('The TF version is {}.'.format(tf.__version__)) import keras print('The Keras version is {}.'.format(keras.__version__)) from keras impor...
5d2da17927e701f87dbbbfe8aeda91dff5bd62b53090c63efad91a5eb1d7fc45
Python
13,726
269
import numpy as np import mimic_iii_sql.psql_wrapper as psql_mimic import aumc_sql.psql_wrapper as psql_aumc from keras.utils import Sequence """ Version 3: Standardisation and imputation after train-test split to rectify data leakage Version 2: Add train and validate in MIMIC-III, predict in MIIMC-III and AUMC ...
2673a4199c27f17ce7386659abeaec10208b271066aa79edfaccf64a91d32c3a
Python
13,801
353
# Copyright (c) Facebook, Inc. and its affiliates. import torch import torch.distributed as dist from fvcore.nn.distributed import differentiable_all_reduce from torch import nn from torch.nn import functional as F from detectron2.utils import comm, env from .wrappers import BatchNorm2d class FrozenBatchNorm2d(nn.M...
c613a368326b21db210d5c32c7f2f2ca22bd116faa641ccd3e539e89c8771d70
Python
13,803
355
#!/usr/bin/python3 ################################################################################## # # MIT License # # Copyright (c) 2025 Kevin Rockenbach, Agnieszka Golicz # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "So...
626af97230c3c25fbf84c1e57185c303f89fabbb5a0cd9d967c3cfc89e548f98
Python
13,892
347
#!/usr/bin/env python """ train_densenet_fc_age.py Train a DenseNet-style CNN with attention blocks (HFAB/ERB) to predict a continuous target (e.g. age, episodic-memory score) from square functional connectivity (FC) matrices stored as .mat files. M. Esmaeili et al. (2026), Brain-Cognitive Gaps in relation to Dopamine...
9ce299f942e52de1c881d734def4b827bd81b6b31b7b883423f406e46450edc9
Python
13,894
270
import numpy as np import mimic_iii_sql.psql_wrapper as psql_mimic import aumc_sql.psql_wrapper as psql_aumc from keras.utils import Sequence """ Version 3: Standardisation and imputation after train-test split to rectify data leakage Version 2: Add train and validate in MIMIC-III, predict in MIIMC-III and AUMC ...
9b9b8b178292bb5e5953901ae0a6101a3e52e7b96c9ced9584beb113d2a5460c
Python
13,896
341
# Copyright (c) Facebook, Inc. and its affiliates. import logging import numpy as np from typing import Dict, List, Optional, Tuple import torch from torch import nn from detectron2.config import configurable from detectron2.data.detection_utils import convert_image_to_rgb from detectron2.layers import move_device_lik...
568fdcaaa87910d9fd859cc30359c41a8e515816568bb9f58ad704a089b81da0
Python
13,936
479
""" Created on Wed Oct 16 11:56:28 2024 @author: dcupolillo """ import matplotlib.pyplot as plt import matplotlib.cm as cm from matplotlib.patches import Rectangle import numpy as np import seaborn as sns from sklearn.metrics import confusion_matrix from sklearn.metrics import average_precision_score from sklearn....
ca54453183c170e1461effbd7e0b6b62d85c8b4ccfd16be31e2c88634b88f8d1
Python
13,941
340
# Very slightly adapted from perses https://github.com/choderalab/perses # License: MIT # OpenFE note: eventually we aim to move this to openmmtools where possible # turn off formatting since this is mostly vendored code # fmt: off import copy import warnings import numpy as np from openmmtools.alchemy import Alchem...
5e66735a62aaf17b8b9bfa6520ecccf3c47ae554495557e2045bd73be2899719
Python
13,956
314
""" Written by Tom George and Masahiro Nakano """ import ratinabox from ratinabox.Agent import Agent import numpy as np import copy from scipy.interpolate import interp1d import warnings class SubAgent(Agent): """SubAgents take as input, and are "subservient" to, another Agent (the LeadAgent). The key thing ide...
0d84ff43e6a9c57566b8c2907e2b403810b415f03e4a86394800941682f6b41d
Python
13,965
293
""" Created on 10/08/2017 @author: Niklas Pallast Neuroimaging & Neuroengineering Department of Neurology University Hospital Cologne """ import sys,os import numpy as np import nibabel as nii import glob import subprocess import shlex sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), os.p...
40a211b3b6143b26b26314786c7dc7d59cdb7563613ee886f7a83d703b92fe47
Python
13,987
323
# Copyright (c) Facebook, Inc. and its affiliates. import logging import unittest from copy import deepcopy import torch from torch import nn from detectron2 import model_zoo from detectron2.config import get_cfg from detectron2.export.torchscript_patch import ( freeze_training_mode, patch_builtin_len, pat...
0191b4e39ad87fc7daddb1377594cf9df0c4821fdf48fce11ae34ac4574b0cea
Python
14,008
295
import argparse from math import inf #### Argument parser #### def setup_shared_args(parser): """ Sets up the argparse object for the qm9 dataset Parameters ---------- parser : :class:`argparse.ArgumentParser` Argument Parser with arguments. Parameters ---------- p...
4092733b85385b9188d645b8b0df02cfcc23b5057ce328c777c768d681dd6ec8
Python
14,008
377
""" Stage 4: build session responses + extract modulation / pulse-locking metrics. Generates session_responses (pkl), stim_condition_results (CSV), and per-unit figures from batch_sort/stage3/analyzer_final.zarr + trial_df.csv. Usage: python -m batch_process.stage4_postprocess <session_folder> [<session_folder> ....
8246d902a688b33977027b979776d7c5293a4fc6cf1d329c46e03392fe8f084f
Python
14,009
426
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 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, either version 3 of...
7af1de52247ba7c06e0a7d211f44db6930abd650ed5aab7329128f87cf34eb63
Python
14,022
354
#!/opt/env/bin/python """ Created on 10/08/2017 @author: Niklas Pallast Neuroimaging & Neuroengineering Department of Neurology University Hospital Cologne """ from __future__ import print_function import atexit import argparse import os import glob import shutil import gzip import subprocess import sys sys.path.ins...
2137c47ad08e786df894d8195622cab96442dc6cbe0b09a432036c956a44d408
Python
14,061
268
import numpy as np import mimic_iii_sql.psql_wrapper as psql_mimic import aumc_sql.psql_wrapper as psql_aumc from keras.utils import Sequence class PoolBatchGenerator(Sequence): """Custom Keras sequence generator for getting data batches from MIMIC-III and AmsterdamUMC PSQL DB.""" def __init__(self, admissio...
13f780ae7a525e2d552d81195545ee78f7825111926cbc18e82f55dfd9ecd8ca
Python
14,070
412
"""Toy self-driving demo of the CW-Net algorithm (Code Ocean capsule entrypoint). Trains a CW-Net (concept classifier + ranker) on latent states of a pre-trained PPO CarRacing agent (weights/agent_weights.pt, from JinayJain/deep-racing), then runs the wrapped agent in simulation and saves losses, a concept confusion m...
1ed038c173f2270e7fc075ee7e664525a3a491cbe5b8474a328737c07c4c629e
Python
14,100
348
import pandas as pd import torch from torch_geometric.data import Dataset, Data import numpy as np import os from tqdm import tqdm from constants import ALL_ATOM_LABELS, DICT_AA_SELECTION, SELECTED_ATOMS from utils import is_connected, extract_pqr_data, build_edges_blockwise_less_atoms, get_atom_indices_type_aa_type_...
0db2a372a094393fafbfd11557a1a4d345ff491f515f0e156afb7b95b96b5731
Python
14,116
380
# -*- coding: utf-8 -*- # Copyright (c) Facebook, Inc. and its affiliates. import inspect import numpy as np import pprint from typing import Any, List, Optional, Tuple, Union from fvcore.transforms.transform import Transform, TransformList """ See "Data Augmentation" tutorial for an overview of the system: https://d...
b7fbcd257711a0b80718006d0a26fd602f1045cd817a4dbf274eb4bea7c79591
Python
14,146
405
import numpy as np import pandas as pd import seaborn as sns import os import matplotlib.pyplot as plt from scipy.stats import mannwhitneyu import mimic_iii_sql.psql_wrapper as psql_mimic import adam_sql.psql_wrapper as psql_adam import yaml """ To extract demographic and patient characteristic of MIMIC-III and Ams...
d221d17bb3a5d018fea612a2077e35e779a0ab11cafb7fefa9d8473a00c9063a
Python
14,146
371
"""Test space drawer classes for various grid types.""" import random from unittest.mock import MagicMock, patch import altair as alt import networkx as nx import pytest from matplotlib.collections import LineCollection from mesa.discrete_space import HexGrid, Network, OrthogonalMooreGrid, VoronoiGrid from mesa.expe...
c570dd00ad5b66175053e60159e1fcb0d67dee3c9fa8da9c11a65817db21131a
Python
14,149
433
import os import pathlib import sys from typing import List, Literal import click import numpy as np import pandas as pd from cinnabar import FEMap, Measurement from openff.units import unit from openfecli import OFECommandPlugin from openfecli.clicktypes import HyphenAwareChoice from openfecli.commands.gather import...
67ab177f1b708d72993e006cec13a4e557120bd2662738519ac66cad4658d2ba
Python
14,163
336
#python compareDIffExprDIANNvalues.py DDAreport.parquet_Ms1_Area_pivot_all_protein_data.csv reportDDA.parquet_Ms1_Area_pivot_all_protein_data.csv import sys import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns from pathlib import Path from scipy import stats if len(sys.argv) !=...
9203d4571a7df9c2d992a30978ceadb47cd10b39b727aed57c54ec1be57acf4c
Python
14,165
482
#!/usr/bin/env python # coding: utf-8 # # [setup](https://www.kaggle.com/yujiariyasu/plot-3positive-classes ) #!pip install pandas #!pip install pydicom #!pip install tqdm #!pip install skimage #!pip install scikit-image #!pip install cv2 #!pip install opencv #!pip install opencv-python #!pip install GDCM #!pip install...
15f7edd55febd6c24c2ac2d3b99d6725f9f8fffc61466309f2c8681a4a3ac003
Python
14,166
344
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Open Race Optimizers Compatibility Layer This module wraps our existing optimizers to make them compatible with the open race competition. The key differences are: - Open race uses continuous function evaluation, not hidden points - Optimizers need to propose points w...
9919372ccb4d1e6e9985e7cc5628dba58bf253ace93e0ab47715739946a5f1ed
Python
14,176
293
# Copyright (c) Facebook, Inc. and its affiliates. # pyre-unsafe from typing import Any, List import torch from torch.nn import functional as F from detectron2.config import CfgNode from detectron2.structures import Instances from .mask_or_segm import MaskOrSegmentationLoss from .registry import DENSEPOSE_LOSS_REGI...
36bd9571500fa0ed9fe37f64bea3b6f627c606370d5e0ec785a9b030d22bbf1a
Python
14,203
281
# type: ignore """Verification tests for low-level feature completeness / coverage (`completeness.py`). A tiny, fully hand-worked static fixture (five layer-1 neurons forming the informative pool, and seven anchor-layer-2 PNGs) makes every recruitment count, coverage figure and any-vs-matched agreement checkable by ey...
5a781175fbf99c2517ad3e181acb8e846ad69554745baefaa713198cef444274
Python
14,203
419
""" author:CBJ """ import torch import torch.nn as nn class MultiScale1DCNN(nn.Module): """ Multi-Scale 1D Convolutional Neural Network Contains three parallel paths: - Short-term path: kernel_size=7 (corresponds to FFMC, rapid weather-driven response) - Medium-term path: kernel_size=30 (corresponds to ...
fea0aa41f400ad11648468b0514ec4de56b836a000c9be67a7cecb9daddb35e0
Python
14,209
417
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 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, either version 3 of...
845762fd35d0f59377e1f0b8e077737fa6714a08eab3ee529f325606278f5238
Python
14,211
309
import os import argparse from calendar import month_name from datetime import datetime from pathlib import Path from zoneinfo import ZoneInfo os.environ.setdefault("MPLCONFIGDIR", "/tmp/matplotlib") os.environ.setdefault("XDG_CACHE_HOME", "/tmp") Path(os.environ["MPLCONFIGDIR"]).mkdir(parents=True, exist_ok=True) im...
ee454feafbf5e6aa4e8d69c1b08f7643b17e437c1dce8aa7c8047d717fdbe848
Python
14,218
336
import logging from os import PathLike from lightning.pytorch import __version__ from lightning.pytorch.utilities.parsing import AttributeDict import torch from chemprop.nn.agg import AggregationRegistry from chemprop.nn.message_passing import ( AtomMessagePassing, BondMessagePassing, MulticomponentMessag...
3ecfd8f33ad255b7c52a03623d2a5b652e3b63055dd06b51f35927c1d87aad3a
Python
14,221
296
""" Created on 10/08/2017 @author: Niklas Pallast Neuroimaging & Neuroengineering Department of Neurology University Hospital Cologne """ import csv import os,sys import nibabel as nii import glob import numpy as np import scipy.io as sc sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ...
0d2cb619821a4c1b794bd9bfef0b8ae50988c367799f02ef2bc8dfb832e03c8b
Python
14,253
357
# Script that makes use of more advanced feature selection techniques # by Alberto Tonda, 2017 import copy import datetime import logging import numpy as np import os import sys from sklearn.ensemble import AdaBoostClassifier from sklearn.ensemble import BaggingClassifier from sklearn.ensemble import ExtraTreesClassi...
35c400af2523d478f1f2487e713a765f103dd54e86af13d3f805c8319ddc53dc
Python
14,336
348
#!/usr/bin/env python3 # /// script # requires-python = ">=3.10" # dependencies = ["mcp[cli]<2", "pywin32; sys_platform == 'win32'"] # /// """MCP server over the charted evidence of Leimroth et al. 2026, "Exploring EEG and ECG in Music Listening: A Scoping Review" (Psychophysiology 63(9) e70385, doi:10.1111/psyp.70385)...
2a033261e3de80ac8826e4f00b3ef6a0650063d0e18857421cd68556b990ee16
Python
14,353
406
""" Created on 10/08/2017 @author: Niklas Pallast Neuroimaging & Neuroengineering Department of Neurology University Hospital Cologne """ import sys, os import nipype.interfaces.fsl as fsl import nibabel as nii import numpy as np import glob import shutil import regress import getSingleRegTable import cv2 import cr...
5e6a1332af428de8e8665cd1b3da039f78ca3fdeb9b62580025a2a2a5f33d991
Python
14,354
383
from abc import ABC, abstractmethod from typing import List, Optional, Tuple import torch import torch.nn as nn from loguru import logger from stoic.layers import Identity class MaskedInstanceNorm1d(nn.Module): """InstanceNorm1d that ignores padding positions when computing statistics. Standard InstanceNor...
2f659a9c4378670266a6beda5ff5d3d8d5c82978a86b4100a9f269ab903c1264
Python
14,356
355
## utils.py import logging import os import numpy as np import nibabel as nib import matplotlib.pyplot as plt from matplotlib.transforms import Bbox from matplotlib.gridspec import SubplotSpec from numpy.fft import fftn, ifftn, fftshift, ifftshift import math import csv from scipy import signal def saveImage(data :...
c0ae6b963149c6f509db0d62b298ab970dbdab687899b74ecf2278ab47f71e0c
Python
14,363
443
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """Settings class for equilibrium AFE Protocols using OpenMM + OpenMMTools This module implements the necessary settings necessary to run absolute free energies using OpenMM. See Also ----...
f5bbf6ec4363513323b8303883e9eeaa328155818a2195fc531b9603d1bc5a5f
Python
14,368
356
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import os import pathlib import MDAnalysis as mda import pooch import pytest from openff.units import unit from rdkit import Chem from openfe.protocols.restraint_utils.geometry.boresch.geom...
11f15dce3c24345732534fb32ef4808ebc725fa80b144cda3d55f8c681b6ab24
Python
14,369
430
""" Spectral analysis of neuronal responses. ## Functions - `whitenoise()`: band-limited white noise. - `rate()`: firing rate computed by kernel convolution. - `spectra()`: stimulus- and response power spectra, and cross spectrum. - `susceptibilities()`: stimulus- and response spectra up to second order. - `diag_proj...
5462027cfff20f861be3340b907affe9a246a2b642f96b6ee867b034f44b6231
Python
14,385
389
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import abc import warnings from typing import Callable, Iterable, Optional, Type from gufe import ( AlchemicalNetwork, ChemicalSystem, LigandAtomMapping, LigandNetwork, P...
8f21d8e5b9ea14d46babd2b074335fa8b6dbb27c4311959552fe1dca0622bdf6
Python
14,389
401
"""Tests for the IVSCC features in `navis.morpho.ivscc`. Correctness is pinned against a small hand-built neuron whose geometry we can work out on paper. The example (insect) neurons are only used to smoke-test the plumbing and to cross-check features against navis' own implementations of the same quantity - IVSCC fea...
2c0e4e1ccb7d4f665cfb1a4205109752efea401f90e46fa22bf73e13906b0311
Python
14,399
376
import tensorflow as tf import numpy as np import math from sklearn import preprocessing eta=0.1 #elimination_rate=1 #print('squ',64,eta,elimination_rate,'\n') def IN(): n_dim=train_X.shape[1] W1=0.01*np.random.randn(n_dim,n_hidden1).astype(np.float32) B1=np.random.randn(n_hidden1).astype(np.float32) ...
dceeb6248df071f961c9cb9ff5b6659876ac966075efff151ae99467081fc84b
Python
14,401
340
from __future__ import annotations import copy import random from dataclasses import dataclass import numpy as np import torch from torch import nn from torch.utils.data import DataLoader, TensorDataset @dataclass(frozen=True) class BPNNTrainingConfig: dropout: float = 0.4 learning_rate: float = 0.005 w...
82e5ee1149cc39446b9536adcbbe7ef4673fe3374c5c0b3467bc1034aeb0e81b
Python
14,405
416
# -*- coding: utf-8 -*- """Functions for fetching annotations (from the internet, if necessary).""" from collections import defaultdict from pathlib import Path import re import shutil import pandas as pd import warnings try: # nilearn 0.10.3 from nilearn.datasets._utils import fetch_single_file as _fetch_fil...
ca8c2c19be10c7ee5270d6dee185bb4e574f7ef5f65cf57f4aac3ade5ed7f49d
Python
14,419
387
"""User functional API for running PNG analysis using SPADE as backend method. """ from itertools import combinations from typing import Any, Optional, Iterable, Sequence import numpy as np import pandas as pd from hsnn import ops from hsnn.core.logger import get_logger from ..base import get_midx from ..spikesdb im...
c5534724c49f67a907c1da6d9f80f9a2897c053e59b59428eb2970f4549cb4db
Python
14,426
339
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 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, either version 3 of...
d597561ee888c4066a22c2a87bd1bab412bce4259acb7771e9a427a3ff1d1e86
Python
14,429
425
# Copyright (c) Facebook, Inc. and its affiliates. import math import numpy as np from enum import IntEnum, unique from typing import List, Tuple, Union import torch from torch import device _RawBoxType = Union[List[float], Tuple[float, ...], torch.Tensor, np.ndarray] @unique class BoxMode(IntEnum): """ Enum...
74991bb4db48c5da4b5dd2d0865e95810659fb88656ae70dcb5476348a460b21
Python
14,435
404
############################################################################ # Copyright (c) 2025-2026 University of Helsinki # All Rights Reserved # See file LICENSE for details. ############################################################################ import pytest from isoquant_lib.barcode_calling.indexers impor...
28acae7f2d28cb0447ef000e08f3a09a0df240d90ea4bcd20e5b5395b639f56c
Python
14,472
339
""" velocity_off_manifold.py Quantifying the off-manifold instability of latent dynamics in mmVelo. Estimating local tangent spaces from the kNN neighbors of each cell using batched SVD, and decomposing posterior d samples into on-manifold and off-manifold components to evaluate the variance of each component. Defin...
1596d3f04a974be2d6d5fc46f74f730d0598a4969865e31f0416b9ef18760b7f
Python
14,485
408
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 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, either version 3 of...
70bdfe62ba3ed528f23b8283b7d4b6d54736ca92a6f90fc1a0cceb32b319ee32
Python
14,489
325
import os from typing import Union import numpy as np import tifffile import torch from ..multi_output_unet3d.multi_output_unet3d import MultiOutputUnet3D from ..progress import ProgressNotifier from ..utils import get_device from ..utils.model_cache import load_cached_model from ..utils.tiling import TileBlender, au...
26afc5dfc55b9bc6ef2201489714d23092b4914aa947b29a0156d48fbd7621ae
Python
14,491
279
############################################################################# #### plot_fig4.py ############################################################################## # -*- coding: utf-8 -*- """ Reproduce Figure 4 from Grabot et al. (Traveling Waves in the Human Visual Cortex: an MEG-EEG Model-Based Appr...
3e304ffa093d2b495e0f8ba2acfa303090bed944f4d9c62497962ce2f9eb9868
Python
14,498
434
import json import shutil from importlib import resources from unittest import mock import numpy as np import pytest from click.testing import CliRunner from gufe import AlchemicalNetwork, SmallMoleculeComponent from openff.units import unit from openff.utilities import skip_if_missing from openfe.protocols.openmm_ut...
24c8672e46186bf2f3332b50b9ce13edda60764364afc8e9e32f7fa872eb59ce
Python
14,503
367
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 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, either version 3 of...
29bab022bb77830ff52bc45d3ffa111a4853d651a606f028ccc74591fd68a259
Python
14,510
342
# AUTOGENERATED! DO NOT EDIT! File to edit: 51_plotting.ipynb (unless otherwise specified). __all__ = ['plot_rna_map', 'plot_binding_changes', 'plot_predictions', 'plot_change_in_binding_per_exon', 'plot_motif', 'plot_perturbations', 'plot_perturbation_zscores', 'plot_perturbations_fdr'] # Cell import nump...
a5bb94b2050a1a34fa209c800cfb23724d8e1360af6764e238f5b1737db847e9
Python
14,526
415
from __future__ import division import numpy as np import bitarray as ba def getBlockLefts(coords, max_dist): ''' Converts coordinates + max block length to the a list of coordinates of the leftmost SNPs to be included in blocks. Parameters ---------- coords : array Array of coordinat...
e8803dca79844f4cd5fd60d10c83c09c9006596a856e4bb8be9126446f804d8f
Python
14,527
349
#!/usr/bin/env python # # Copyright (c) 2019 10X Genomics, Inc. All rights reserved. # from __future__ import annotations import os from collections.abc import Iterable, Mapping from typing import TYPE_CHECKING import numpy as np from six import ensure_str from sklearn.utils import sparsefuncs import cellranger.an...
4a35d7591a7e21f93f6da91599fc7af507226b934ad0aa0f746071505229f7ae
Python
14,531
329
from __future__ import annotations import argparse import hashlib import importlib.metadata import json import json import textwrap from collections.abc import Sequence from itertools import product from pathlib import Path from typing import Any import matplotlib matplotlib.use("Agg") import matplotlib.pyplot as pl...
90447c5f47285fc5c7f4628a0b6b52fafb4f5f13f6b24f49c6340ca314c95eda
Python
14,546
412
"""Tests for `navis.heal_skeleton` and the machinery behind it.""" import tracemalloc import navis import numpy as np import pandas as pd import pytest from scipy.sparse import coo_matrix from scipy.sparse.csgraph import connected_components, minimum_spanning_tree from scipy.spatial import cKDTree def fragment(neu...
13c9ffbc0e3cfd2b266d61e5c0e224201a82cf9d66d540465e089ac531667f97
Python
14,547
349
""" train_mouse_brain.py -------------------- Three-stage training pipeline for Tutorial 1 (embryonic mouse brain). Monitor keys are hardcoded here — NOT in the notebook — to prevent misconfiguration: - Stage 1 & 2 : DREG_PRE.validation_step logs "val_elbo_loss" - Stage 3 : DREG_DYN.validation_step logs "va...
2172786cb167ea91d1b53d787b2c037052783c2b78b76cde65fbde34f37d1d30
Python
14,557
418
""" Created on March 16, 2026 @author: dcupolillo Simple manual annotation GUI for test datasets. Allows users to label individual calcium imaging traces. """ import sys import numpy as np import random from pathlib import Path from PyQt5.QtWidgets import ( QApplication, QMainWindow, QPushButton, ...
9d9b9595783e8c7d520f117b742c9184cc587c45e7f019bcfe3b92f43e96e5cc
Python
14,593
428
# This script is part of navis (http://www.github.com/navis-org/navis). # Copyright (C) 2018 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, either version 3 of...
ebb6d1e08744365496a513ed59fdf75361b0d5a83a7c650998428066115a185d
Python
14,596
296
""" Created on 10/08/2017 @author: Niklas Pallast Neuroimaging & Neuroengineering Department of Neurology University Hospital Cologne """ import csv import os,sys import nibabel as nii import glob import numpy as np import scipy.io as sc sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ...
bd87da79f003f87c2b6d34722fa619b73af67827976669a6458c9df8b85866c8
Python
14,638
408
import random from typing import NamedTuple import uuid import numpy as np import pytest from chemprop.featurizers.molgraph import CGRFeaturizer, RxnMode from chemprop.utils import make_mol AVAILABLE_RXN_MODE_NAMES = [ "REAC_PROD", "REAC_PROD_BALANCE", "REAC_DIFF", "REAC_DIFF_BALANCE", "PROD_DIFF...
a9bab24e2efc4fb8fece00f1c2c800a64d58e989a6b4aaa0e4e75ebd7db8f7a7
Python
14,645
256
############################################################################ # Copyright (c) 2022-2026 University of Helsinki # Copyright (c) 2020-2022 Saint Petersburg State University # # All Rights Reserved # See file LICENSE for details. ############################################################################ ...
a4e3b1fd08d22d33aee90575e2f20885866d2ee00eea9f2cc9d05797b88e299f
Python
14,651
395
from copy import copy from typing import Hashable, Optional import numpy as np import numpy.typing as npt import pandas as pd import xarray as xr from ._types import CountsArray, RatesArray from .base import infer_rates __all__ = [ "get_specific_measures", "get_sorted_measures_rates", "get_specific_measu...
b228d4fd94ccf8e321ada964f8b3c8deec8353c8b307e55fce43452dd04c8b45
Python
14,686
479
""" Created on Thu Jun 26 09:56:37 2025 @author: dcupolillo """ import pyqtgraph as pg import numpy as np from PyQt5.QtWidgets import ( QMainWindow, QGridLayout, QWidget, QPushButton, QSlider, QAction, QInputDialog) from PyQt5.QtCore import Qt import matplotlib.pyplot as plt class ImageView(pg.ImageView)...
29b28e7b19c06c75e85b57605156b305095fbd7b78aab920ee79db790f052750
Python
14,700
378
import time import numpy as np import argparse from copy import deepcopy from scipy import interpolate parser = argparse.ArgumentParser('Preprocessing: Generate training/validation/testing features from pdb') parser.add_argument('--MDfolder', type=str, default="data/pdb/", help='folder of pdb MD') ...
7767c76deeea5f4efe332fa6904242003a43663c210f9945ca661227239b2ee6
Python
14,708
384
#!/usr/bin/env python # # Copyright (c) 2018 10x Genomics, Inc. All rights reserved. # import pickle import sys from collections import defaultdict import martian import numpy as np import cellranger.analysis.batch_correction as cr_batch_correction import cellranger.analysis.constants as analysis_constants import cel...
39ece71a01737f058020133730173988c81f9b57da737a242fe38bce3af0cd8c
Python
14,712
477
""" Embedding approaches. """ # Author: Oualid Benkarim <oualid.benkarim@mcgill.ca> # License: BSD 3 clause import warnings from abc import ABCMeta, abstractmethod import numpy as np from scipy import sparse as ssp from scipy.sparse.linalg import eigsh from scipy.sparse.csgraph import laplacian from scipy.sparse.cs...
4e4ddd7ee469e68e25584777b18402bea0a18f4a36cb48ce9a3a4dd8160f3cf8
Python
14,732
339
# type: ignore """Verification tests for the role co-membership matrix (`comembership.py`). Two hand-checkable in-memory fixtures lock in the cell construction (within-layer H-B switching and the structural mask; cross-layer switch-up/switch-down and the count identity), and a gated suite asserts the invariants + a co...
a37ba042eef240c53dcc1d168183365756419693dfe7f82733558c2569bab65b
Python
14,733
411
"""Tests for snakebids.utils.snakemake_templates module.""" from __future__ import annotations import re import pytest from hypothesis import given from hypothesis import strategies as st from snakebids.utils.snakemake_templates import SnakemakeFormatter, SnakemakeWildcards from tests.test_snakemake_templates.strat...
15224e86a3b78224e5cf94e8bcda3416a94a46f5ea995866566b3c3655711338
Python
14,741
288
from argparse import ArgumentError, ArgumentParser, Namespace import logging from pathlib import Path import sys from chemprop.cli.utils import LookupAction from chemprop.cli.utils.args import uppercase from chemprop.featurizers import AtomFeatureMode, MoleculeFeaturizerRegistry, RxnMode logger = logging.getLogger(__...