sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
3e33220052c270e204268beb1cada49d5a5f023803dd93e6e601976b64fd2bd0 | Python | 15,990 | 361 | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import anndata as ad
import scanpy as sc
from scipy.io import mmwrite, mmread
import seaborn as sns
import scipy
np.random.seed(42)
# peak-gene linkage matrix
dir_path = "/home/nomura/Proj/mmvelo/data/10x_multiome_brain_repre_wo_IN/analy... |
02310e306e266caeb673fab2ffe5eb5e2099bf4c4284642f0279f34b95f06faf | Python | 16,015 | 443 | """ Created on Fri Aug 2 14:58:52 2024
@author: dcupolillo
Loading logics for metadata and data from raw ScanImage TIFF files.
"""
from __future__ import annotations
from pathlib import Path
from tqdm import tqdm
import tifffile
import numpy as np
from skimage.util import img_as_uint
from scipy.ndimage impor... |
cf97050ca9cfa5b4d5aeeb5203240cc0c14385f760f0b3cf4aa5c663437d1533 | Python | 16,070 | 555 | """Tests for continuous space."""
import numpy as np
import pytest
from mesa import Model
from mesa.experimental.continuous_space import ContinuousSpace, ContinuousSpaceAgent
def test_continuous_space():
"""Test ContinuousSpace class."""
model = Model(rng=42)
dimensions = np.asarray([[0, 1], [-1, 0]])
... |
d9bcaf8330887ab644b89265e8de4f86474c22d5a935c3ff3d1abf4815300be7 | Python | 16,081 | 448 | import logging
import numpy as np
import torch
import torch.nn as nn
from .backbone import Backbone
from .utils import (
PatchEmbed,
add_decomposed_rel_pos,
get_abs_pos,
window_partition,
window_unpartition,
)
logger = logging.getLogger(__name__)
__all__ = ["MViT"]
def attention_pool(x, pool, ... |
70823387dd3cf8a7bece19cf26c2ca5f40d3511d97cd714040c4f2c91768958c | Python | 16,087 | 501 | """
Plotting functionality based on VTK.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import os
import warnings
from collections import defaultdict
import numpy as np
from numpy.lib.stride_tricks import as_strided
from vtk import vtkCommand
import vtk.qt as vtk_qt
# Fix for VT... |
81fb8aeb1040a39684afe3e6ba18edaaa7734b2878794b42a0494c452f467241 | Python | 16,140 | 522 | """ Created on Mon Aug 28 10:00:25 2023
@author: dcupolillo """
from __future__ import annotations
import numpy as np
from scipy.spatial import ConvexHull, QhullError
import matplotlib.pyplot as plt
def internode_distance(
node1: object,
node2: object
) -> float:
"""
Calculate the Euclidean dista... |
314aad2778335f42c7c2df029f89682556492a335ec64f24b36670f98f788360 | Python | 16,158 | 430 | #!/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... |
e59f779e8780ce60f95bd2001b9fb0300835ec2511e968125229f22e9590740e | Python | 16,186 | 467 | """Tests for the neuron methods that wrap a top-level function.
These wrappers are thin by design, so what is worth pinning down is not what
they compute - the base function's own tests cover that - but that they exist
on the right classes, agree with the function they wrap, and honour `inplace`.
The last two are wha... |
383fd592193ca8e49d2b6787084b271f4227183598513178086abbeda2139f40 | Python | 16,251 | 451 | """
Manipulate Morphology
=====================
<!-- difficulty: beginner -->
Prune, resample, smooth and reshape neuron morphology.
See the [API reference](../../api#neuron-morphology) for a complete list of available functions.
Some manipulations work on all (or most) neuron types; others only make sense for a spe... |
affca9543c608cb3f6c12c31327ffc643d04b2f9a2d524c1461384acaf904f41 | Python | 16,261 | 437 | """
STPR-based population coupling with configurable window.
Computes spike-triggered population rate (STPR) and normalized PC
using only spikes within a specified window from stim onset.
Saves per-animal pkl files in same format as v4 (stpr_dict, pc_dict, pc_norm_dict).
Usage:
python -m pop_coupling.movement_co... |
dfd8749e249cfa767f1df57f83ed954aba1fad7dc74375a1ebf297dcdf4e12f7 | Python | 16,261 | 298 | import logging
from collections import defaultdict
from typing import Optional
logger = logging.getLogger('IsoQuant')
class FusionValidator:
def __init__(self, detector) -> None:
self.detector = detector
def _get_breakpoint_coords(self, fusion_key):
"""Extract chromosome and position coordin... |
8437bd32ea1f055457d5e5d0b1e5b4fcbc51eeeb619586401bc9204e64cc501b | Python | 16,267 | 315 | import multiprocessing
import queue
from torch.multiprocessing import Event, Queue, Manager
from time import sleep
from typing import Union, List
import numpy as np
import torch
from batchgenerators.dataloading.data_loader import DataLoader
from nnunetv2.preprocessing.preprocessors.default_preprocessor import Defaul... |
0d245768e48210870fa5016dab92c5656d3013769caeefb0d8a397e72068d6f3 | Python | 16,280 | 398 | """
If you use this code, please cite one of the SynthSeg papers:
https://github.com/BBillot/SynthSeg/blob/master/bibtex.bib
Copyright 2020 Benjamin Billot
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 Lice... |
d9af5a8aa9acc998e989b7be2b4bd3e718f3c555e68ba26a743a9be31e3f056a | Python | 16,310 | 391 | import sys
sys.path.insert(1, '/home/pma/gwimmer/texture/python/')
sys.path.insert(1, '/home/pma/gwimmer/texture/python/EB/')
import os
import torch
import numpy as np
from PIL import Image
from tqdm import tqdm
from torch.utils.data import Dataset, DataLoader
import matplotlib.pyplot as plt
from torch.optim import A... |
d586748f0dd811534b4be0ed2bf3ba3f287422e376e0435410423dc23015cfb2 | Python | 16,321 | 379 | from collections import Counter
import os
from pathlib import Path
from typing import Any, Dict, List, Optional, Tuple
import torch
import torch.nn as nn
import torch.nn.functional as F
from huggingface_hub import PyTorchModelHubMixin, login
from loguru import logger
from stoic.feature_pooling import (
AveragePoo... |
9814d21d0c0914831a2328fd38a6ac555c698b98b9ece8ad80c73d1b953b4784 | Python | 16,348 | 316 | """Reproduce the Extended Data Fig. 5 mental-model-vs-prediction analysis.
Figure (plots/Comparison_Task1_vs_Task2_Stacked_Reordered.pdf): prediction
confidence deltas by mental-model category (nearest-neighbour task and text
rationale), for experts and non-experts.
Log (logs/Comparison_Task1_vs_Task2_Stacked_Reorder... |
607ddc32dceb218e43afbf7595895072fd54aa2e9f5ba58e0a1dc90b3837e071 | Python | 16,363 | 455 | # 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... |
d81d560239bb22fae95d208cf3a94383cc23411440d46804e0ca1f7e56358863 | Python | 16,370 | 422 | #!/usr/bin/env python3
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
"""Evaluate IsoQuant's polyA-site pre... |
eedae5180c0ce2d58f1fd4269179694f9e36edaaffc59b90ec6353d960928c6a | Python | 16,385 | 421 | #!/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... |
bad84e8f290f4fc3ea34c836cb8466cff4243968512ae6c81e3622d2fba8d127 | Python | 16,401 | 468 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Binary Classification DNN Training
This script trains simple feedforward neural networks for binary classification
at different time horizons (e.g., 1 year, 3 years, 5 years).
Features:
- Treats survival analysis as binary classification problem
- Independent models ... |
074584cfa00d38bee065877f53397e79ac6f8debf423eebb24017a8fdd8684a9 | Python | 16,424 | 431 | """
Control Spike Sorting Pipeline - Stage 1 (Batch)
=================================================
Runs preprocessing, sorting, auto-curation, and generates PPTs for ALL sessions.
Skips sessions that are already sorted. Everything saved to disk.
After this completes, review the PPTs and run stage2_finalize.py.
Us... |
aae09d186010f7a8b5e6f91dc46185fe1587c3b87e5776a756da792a2bae32f1 | Python | 16,426 | 387 | """Figure S3 (S-Ephys) -- Electrophysiology supplementary.
Panels:
A. PCA example (PC2 vs PC1, stim vs non-stim)
B. Modulation z-score of all modulated cells over weeks
C. Time to max firing rate of all modulated cells over weeks
D. Modulation at each session's detection threshold
Usage (from repo root):
... |
d53fbd8d3e2a65fa52024a06d6eb36f4d2e62f426d983356634ce7f7c5d0a4d6 | Python | 16,427 | 388 | from abc import abstractmethod
from lightning.pytorch.core.mixins import HyperparametersMixin
import torch
from torch import Tensor, nn
from chemprop.conf import DEFAULT_ATOM_FDIM, DEFAULT_BOND_FDIM, DEFAULT_HIDDEN_DIM
from chemprop.data import BatchMolGraph
from chemprop.exceptions import InvalidShapeError
from chem... |
bf5d3ed574c5b7d583451a5c138f30cdc76533e3d705955d656723ecb8aed880 | Python | 16,428 | 419 | """
Created on Wed Dec 15 13:01:26 2021
@author: Tony Kelly
"""
from os.path import dirname, join as pjoin
from scipy.io import loadmat
import numpy as np
import pandas as pd
pd.options.mode.chained_assignment = None # default='warn'
from pathlib import Path
def branch_dsc(path, res, ex_factor, p=200, pdiff=5):
... |
ad7c51587ab4568365d65e8ab33db7f273448087aa02fe94d4dd156ff24e6834 | Python | 16,432 | 335 | import os.path
from typing import Union
import numpy as np
import tifffile
import torch
from ..progress import ProgressNotifier
from .multi_output_nested_unet import MultiOutputNestedUNet, MultiOutputNestedUNet_3Levels
from ..utils import get_device
from ..utils.model_cache import load_cached_model
from ..utils.tilin... |
c6a86f4824f0afeb9ae440ea08129b7e910cdb70589bfd06d2398dbcecd26dc7 | Python | 16,437 | 448 | """
Inference Script — Axon Segmentation
Applies a trained single-task attention U-Net to segment axons in
Bielschowsky-stained images. Supports single tiles (128×128) and large images
via a sliding window approach with Gaussian blending.
Usage:
# Single image:
python inference_single_tile.py checkpoints/best... |
48c0eee00fbdb581a2ed45740b7a461798c595ea17e2fd43fac2fbb2606bf26a | Python | 16,444 | 587 | """
Basic functions on surface meshes.
"""
# Author: Oualid Benkarim <oualid.benkarim@mcgill.ca>
# License: BSD 3 clause
import warnings
from itertools import combinations
import scipy.sparse as ssp
from scipy.spatial.distance import cdist
from scipy.sparse import csgraph as csg
import numpy as np
from vtk import (... |
3a5c429e91af829a146192e263189793ed573ed5aaae71c0e948a1f0e015342e | Python | 16,457 | 466 | import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import eigh
from functools import reduce
from matplotlib import colormaps
from matplotlib.ticker import LogLocator
j = 1j
def kron(oplist):
"""Compute the Kronecker product of a list of matrices."""
return reduce(np.kron, oplist)
... |
1322be1b5fd79c177f8e1acce777769a8ddd89bd644eb3d1369348c42791093d | Python | 16,487 | 475 | import os
import subprocess
import nibabel as nib
import nipype.interfaces.fsl as fsl
import numpy as np
def set_default_xyzt_units_if_unknown(target):
"""
Set NIfTI space/time units to mm/sec only if they are unknown.
Accepts either:
- a file path to a NIfTI file, or
- a nibabel ... |
41c757a88e4664385429dc6939b8ab0881251946c3850281999b061fdd3f35ca | Python | 16,489 | 142 | from __future__ import annotations
from pathlib import Path
from xml.sax.saxutils import escape
from zipfile import ZIP_DEFLATED, ZipFile
PROJECT_ROOT = Path(__file__).resolve().parents[1]
OUTPUT_PATH = PROJECT_ROOT / "docs" / "SMILES2Docking_workflow_for_publication.docx"
PARAGRAPHS = [
"SMILES2Docking Workfl... |
cbfb15d506fa5338bfc4d6eb4a970d8160d94ab31329b84d503faab2460d5447 | Python | 16,492 | 368 | import os
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import anndata as ad
import scanpy as sc
from scipy.io import mmwrite, mmread
import seaborn as sns
import scipy
np.random.seed(42)
# peak-gene linkage matrix
dir_path = "/home/nomura/Proj/mmvelo/data/10x_multiome_brain_repre_wo_IN/analy... |
9eab57faf0c8064aad4d7c4300065720f70276037812e71dc03f25b5fd0f69f7 | Python | 16,493 | 392 | import os
import sys
import torch
import tensorflow as tf
from colorama import init, Fore, Style
init()
# ANSI color codes for terminal output
CYAN = Fore.CYAN
GREEN = Fore.GREEN
YELLOW = Fore.YELLOW
BLUE = Fore.BLUE
MAGENTA = Fore.MAGENTA
BOLD = Style.BRIGHT
RED = Fore.RED
RESET = Style.RESET_ALL
... |
c0b6c9df360c4b1ef80e0dc8117d8f098036d7447aaab3034adf154c091e3e19 | Python | 16,504 | 351 | from __future__ import annotations
from time import time
from typing import Union, List, Tuple, Type
import numpy as np
import torch
from acvl_utils.cropping_and_padding.bounding_boxes import insert_crop_into_image
from batchgenerators.utilities.file_and_folder_operations import join
import nnunetv2
from nnunetv2.uti... |
b9ffaf167bc079c9a1c89fac5414bcf7afffaaeaae96e9deb5ec09f36dd2ba12 | Python | 16,555 | 441 | """Tests for mesa.experimental.states.state.
Validates piecewise-linear extrapolation, piecewise-quadratic kinematics,
analytical threshold crossing detection, and initialization race condition safety.
"""
from __future__ import annotations
import pytest
import mesa.experimental.mesa_signals.core as signals_core
fr... |
ab5982cf290f2129a0a09eada117880e10aabd071271ddd2064acbd312d96b7f | Python | 16,584 | 439 | # Copyright (c) Facebook, Inc. and its affiliates.
import ast
import builtins
import collections.abc as abc
import importlib
import inspect
import logging
import os
import uuid
from contextlib import contextmanager
from copy import deepcopy
from dataclasses import is_dataclass
from typing import List, Tuple, Union
imp... |
52bfbd9fbb85a9a13538af1c82ab6ec629806c6423ffad6a5a58df8cef8506df | Python | 16,605 | 294 | """Reproduce the Extended Data Fig. 4 mental-model figure and statistics.
Figure (plots/ED4_mental_model_full_figure.pdf):
Rows A/B: confusion matrices of free-form text-rationale alignment for
experts (A, N=9) and non-experts (B, N=30). Each participant's before/after
responses were matched by an LLM judge ... |
65d0f5f04080ee55f610440bea30a736bfc937077bf088451b492ac8ca461558 | Python | 16,619 | 479 | #!/usr/bin/env python3
############################################################################
# Copyright (c) 2025-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
"""
Test runner for barcode calling qua... |
57dd93cda671aa60be03e324f750649d947a55e6360ab6d830838a397ce2d33e | Python | 16,664 | 452 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
"""
Implementation of RegNet models from :paper:`dds` and :paper:`scaling`.
This code is adapted from https://github.com/facebookresearch/pycls with minimal modifications.
Some code duplication exists between RegNet and ResNets (e.g., ResStem) in o... |
f10459273b951b6428d3394bd63e00f3ecd6fa9e672365570e514a91416f0654 | Python | 16,677 | 435 | """
This file contains functions to handle keras/tensorflow tensors.
- blurring_sigma_for_downsampling
- gaussian_kernel
- resample_tensor
- expand_dims
If you use this code, please cite the first SynthSeg paper:
https://github.com/BBillot/lab2im/blob/master/bibtex.bib
Copyright 2020 Benjamin Billot... |
3295bec325711418cb3059b759cad515e9b340c5284f1ebadeb7dc26204f1f99 | Python | 16,707 | 459 | ############################################################################
# Copyright (c) 2023-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
import copy
import os
import sys
import logging
import gzip
i... |
d898c533b2a4ea9adb7b5ea3d34e12a30270d8e7beda4dbba0ba425308df12b4 | Python | 16,709 | 436 | # type: ignore
import os
from concurrent.futures import ProcessPoolExecutor
from copy import deepcopy
from functools import partial
from pathlib import Path
from typing import Iterable, Mapping, Optional, Sequence
import numpy as np
import pandas as pd
import ray
import xarray as xr
from joblib import Parallel, delaye... |
1b37a91e1a3e76505922fbeace2d57fb6c79ac7ca05276562f66dabdd650750e | Python | 16,711 | 365 | import os
import numpy as np
import pandas as pd
import umap
import matplotlib.pyplot as plt
import seaborn as sns
import anndata as ad
import scanpy as sc
import scvelo as scv
import scanpy.external as sce
from scipy.io import mmwrite, mmread
import statsmodels.api as sm
np.random.seed(42)
# peak-gene linkage matrix... |
82d892d1c049cc5e89c81913f830ab69c090328d1f3dc435cc351575ef1c5c63 | Python | 16,715 | 457 | #!/usr/bin/env python
# Copyright 2016-2020 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
3dfbade151d869d0d743cb330eb08da4d91fdc0b97ea53078ad488c7b86265e5 | Python | 16,718 | 407 | #!/usr/bin/env python3
"""Deterministic generator-only inference for the portable RAVEN bundle."""
from __future__ import annotations
import argparse
import json
import math
import os
from pathlib import Path
import random
import sys
from typing import Iterable
ROOT = Path(__file__).resolve().parent
DEFAULT_CONFIG ... |
90de47b5e432c9140d959ab2d8b212e5cbca455712de8f1d70b2a04cfae11aae | Python | 16,722 | 488 | import contextlib
import logging
import pathlib
import subprocess
import sys
from collections import namedtuple
from unittest.mock import Mock, patch
import psutil
import pytest
from psutil._common import sdiskusage
from openfe.utils.system_probe import (
_get_disk_usage,
_get_gpu_info,
_get_hostname,
... |
fa5f4198988ad8b52c533ae5ef1d87c26cbb8464bd66b4874d22153a825faa04 | Python | 16,740 | 373 | #!/usr/bin/env python3
"""
Train an EGNN model to predict enzyme pH optima.
Highlights
---------
- Works with preprocessed, batched datasets produced by `create_pyg_dataset.py`.
- Supports single train/val split or K-fold cross-validation.
- Label-Distribution Smoothing (LDS, Yang et al.) and class-balanced weighting.... |
4781120e24efc8fcfe1dc4fd6898848fead08321bee7d07f89bee3194c77d376 | Python | 16,747 | 422 | import random
import torch
import torch.nn as nn
from torch import Tensor
from types import SimpleNamespace
from typing import List
from .modules import (
RNNDecoder,
Upsampling,
ESM2Encoder,
LatentEncoder,
GRULatentEncoder,
DropoutPredictor,
PositionalPIController
)
from .train_helper impor... |
47a4ffbf4a3fa2fcb1a64db8bba227517753d39e648953d7542049b720f2c3b4 | Python | 16,750 | 404 | # -*- coding: utf-8 -*-
"""
Created on Thu May 22 13:36:42 2025
@author: Till Habersetzer
Carl von Ossietzky University Oldenburg
till.habersetzer@uol.de
Extracting and visualizing subject head movement
https://mne.tools/dev/auto_tutorials/preprocessing/59_head_positions.html
- Transformati... |
9a00016426e6d246cc9019a256cf5ad4a287e85bdbac1d3db85594155af2024c | Python | 16,766 | 503 | from time import time
import warnings
import pkg_resources
from einops import rearrange,repeat
import numpy as np
import skimage
import torch
from torch import nn
from PIL import Image
import cv2 as cv
from scipy.ndimage import label
from scipy.ndimage.morphology import binary_fill_holes
from scipy.ndimage import unifo... |
6832a3eef5973a4c48f174ae0c63854585dcfcf1f7737d227bd88a27dded262b | Python | 16,768 | 444 | # 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 numpy as np
import pooch
import pytest
from numpy.testing import assert_equal
from openff.units import unit
from openfe.protocols.r... |
4b7c0206289de26c0a025f7c36d7933caf3c927a3f0489cbb521873bd1e0309a | Python | 16,825 | 420 | #!/usr/bin/env python3
#
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2019-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
#####################################################... |
e5359ed032681e4de8460f6e5a5b5f911cff3504c37ae7adb415e2aecd85254a | Python | 16,836 | 415 | """
taken from: https://github.com/karpathy/minGPT/
GPT model:
- the initial stem consists of a combination of token encoding and a positional encoding
- the meat of it is a uniform sequence of Transformer blocks
- each Transformer is a sequential combination of a 1-hidden-layer MLP block and a self-attention block... |
e864b21d638a2d0e3de3033f720c2a5d7011e5d4af0b12cb11f21b75af125421 | Python | 16,839 | 446 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib.ticker as ticker
from scipy.linalg import eigh
from functools import reduce
import matplotlib
matplotlib.rcParams['pdf.fonttype'] = 42
matplotlib.rcParams['ps.fonttype'] = 42
# -------------------------------------------... |
9a31255306173a7ec0a10d98782796a4a3238b3b665067725cb689ad4546b9eb | Python | 16,850 | 426 | """A TagAssigner class based on the JIBES model."""
# Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
from __future__ import annotations
import json
import resource
import time
from enum import Enum
import numpy as np
import pandas as pd
from six import ensure_binary, ensure_str
import cellranger.analys... |
179158825eb840fefe13b2785ccc6251a222eca30ee4dd60f362706f865234a5 | Python | 16,858 | 430 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
import contextlib
import copy
import io
import itertools
import logging
import numpy as np
import os
from collections import OrderedDict
from typing import Dict, Iterable, List, Optional
import pycocotools.mask as mask_utils
impo... |
fa17ac547fad84eda05be5713b6247f197e11e2f1dbfb5b9706b33882b0c96bd | Python | 16,888 | 400 | #!/usr/bin/env python3
__doc__ = \
"""The Developmental Cognition and Neuroimaging (DCAN) Labs fMRI Pipeline [1].
This BIDS application initiates a functional MRI processing pipeline built
upon the Human Connectome Project's minimal processing pipelines [2]. The
application requires only a dataset conformed to the BID... |
09f3f917610a04575b540549644d562fe78af4cdc3b5955de6469ebf82f7effb | Python | 16,891 | 369 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import os
import pytest
import gffutils
from unittest.mock imp... |
1a07d7209161fbccb3029e4dd5fa6d37bdfe1ae4d0632e841070e47998ccc6c0 | Python | 16,916 | 482 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
DeepSurv Model Training
DeepSurv is a deep learning extension of Cox proportional hazards model.
Instead of a linear predictor, it uses a neural network to estimate risk scores.
Features:
- Deep neural network for risk score prediction
- Cox partial likelihood loss f... |
868a263c4ec84206c07554f88916670ad071daa7d05ef5355efd9bce702b93b8 | Python | 16,918 | 313 | #!/usr/bin/env python
# Copyright 2017-2018 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
86b304df21c3a62c002035562bf85d5e8e1c057b0eb73859afc4650a0530a053 | Python | 16,919 | 386 | #!/usr/bin/env python
#
# Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
#
"""Martian stage AGGREGATOR_PREFLIGHT."""
from __future__ import annotations
from typing import NamedTuple
import martian
import cellranger.constants as cr_constants
import cellranger.hdf5 as cr_h5
import cellranger.molecule_cou... |
b9a5b45d04b0113241426c794fa5829d826b6314812e74673c1083f541cd1488 | Python | 16,940 | 366 | import os
import numpy as np
import pandas as pd
import umap
import matplotlib.pyplot as plt
import seaborn as sns
import anndata as ad
import scanpy as sc
import scvelo as scv
import scanpy.external as sce
from scipy.io import mmwrite, mmread
import statsmodels.api as sm
np.random.seed(42)
# peak-gene linkage matrix... |
41098f7ae11e98a7bfa37f2818d139637f204eea26c13551cbad0116f7cac173 | Python | 16,971 | 386 | """
core/plots.py
-------------
All figure generation. Every function receives processed data (DataFrames,
arrays, dicts) and a file path — no raw data loading here.
Every function calls save_fig() from utils.common so PNG + optional SVG
are handled consistently.
"""
import numpy as np
import pandas as pd
import mat... |
46ec68a4be9aede3b3acd05bfda94d7e61348c5b4ace958535093f516faa9c7f | Python | 16,976 | 487 | from __future__ import division
import ldscore.sumstats as s
import ldscore.parse as ps
import unittest
import numpy as np
import pandas as pd
from pandas.util.testing import assert_series_equal, assert_frame_equal
from nose.tools import *
from numpy.testing import assert_array_equal, assert_array_almost_equal, assert_... |
faf888d259b0e73f5742a0e067d37d0eff8dee28a086cb3f640e0c49704c93dd | Python | 16,978 | 514 | # Copyright (c) Facebook, Inc. and its affiliates.
import math
from functools import lru_cache
import torch
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from torch.nn.modules.utils import _pair
from torchvision.ops import deform_conv2d
from detectron2... |
4855d3804f6f427e0f19928aeb72d28e9883aa3a21f6fac0a9febb5be6cdfcf6 | Python | 16,986 | 646 | #%%
import numpy as np
import pickle as pk
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from src.hbonds import karplus_dict, backbone_torsions
from src.stats import moving_block_bootstrap
#%%
# Load results
with open("results_jcoup_garnet.pk", "rb") as f:
RESULT... |
5df4358972d7b882a7150b54eeaa33632e7fa5dec1270d4b3fc68425eb2c4d74 | Python | 17,016 | 518 | import logging
import pytest
from openfe.utils import logging_control
from openfe.utils.logging_control import (
_AppendMsgFilter,
_BaseLogFilter,
_MsgIncludesStringFilter,
)
@pytest.fixture
def logger():
"""Create a test logger with a handler that captures log records."""
test_logger = logging.... |
959331698ba7ed5150aa4b3b4c1b4512678809ad1b9f97bb25a754bb4208e4a8 | Python | 17,042 | 466 | # noqa: D100
import warnings
from collections.abc import Callable
from dataclasses import fields
import altair as alt
import numpy as np
import pandas as pd
from matplotlib.colors import to_rgb
import mesa
from mesa.discrete_space import (
OrthogonalMooreGrid,
OrthogonalVonNeumannGrid,
)
from mesa.visualizati... |
fac54d61d5f199ce5d890caa7c51d4072cd548ea4fddea0f71d2cbd89ea0c03e | Python | 17,086 | 482 | """A command console interface for interactive Python code execution in the browser.
This module provides a set of classes and functions to create an interactive Python console
that can be embedded in a web browser. It supports command history, multi-line code blocks,
and special commands for console management.
Note... |
f2b9cc9851c870f9dc7b54ae1bf78ee708cf6405135d93133ccaf2ad86c468e4 | Python | 17,096 | 347 | #!/usr/bin/env python3
"""Scripted review pass over the Paper2Skill extraction of the Wiley PDF.
Why a script: the PDF sets Tables 1-6 on landscape pages whose text runs
bottom-to-top, and the extractor produced no usable rows for them (and no
text for the rotated captions and footnotes). Every page also carries a
ver... |
5bf5b20491ec3f6125394b4c0c4f72c66aaab3db7ad5e66c6f25c84facfa41fa | Python | 17,138 | 479 | import numpy as np
import matplotlib.pyplot as plt
from scipy.linalg import eigh
from functools import reduce
import seaborn as sns
from matplotlib.ticker import LogLocator
from matplotlib.colors import LogNorm
import matplotlib.colors as mcolors
# Helper: Kronecker product
def kron(oplist):
return re... |
a44d71134c316fe06c3d782a4439eff8f9dff65f62b797befe40114183a8d0d9 | Python | 17,142 | 361 | #!./venv/bin/python
import os
import sys
import time
import logging
import argparse
import pickle
import numpy as np
from datetime import datetime
from sklearn.metrics import roc_auc_score, roc_curve, confusion_matrix, precision_recall_curve, auc
from keras.callbacks import Callback, EarlyStopping, ModelCheckpoint
fr... |
e6fec23076eacc50ae94d82f43edf0be142a675e82ee4d55c84599dca56d9b2d | Python | 17,142 | 420 | # Copyright (c) Facebook, Inc. and its affiliates.
import functools
import io
import struct
import types
import torch
from detectron2.modeling import meta_arch
from detectron2.modeling.box_regression import Box2BoxTransform
from detectron2.modeling.roi_heads import keypoint_head
from detectron2.structures import Boxe... |
cb2df3ab331e5902521abefd89a58885e6bde433e4c825bdd35286834628bb46 | Python | 17,158 | 365 | #!./venv/bin/python
import os
import sys
import time
import logging
import argparse
import pickle
import numpy as np
from datetime import datetime
from sklearn.metrics import roc_auc_score, roc_curve, confusion_matrix, precision_recall_curve, auc
from keras.callbacks import Callback, EarlyStopping, ModelCheckpoint
fr... |
05c0ba193b20470860814501194ff58216e95dd3002ff38d3c3295d1e2571a59 | Python | 17,210 | 381 | from __future__ import annotations
import argparse
import hashlib
import importlib.metadata
import json
import platform
import sys
import time
from collections.abc import Callable, Mapping, Sequence
from pathlib import Path
from typing import Any
import numpy as np
import pandas as pd
import torch
from bpnn_batch im... |
70345b6a5d86f776c48337fb41433f9508b7a9c2392a51ab9a523e193f26d6f6 | Python | 17,221 | 494 | # 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... |
f2de43f8bc21a3bc8d7527380ff18015404a7a95561f7762a401cc87f740ddff | Python | 17,222 | 291 | import warnings
import numpy as np
from copy import deepcopy
from typing import Union, List, Tuple
from dynamic_network_architectures.architectures.unet import ResidualEncoderUNet
from dynamic_network_architectures.building_blocks.helper import convert_dim_to_conv_op, get_matching_instancenorm
from torch import nn
f... |
7c9c3de3f46450dff5e9bf0aa4c663ce1837081bdfb59825d67eeab09ab614d4 | Python | 17,240 | 424 | import logging
from typing import Optional, Union
import numpy as np
import pandas as pd
import networkx as nx
from ._utils import _array_to_hex, _is_dark
from ._constants import DIVERGING_PALETTES
from pvsvg import Network
class IDEA:
def __init__(
self,
degs: pd.DataFrame,
go: pd.DataFra... |
9485d0042b59bc4a040e25a78926794d09728a24e3a988f43a84c8a717031dc0 | Python | 17,249 | 564 | #!/usr/bin/env python3
import os
import sys
import subprocess
import shutil
import traceback
import argparse
import concurrent.futures
import multiprocessing
import numpy as np
import nibabel as nib
from nibabel import orientations as nio
from typing import Optional
"""
Batch reorientation of NIfTI files within a BI... |
62745ddedfdc919252b988821d2fd778155dc2d4dc07a488bd37cc68995ca60c | Python | 17,255 | 474 | """Tests for k-fold utilities: epoch budget, stopped epoch tracking, and class weights."""
import numpy as np
import pytest
import torch
import torch.nn as nn
import pandas as pd
from nfml.data.featurisation import create_graph_dataset
from nfml.data.splitting import scaffold_kfold
from nfml.models.gnn import GCNMode... |
c926fc2a57357e6d1bbb7e08eb196e32ad5d2af97d14620f41d0e7ffef247d59 | Python | 17,276 | 483 | #!/usr/bin/env python
#
# Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
#
#
"""Feature Assignments object."""
# pylint: disable=invalid-name, inconsistent-return-statements
from __future__ import annotations
import itertools
import json
import os
from collections import Counter
from collections.abc impor... |
6ce07b365eab413404b2db841ed74cbfa310dd1296903e81ada207bd38095f92 | Python | 17,277 | 520 | """Test Solara visualizations - Modern API."""
import random
import re
import unittest
import ipyvuetify as vw
import pytest
import solara
import mesa
from mesa.discrete_space import CellAgent, OrthogonalMooreGrid
from mesa.experimental.scenarios import Scenario
from mesa.visualization.backends.altair_backend import... |
7ec22f6d84c276b02332dad4f88e51c0965175982bd35a534017a74e7d4d7fb3 | Python | 17,277 | 420 | import glob
import math
from collections import defaultdict
from pathlib import Path
import argparse
import matplotlib.pyplot as plt
import networkx as nx
import numpy as np
import pandas as pd
import sknw
import tifffile as tif
import tqdm
from joblib import Parallel, delayed
from scipy.ndimage.morphology import dist... |
e0e4f2c2e31dbc5e58caf9ba6df603dc515bf1d8a4723f1c6be23851050834f4 | Python | 17,364 | 424 | #!/usr/bin/env python3
#
# Copyright (c) 2016 10X Genomics, Inc. All rights reserved.
#
from __future__ import annotations
import csv
import json
import os
import sys
from functools import reduce
from typing import TYPE_CHECKING, TypedDict
import numpy as np
import scipy.stats
from six import ensure_binary, ensure_s... |
6d9f7a0357911747798733778c51a19202438404e25d96bdaaec0d3b458278dd | Python | 17,365 | 519 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import gzip
import os
import pathlib
import urllib.error
import urllib.request
from importlib import resources
import gufe
import mdtraj
import numpy as np
import openmm
import pandas as pd
... |
b4f7466823002ba6d90c1cd968f6a5c34dc780bdcb0a0c8978f939886de378a0 | Python | 17,380 | 511 | from abc import abstractmethod
import torch
from torch import nn, autocast
from dynamic_network_architectures.architectures.primus import Primus, PrimusV2B, PrimusV2L, PrimusV2M, PrimusV2S
try:
from dynamic_network_architectures.architectures.primus import PrimusV3S, PrimusV3B, PrimusV3M, PrimusV3L
except ImportEr... |
2612b93f8a30149e85cf96353f0ecb2f6234780acd3e7a8623640268e63d5f3b | Python | 17,405 | 576 | # 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... |
a73a74da64813dd29c798a7d991ac83f7c60ae3d3bc910205d426664c6ae9d2f | Python | 17,408 | 504 | """
tensorflow/keras utilities for the neuron project
If you use this code, please cite
Dalca AV, Guttag J, Sabuncu MR
Anatomical Priors in Convolutional Networks for Unsupervised Biomedical Segmentation,
CVPR 2018
or for the transformation/integration functions:
Unsupervised Learning for Fast Probabilistic Diffeomo... |
2b5a631f30289373bf98d30ad253c3c934a99697971bf7226107d9ab615f267d | Python | 17,415 | 541 | # -*- coding: utf-8 -*-
"""
Created on Sun Aug 14 14:53:28 2016
@author: Luciano Masullo, Federico Barabas
"""
import os
import numpy as np
import math
import configparser
from scipy.ndimage.measurements import center_of_mass
from skimage.feature import peak_local_max
try:
import skimage.filters as filters
except... |
614970a7651760e6175eb3eee4ef84fd9c06b566e5eb5a9dda0d3cc378beaade | Python | 17,415 | 502 | from __future__ import annotations
import argparse
import copy
import tempfile
from collections.abc import Mapping, Sequence
from pathlib import Path
from typing import Any
import pytest
from hypothesis import given
from hypothesis import strategies as st
from pytest_mock import MockerFixture
from pytest_mock.plugin ... |
d6a447662bed1be961aa79b0fa3fb8a115fd55893491c2581090d6d35286f880 | Python | 17,445 | 407 | #!/usr/bin/env python
# Copyright 2016-2024 Biomedical Imaging Group Rotterdam, Departments of
# Medical Informatics and Radiology, Erasmus MC, Rotterdam, The Netherlands
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obt... |
fdb103631ea3250db1ecfe7e669e18491baae825eba1622cee7646d119e588f4 | Python | 17,475 | 396 | import torch
import torch.nn as nn
import torch.nn.functional as F
import random
import numpy as np
import sklearn
import os
class Encoder(nn.Module):
def __init__(self,input_dim, output_dim, hidden_dims):
super(Encoder, self).__init__()
self.encoders = nn.ModuleList(
[nn.... |
6f6864b34114d14e68457447815ef3e493f30c89741baa903446c567c63de278 | Python | 17,481 | 602 | # -*- coding: utf-8 -*-
"""Utilities for loading / creating datasets."""
import json
import os
import importlib.resources
import requests
# osf repo prefix
RESTRICTED = ["grh4d"]
# uniquely identify each item ('hemi' can be None)
FNAME_SURF_KEYS = ['source', 'desc', 'space', 'den', 'hemi']
FNAME_VOL_KEYS = ['source'... |
5b7bb49a111c5379f5d5a554ab5f08df9bbf1a175eb52f8eeddfc47a91f5dac8 | Python | 17,497 | 424 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
===============================================================================
pHoptNN — Enzyme pH Optimum Prediction (EGNN-based Inference)
===============================================================================
Overview
--------
This script predicts the opt... |
3a985b5e07bd30f4d13bf0a4172b33e2528a860a76554bf569cef13deac352d8 | Python | 17,518 | 527 | # -*- coding: utf-8 -*-
import jax
import jax.numpy as jnp
from jax import vmap, lax
from functools import partial
import numpy as np
import matplotlib.pyplot as plt
TAU = 2 * np.pi
def get_circular_tuning_curve_all(angular_var, S, n_bins=60, kappa=10, density=False):
assert angular_var.ndim == 1
assert S.... |
ff078be81980b464b9d0fc06deb9076371dd4b6c297b1633012302c7f4b23bfa | Python | 17,547 | 345 | '''
Created on 19.10.2020
Author:
Michael Diedenhofen
Max Planck Institute for Metabolism Research, Cologne
Description:
Pre-requisite: 01_dilate_mask_process.py
Result: for all time points the peri-infarct masks will be aligned in the rsfMRI and DTI space
Two scans of the same session can be aligned to each other w... |
6483df6f97fdfb1a313d8581c50ab32a326246c292c064936c515eeb4ff2c65b | Python | 17,548 | 491 | import numpy as np
import matplotlib.pyplot as plt
import os
import contextlib
from spikeinterface import full as si
from batch_process.util.curate_util import *
import warnings
# ignore OMP_NUM_THREADS memory leaks warning
warnings.filterwarnings("ignore")
@contextlib.contextmanager
def _suppress... |
08a838caa3b957031231b7d1bdac705719de06d7120b4086e0a3892a640e579b | Python | 17,568 | 511 | import xarray as xr
import numpy as np
from pathlib import Path
import pandas as pd
import pickle
from functools import partial
import jax.numpy as jnp
from scipy.signal import convolve
from kalmax.kde import poisson_log_likelihood
from scipy.io import loadmat
from scipy.stats import circmean
from kalmax.kde import po... |
8a868d3d43b34e5d1fdf1506333672248d61534fbf6e9f1c92c1ba821586c711 | Python | 17,575 | 515 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 13 17:21:10 2022
@author: Anumita Jawahar & Joseph Vermeil
UtilityFunctions.py -
Joseph Vermeil, Anumita Jawahar, 2022
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 Soft... |
77b4469e4ccf61d3bddfb10a29ce195d7c484c4671bb91796b111786bc8a3885 | Python | 17,583 | 371 | #!./venv/bin/python
import os
import sys
import time
import logging
import argparse
import pickle
import numpy as np
from datetime import datetime
from sklearn.metrics import roc_auc_score, roc_curve, confusion_matrix, precision_recall_curve, auc
from keras.callbacks import Callback, EarlyStopping, ModelCheckpoint
f... |
1f6ee9c796611b6585e9c0757b5b8c3d3c68360701164813f5be4c853f9a6b78 | Python | 17,612 | 444 | """
Multiprocessing
===============
<!-- difficulty: intermediate -->
Speed up batch workloads with built-in parallel processing.
By default, most {{ navis }} functions use only a single thread/process (although some third-party functions
used under the hood might). Distributing expensive computations across multiple... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.