sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
c8b130bc05af6d4adb2e6193ac92881a67157a70ed80d485f8c5534b942bcad5 | Python | 12,410 | 402 | import torch
import torch.nn as nn
import torchvision.transforms as TV
import torch.nn.functional as F
from einops.layers.torch import Rearrange
import math
import copy
from copy import deepcopy
# from model.utils import LambdaLayer, generate_power_spectrum_torch
# from model.vit import ViT
class SELayer(nn.Module):... |
f9ecb187e821c098f0107a16f4d8eae5cb9c90e5b3033337b4ba2f06791be1a7 | Python | 12,416 | 307 | # Copyright (c) Facebook, Inc. and its affiliates.
import copy
import numpy as np
from contextlib import contextmanager
from itertools import count
from typing import List
import torch
from fvcore.transforms import HFlipTransform, NoOpTransform
from torch import nn
from torch.nn.parallel import DistributedDataParallel
... |
15b526c28806f67b29152c02f34f2bc4a261890e815c55540005608ffa3b0fc7 | Python | 12,417 | 323 | from __future__ import annotations
import io
import logging
import traceback
from typing import Iterable, TypeAlias
from lightning import pytorch as pl
import torch
from torch import Tensor, nn, optim
from chemprop.conf import LIGHTNING_26_COMPAT_ARGS
from chemprop.data import BatchMolGraph, MulticomponentTrainingBa... |
c4bbfe01123486f2a1a98cd1d39592bfa544ad9c874882f3b0700beb8d98998e | Python | 12,427 | 268 | import numpy as np
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
from sklearn.metrics import accuracy_score
from sklearn.svm import SVC
from sklearn.model_selection import GridSearchCV, StratifiedKFold
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler, Polynom... |
d3d85b0e6f3384c4a87b22ebf225adcaf089009cc6e0a813ccea6c55f4693b71 | Python | 12,443 | 339 | # Copyright (c) Facebook, Inc. and its affiliates.
import contextlib
import copy
import itertools
import logging
import numpy as np
import pickle
import random
from typing import Callable, Union
import torch
import torch.utils.data as data
from torch.utils.data.sampler import Sampler
from detectron2.utils.serialize im... |
c4d96b911f91c1e97d7149e680bdbb9a7cbc13518ba95227fea03b95ddb70715 | Python | 12,449 | 277 | # -*- coding = utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
# pyre-ignore-all-errors
from detectron2.config import CfgNode as CN
def add_dataset_category_config(cfg: CN) -> None:
"""
Add config for additional category-related dataset options
- category whitelisting
- category mappin... |
e26c70c1389454fa96a7fd5144a240e8e4044043f44b85c1e322c8e429d2e40e | Python | 12,450 | 236 | """SAMPLING ONLY."""
import torch
import numpy as np
from tqdm import tqdm
from functools import partial
from ldm.modules.diffusionmodules.util import make_ddim_sampling_parameters, make_ddim_timesteps, noise_like
class PLMSSampler(object):
def __init__(self, model, schedule="linear", **kwargs):
super()... |
87abd45106d1f52bda1424ba3cbf56c74b8cc5d3e03acbe8960e7797ed3d1cc9 | Python | 12,461 | 252 | '''
Created on 19.10.2020
Author:
Michael Diedenhofen
Max Planck Institute for Metabolism Research, Cologne
Description:
Pre-requisite: 02_apply_xfm_process.py
Result:
rsfMRI - a Matlab file which contains two text files: 1) for each region one column with the averaged rsfMRI time series and 2) the atlas labels names... |
772326ac98a06eae506f6f267feff08fd6d271a4b178f2950852248ac3ddfadb | Python | 12,464 | 206 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2020-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
... |
bdce137cc297e33e126d648c625dd905a6c41d6aa80a521f4a629bbeca3df294 | Python | 12,473 | 262 | import multiprocessing
import os
from copy import deepcopy
from typing import Tuple, List, Union
import numpy as np
from batchgenerators.utilities.file_and_folder_operations import subfiles, join, save_json, load_json, \
isfile
from nnunetv2.configuration import default_num_processes
from nnunetv2.imageio.base_rea... |
e541952fbfab842d193ddf04539c6d1b5f1820c4daf0c6f40ed02790056ccfa5 | Python | 12,500 | 358 |
import os
import matplotlib
import random
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from h5py import File
from picasso import io
from picasso import clusterer
from picasso.run import pylocalise
from skimage import io as skio
from loguru import logger
logger.info('Im... |
92f29019418be5f21cae2996677b734e8e3e8e26ae58960326379d1e15ca22e9 | Python | 12,502 | 349 | """
Attention U-Net for Axon Segmentation
Self-contained implementation of the single-task attention U-Net used for
axon segmentation in Bielschowsky-stained postmortem brain tissue.
Architecture:
- Encoder: 4-level contracting path with dropout regularization
- Bottleneck: Deepest feature representation
... |
8a41cd6aa1ff6eb7cf61161527a7834ba4a3bb388bc6c28e1e22a55ed6bccd3a | Python | 12,506 | 353 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import glob
import logging
import os
import sys
from typing import Any, ClassVar, Dict, List
import torch
from detectron2.config import CfgNode, get_cfg
from detectron2.data.detection_utils import read_image
from detectron2.engi... |
5cc501341b3248d8eb3834bf932aa82b05f28c75b768c016fb2a9dcdf71f3667 | Python | 12,521 | 303 | #!/usr/bin/env python
#
# Copyright (c) 2016 10X Genomics, Inc. All rights reserved.
#
from __future__ import annotations
import errno
import glob
import os
from collections import defaultdict
import martian
import pandas as pd
from six import ensure_binary, ensure_str
import tenkit.fasta as tk_fasta
import tenkit.... |
a22efa9f9c6816457e1624aadbe1325fb0bcb7efba3f9282a6eddc5e71f1b1f7 | Python | 12,543 | 299 | """
Custom SpikeInterface-compatible preprocessing modules for ICMS artifact removal.
These are standalone versions of the custom preprocessors originally added to
a local SpikeInterface fork. They work with any SI version (0.100+) as external
classes by importing the base classes directly.
Contains:
- Mean... |
ebd7ea6d4adaf7b7f9c93523fc06491a5edb29ac7b29d9f4ed803ce14b1f592a | Python | 12,556 | 341 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
import os
import sys
from math import *
from lmfit import Minimizer, Parameters
import matplotlib.pyplot as plt
import nibabel as nii
import numpy as np
import progressbar
from .... |
8320503b30f727ca551e467100b855b2da1ba16aff1a48fe6cc51c3735921758 | Python | 12,571 | 374 | from __future__ import annotations
import itertools as it
import os
import sys
import textwrap
import warnings
from collections.abc import Iterator
from pathlib import Path
from typing import Literal, Protocol, TypeAlias
import more_itertools as itx
from snakebids.io.console import in_interactive_session
from snakeb... |
4e31bce0f0f899d4399454a6d3a2e69d459f4dbb80cdb9366255ac11b67a7373 | Python | 12,573 | 311 | import os
import re
import inspect
import importlib
import sys
from pathlib import Path
# Add the project root to the Python path
sys.path.insert(0, str(Path(__file__).parent.parent))
# ANSI color code pattern to remove
ansi_escape = re.compile(r'\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])')
# Directory where script modul... |
77bfe9bc63370de85143c7bb17ff232b6fd17964cdef5ee2fc3e104b1a9d29f4 | Python | 12,586 | 347 | #!/usr/bin/env python
#
# Copyright (c) 2025 10x Genomics, Inc. All rights reserved.
#
"""Compute segmentation plots for Visium HD data."""
import csv
import json
import os
from collections import Counter, defaultdict
import cv2
import martian
import numpy as np
import skimage
from PIL import Image
import cellranger.... |
fb99ff79ad9c10fc84ce357d3c2d65d633088e7508966e37531b4ec1aca7e1dd | Python | 12,596 | 282 | ###########################################################################
# Copyright (c) 2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
import logging
import sys
from enum import unique, Enum
from typin... |
6005520297b15178ba7a084c81d098d4402f7b77faaa382f6262597b62527126 | Python | 12,599 | 366 | import glob
import os
import torch
from torch.utils.data import DataLoader
from pathlib import Path
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from ..utils import EEGDataset, load_checkpoint, ValidationOnlySplitter, get_model_hash
PKG_ROOT = Path(__file__).resolve().parents[1] # .../... |
d1eb0a45dab87a50166c8acf2229a539af71753a87148bb91f89e00c35b9b9ad | Python | 12,604 | 379 | import logging
import os
import re
from os import PathLike
from pathlib import Path
from typing import List, Optional, Sequence, Union
import numpy as np
import pandas as pd
import tifffile
from ._steinbock import SteinbockException
logger = logging.getLogger(__name__)
img_dtype = np.dtype(os.environ.get("STEINBOCK_... |
3691357d6acfad6aa6b70925f92e23fd87b1302a6c08d1953f07f0ac599ee4ea | Python | 12,615 | 321 | import random
import torch
import torch.nn as nn
from lightning import LightningModule
from lightning.pytorch.utilities.types import STEP_OUTPUT, OptimizerLRScheduler
from torchmetrics import MeanMetric, MinMetric
from typing import List
from .modules import (
ESM2Encoder,
LatentEncoder,
GRULatentEncoder,
... |
dd65be23df8de7ea09eada0003af87b1e57ebb7830b5669ab764fb78621d7088 | Python | 12,617 | 363 | import pandas as pd
import numpy as np
from hsnn.analysis.png.filters import get_structural_indices
from hsnn.analysis.base import get_midx
def _make_syn_params(rows):
"""
rows: list of dicts with keys: layer_post, proj, pre, post, w, delay
"""
df = pd.DataFrame(rows)
df.set_index(['layer_post', ... |
1a6539853717e4cf90f2830893326b87a56bee61bbd6e84b275fd68019b425ad | Python | 12,625 | 239 | # Copyright 2021 HIP Applied Computer Vision Lab, Division of Medical Image Computing, German Cancer Research Center
# (DKFZ), Heidelberg, Germany
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy... |
2e6466909d40388241a946eb26abe6ec5119f5f9e3f67ff1c0630648ecbfe5cc | Python | 12,631 | 351 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
"""
See "Data Augmentation" tutorial for an overview of the system:
https://detectron2.readthedocs.io/tutorials/augmentation.html
"""
import numpy as np
import torch
import torch.nn.functional as F
from fvcore.transforms.transform import (
... |
0d2fa7f0b66aa35c58fb6f6340e4bc9b9dd604b557176944a64df863e174cb21 | Python | 12,634 | 376 | import pytest
import torch
from chemprop.uncertainty.calibrator import (
AdaptiveMulticlassConformalCalibrator,
IsotonicCalibrator,
IsotonicMulticlassCalibrator,
MulticlassConformalCalibrator,
MultilabelConformalCalibrator,
MVEWeightingCalibrator,
PlattCalibrator,
RegressionConformalCal... |
3d013b04ae70a324159335931c504d7aeb69dae61d8f749b3f7a7e7d05f1ec11 | Python | 12,644 | 442 | # 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 SepTop Protocols using OpenMM + OpenMMTools
This module implements the necessary settings necessary to run SepTop RBFE
calculations using OpenMM.
See Also... |
c44efaf2e6b1d1ce0dff5b2cab42e5540636ce6ed98e7dd5b268f1cac7ede1f7 | Python | 12,645 | 348 | from pathlib import Path
from typing import List
from PIL import Image
import pandas as pd
import torch
from torch.utils.data import DataLoader
from torchvision import transforms
from transformers import ViTFeatureExtractor, AutoTokenizer
PHENOTYPING_COLUMNS = [
'Acute and unspecified renal failure',
'Acute ce... |
485e076930ae66fbe28057d52dd13acf97be33e304e7c062f765cf66ba457fe1 | Python | 12,652 | 319 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
import torch
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components
from torch_geometric.nn import knn_graph, radius_graph
from e3nn.o3 import spherical_harmonics
from Bio.PDB.MMCIFParser import MMCIFParser
from cons... |
9518d480134d7726407a8615a886bea91f20aefbed673bee7e256139d7c5e8e9 | Python | 12,662 | 389 |
import os
import torch.nn.functional as F
import random
import numpy as np
import scipy.misc as misc
import imageio
from tqdm import tqdm
import math
# from utils import utils_image
import torch
import csv
from collections import OrderedDict
IMG_EXTENSIONS = ['.jpg', '.JPG', '.jpeg', '.JPEG',
... |
0d076bae71975828796dd5be77d3896066265af9c637cda376fa180f9b7a22dd | Python | 12,663 | 238 | import pickle
import numpy as np
import time
from tqdm.auto import tqdm
from rCPGswCPG.protocols.protocols import *
from rCPGswCPG.parameter_extraction.param_extraction_utils import analyse_noSI, analyse_longSI, analyse_shortSI
from rCPGswCPG.utils.gen_utils import *
import os
from rCPGswCPG.utils.utils import *
from c... |
c3b9f0370a43addb0b29515d09d4daec58979378fea4eeabc032267cc6d2cdf2 | Python | 12,677 | 300 | import numpy as np, random
from tqdm import tqdm
import torch
import torch.nn.functional as F
import torch.nn as nn
import random
from typing import Union, Tuple, Optional
from torch_geometric.typing import (OptPairTensor, Adj, Size, NoneType,
OptTensor)
from torch import Tensor
fro... |
3b191f08bbc603f2ca33d14380cdb8b891eab8e0dc92c1e334538478117de127 | Python | 12,687 | 346 | """
qPCR Statistical Analysis — Article 1 (Control vs PTSD)
Boxplot with jitter, ggplot2 style.
UPDATED: Removed ANOVA (redundant for 2 groups)
Statistical pipeline:
1. Outlier removal — IQR 1.5×
2. Normality — Shapiro-Wilk per group
3. Two-group test — t-test (if both normal) or Mann-Whitney U (if any no... |
05a90df3822f60a2a2e3f479e2315cbafafaf45c68917cc9f2c8d5c32cc0292a | Python | 12,698 | 343 | """Behavioural contracts for `navis.smooth_skeleton`.
Both kernels live in navis-fastcore, so these check the properties navis
promises rather than the arithmetic: what moves, what is pinned, what the
topology looks like afterwards, and which of `window`/`sigma` was asked for.
The numeric ones use toy neurons small e... |
b8025e70ace2f318dcd1ea0cd699aa60e15ba42ff7554b44a02546bcf6343acb | Python | 12,705 | 330 | # Copyright (c) Facebook, Inc. and its affiliates.
#
# 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 ... |
35bf9c3e1e7afe607a91c9205a78b48810d10889c3d01ccbf311b042e04a278d | Python | 12,711 | 333 | #
# Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
#
"""Function to convert V2 to V3 files.
Separated out from the main molecule_counter to avoid dependencies.
"""
from __future__ import annotations
import random
from collections import OrderedDict
import h5py
import numpy as np
import cellranger.barco... |
ef1448b7524e76dc3cb98f95e734b35f7a0187813c9f845f1a8813b59f4af6a4 | Python | 12,714 | 302 | from __future__ import annotations
from dataclasses import dataclass
from typing import Any
from rdkit import Chem
from rdkit.Chem.EnumerateStereoisomers import EnumerateStereoisomers, StereoEnumerationOptions
from src.utils.models import (
StereochemistryResolution,
StereochemistryVariant,
UndefinedSter... |
dfab96f7458836fad35f6189328aa9ac0e245f26ec5fa39699a8773ec3451596 | Python | 12,716 | 337 | '''import scanpy as sc
adata=sc.read_h5ad("../data/PBMC.h5ad")
print(adata.X[:10,:10])
sc.pp.highly_variable_genes(adata, n_top_genes=2000, batch_key="condition")
adata = adata[:, adata.var['highly_variable']]
#Visualization
sc.pp.neighbors(adata)
sc.tl.umap(adata, min_dist=0.5)
sc.pl.umap(adata, color=['... |
b26571d5e78533a973b1e57708277ee9a607dbce735ecd8ae312b1dc3bcfd42a | Python | 12,735 | 325 | """
synthseg - Neural Network-Based Brain MRI Segmentation
Part of the micaflow processing pipeline for neuroimaging data.
This module provides an interface to SynthSeg, a deep learning-based tool for automated
brain MRI segmentation that works across different MRI contrasts without retraining.
SynthSeg segments brai... |
894394ad34269ad7ced9b6ed123b54677da9873e75db2d9bd33b8ac88fefaf63 | Python | 12,737 | 370 | # 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... |
a25a733da12e30bb48ab4693cd69e46598fbbb03b657ad1238564b206fa695a4 | Python | 12,738 | 279 | #!/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... |
810533b4c8bd9f3b183b8dbe183dd128be4e533c9c390a2ab6a5710ba3e4ed05 | Python | 12,754 | 314 | """
Dev script to generate some result jsons that are used for testing
Generates
- ABFEProtocol_json_results.gz
- used in abfe_results_json fixture
- SepTopProtocol_json_results.gy
- used in septop_json fixture
- AHFEProtocol_json_results.gz
- used in afe_solvation_json fixture
- RHFEProtocol_json_results.gz
-... |
6878a6511a6d3d30d4200934b4c2e96f7b88e23891e9c61d5c489cb4e6eb17a8 | Python | 12,762 | 349 | #!/usr/bin/env python
"""
author:CBJ
"""
import sys
from pathlib import Path
import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler
import joblib
import logging
# Add the project root directory to the system path
PROJECT_ROOT = Path(__file__).parent.parent
sys.path.insert(0, str(PROJE... |
2618dfd7ba2a510956df186a26069bda1aa6ec178bbcea82e9c3f103dda95172 | Python | 12,768 | 392 | #!/usr/bin/env python3
#
# Mesa documentation build configuration file, created by
# sphinx-quickstart on Sun Jan 4 23:34:09 2015.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All c... |
286ac47d519d4aeb745e720853e79aa98882e3bef9a92f0289439c95dae5eb63 | Python | 12,797 | 359 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
import logging
import numpy as np
from typing import List, Optional, Tuple
import cv2
import torch
from densepose.structures import DensePoseDataRelative
from ..structures import DensePoseChartResult
from .base import Boxes, Image, MatrixVisualizer
c... |
401f415ab4ec2dd02549ff1efa5286c4971bd30f221da9dc79a0ca154bf03636 | Python | 12,824 | 245 | from __future__ import annotations
import argparse
import json
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from scipy.stats import spearmanr
COUNTRIES = ["AUS", "BEL", "CZE", "FIN", "GBR", "IRL", "KOR", "LTU", "POL"]
PRIMARY_VARIABLES = [
"ESCS", "HOMEPOS", "MATHEFF", "ST255Q01JA"... |
16c1082d1bb7ad032a8f569e45c25ad5d836b9c148dc8e36f2210ed50436132d | Python | 12,852 | 342 | import string
import click
import pathlib
import logging
import warnings
import json
from functools import partial
from openff.units import unit
import openfe
from openfe.protocols.openmm_rfe.equil_rfe_methods import RelativeHybridTopologyProtocol
from rdkit import Chem
import kartograf
from kartograf.filters import (
... |
69f3f32177be0d1f2cd38638994320a5cd189124c03d81588205e71ffe1e99b8 | Python | 12,852 | 331 | #!/usr/bin/env python
"""
ltpltd.py
---------
LTP / LTD classification from CASCADE firing-rate outputs.
Compares mean per-electrode firing rate in one or more MEASURE recordings
against a BASELINE recording. Each electrode is classified as:
LTP — rate increased by >= threshold % (default 20 %)
LTD —... |
4a21d61cd21af41edffc5c41f15c1b6f00cd253ea02631b91aa07a4bd2bc00be | Python | 12,867 | 321 | from __future__ import print_function
import argparse
from functools import reduce
import torch
import torch.nn as nn
from torch.autograd import Variable
from torch.utils.serialization import load_lua
class LambdaBase(nn.Sequential):
def __init__(self, fn, *args):
super(LambdaBase, self).__init__(*args)... |
4f4b46dfc19082d14cdfb1a8feab7892eac7c57badf84083c5e6cf23b015f950 | Python | 12,872 | 323 | # Copyright (c) Facebook, Inc. and its affiliates.
import copy
import itertools
import logging
from collections import defaultdict
from enum import Enum
from typing import Any, Callable, Dict, Iterable, List, Optional, Set, Type, Union
import torch
from fvcore.common.param_scheduler import (
CosineParamScheduler,
... |
28e1ee39da882d62f630ff97b0b43b421b86d33c419a98bd218b9991286dbed8 | Python | 12,873 | 347 | from __future__ import annotations
import operator as op
import re
import string
import sys
from typing import Any
import more_itertools as itx
import pytest
from hypothesis import assume, given
from hypothesis import strategies as st
import tests.strategies as sb_st
from snakebids.utils.containers import ImmutableL... |
0705b4518929435c64fdc15346f0a13a1b23779b3cf0c6d2f7aa9449f0d38a5b | Python | 12,885 | 387 |
# GRACESPort.py
# ------------------------------------------------------------
# Run GRACES feature selection from CSVs, but *without* changing GRACES.py.
# This wrapper performs iterative single-feature selection to reach k=7,
# adds preprocessing, stability selection across seeds, and evaluation.
# -----------------... |
8b7053453602bb4cfd5aef523f58332656862add59ab93bf8fae44b89d2e9ef4 | Python | 12,908 | 323 | """Role ambiguity and resolution over the HFB annotation table.
This module quantifies the **ambiguity** (a circuit neuron's own identity becomes
increasingly insufficient to specify the bound feature with depth) and supports the
**resolution** (the bound feature is nonetheless carried by the time-locked polychronous
... |
9fcc7a94cbb346ba0e5fb084475133d8de0f811bfa95c8b6aedcc5c65e5b2198 | Python | 12,950 | 298 | from layers import *
from metrics import align_loss, class_loss, label_loss
from inits import *
flags = tf.app.flags
FLAGS = flags.FLAGS
class Model(object):
def __init__(self, **kwargs):
allowed_kwargs = {'name', 'logging', "task", "rel_update"}
for kwarg in kwargs.keys():
assert kwa... |
7afd0ef8aa1e0c355faf60c2e5cc22ea6e5dd559d86a1b22847c67a8cccff1fe | Python | 12,959 | 345 | #!/usr/bin/env python
# Copyright 2017-2023 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... |
b5c8cb210903ccde364de59e6644ab801af1149b5b6d1139b89a579cccc6c49a | Python | 12,978 | 379 | """ I/O operations for SpineDataset
Created on January 21, 2026
@author: dcupolillo """
from __future__ import annotations
from pathlib import Path
import flammkuchen as fl
from tqdm import tqdm
class DataPaths:
"""
Constants for data file paths.
This class defines standard relative paths for var... |
d72aaa3a25fabe1cfd3901ad467b1e623365e204138f7b7d6c6d2dd7c69cba3b | Python | 12,981 | 303 | #!/usr/bin/env python3
"""
eval_for_top_k_against_top_k_prediction.py
Threshold-free top-k enrichment analysis for off-target prediction benchmarking.
Methodology follows Fig. S7 in Haeussler et al., Genome Biology (2016).
Definition:
- Actual top-k% : sites ranked in the top k% by actual_substrate_abundance
- ... |
7dc5219a772b9bfe163eb5cbdaf45adfcd462ca78a9d29f17a24e02e1b9b1418 | Python | 12,985 | 287 | """Completeness / coverage of the informative low-level feature representation.
Quantifies how completely the network's *informative* low-level (**L**) neurons are recruited
into labelled binding circuits, and how that recruitment thins as the binding circuit's feature
selectivity (PNG F1) is tightened. All functions ... |
a0e7c99c82fa81f3f6547bc1d230564978d0d1edbfa1682393da2f8488fb3cff | Python | 12,986 | 349 | import batch_process.util.plotting as plot_util
import spikeinterface.full as si
import numpy as np
import os
import shutil
import matplotlib.pyplot as plt
def save_sparse_analyzer(analyzer, method="memory", radius_um=60, job_kwargs=None):
if job_kwargs is None:
job_kwargs = {}
# save spars... |
f558a48821fc1920ab140ab18c922f865c23370df72f878c711f1be37bfa4f16 | Python | 12,989 | 262 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Jan 4 22:14:06 2022
@author: evanqu
"""
import numpy as np
import gzip
import logging
import argparse
from accusnv import log as accusnv_log
from accusnv.preprocessing import utils as ghf
import pickle
log = logging.getLogger('accusnv')
#%% Version ... |
525cee67663382d84e85a18d26f924fe6f9cbd2b251a7c538a613ad7de010ebc | Python | 12,990 | 299 | # Copyright (c) Facebook, Inc. and its affiliates.
from typing import List
import torch
from torch import nn
from torch.autograd.function import Function
from detectron2.config import configurable
from detectron2.layers import ShapeSpec
from detectron2.structures import Boxes, Instances, pairwise_iou
from detectron2.u... |
05c956dab2c8d4a7e3d7297aa0325629f1077cb8d1d2b1074206f98497a97575 | Python | 12,996 | 351 | from torch import nn
import torch
class MLP(nn.Module):
""" a simple 4-layer MLP """
def __init__(self, nin, nout, nh):
super().__init__()
self.net = nn.Sequential(
nn.Linear(nin, nh),
nn.LeakyReLU(0.2),
nn.Linear(nh, nh),
nn.LeakyReLU(0.2),
... |
e0bd76c20e65f2dacbaaa19aef429cdad981a23ecb7a359e3ef99f31c9794e73 | Python | 13,006 | 342 | from __future__ import division
import ldscore.regressions as reg
import unittest
import numpy as np
import nose
from numpy.testing import assert_array_equal, assert_array_almost_equal
from nose.tools import assert_raises, assert_equal
np.set_printoptions(precision=4)
def test_update_separators():
ii1 = [True, Tr... |
b0896917e8fd20e8bf7fb3bf446bed6e66d451e60a09b69bc22b16e317188275 | Python | 13,017 | 428 | """ Created on Mon Nov 6 10:29:44 2023
@author: dcupolillo """
from __future__ import annotations
from pathlib import Path
import numpy as np
import tifffile
from ROIpy.core.components import Node
def stack_metadata_dictionary(
stack_name: str = None,
data_type: str = None,
corners_um: l... |
d88a723a7cd55fab3a2d2722898668781f4163e0b807b5cd0f64d4bbba53add9 | Python | 13,034 | 375 | # Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
"""These define information about the sample required to generate a web summary."""
# pylint: disable=too-few-public-methods,missing-docstring,too-many-arguments
from __future__ import annotations
import json
from dataclasses import dataclass
from typing i... |
065ecdb158cb0b9ed12700b1405d0a945004e07721afe329f084e0f61b05924a | Python | 13,103 | 326 | # %%
from __future__ import annotations
import argparse
import contextlib
import io
import json
import os
import pickle
import sys
import warnings
import numpy as np
import pandas as pd
import scipy.io
import scipy.stats as stats
import tensorflow as tf
from joblib import delayed
from joblib import Parallel
from kera... |
62a18d219ec357c86dae7a3caf05dfce61ba042ae61f0f94cec8a0a1a58b63f9 | Python | 13,124 | 389 | # !/usr/bin/env python
# Copyright (c) 2022 10X Genomics, Inc. All rights reserved.
"""Code to produce altair umi and Genes distribution plots for the websummary."""
import altair as alt
import pandas as pd
import polars as pl
import cellranger.altair_utils as alt_utils
import cellranger.rna.library as rna_library
f... |
a7a8b42fb3e310cfb407028754befd15acb728124548511a7a5ef422b6d38b7c | Python | 13,129 | 340 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Postpartum Brain Age Prediction Model
=====================================
Conceptual PyTorch implementation of the brain age prediction model described in:
"A biphasic brain aging trajectory during the postpartum period: Longitudinal evidence for initial advancement... |
a4558414961fd88f9057b95f789c63b09627f75e069175c4cef17ae5b9cc6db1 | Python | 13,136 | 338 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pathlib
import mdtraj as md
import numpy as np
import openmm
import pytest
from gufe.protocols import execute_DAG
from numpy.testing import assert_allclose
from openff.units import u... |
21f6ae276cd0dbc8c200c182ede8e41cbfc9dcc05f2932d02dc5326123270254 | Python | 13,141 | 495 | """ Created on Mon Oct 28 17:23:20 2024
@author: dcupolillo """
import flammkuchen as fl
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
# %% Take only traces labeled as '1'
def filter_h5(
h5_path: str or Path,
label: int
) -> dict:
"""
Filter a given binary ... |
b96dc181cd71d44db62c7a06969ca936097b6b3f4e9ce9d6277700b9307208ca | Python | 13,141 | 316 | # 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... |
c58055f19f3bb409c729b6170dda6b433a7663d3a3861f58983a7c5fd24c2f7e | Python | 13,157 | 416 | '''
Created on 20.08.2020
Author:
Michael Diedenhofen
Max Planck Institute for Metabolism Research, Cologne
Read Bruker ParaVision JCAMP parameter files (e.g. acqp, method, visu_pars).
'''
from __future__ import print_function
VERSION = 'pv_parser.py v 1.0.2 20200820'
import re
import sys
import collections
impo... |
c09032cd39c21c44fd998d80b682e7d742375203d9b071aafdfd5c9ac0c61b05 | Python | 13,171 | 379 | """ Created on Tue Aug 27 16:49:49 2024
@author: dcupolillo """
from __future__ import annotations
from ROIpy.core.structures import Stack, Morphology, Scanfields
import numpy as np
import pyqtgraph as pg
from PyQt5.QtWidgets import (
QMainWindow, QFrame, QGridLayout, QLabel, QSlider, QWidget, QVBoxLayout)
fro... |
4c4a7664a02525e65ab0310c7d41948b92921acc5f85197bc532b7e5ddbbae2f | Python | 13,213 | 344 | from __future__ import annotations
from dataclasses import dataclass, field
import numpy as np
from rdkit.Chem import AllChem as Chem
from chemprop.featurizers import Featurizer
from chemprop.utils import make_mol
MoleculeFeaturizer = Featurizer[Chem.Mol, np.ndarray]
@dataclass(slots=True)
class _DatapointMixin:
... |
90dd36d0d905175ebbd72bcff9ad3e59a3594500499cac4ccf16d5e37509a786 | Python | 13,213 | 328 | # Copyright (c) Facebook, Inc. and its affiliates.
import logging
from typing import List, Optional, Tuple
import torch
from fvcore.nn import sigmoid_focal_loss_jit
from torch import nn
from torch.nn import functional as F
from detectron2.layers import ShapeSpec, batched_nms
from detectron2.structures import Boxes, I... |
20f681c847a2aea5a16a66a90e18cd04539e374cc846f48cf3ccb075fc397dbc | Python | 13,214 | 383 | #!/usr/bin/env python
#
# Copyright (c) 2014 10X Genomics, Inc. All rights reserved.
#
"""Methods for safely encoding values to json.
The json standard does not permit encoding NaN, but Python will still happily
do it, which can cause problems for other programs. This module contains code
to fix those values up, as ... |
9caa064325db0d39a83ec10805be02af6981c94e7fd5d867425bf9c615b987a7 | Python | 13,214 | 302 | import os
import matplotlib.pyplot as plt
import streamlit as st
from datetime import datetime
from nmj_master_dashboard import (
BTX_CLASS_EARLY_NMJ,
BTX_CLASS_MUSCLE,
BTX_CLASS_NEURON,
BTX_CLASS_ORPHANED,
annotate_global_btx_intensity_otsu,
collect_image_jobs,
get_confocal_metadata,
p... |
643cc9d96cf12e8a1316e7bd4277143098715c849f488377ab34abcf8d5ca9fd | Python | 13,226 | 331 | #!/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... |
59b7f83a61e72ab26b5781f2e6f7e6b30c18c76a31f06471c9450acf15be92a9 | Python | 13,227 | 307 | """
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... |
c5180909f2de3e3cf5394501267bda2c9b4969d3c5e7db23ec9b453c5ca4d5bd | Python | 13,229 | 378 | """
Minimal Python port of scripts/claude_run_compare.R (renamed to limma.py)
Produces CSV with columns: gene, logFC, limma_mod_t, limma_mod_p
"""
import math
from typing import Dict, Any
import numpy as np
from scipy import linalg
from scipy import stats
from scipy.special import psi, polygamma
import csv
import sys
... |
0546e9a95a7c40cbac46c259d32994f1bb53894624f72a81c1dd9038372b1a0b | Python | 13,238 | 337 | # 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... |
0b69a8a0316de2bb15e09933d1230475ba73caa81707ab8deb1a710a6e96e475 | Python | 13,238 | 411 | # AUTOGENERATED! DO NOT EDIT! File to edit: 70_bamfiles_converters.ipynb (unless otherwise specified).
__all__ = ['SimplifiedAlignedRead', 'ReadPair', 'sam2wig', 'sam2wig_efficient', 'sam2bed_efficient']
# Cell
from tqdm import tqdm
import numpy
from pyranges import PyRanges
import pandas as pd
import pyranges
from .... |
e60fce80aed3203c39bd460c82188120d665b3ac3a4adbcd9df43219f7ee6a14 | Python | 13,241 | 311 | #############################################################################
# HYBRID SYSTEM SAMPLERS
#############################################################################
"""
This is adapted from Perses: https://github.com/choderalab/perses/
See here for the license: https://github.com/choderalab/perses/blob/... |
2adbb4c85d2422e53649d740076653877e14b0882637a168609b1994c04370ed | Python | 13,268 | 395 | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
# flake8: noqa
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path ... |
c28fba88f9d8bf9736676a1c0d340db5870bcbf16ecb859ae623dd274fa95d02 | Python | 13,279 | 410 | #
# Copyright (c) 2017 10X Genomics, Inc. All rights reserved.
#
from __future__ import annotations
import os
from typing import NamedTuple, TypedDict
from six import ensure_binary, ensure_str
import cellranger.constants as cr_constants
import cellranger.utils as cr_utils
import cellranger.vdj.chain_types as chain_... |
18ad0f0bc6da22de8e73aa7d435ef0dd543a9e1d0adc674f2740940279ba371a | Python | 13,287 | 317 | import os
import glob
import numpy as np
import pandas as pd
import anndata as ad
import numpy as np
import scanpy as sc
import time
import matplotlib.pyplot as plt
from .TSvelo_utils import run_paga, run_palantir, get_colors, show_imgs, sigmoid, relu, scv_analysis
from .TSvelo_pp import preprocess
from .TSvelo_branch ... |
5aaa8a4aa2fac9f661d61cd511d4f99d0c55943966e1ef0cc1e67594c2c5ebd4 | Python | 13,298 | 322 | # Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
"""Python implementation of classes also implemented in Rust.
This was the original implementation
before these classes were migrated to PyO3. They are kept around to enable easier
prototyping of model changes and because they are occasionally passed as pi... |
3e410e262f91d9d2969dcd3f91aff8bc5cba9e991120409dcd784e3412b4bce7 | Python | 13,299 | 358 | # 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... |
2e0a24767091f067357523d677a62f1eef179a3c7af1d4bb677fe8799a31d2ac | Python | 13,315 | 344 | ## Prediction only takes place on AUMC test set.
## prediction on local database such as MIMIC-III has been undergone on keras_lstm.py
import os
import sys
import time
import logging
import argparse
import pickle
import glob
import scipy.stats
import numpy as np
import seaborn as sns
import pandas as pd
from datetim... |
aab8ff9a79ae4d57d8190d4e32e4fb421ee0a44612df83670d60c036a678d6af | Python | 13,316 | 347 | import numpy as np
import pickle as pkl
import scipy.sparse as sp
import sys
import tensorflow as tf
import math
import os
import random
from collections import Counter
import logging
import pandas as pd
import shutil
from sklearn.impute import SimpleImputer
from sklearn.linear_model import LinearRegression
from sklear... |
44b5291cf9f8c3fa21656f6de8e435e59fbb6d938c0ed15234aac605aeadc19c | Python | 13,321 | 447 | """
I/O utilities for saving/loading models and experiment tracking.
Deliberately free of any plotting dependency: this module sits on both the
training and inference import paths, so anything imported here is imported
everywhere.
"""
import logging
import os
import pickle
from datetime import datetime
from pathlib i... |
cf435cacbd2dbcbf0f8ca2eb2ebcd8f900e261c4f1f1ebffa7cb9fcf0ba6a597 | Python | 13,330 | 381 | """Tests for the meta-agents membership manager."""
import pytest
from mesa import Agent, Model
from mesa.agent import AgentSet
from mesa.meta_agents import MembershipEdge, MembershipView, MetaAgents
def test_meta_agents_create_records_memberships():
"""Create should return live objects and record memberships."... |
297f6ca5c72a4b2a7a5a1c0037f48e7807a7752cb5bbbf2b3bad04df8aa4a12f | Python | 13,333 | 399 | from __future__ import annotations
from dataclasses import dataclass, field
from pathlib import Path
import time
import numpy as np
import tifffile
from spyne.core.spines.analysis.backends.base_backend import (
BaseBackend, InferenceJob, InferenceResult)
from spyne.core.spines.analysis.padding import unpad_predi... |
7f2eb518b090097a9a6af845f3297b4f5f106c1515c65c10528b464c982884db | Python | 13,340 | 394 | #M1
import os
import time
import random
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.optim as optim
from torch.utils.data import DataLoader, TensorDataset
from collections import Counter
from typing import Optional
import scanpy as sc
import anndata as ad
import... |
87d3ffdab3ecacdfcfe236e582f1127c48c8d01c8529b985c6fbc4437fab6251 | Python | 13,366 | 367 | #!/usr/bin/env python
"""Train an NF (ferroelectric nematic) property model from a config file.
Every published result came from one config file. Rather than a script per
architecture-task-split combination, the parameters that vary live in
``configs/*.yaml`` and the shared pipeline lives here, once.
Handles both mod... |
a74694bee62b3f35a284c3d20e32c91381889f614666173503472faffdf04f74 | Python | 13,373 | 235 | # AUTOGENERATED BY NBDEV! DO NOT EDIT!
__all__ = ["index", "modules", "custom_doc_links", "git_url"]
index = {"bed2splicesiteinfo": "01_rnamap.ipynb",
"MapBase": "01_rnamap.ipynb",
"RNAmap": "01_rnamap.ipynb",
"reshape_into_bins": "53_mikemaps.ipynb",
"CoverageBigWig": "02_parsers.... |
aec4710efcc167d358209aa13992a204701015659c9574746b9c7ebe4ea3b799 | Python | 13,375 | 340 | #!/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... |
0a44bb2c44f3889ff473a452df3fe863519e566babe1bec82886962d27c6e9c9 | Python | 13,379 | 337 | # Copyright (c) Facebook, Inc. and its affiliates.
import functools
import json
import logging
import multiprocessing as mp
import numpy as np
import os
from itertools import chain
import pycocotools.mask as mask_util
from PIL import Image
from detectron2.structures import BoxMode
from detectron2.utils.comm import get... |
c05c63a51faea663ad83ac72a1327ae6b8b22180a2e555d769907474b4e8f745 | Python | 13,379 | 347 | import numpy as np
import scipy.spatial
import torch
import matplotlib.pyplot as plt
from scipy.stats import norm
from ndreamer.plot import plot_distribution_with_binary_zscore
def weighted_mean_neighbors(
adata,
reference_batch,
reference_condition,
bandwidth=1.0,
nearest_neighbo... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.