sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
06bbf5e897b7093b6bdffd084d729f70ed1ea6477551b4806ba86abedfe32f51 | Python | 5,183 | 140 | import functools
import torch.nn as nn
from taming.modules.util import ActNorm, ActNorm3D
def weights_init(m):
classname = m.__class__.__name__
if classname.find('Conv') != -1:
nn.init.normal_(m.weight.data, 0.0, 0.02)
elif classname.find('BatchNorm') != -1:
nn.init.normal_(m.weight.data... |
1284e1af750361b7c0f69b41a347ddddb6ef83625f33e9d38999b2fafe231530 | Python | 5,185 | 128 | # Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
"""Decide which is T vs B vs T(Gamma/Delta) inputs."""
from __future__ import annotations
from typing import TYPE_CHECKING
import martian
if TYPE_CHECKING:
import cellranger.mro_types.structs as mro_structs
__MRO__ = """
stage SPLIT_VDJ_INPUTS(
i... |
f9667407f26f9cd1215204abda5b02c5ddadb6818a0ba9791e8ddcf89d8e9ea5 | Python | 5,185 | 159 | #!/usr/bin/env python
#
# Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
#
"""Subsample reads for sequencing saturation analysis."""
from __future__ import annotations
import gzip
import pickle
from typing import TYPE_CHECKING
import martian
import cellranger.constants as cr_constants
import cellranger.... |
2a8655102f42882ef814a3080d982f1099b0cad017bbf0825d931325b465ac7e | Python | 5,188 | 129 | from __future__ import annotations
import argparse
import json
import time
from pathlib import Path
import numpy as np
import pandas as pd
from baseline_models import grid_search_grouped_cv, predict_baseline, refit_baseline
from metrics import evaluate_held_out_pv_predictions
from target_scaling import WeightedTarge... |
42cbaf0ad456676ea58a1775c24f44fca602dffea6b19d428e994d04114e52f8 | Python | 5,195 | 197 | """This provides logging functionality for MESA.
It is modeled on the default `logging approach that comes with Python <https://docs.python.org/library/logging.html>`_.
"""
import inspect
import logging
from functools import wraps
from logging import DEBUG, INFO
from typing import ClassVar
__all__ = [
"DEBUG",... |
93f0c632bf09438b131dbb6f63b3d550c81f94f7823fefb4eed29d50896b994b | Python | 5,197 | 134 | import torch
from torch import nn
from typing import Dict, List, Optional
class MultiOutputUnet(nn.Module):
def __init__(self, in_channels=1, output_heads: Dict[str, dict] = None, n_filter=32, **kwargs):
"""
Multi-output U-Net architecture supporting various output heads.
Parameters
... |
9eb02ba45128cd90304a5b91d6a4f0e1eafb3bd5ef7d0a0c9ae340289809be2e | Python | 5,197 | 153 | import logging
import numpy as np
import pytest
from click import ClickException
from click.testing import CliRunner
from gufe import SmallMoleculeComponent
from openff.toolkit import Molecule
from openff.units import unit
from openff.utilities.testing import skip_if_missing
from openfecli.commands.generate_partial_c... |
18e04b6b19be1e8fb5cef2edb999f52996b7f66cecf4a97c2376790690fe7fa4 | Python | 5,203 | 131 | #!/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... |
4e59a23afc16dec391ef8b1591852abde40495eaa1f007bef09b5b7cb346a6b2 | Python | 5,206 | 184 | import matplotlib.pyplot as plt
from matplotlib.axes import Axes
import numpy as np
import pandas as pd
def axis_on_for_ylabel(ax: Axes):
ax.axis("on")
erase_all_axes(ax)
erase_ticks(ax)
def savefig(file_path, dpi=None):
"""
Save the current figure to the fig_dir with the given filename.
Pa... |
7122be4b27cb38bf8ad7a6ba5b4eaf55ce8cec1fe88aefde3072e3cfd8343a8d | Python | 5,206 | 149 | import functools
import os
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from skimage import io
from loguru import logger
from smma.src.utilities import comdet
import smma.src.utilities as utilities
logger.info('Import OK')
# Remember to add napari.run() calls after eac... |
786e7c579292b0cad3ab42778ded4ed06b91aea1457c826504f506bc1ca3c6c4 | Python | 5,208 | 128 | """シナプス配列の乱数部分(係数をかける前の配列)を作成するコード"""
from myfunc0829 import GetSynapsepath
import numpy as np
import pickle
import os
rng = np.random.default_rng()
Num_state = 4 # 粗視化した状態の数
Num_inp = 500 # 感覚入力ニューロンの各サブグループのニューロン数
Num = 500 # 感覚入力ニューロン以外の各サブグループのニューロン数
# 各シナプス結合行列のもととなる配列を作成
l_0 = np.abs(rng.standard_... |
395a9de2f1846c06c144eb8e1b780c1627c5561da270e145d376d6fd6f7d8992 | Python | 5,213 | 161 |
""" Cortex dataset handler """
__author__ = "Fabi Bongratz"
__email__ = "fabi.bongratz@gmail.com"
import re
import os
from typing import Union, Sequence
from enum import IntEnum
import trimesh
import nibabel as nib
import numpy as np
import torch
import torch.nn.functional as F
from tqdm import tqdm
from pytorch3d.... |
8b1d59264f649282cb25c375a9e089b6f8a516382820dee5d345c72d01db122e | Python | 5,214 | 152 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
import sys,os
import numpy as np
import peakdet as pk
import scipy.signal as sc
# noinspection PyTypeChecker
def getI32(file_name,numberOfSlices,numberOfAllRepitionsParTable)... |
8383b880c72eef4fb63bdbd19922a5579e4a42fc00967deec90b43225f38b28e | Python | 5,221 | 118 | from tristan_pipeline.io.params import *
from tristan_pipeline.utils.loading_utils import *
from tristan_pipeline.utils.preproc_utils import *
import glob
import nibabel as nib
from nilearn.image import mean_img, load_img, index_img
import os
import shutil, json
subjects = [5]
sessions = [1]
#####First: prep the ap/... |
d7f2f66fbca1da8d67c0f2668fecc685af46aaffa0003c89a27c09d076e9ad09 | Python | 5,237 | 176 | import torch
import torch.nn as nn
import torch.nn.functional as F
from .meta.electrode_names import channels
from .VisualTransforms import EEGScalpMap
def conv_2plus1d(
in_ch, out_ch, k_t=3, k_s=3, stride_t=1, stride_s=1, padding_t=1, padding_s=1
):
# Spatial 2D conv
spatial = nn.Conv3d(
in_ch,
... |
ce9f7e524454d1de7436ab8d3b4d66f7fad06b86b2b661e88731d6a450e31ba4 | Python | 5,241 | 133 | # Read molecules and record elements, formal charges, aromatic atoms, ring atoms,
# n bonded atoms, bonds, angles, propers, impropers and molecule indices
# Output uses one-based indexing
# See also https://github.com/openmm/spice-models/blob/main/five-et/createSpiceDataset.py
import h5py
from openff.toolkit.topolog... |
5b923ad1110cc73ffe9658e90e1c8e944c6dc5e275669e968bac77c762805706 | Python | 5,242 | 138 | #python mqrunDash_playwright_test.py --db "Z:\Download\mqrun.duckdb" --mode peptide --term HLSGEFGK
import argparse
import subprocess
import sys
import time
from pathlib import Path
import requests
from playwright.sync_api import TimeoutError as PlaywrightTimeoutError
from playwright.sync_api import sync_playwright
A... |
fc965437f35f1ed5bc13e2dee9fe69e9e60800d5130c0f39990071d0d8964efd | Python | 5,253 | 142 | #!/usr/bin/env python3
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import argparse
import logging
import ... |
0e9fcf0830ef35da8d9a46dddce01bca7a3cd1fb924f056565a5fc638b1c5d0b | Python | 5,254 | 150 | #!/usr/bin/env python
# Copyright 2020-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... |
23cca54e7c1f8e66b883932ced5435d3f1949f968c3755d3882f357cdf7ceedf | Python | 5,255 | 143 | #!/usr/bin/env python3
#
# Copyright (c) 2022 10X Genomics, Inc. All rights reserved.
#
"""Infer Gem well throughput if there's no top level argument."""
from __future__ import annotations
from typing import TYPE_CHECKING
import h5py
import martian
import cellranger.constants as cr_constants
import cellranger.featu... |
31408f9ac1c1978555e3981314edb55d30c2646b31f2e54128f4eda26da600e0 | Python | 5,256 | 154 | #!/usr/bin/env python
# Copyright 2025-2025 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... |
f5a0c1b38e762c9918ab8b11afecfeb23755d0dbbb2ab5671ec5bd5f667474b8 | Python | 5,258 | 140 | """ Created on Tue Aug 27 15:47:53 2024
@author: dcupolillo """
from PyQt5.QtWidgets import (QMainWindow, QFrame, QLabel, QGridLayout,
QPushButton, QLineEdit, QMessageBox)
from PyQt5.QtCore import Qt, pyqtSignal
from ROIpy.core.structures import Stack, Morphology, Scanfields
class S... |
ef83e85cc782394c509a972460d2dfd2c358c71347cdee63cce232d37e7e4b7c | Python | 5,259 | 100 | from __future__ import annotations
import numpy as np
import torch
from torch import nn
class MeanPVEnsemble(nn.Module):
def __init__(
self,
input_dim: int,
hidden_width: int,
pv_count: int = 10,
dropout: float = 0.0,
target_means: np.ndarray | None = None,
... |
65a0171e1a06cbb578adeff70c113fa876061d1b3503b08ee270be35b330437f | Python | 5,261 | 106 | """The log files AccuSNV writes for a run.
Every job writes its own pair of files in the ``logs`` directory of the output directory, named
for the rule and the sample or group it ran on. Snakemake only ever runs one job per rule and
sample, so each file has exactly one writer; jobs sharing a file would garble each oth... |
82cf675c7a4ef8da721930add58cba2dfb839d52761153ab6cd0d84f7bb66164 | Python | 5,262 | 113 | ################################################
# ---------- NBS Plotting Functions ---------- #
################################################
import pandas as pd
import numpy as np
import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import seaborn as sns
from lifelines import KaplanMeierFitter
... |
8724f4a1dedcd5d760c38a787fc12aa0cb43e4ad03f817fa3c07c60e91c8cff3 | Python | 5,266 | 152 | from composer import Trainer
from composer.utils import reproducibility
from glob import glob
import logging
from omegaconf import DictConfig
from omegaconf import OmegaConf as om
from omegaconf import errors as omerrors
import os
from pathlib import Path
import transformers
import torch
from train_modules import (
... |
fb7fd9580be6a17fb95735413c63748bc5d6559ac9f73a1ede3be842eb5743de | Python | 5,266 | 94 | """
SlotDeconv: Run script for spatial transcriptomics deconvolution.
Usage:
python run_slot.py --data_dir /path/to/data --output_dir /path/to/output
"""
import argparse
import os
import numpy as np
import pandas as pd
from slot_model import SlotDeconv, DEFAULT_CONFIG
from slot_utility import (load_data, align_gen... |
5fc449adca5f36921ee5fbb51d5a32a71f202bbc8105334dbb7f6319ad47a8dc | Python | 5,270 | 106 | """Where pileup2diversity gets its reference base, and what it does when that base is unusable.
samtools has been seen writing stray bytes into column 3 of the pileup, so the reference base is
now read from the FASTA instead. These check that the FASTA wins when column 3 disagrees, that a
non-ASCII byte no longer stop... |
de0ed4411999191c3b1a8451ef017640d553d7047b21a970f77d730841c35847 | Python | 5,270 | 140 | # Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
"""Looks at the sample def and determines which feature-counter calls can be disabled."""
from __future__ import annotations
from typing import TYPE_CHECKING
import martian
import cellranger.rna.library as rna_library
from cellranger.fast_utils import Mul... |
d12578380b72e72e54d9e92790bf939b68f56071be8aacac7169acac163b6970 | Python | 5,280 | 137 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
import sys,os
import numpy as np
import glob
import shutil
import parReader
import i32Reader
def findData(path,addon):
reg_list = []
fileALL = glob.iglob(path+'/'+addon... |
35b761d011346c7f11a5a66926259abc3a8e2f7c4deff0bd3ab94d81fa8b349a | Python | 5,285 | 109 |
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import argparse
import pysam
import gffutils
import os
from ... |
d0f9d3ace10312d749aa8781a55485cae52e5fab474634f924a68f32d6e3acf2 | Python | 5,288 | 129 | #!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
import numpy as np
from typing import List
from detectron2.config import CfgNode as CfgNode_
from detectron2.config import configurable
from detectron2.structures import Instances
from detectron2.structures.boxes import pairwise_iou
from d... |
392598a6f762ad9731ae86a31b2ca1eef310db6dc85eb686ba68a50af22e6f81 | Python | 5,292 | 131 | import numpy as np
import torch
import nibabel as nib
import argparse
from .model import UNet3D
from . import util
def inference(T1_path, b0_d_path, model, device):
# Eval mode
model.eval()
# Disable gradient computation for inference
with torch.no_grad():
# Get image
img_T1 = np.e... |
efc3b3b80f562e2a3bfef5be024dec36834e10b68ef1d83b9e86bc1db828b10f | Python | 5,302 | 146 | from copy import deepcopy
import sympy
from scipy.optimize import minimize
from scipy.signal import savgol_filter as sg
from sklearn.ensemble import IsolationForest as IF
from scipy import signal
from scipy.signal import butter, periodogram, find_peaks, hilbert
import ruptures as rpt
import peakutils
import numpy as np... |
4dc2b36b635cc079ee956f064bc5576e36bbb9b40c592f05a15b4062d3d08211 | Python | 5,314 | 147 | import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os
import pickle
# Function to request file path from the user
def get_file_path(prompt):
path = input(prompt)
while not os.path.isfile(path):
print("Invalid path. Please enter a valid path.")
path = input(... |
80de2ac610297ddb7511867d06fc483c849af496ffa0d3d6ec5a5963051bd7e3 | Python | 5,314 | 147 | import pytest
from typing import Optional
import numpy as np
from sqlalchemy.exc import IntegrityError
import hsnn.analysis.png.db as polydb
from hsnn.analysis import png
@pytest.fixture(scope='module')
def polygrps() -> list[png.PNG]:
return [
png.PNG(
layers=np.array([3, 3, 4]), nrns=np.ar... |
630fbf96d416dc90007c68ac6a340890e94ce3ef9df5306385adcf4325fc2ea7 | Python | 5,321 | 154 | import numpy as np
import pytest
from sklearn.preprocessing import StandardScaler
from chemprop.data.datasets import MolAtomBondDatapoint, MolAtomBondDataset
from chemprop.featurizers.molgraph import SimpleMoleculeMolGraphFeaturizer
from chemprop.utils import make_mol
@pytest.fixture(params=[1, 5, 10])
def smis(smis... |
5fc34d2f104530d141937468bbe7d4d7593e080f4e12a07c55733c8e0f4fca3f | Python | 5,327 | 155 | #
# Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
#
"""Utilities for dealing with targeted and features."""
# Do not add new things to this module.
# Instead, either find or create a module with a name that better describes
# the functionality implemented by the methods or classes you want to add.
from c... |
bae5490172df7c99604680da0e93c94f787fab3b753d4838c00393b09e985bf6 | Python | 5,330 | 172 | # This is the model presented in the work:
# S. Palazzo, C. Spampinato, I. Kavasidis, D. Giordano, J. Schmidt, M. Shah,
# Decoding Brain Representations by
# Multimodal Learning of Neural Activity and Visual Features,
# IEEE TRANSACTIONS ON PATTERN ANALYSIS AND MACHINE INTELLIGENCE,
# 2020, doi: 10.1109/TPAMI.2020.2995... |
1c77e74e2e902cbc6424e0946b1b9a73ebb14e7ec64984dd049502f3966ef8d6 | Python | 5,331 | 149 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from typing import Any, Dict, Optional, Tuple
class EntrySelector:
"""
Base class for entry selectors
"""
@staticmethod
def from_string(spec: str) -> "EntrySelector":
if spec == "*":
return AllEntrySelector()
... |
18b103bed6e2bf39d272a4c547f1a978c2ae8ce4478c9f8cf83723076cf12017 | Python | 5,336 | 127 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# pyre-unsafe
from dataclasses import dataclass
from typing import Any, Iterable, List, Optional
import torch
from torch.nn import functional as F
from detectron2.structures import Instances
@dataclass
class DataForMaskLoss:
"""
Contain... |
be29f8fa4222d5cffe8f565a45217d9a05ab8f79a198a52150213511e7184b44 | Python | 5,336 | 147 | import json
import pathlib
import pytest
from gufe.storage.errors import ChangedExternalResourceError, MissingExternalResourceError
from gufe.storage.externalresource import FileStorage
from gufe.storage.externalresource.base import Metadata
from openfe.storage.metadatastore import JSONMetadataStore, PerFileJSONMetad... |
2e0edfce234e40c498ef5128f73b1b13aa33321c313ab66d35fe13df3978f719 | Python | 5,343 | 170 | """
Dataset curation functions.
Provides summary statistics and duplicate detection for molecular datasets.
"""
import logging
from typing import Dict, Optional, Tuple, Union
import numpy as np
import pandas as pd
from rdkit import Chem
from rdkit.Chem import Descriptors
logger = logging.getLogger(__name__)
def s... |
1a13a6524c34f5a53d79c3b721c04d064f98f7ff3bbbf93f20579299f2af399d | Python | 5,347 | 138 | import os
import torch
import pandas as pd
import torch.nn.functional as F
from ..utils.evaluation_metrics import update_per_subject_stats, calculate_subject_accuracy # From our previous refactor
def train_model_pipeline(
model,
optimizer,
loaders,
opt,
n_classes,
saving_path,
model_hash,
... |
bccd893c73cb40791ee5a09529577e8862d1c7bcc3ac4108d2d8714d06779528 | Python | 5,358 | 152 | # An example config to train a mmdetection model using detectron2.
from ..common.data.coco import dataloader
from ..common.coco_schedule import lr_multiplier_1x as lr_multiplier
from ..common.optim import SGD as optimizer
from ..common.train import train
from ..common.data.constants import constants
from detectron2.m... |
d3312c400d5a61c99b91e6688a432b4e61f8efcd7481d6d64a4a247b7e5d070c | Python | 5,359 | 134 | """
Post-processing: extract features from SessionResponses into CSV/pkl.
Changes from v2:
- Output filenames include window label
- Reuses response_plotting_util from v2 for save logic
"""
import numpy as np
import pandas as pd
from pathlib import Path
import dill as pickle
import batch_process.util.file_util as fil... |
f1a18a8d2601631cc5c42ed65921bc7aede071606d5c6b16c3e85dbc58cb994a | Python | 5,360 | 139 | """
Leave-One-WSI-Out (LOWO) Dataset Utilities
Provides dataset filtering and dataloader creation for LOWO cross-validation,
where each fold withholds one whole-slide image (WSI) from training.
Components:
LOWODataset — filters an AxonDataset by excluding specified WSIs
get_unique_wsi_ids — lis... |
e713be40ad67c23b3f5f90b103f21bf5a7b521a6362df8d1c3e8fe197208200d | Python | 5,363 | 166 | """ Created on Wed Jun 25 15:22:26 2025
@author: dcupolillo """
from spyne.core.imaging.imagingdataset import ImagingDataset
from PyQt5.QtWidgets import (
QMainWindow, QFrame, QLabel, QGridLayout,
QSlider, QLineEdit)
from PyQt5.QtCore import Qt, pyqtSignal
class RoiPanel(QFrame):
roi_n_signal = pyqt... |
dbfebbb30dacd40060c742b9cbd8b83db71d55f9b05cfdb91189f72a62ce821d | Python | 5,378 | 124 | import os
import numpy as np
import cv2
import albumentations
from PIL import Image
from torch.utils.data import Dataset
from taming.data.sflckr import SegmentationBase # for examples included in repo
class Examples(SegmentationBase):
def __init__(self, size=256, random_crop=False, interpolation="bicubic"):
... |
345dad2a9f18498ec4a79b016886a5e09c1433e9fa231bb41d78984ca3cff2b8 | Python | 5,387 | 190 | # -*- coding: utf-8 -*-
"""Implementation of surrogate map generation as in Burt et al., 2018, Nat Neuro."""
import warnings
import numpy as np
from scipy.optimize import least_squares
from scipy import sparse as ssp
from scipy.stats import boxcox
def _make_weight_matrix(x, d0):
"""
Construct weight matrix ... |
c09c8c97de1606fdb96b5d7b48c366dcf761ad8edbaa9b5cced38150000437e5 | Python | 5,392 | 187 | """Test copy methods for VTK wrappers."""
import copy
import pytest
import numpy as np
import vtk
from brainspace.vtk_interface import wrap_vtk
from brainspace.vtk_interface.wrappers import BSPolyData
def test_copy_method_basic():
"""Test basic .copy() method functionality."""
# Create a PolyData object wit... |
ff20f8dbd4abfcca3caf0657c58333cc18d8ae45ba2435aa57d51f61c36792bf | Python | 5,396 | 170 | # from celery import shared_task
import time
start_time = time.time()
import os
from pathlib import Path
import pickle
import yaml
import numpy as np
import torch
from PIL import Image
from torch.utils.data import DataLoader, Dataset
from torchvision import transforms
from .AttackCNN.utils.model_utils import load_mo... |
dd29e5e9786b422f89e367f0189f49ba359bc0c26e1eb8b7964833f51fe17dd1 | Python | 5,398 | 134 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
import sys,os
import numpy as np
import glob
import parReader
import i32Reader
def findData(path,addon):
reg_list = []
fileALL = glob.iglob(path+'/'+addon, recursive=True... |
98f0e9adf4f2ce1832ce9197cfa15dac17ded67c90f1f3a18d326145f1218d5c | Python | 5,407 | 141 | from abc import abstractmethod
from typing import Sequence
from lightning.pytorch.core.mixins import HyperparametersMixin
import torch
from torch import Tensor, nn
from chemprop.conf import DEFAULT_HIDDEN_DIM
from chemprop.nn.hparams import HasHParams
from chemprop.nn.utils import get_activation_function
class FFN(... |
0eea9badbe2a38e046137684db885cc66108d7eac59023f5325a71a295d01d86 | Python | 5,417 | 101 | import joblib
import numpy as np
import pandas as pd
def data_loader(path2data, freqs, heart_thresh, eye_thresh, peaks, fit_knee, sss, interpolate=False, get_psd=False):
'''Data loading utility function can be used for loading preprocessed salzburg and camcan data'''
#my_path_ending = f'*/*[[]{freqs[0]}, {... |
0029709e915a8f5ea39ea0bf5cbd52fe6ebb05eb5c25ddeb246299312361efc0 | Python | 5,428 | 135 | #%%
import pandas as pd
import mne
from os.path import join
from autoreject import Ransac
from autoreject.utils import interpolate_bads
import numpy as np
import joblib
#%%
df = pd.read_csv('../data/resting_lists_sbg/resting_list.csv')
df_sel = pd.concat([df.loc[idx] for idx, p in enumerate(df['path']) if 'gw_sleep_p... |
7768f5e2d3800b340b255a22852f0b718b8ba3f37a4f270aa76fe1f042500a00 | Python | 5,434 | 150 | import numpy as np
import os
import pandas as pd
from pandarallel import pandarallel
import torch
import torch.nn.functional as F
from tqdm import tqdm
class DistWrapper:
def __init__(self, cfg, logger):
self.cfg = cfg
self.logger = logger
def calc_dists(self):
"""
Gets embedd... |
273235178333236b5eaf8d4526430b24244a70f813a117c77ff8a5ae8f9db110 | Python | 5,435 | 158 | #!/usr/bin/env python3
"""Computes PNG counts per layer and saves to disk.
This script computes the number of detected PNGs per layer for each trial,
organised by architecture (SEMI, ALL) and state (pre, post).
Output structure:
{
'SEMI': {'pre': np.ndarray, 'post': np.ndarray}, # shape: (num_trials, 4)
'ALL... |
95eb823520ab1dc11721d7691735ac740c691fd20650acdfe7a0af3652aea1af | Python | 5,436 | 139 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# pyre-unsafe
from dataclasses import dataclass
from typing import Any, Optional
import torch
from detectron2.structures import BoxMode, Instances
from .utils import AnnotationsAccumulator
@dataclass
class PackedCseAnnotations:
x_gt: torch... |
311bc67f92673ba22ea450e43301eb5d7615fe57eeb30f948b978140d84ead37 | Python | 5,441 | 126 | #!/usr/bin/env python3
"""Detects three-neuron binding circuits (HFBs), from spike recordings.
This script relies on inference spike recordings, e.g. generated by `inference.py`,
and uses SPADE for the detection of HFBs. The detections are output to the specified
directory as `hfb*.db` for analysis.
"""
from argparse... |
233d4bcf4b57e3a264ceb129367c2dafeca6fedd2b81ba24ff4e7e7396c2cd77 | Python | 5,443 | 182 | # #### Effect of pooling samples on the efficiency of comparative studies using microarrays
# https://academic.oup.com/bioinformatics/article/21/24/4378/180078
# #### Baseed on https://www.curiousily.com/posts/deploy-keras-deep-learning-project-to-production-with-flask/
#python -m pip install --upgrade pip --user
#pyth... |
e29d511bf1fe556f7be9a124613204316c83e4a9d460f5b3c83d0c594560dabc | Python | 5,444 | 135 | import os
import pandas as pd
import scanpy as sc
import numpy as np
from sklearn.metrics import silhouette_score, normalized_mutual_info_score
from sklearn.preprocessing import LabelEncoder
from scipy import sparse
def remove_sparsity(adata):
"""Convert sparse AnnData matrix to a dense numpy array."""
if spar... |
23fdd330e7b21c79b910b072395b7d5ae2cc0bc64cade397352362e429f88be1 | Python | 5,449 | 171 | from typing import Any, Optional, Sequence
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import xarray as xr
from matplotlib.axes import Axes
from hsnn.utils import labels_to_masks
from hsnn.core import SpikeRecord
from hsnn.analysis._types import RatesArray
from .base import setup_axes, set_... |
6922cd4c331a9959d252b401d47e88d63110510b9fa7b21f0c933262e7389213 | Python | 5,453 | 167 | #!/usr/bin/env python
#
# Copyright (c) 2023 10X Genomics, Inc. All rights reserved.
#
"""Analyze cell types generated from CALL_CELL_TYPES."""
import functools
import gzip
import operator
from typing import TextIO
import martian
import tenkit.safe_json as tk_safe_json
__MRO__ = """
struct CellTypesAllMethods(
... |
d5fb8db3b1b5a22f5d6ded4ed780b6c07d4e942c9c390ee6a508e3380cdb1051 | Python | 5,453 | 132 | import numpy as np
import matplotlib.pyplot as plt
import pickle
import os
from scipy.stats import mannwhitneyu
brain_regions_bil = np.array(['AIns_L', 'AIns_R', 'Amy_L', 'Amy_R', 'DLPFC_L', 'DLPFC_R', 'HPC_L', 'HPC_R', 'NAcc_L', 'NAcc_R', 'PCC_L', 'PCC_R', 'PCu_L',
'PCu_R', 'PHG_L', 'PHG... |
e7ab332e20b1cc588f31eff9920a57fd0436602e193a5910f39415f1c1bb6d48 | Python | 5,455 | 191 | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 23 17:50:53 2021
@author: Joseph Vermeil
MainTracker_##.py - Script to use the Tracking functions in the BeadTracker program.
Please replace the "_NewUser" in the name of the file by "_##",
a suffix corresponding to the user's name (ex: JV for Joseph Vermeil)
Joseph Ver... |
c00817feabd64e46cc22352395f5cb3e6d8db0e4f02887a64369e7864fc17b85 | Python | 5,462 | 143 | import math
import warnings
from typing import Optional, cast, List
from torch import Tensor
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler, CosineAnnealingLR, _enable_get_lr_call
class Lin_incr_LRScheduler(_LRScheduler):
def __init__(self, optimizer, max_lr: float, max_steps... |
98127cf461b6cfc94ecd08eeed86d2eb6a87dfe039aa9a7603157dfc9625852d | Python | 5,467 | 147 | import torch
from torchani.models import ANI1x, ANI2x
from typing import Optional
try:
from NNPOps import OptimizedTorchANI
except ImportError:
OptimizedTorchANI = None
import os
class GmxANIModel(torch.nn.Module):
def __init__(self, use_opt=None, atomic_numbers=None, model_index=None, version=1, d... |
88349426d60426fd9198ed195858772592b99b6fc6767f57333151ba3696c7c7 | Python | 5,471 | 207 | import torch
from stoic_train.samplers import DistributedDynamicBatchSampler
class DummyGraph:
def __init__(self, num_nodes: int, num_edges: int):
self.num_nodes = num_nodes
self.edge_index = torch.zeros((2, num_edges), dtype=torch.long)
class _SplitColumn:
def __init__(self, values):
... |
1bcd77c0e7a3e54e032141c93e4b6f20f9e13db356c8279dc27fbc78e14e05a8 | Python | 5,476 | 170 | import math
import types
import numpy as np
import pytest
import torch
import stoic_train.callbacks as cb
from stoic_train.callbacks import (
ResamplingCallback,
SetupWandB,
StoichiometryModelClassWeights,
)
class DummyLoss:
def __init__(self):
self.weight = None
class DummyInnerModel(torc... |
02d7e535a71fc20bf2121e929e98d7d765a2ab679bccb434d04eb6fa9459b025 | Python | 5,479 | 132 | #!/usr/bin/env python3
"""
add_percentile_p005_260506.py
Generates two filtered percentile files from the merged stats-v2.txt:
- stats-v2.pct_t-test_p0.05.txt : t-test p<0.05 rows only, pct ranked within that subset
- stats-v2.pct_wilcoxon_p0.05.txt : wilcoxon p<0.05 rows only, pct ranked within that subset
... |
51cb894da7a311eda5f90bcedd70ceabba950a3ec25cbbc256ed2fbbe7740556 | Python | 5,486 | 137 | # -*- coding: utf-8 -*-
"""
Created on Sat Feb 11 18:51:26 2017
@author: Federico Barabas
"""
import numpy as np
from pyqtgraph.Qt import QtCore, QtGui
import pyqtgraph as pg
from pyqtgraph.parametertree import Parameter, ParameterTree
class DevTree(ParameterTree):
def __init__(self, *args, **kwargs):
... |
74cbaec7dc071bdc0b5f117e0695ddfe72f0f12a296117dda87875588e6bf3b4 | Python | 5,486 | 158 | """Tools to generate a Snakemake-based BIDS app.
This legacy module once had the core snakebids bidsapp implementation, but now is a
simple wrapper around :mod:`snakebids.bidsapp` with the
:class:`~snakebids.plugins.SnakemakeBidsApp` plugin. For new apps, this functionality
can be more flexibly implemented with:
.. c... |
8bde58c7ed5b8dda9dff10ab00190049c3b0e1bac939f64b5d0a5a95ac2642db | Python | 5,488 | 116 |
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import pytest
from isoquant_lib.alignment.alignment_info imp... |
93ead4071cc12237c96273d28cfcbb410df1a552889c7dfa5a0af9e3331dd444 | Python | 5,493 | 153 | """Figure S7 -- Control animal ephys (no behavioral training).
Panels A-E: PL mod | NPL mod | PL t2max | NPL t2max | PL P(spike)
All comparisons early vs late, all NS.
Usage (from repo root):
python -m python.fig_s7.generate_figure
"""
import sys
from pathlib import Path
sys.path.insert(0, str(Path(__file__).reso... |
630e70838ac43f76464dd7f8661540bc8d99f489438c0131790e646c4224ce52 | Python | 5,494 | 143 | """
Dotprops
========
<!-- difficulty: beginner -->
Create dotprops — point-and-vector representations — from skeletons, meshes or raw points.
[`navis.Dotprops`][] are point clouds with associated principal vectors which are mostly used for
NBLASTing. They are typically derivatives of skeletons or meshes but you can ... |
04991057cf5893120f425a6891c36d95ce2de8daf1790e731bda08523e8d3734 | Python | 5,495 | 135 | # -*- coding: utf-8 -*-
"""
Created on Thu Mar 6 11:40:04 2025
@author: Till Habersetzer
Carl von Ossietzky University Oldenburg
till.habersetzer@uol.de
"""
import matplotlib.pyplot as plt
from scipy.spatial.transform import Rotation as Rscipy
import numpy as np
def plot_rotation_circle(ax, idx, c... |
7cc0a3c8622e7b548435d012d9b08b31d3d77e0b82c71d7af5e0e017220bc572 | Python | 5,506 | 127 | # Read molecules and record elements, formal charges, aromatic atoms,
# n bonded atoms, bonds, angles, propers, impropers and molecule indices
# Output uses one-based indexing
# See also https://github.com/openmm/spice-models/blob/main/five-et/createSpiceDataset.py
# This is for the Takaba2024 RNA data from https://z... |
f061877626f5fd58f4fca34ed26fd6b24765621fd8ccdb466c40002f2e5ee251 | Python | 5,507 | 103 | import torch.backends.cudnn as cudnn
cudnn.benchmark=False
import numpy as np
import time
import os
import lpips
from data import data_loader as dl
import argparse
from util.visualizer import Visualizer
from IPython import embed
parser = argparse.ArgumentParser()
parser.add_argument('--datasets', type=str, nargs='+',... |
c50388d6af2230bbf9d2520841bf398b441db8d475d514cbac88770ced89d775 | Python | 5,515 | 144 | #!/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... |
6021689ae577f8e002f8b10b9e11fb72d457215376cabc0d71f61821201cc333 | Python | 5,520 | 147 | from copy import deepcopy
import numpy as np
from batchgenerators.utilities.file_and_folder_operations import *
import shutil
from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_json
from nnunetv2.paths import nnUNet_raw
import SimpleITK as sitk
if __name__ == '__main__':
"""
Downlo... |
dc5ae3efd8df3e368b9ec0292fb94be91ddb6a48851fd40cb596a75d53af20e4 | Python | 5,521 | 151 | """
core/avalanche.py
-----------------
Neuronal avalanche detection.
Method follows Habibollahi et al. (2022) / Beggs & Plenz (2003):
1. Bin population spike counts with bin width Δt.
2. Apply a percentile threshold to the population activity.
3. An avalanche = run of consecutive bins ABOVE the threshold.
4. ... |
9c59fea6a9a9aaa32e378e48ec002fb644018cc7e02bf879f77f87cd74f4f188 | Python | 5,522 | 131 | """
Averages all b0 images in a DTI dataset based on the b-values.
Given a 4D DWI NIfTI image file, this function locates the corresponding b-values file
(.bval or .btable), identifies all volumes with b-values less than 75 (b0 images), and
computes their mean to generate an averaged b0 image. If multiple b0 volumes a... |
01b12ddec753c5a01dba292821e83f9d8c7b688c5d112a2ffd769c74ddd6b89f | Python | 5,523 | 151 | import os
from tensorboardX import SummaryWriter
import torch as tc
import pickle
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
import numpy as np
from argparse import Namespace
def get_device(device_id: int) -> tc.device:
if device_id == -1:
device = tc.device('cpu')... |
bce76249b4fddf54049fffe2ed061de69f5413b45e6cea6b46a33b257d7c6bd0 | Python | 5,535 | 153 | #!/usr/bin/env python
# Copyright 2016-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... |
88a81408298f5ec310762623febc7bc29014ae61d6b42ece74d9b2f6d24f8342 | Python | 5,541 | 121 |
#####DO NOT REVIEW, CHANGES IN PATHS#####
import os
import numpy as np
import pandas as pd
import nibabel as nib
from nilearn.image import math_img
from nilearn.masking import apply_mask
from nilearn.glm import threshold_stats_img
from tristan_pipeline.io.params import *
from tristan_pipeline.utils.loading_utils impo... |
242e2523dbc784480d20dc9300c93545e4697a594fe8476b399489c3bfd728fa | Python | 5,545 | 132 | """Phoneme segment identification from MFA or CMUdict fallback."""
import re
from collections import defaultdict
from .config import TAPAConfig
from .phoneme_maps import ARPABET_FRICATIVES, ARPABET_STOPS, ARPABET_VOWELS
def strip_stress(phone):
"""Remove stress markers from ARPAbet phones."""
return re.sub(... |
00071299ecba2ca83b416e48965c323aad1137c1e28b37de1ac90a63ba27e865 | Python | 5,551 | 186 | """Common utilities for computing information measures across trials.
This module provides shared functionality for computing stimulus-specific
information measures from inference recordings, used by both standard
experiment analysis and hyperparameter sweep analysis scripts.
"""
from concurrent.futures import Proces... |
92fe584e3766676020cb9ffc45006334fe3c510ed3a8c3a957c259d8c3302de7 | Python | 5,553 | 106 | import os
import numpy as np
from PIL import Image
Image.MAX_IMAGE_PIXELS = None
import torch
import torch.multiprocessing
from torchvision import transforms
torch.multiprocessing.set_sharing_strategy('file_system')
from einops import rearrange
from . hipt_model_utils import get_vit256, get_vit4k
class HIPT_4K(torch.... |
8114bfa6a5b4e7149f288b7d012e488b158382de82f37cf381ba31c7f336d98e | Python | 5,560 | 154 | # 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... |
a63b1815b6cc0d1ad45edf08d61697aa5d95072de52d1b9e41a7435ecfc8d5c4 | Python | 5,560 | 160 | from lightning import pytorch as pl
import pytest
import torch
from torch.utils.data import DataLoader
from chemprop.data import MoleculeDatapoint, MoleculeDataset, collate_batch
from chemprop.models import MPNN
from chemprop.uncertainty.estimator import (
ClassificationDirichletEstimator,
DropoutEstimator,
... |
e482a5db8c0b530e03854c8174bb9e1f4ba54669c5b14ce40737daa5a0a779ab | Python | 5,561 | 136 | import logging
from os import PathLike
from pathlib import Path
from typing import Generator, Optional, Sequence, Tuple, Union
import numpy as np
import pandas as pd
from anndata import AnnData
from scipy.sparse import csr_matrix
from .. import io
logger = logging.getLogger(__name__)
def try_convert_to_dataframe_f... |
da14d503fa4240e4a85bd990df26f7dce3157ff4dd895795014dc8d0447202e4 | Python | 5,562 | 180 | """
Uncertainty quantification and out-of-distribution detection.
Provides Tanimoto-based applicability domain assessment and ensemble
uncertainty utilities.
"""
import gc
import logging
from typing import Dict, List, Optional, Tuple
import numpy as np
from rdkit import DataStructs
from nfml.data.fingerprints impor... |
512b5e06d383811f73dc13332fe6e929e5cdc48ad2dc8da1201d175c7fa17222 | Python | 5,564 | 156 | from abc import ABC, abstractmethod
from pathlib import Path
from typing import Iterable, List, Mapping, Optional, Sequence, Tuple
import numpy as np
import pandas as pd
import xarray as xr
from .config import ModelParams
from .encoders import encoder_registry
from .interfaces import IEncoder, IStimulus, ILayer, INet... |
d7a52461f079f6c2d59a746f1f8285b1151d1b223fb837e3b56382bbbea44ad2 | Python | 5,564 | 177 | """Matplotlib based solara components for visualization MESA spaces and plots."""
from __future__ import annotations
import warnings
from collections.abc import Callable
import matplotlib.pyplot as plt
import solara
from matplotlib.figure import Figure
from mesa.visualization.mpl_space_drawing import draw_space
fro... |
8d226c357b01e8cf58d9f680f1f09d62e12aea4b4ecd5839104edcf8358234e8 | Python | 5,569 | 124 | import argparse
import os
from pathlib import Path
import numpy as np
import tifffile as tif
import torch
import tqdm
import ttach as tta
from catalyst import utils
from catalyst.dl import SupervisedRunner
from skimage.transform import resize
from dataset import load_data
from model_utils import build_model
from tran... |
baa148f30abbe0c161fae2b8c7f66dcaed82008e3826b0eba407baf335cb27c6 | Python | 5,576 | 135 | #coding https://mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example/ with pytorch, checking with iterative version at https://github.com/animesh/ann/blob/master/ann/Program.cs with following output
#Iteration = 1 Error = 0.298371108760003 Outputs = 0.751365069552316 0.772928465321463
#Iteration... |
cc32994ff06e7b168726957abb00b50604320b95244c723358e5ccbc5c9fef7a | Python | 5,576 | 142 | '''
Created on Feb 18, 2025
@author: voodoocode
'''
import csv
import numpy as np
import pyexcel
CONF_STN_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/conf_stn.csv"
DB4_KEY_TRANS = "/mnt/data/Professional/LMU/data/Beta-prevalence/database4/key_trans.csv"
def get_anat_meta():
db4_keys = dict()
db4... |
7c4d401586022e7b9403724bab911ea57f406b391eaa6220bc5092cb92d097f7 | Python | 5,579 | 162 | import os
import napari
import numpy as np
import tifffile
import glob
from qtpy.QtWidgets import QPushButton
class ImageAnnotator:
"""
A class for annotating images using Napari with a single label.
Parameters
----------
folder_images : str
Path to the folder containing the images to be ... |
27ab6d598ce421d1ed81ccc3bd623d8c6c48fdee4d37b6cf198d9ae3d2d284fa | Python | 5,581 | 111 | import torch
import torch.nn as nn
from taming.modules.losses.vqperceptual import * # TODO: taming dependency yes/no?
class LPIPSWithDiscriminator(nn.Module):
def __init__(self, disc_start, logvar_init=0.0, kl_weight=1.0, pixelloss_weight=1.0,
disc_num_layers=3, disc_in_channels=3, disc_factor=... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.