sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
5d2ed3ad2e030e6cc66076c1e839e8dceeba2b0c7f78f1865cce35dd1156da6e | Python | 5,581 | 184 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""
Reusable utility methods to validate input systems to OpenMM-based alchemical
Protocols.
"""
from typing import Optional, Tuple
from gufe import (
ChemicalSystem,
Component,
... |
3cbabc05c2f5b2c1faf5ec8edc6a445c624307de3e06de9963136f46f71775fc | Python | 5,599 | 142 | import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import os
import argparse
import networkx as nx
parser = argparse.ArgumentParser(
'Find shortest paths along domains in residues.')
parser.add_argument('--num-residues', type=int, default=77,
help='Numb... |
35959f859538bfb6c4e213fb00ae188d8725a106334b18bb30745bdd52b80a6c | Python | 5,603 | 155 | # Calculate energy and forces with OpenMM for comparison to Molly
# Used OpenMM v8.4.0, Python v3.11.14
from openmm.app import *
from openmm import *
from openmm.unit import *
import os
data_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "data")
ff_dir = os.path.join(data_dir, "force_fields")
o... |
52c3ee83bf73fbbb9e5220112e8f996adbe596eaefcf6fbbe00d0547f6b4b7fd | Python | 5,603 | 169 | import torch
import torch.nn as nn
import matplotlib.pyplot as plt
import numpy as np
from scipy import signal as sig
from torcheeg import transforms
import torch
import torch.nn.functional as F
import pywt
from ..models import EEGViT
# Load EEG data
readRecord = lambda data, recordNo: data["dataset"][recordNo]["ee... |
ad914dac677d47787c8a4e098aa51424451d62a3b524ab48c30623b4524acd70 | Python | 5,604 | 169 | from __future__ import annotations
import os
import shutil
import subprocess
import uuid
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any
from rdkit import Chem
from src.utils.runtime import bundled_obabel_binary, openbabel_runtime_env
class OpenBabelError(Exception):
""... |
16f089ae33a624012cbfd7dec0125965ad31db14995b8da702fb67d92d619441 | Python | 5,609 | 154 | import os
import re
from typing import Any, Dict, List, Mapping, Optional, Tuple
import numpy as np
from omegaconf import DictConfig, OmegaConf
def _as_plain_dict(cfg: Mapping[str, Any]) -> Dict[str, Any]:
"""Convert a config node into a plain Python dict.
Args:
cfg: Mapping-like config node.
R... |
205f7d6dd3839a5d09bd667b9279b0cda7c0a5df348783e2c0f213a5d9cb3b49 | Python | 5,612 | 138 | """Stripped version of https://github.com/richzhang/PerceptualSimilarity/tree/master/models"""
import torch
import torch.nn as nn
from torchvision import models
from collections import namedtuple
import torch.nn.functional as F
from taming.util import get_ckpt_path
class LPIPS(nn.Module):
# Learned perceptual me... |
0a6805f9dfe25e1d431c9faeabf82ebbd95d88e6f14c3f6c11ee9f959f266cc1 | Python | 5,622 | 134 | #!/usr/bin/env python3
"""Build the machine-readable RAVEN bundle provenance manifest."""
from __future__ import annotations
import argparse
import csv
from datetime import datetime, timezone
import hashlib
import json
from pathlib import Path
import subprocess
DEFAULT_CHECKPOINT = (
"logs/2025-06-18T01-31-51_r... |
44f8eb09a21aa3ba636751053619161283ee8b52f04dc50ce3a6a1ce28d25072 | Python | 5,625 | 138 | import math
import time
from typing import Optional
from tqdm import tqdm as tqdm
"""
Build a super dumb iterator wrapper which then returns a progress, this should be kinda splitted
first we need an object which remains alive the whole time where the logic and the variables are set to know
where the progress should ... |
7b6dfb527cd01fe41ad25d56fc99db725df39d2eb3ac0d6aab74039cdb9d390f | Python | 5,635 | 175 | #This is a set of functions i use to interact with the fooof objects
#Imports
import numpy as np
import mne
import matplotlib.pyplot as plt
from matplotlib import cm
from fooof.analysis import get_band_peak_fg
from fooof.objs import combine_fooofs
from fooof import FOOOFGroup, fit_fooof_3d
import pandas as pd
def che... |
69047ff3d7f673eb8dc45cf3b8493c5624b30db0bb972710f9019eca742f73fa | Python | 5,636 | 146 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from typing import Any, Dict, List, Tuple
import torch
from torch.nn import functional as F
from detectron2.config import CfgNode
from detectron2.structures import Instances
from densepose.converters.base import IntTupleBox
from densepose.data.utils i... |
9a9983d76c0b68ce8b557d6f556d45458232fee1a6e6973ed476ba73cc6efa8d | Python | 5,640 | 159 | """
NBLAST against FlyCircuit
=========================
<!-- difficulty: advanced -->
Match a query neuron against the entire FlyCircuit light-level dataset.
!!! important "This example is not executed"
In contrast to almost all other tutorials, this one is not executed when the documentation is built.
Conseq... |
ded57b2e4a14ab4775461f036449e6dda9062173736de3502f181a8364757198 | Python | 5,647 | 107 | # 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... |
b3c038a8d0d7edcd821680e7017813b0cccf145159a134d29eb9d512f6be563d | Python | 5,653 | 124 | import scanpy as sc
import torch
import scipy
import numpy as np
# Acknowledgement to scCRAFT from Chuan He (https://www.biorxiv.org/content/10.1101/2024.10.22.619682v1)
def multi_resolution_cluster(adata, resolution1=0.5, resolution2=7, method="Leiden"):
"""
Performs PCA, neighbors calculation, and ... |
b0086520b03da6eea0ac15c979e41c80511d105af4b2926ae6fefa221936bb4e | Python | 5,654 | 142 | """
Orchestration: create SessionResponses objects and save to disk.
Changes from v2:
- Accepts WindowConfig parameter
- Uses v3 response classes with keyword arguments
- Saves with window label in filename
"""
from spikeinterface import full as si
import itertools
import numpy as np
import dill as pickle
import panda... |
fdda8082fbf28aa8e5f3fbd26973fc982b0c9385eacf51d36c3389beed2f880c | Python | 5,655 | 168 | #!/usr/bin/env python
# coding: utf-8
#..\..\AppData\Local\r-miniconda\condabin\mamba.bat install pandas
import pandas as pd
# massaa => https://en.wikipedia.org/w/index.php?title=Proteinogenic_amino_acid§ion=2
aamm = pd.read_table('massaa')
aamm['Mon. Mass§ (Da)']
mmH2O = 18.01056
mmProton = 1.00728
pep = 'FYDKMQN... |
937c1849e3912ece10c55bd064701ba3029ab08de94d83e31c7385615885a2f2 | Python | 5,656 | 152 | """
ICMS preprocessing pipeline using stock SpikeInterface + custom artifact removal.
This adapts the proven 'new_pipeline3' from the old SI fork to work with any
SI version by importing the custom preprocessors from this package.
The pipeline assumes stim timestamps are provided in SAMPLES (int).
"""
impor... |
fa87ac901c8e5d72e804232b08041386af9d9c6e76605b7ae09dc7d3d78c88b7 | Python | 5,667 | 192 | """Configuration management for electrophysiology datasets.
Created on February 24, 2026
@author: dcupolillo
"""
from __future__ import annotations
from pathlib import Path
import yaml
import tensorflow as tf
class EphyDatasetConfig:
"""
Configuration manager for electrophysiology dataset processing.
H... |
ffc6b25b33e94b1ee35544ea6dcf51939111c596625c8c7529cd0d5b8639e788 | Python | 5,671 | 112 | from typing import Tuple
import numpy as np
from batchgenerators.utilities.file_and_folder_operations import *
from nnunetv2.evaluation.evaluate_predictions import load_summary_json
from nnunetv2.paths import nnUNet_results
from nnunetv2.utilities.dataset_name_id_conversion import maybe_convert_to_dataset_name, conve... |
61cf1e0f2071a6fbec01c4f197218bf2310ffef0a4176b934739556129bd0c88 | Python | 5,673 | 148 | # Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
"""Type definitions for various analysis types.
This allows others to use them without taking a dependency on
the actual analysis code.
"""
from __future__ import annotations
import csv
import itertools
from dataclasses import dataclass
from typing import ... |
f8e0e3abed98ab90088ce615fc58d51d5b99f168ba0c28f30a77a71f016f5577 | Python | 5,673 | 158 | # Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
"""Parses the target_panel file that contains IDs of target genes.
Outputs include the
indices of target genes within the feature reference, panel metadata, and boolean
flags for disabling targeting-related stages downstream.
"""
from __future__ import anno... |
d8795010ec2fea098ae8df44b22e520e093f15754d00c459c88229307db83c83 | Python | 5,676 | 155 | import math
import segmentation_models_pytorch as smp
import torch
from catalyst import utils
from catalyst.contrib.nn import DiceLoss, RAdam
from catalyst.dl import (CriterionCallback, DiceCallback, IouCallback,
MetricAggregationCallback, SupervisedRunner)
def adapt_input_conv(in_chans, conv_... |
c4edd1b0bfd05292c4075cccad5cf115ada358ad58432833bd9e3a30bf644e36 | Python | 5,677 | 115 | # Copyright (c) Facebook, Inc. and its affiliates.
import logging
from detectron2.utils.file_io import PathHandler, PathManager
class ModelCatalog:
"""
Store mappings from names to third-party models.
"""
S3_C2_DETECTRON_PREFIX = "https://dl.fbaipublicfiles.com/detectron"
# MSRA models have STR... |
43cd3623be631d25f54c0eb6f25211a7b5f795ff64d83df58ed76914d7de91b1 | Python | 5,685 | 182 | """
Script to load MEG and EEG epoch data, compute evoked responses, and plot them using matplotlib.
"""
# %%
from __future__ import annotations
import os
import os.path as op
import matplotlib.cm as cm
import matplotlib.pyplot as plt
import mne
import numpy as np
from matplotlib import font_manager as fm
from matplo... |
7f7adfdef3ef2495cc9e1d1e8f44aa6b9c59a6f13f0357ea7cb601ec2f3e2ac3 | Python | 5,686 | 171 | # Copyright (c) Facebook, Inc. and its affiliates.
import importlib
import importlib.util
import logging
import numpy as np
import os
import random
import sys
from datetime import datetime
import torch
__all__ = ["seed_all_rng"]
TORCH_VERSION = tuple(int(x) for x in torch.__version__.split(".")[:2])
"""
PyTorch vers... |
ab489cbd0b673f720688b8e9da2e1ef40a905eef66b5c9c4bb43efb5bf26f6a5 | Python | 5,688 | 165 | # Copyright (c) Facebook, Inc. and its affiliates.
import logging
import unittest
import torch
from detectron2.modeling.poolers import ROIPooler
from detectron2.structures import Boxes, RotatedBoxes
from detectron2.utils.testing import random_boxes
logger = logging.getLogger(__name__)
class TestROIPooler(unittest.T... |
52cd0b186a667898c52bec1a03eb5cba560a565377069f37b0fd82e1023a3788 | Python | 5,693 | 156 | import torch
import numpy as np
class AbstractDistribution:
def sample(self):
raise NotImplementedError()
def mode(self):
raise NotImplementedError()
class DiracDistribution(AbstractDistribution):
def __init__(self, value):
self.value = value
def sample(self):
retur... |
0cd5fafa85a78194266662abc82f99320070da11c5c352a3e7850f32f17220d7 | Python | 5,699 | 180 | import os
import csv
import argparse
from concurrent.futures import ProcessPoolExecutor, as_completed
import pandas as pd
import requests
from requests.adapters import HTTPAdapter
from urllib3.util.retry import Retry
from tqdm.auto import tqdm
def create_directory(path):
if path and not os.path.isdir(path):
... |
fd487aa9d976ba8940f610c3e91ed417f20f50cb6354a69621766460aba9254b | Python | 5,701 | 170 | #!/usr/bin/env python
# ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2019-2022 Saint Petersburg State University
# Copyright (c) 2022-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
####... |
f3a97864619a42b07d50fd4fb29afcb00a31a143ee181d21440364454dd4ac59 | Python | 5,703 | 128 | from typing import Union
import torch
from torch._dynamo import OptimizedModule
from nnunetv2.training.lr_scheduler.warmup import Lin_incr_LRScheduler, PolyLRScheduler_offset
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
from torch.nn.parallel import DistributedDataParallel as DDP
from nnun... |
0e98e61391e4d9a0d3f26f5105145adb85947257843b104fbfd1c98c91470454 | Python | 5,707 | 153 | #!/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... |
25e1cb163304f1bd4f91c0a97f9999dc35d7a99900b11d4e2745d1c8e2e1a0a0 | Python | 5,713 | 135 | # Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
from typing import Dict
import torch
from torch import nn
from torch.nn import functional as F
from detectron2.layers import ShapeSpec, cat
from detectron2.modeling import SEM_SEG_HEADS_REGISTRY
from .point_features import (
get_uncertain_point... |
8954391b45c54e40e715c3afc1ec94847c833dcd7e2cd89d4e01cc335973653f | Python | 5,713 | 139 | #!/usr/bin/env python3
"""Detects three-neuron PNGs without synaptic constraints.
This script detects all triplet PNGs with layer structure [L-1, L, L] where:
- First neuron is in layer L-1
- Second and third neurons are in layer L
- Second-firing neuron is used as the index (for DB compatibility)
- NO synaptic weight... |
447209fb88732af26c563188dce52c3cbef246187f5e5b8981124186aeb015a6 | Python | 5,718 | 136 | from rCPGswCPG.utils.gen_utils import put
import numpy as np
class Protocol():
def __init__(self, model):
self.model = model
self.external_inputs = np.zeros(len(model.populations))
def run(self):
self.model.clear_history()
return None
class Protocol_noSI(Protocol):
''' Pro... |
da1d8b1118eafca5fa2f7fabac2e3a994f057ba586fff6de2e3415dc9b6d9a77 | Python | 5,721 | 158 | from ij import IJ, ImagePlus
from ij.plugin import RGBStackMerge
from ij.gui import GenericDialog
import os
import re
def main():
# Select main folder
main_folder = IJ.getDirectory("Select the split images folder")
if main_folder is None:
return
chosen_folder_name = os.path.basename(os.path.no... |
ab7c12425c1747b1094f30557eb65ebe07e902ee0de199c353aa36a7e1713631 | Python | 5,723 | 164 | """
dataset_mouse_brain.py
----------------------
DataModule and helper utilities for the mouse brain 10x Multiome tutorial.
The original mmvelo_multi DataModule (MultiomeBrainDataModule_Pre) reads from
hardcoded absolute paths. This module provides a self-contained alternative
that reads from relative paths inside t... |
b470061984186081d40cb056fb44196ee41dcf1cbd4e37ed80bff25af62896ee | Python | 5,724 | 172 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import io
from typing import Dict, Tuple
import matplotlib
from gufe.visualization.mapping_visualization import (
draw_one_molecule_mapping,
)
from rdkit import Chem
from openfe import ... |
89f9615545320de811ce3b7d687f6d3d0e022cab4c13b9ae0b6d35622adf6b09 | Python | 5,726 | 124 | '''
Created on Nov 7, 2024
@author: voodoocode
'''
import os
import numpy as np
import csv
import feat_ex.spiking.core
import finnpy.file_io.data_manager as dm
FS = 10000
DB_NAME = "6"
IN_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/database"
META_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/s... |
ee82b43d9b37072b6c60699550135d2d26dd9a634a29ddb0a959fa54c0682cac | Python | 5,743 | 144 | import torch
import numpy as np
import logging
import os
from torch.utils.data import DataLoader
from qm9.data.dataset import ProcessedDataset
from qm9.data.prepare import prepare_dataset
def initialize_datasets(args, datadir, dataset, subset=None, splits=None,
force_download=False, subtract... |
3857bc529b36e62ef4ab1f438f7bc560fff8f5b321873da9273e9ea01d1fb632 | Python | 5,750 | 148 | import torch
from torch import nn
import torch.nn.functional as F
import logging
class Siam_UNet(nn.Module):
"""
Siamese U-Net model for image segmentation.
Parameters
----------
n_filter : int, optional
Number of filters in the convolutional layers (default is 32).
mode : str, option... |
0ee0a30705cc9e6ebe5e65c6ac16c35c0da67dc3cc6f861dab83113a571d0869 | Python | 5,754 | 205 | from openff.toolkit.topology import Molecule
import numpy as np
from rdkit import Chem
from rdkit.Chem import TorsionFingerprints
def extract_internal_indices(off_mol: Molecule):
# Bond indices
bond_idx = np.array(
[(b.atom1.molecule_atom_index, b.atom2.molecule_atom_index)
for b in off_mol.b... |
6c1169bff4ff27c61953f83c068b547745ffad3d6496fedbb856cb95af9e3bae | Python | 5,755 | 135 | import os
import numpy as np
import nibabel as nib
import matplotlib.pyplot as plt
from matplotlib.lines import Line2D
from tristan_pipeline.utils.plotting_utils import *
from tristan_pipeline.utils.analysis_utils import *
from tristan_pipeline.io.params import *
spaces = ["MNI152NLin2009cAsym"]
###########LOAD SUBJEC... |
9be03f65ef94e53ad63452e2dbec38e3c9b82a8099da3756d58f76d63eefbb03 | Python | 5,755 | 149 | # Title :deeplink.py
# Description :Deep Learning Inference Using Knockoffs
# Author :Zifan Zhu
# Contact :zifanzhu@usc.edu
# Version :1.0.0
#### parse arguments ####
import os, sys, optparse
parser = optparse.OptionParser()
parser.add_option("-X", "--data", action="s... |
221fa21d397ccd70024d765ecea0f539173ad4bb6cd01fe158b9ed29ad97cc96 | Python | 5,757 | 120 | #!/usr/bin/env python
import argparse
import os
import subprocess
from elastixparameterfile import ElastixParameterFile
def create_def_transform(input_transformation, output_transformation, deformation_file=None, verbose=False):
"""
Create a deformation transformation from any other transformation. This
w... |
3a9b3af8560d6f585a1fede14713786da4b57f409f947271d5eff18b98a00a27 | Python | 5,764 | 144 | # Copyright (c) Facebook, Inc. and its affiliates.
from copy import deepcopy
import fvcore.nn.weight_init as weight_init
import torch
from torch import nn
from torch.nn import functional as F
from .batch_norm import get_norm
from .blocks import DepthwiseSeparableConv2d
from .wrappers import Conv2d
class ASPP(nn.Mod... |
af8589bbc312005d659d99ff3984958923c18bf84588e5085626948172371480 | Python | 5,765 | 183 | #!/usr/bin/env python3
#
############################################################################
# Copyright (c) 2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
"""
Convert .cfg + .etl/.qnt/.prf test con... |
5d073ad8d53a6ab3e52b2f4961e2161f50c962d3dcb5cf23bf30d665a33e0cfc | Python | 5,774 | 174 | import pandas as pd
import numpy as np
from .preprocessing import remove_low_info_samples
from os.path import join
"""All the load functions return the following in this order:
train_data_dict: dict
Dictionary of training data. Keys are the omics names and values are the dataframes.
valid_data_dict: dict or None
... |
4f965f984981db24ebdd571fe58204d5cfce924d9d221b4a27f69ef989e36c1e | Python | 5,775 | 168 | import os
import shutil
import torch
import torch.nn.functional as F
import logging
import numpy as np
from scipy.ndimage import gaussian_filter1d
from scipy.signal.windows import triang
class AverageMeter(object):
def __init__(self, name, fmt=':f'):
self.name = name
self.fmt = fmt
self.re... |
db96c807bf15ee8f7de0207ac3c49fb7efbe5befdc8bdd309de53a9977ec7c34 | Python | 5,784 | 185 | """Test cases for the SpaceRenderer class in Mesa."""
import random
from unittest.mock import MagicMock, patch
import numpy as np
import pytest
import mesa
from mesa.discrete_space import (
HexGrid,
Network,
OrthogonalMooreGrid,
VoronoiGrid,
)
from mesa.visualization.backends import altair_backend, m... |
e2080a6294e68d63e7fdef8275bfb2053ff7c7489c9f0d80d558d5990f002136 | Python | 5,789 | 150 | """Consonant measurements: stop VOT and fricative spectral moments."""
from collections import defaultdict
import numpy as np
import parselmouth
from parselmouth.praat import call
from tqdm import tqdm
from .config import TAPAConfig
from .phoneme_maps import ARPABET_VOWELS
def measure_vot(stop_info, audio_np, cfg=... |
495df522d20e5136c14f4346abe4fd9cf1ff9b12337ef4caf800e2e2b120ee2a | Python | 5,794 | 197 | # %%
from __future__ import annotations
import os
import os.path as op
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
ROOT = '../../NOD-MEEG_upload'
# Per-subject ``sub-XX_events.csv`` files; published on OpenNeuro under
# ``derivatives/detailed_events`` (MEG: ds005810, ... |
00eefd9ec115c0652bbbf59ab3a43f934ea5ce4312dfad5d767e3d344e51bbca | Python | 5,795 | 214 | """
Testing Suite for adpbulk
"""
import numpy as np
import pandas as pd
import anndata as ad
import pytest
from adpbulk import ADPBulk
SIZE_N = 100
SIZE_M = 100
np.random.seed(42)
def build_adat() -> ad.AnnData:
"""
creates an anndata for testing
"""
mat = np.random.random((SIZE_N, SIZE_M))
ra... |
9740097db87b1450663c41971ea1fa765e5973d2d96274bf582b59eccbadede3 | Python | 5,796 | 164 | """Import-hygiene guards.
These are the regression tests that stop a plotting or analysis layer creeping
back into the core. An eager ``__init__.py`` that imports every subpackage drags
matplotlib and PIL into any import of the package — including pure-XGBoost work
that needs neither — so the root package resolves sub... |
245ce36a3a59e77f3a379750f8d5722f7837aae89585dcaea5b7955f6309338e | Python | 5,797 | 158 | # Copyright (c) Facebook, Inc. and its affiliates.
import fvcore.nn.weight_init as weight_init
import torch.nn.functional as F
from detectron2.layers import CNNBlockBase, Conv2d, get_norm
from detectron2.modeling import BACKBONE_REGISTRY
from detectron2.modeling.backbone.resnet import (
BasicStem,
BottleneckBl... |
bed203c11527bb228a57c367468c9afe8ba849c0ddbecff7fd02ab8c13985fb0 | Python | 5,810 | 219 | """
@Article{li2014multiplicative,
author = {Li, Chunming and Gore, John C and Davatzikos, Christos},
title = {Multiplicative intrinsic component optimization (MICO) for MRI bias field estimation and tissue segmentation},
journal = {Magnetic resonance imaging},
year = {2014},
volume = {32},
... |
66d6849bb0fe961263bd972cd250818eca14a8a38d02700c19750aa18e7a7426 | Python | 5,811 | 188 | # Copyright (c) 2017 10X Genomics, Inc. All rights reserved.
# 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.
import json
import os
import sys
import numpy as np
import pandas... |
952c9032a8fd15bde9add3c8981b7c5c76d3db86f43621f741d2d603528c8042 | Python | 5,825 | 180 | import shutil
from pathlib import Path
import numpy as np
import pytest
from steinbock import io
from steinbock.classification import ilastik
ilastik_binary = "/opt/ilastik/run_ilastik.sh"
class TestIlastikClassification:
def test_list_ilastik_image_files(self, imc_test_data_steinbock_path: Path):
ilas... |
ccdcbe6c9d83ed3be12b7066a12bf04e66a52d4a4dbe4fd6bb4b17e64fcdd076 | Python | 5,825 | 148 | """Lightning callbacks for Stoic training."""
from typing import Dict, List, Optional, Union
import numpy as np
import torch
import wandb
from lightning import LightningModule, Trainer
from lightning.pytorch.callbacks import Callback
from loguru import logger
class SetupWandB(Callback):
"""Attach W&B model watc... |
17ba4b97538f1b67c786562732ffc0f9bb2c327aeafbfb63c08d2a34c2d915c0 | Python | 5,827 | 139 | import json
from itertools import chain
from pathlib import Path
from typing import Iterable, Dict, List, Callable, Any
from collections import defaultdict
from tqdm import tqdm
from taming.data.annotated_objects_dataset import AnnotatedObjectsDataset
from taming.data.helper_types import Annotation, ImageDescription,... |
564e85b3d67dbf989ef150d5e626debd00dd1b1e97510452e46ea7ea8f6b448d | Python | 5,833 | 121 | #python proteinGroupsFit.py "L:\promec\TIMSTOF\LARS\2025\250402_dda_Hela\tesorai\HeLaCon_quantified_protein_fdr.tsv" 3 10
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.cluster import hierarchy
fPath = sys.argv[1]
#fPath = "L:\\promec\\TIMSTOF\\LARS\\2... |
722cc9be8dc173a97c5eb0bdd62f5c6d90ab0ecb2fe96a0bd50a29e34edc47dd | Python | 5,834 | 151 | from models.gcl import E_GCL, unsorted_segment_sum
import torch
from torch import nn
class E_GCL_mask(E_GCL):
"""Graph Neural Net with global state and fixed number of nodes per graph.
Args:
hidden_dim: Number of hidden units.
num_nodes: Maximum number of nodes (for self-attentive pooling)... |
b0eeac6ffe9a5b836d0c1dbc00cffc80837185daf68e72161237fb2cdd0f2059 | Python | 5,842 | 246 | """This tests the CLI functionality of training and predicting a regression model on a single molecule.
"""
import pytest
from chemprop.cli.main import main
from chemprop.models.model import MPNN
pytestmark = pytest.mark.CLI
@pytest.fixture
def data_path(data_dir):
return str(data_dir / "classification" / "mol... |
c72626177be1bad7214ed360292093824b44de63ce1c0bcedd835129e1958aed | Python | 5,842 | 168 | # %%
from __future__ import annotations
import warnings
from collections import defaultdict
from pathlib import Path
import mne
import numpy as np
import pandas as pd
from joblib import delayed
from joblib import Parallel
from mne_bids import find_matching_paths
from mne_bids import make_report
from mne_bids import r... |
3170c0b284471b6491ec98e2f0a9838de9b1831963fe2d3f2f3fa36e4c420ad0 | Python | 5,843 | 136 | # Copyright (c) Facebook, Inc. and its affiliates.
from __future__ import division
from typing import Any, Dict, List, Optional, Tuple
import torch
from torch import device
from torch.nn import functional as F
from detectron2.layers.wrappers import move_device_like, shapes_to_tensor
from detectron2.utils.torch_version... |
10fd20d32be8acee71afd5250287d59a5cce83f42e4756b9641999206873198d | Python | 5,844 | 171 | """Tests for the fastcore-backed graph primitives.
These used to be *differential* tests: run each primitive with and without
navis-fastcore and assert the two agree. That oracle is gone with the fallbacks
(fastcore is a hard requirement now), and it was never the right one anyway - it
could only ever catch a *disagre... |
3af0b0414f4e19c9b1c853685f214fd3d4f459bf999d88f3c7c6d989f7647e51 | Python | 5,845 | 147 | """
Custom score matrices
=====================
<!-- difficulty: advanced -->
Train a custom NBLAST scoring matrix from your own data.
The core of the NBLAST algorithm is a function which converts point matches (defined by a distance and the dot product of the tangent
vectors) into a score expressing how likely they ... |
fe5b1a74335c8e06ca24ab152bed85e24a5afb175a4a91cf51214a713682b856 | Python | 5,848 | 137 | import utils
import numpy as np
import pandas as pd
import scipy
import math
import os
import sys
import sys
# Helper function
#writes mrc from numpy table of coordinates
def makemrc(actin, shape, voxel_size = 1.34808):
mrc = np.zeros(shape).astype('float32')
for i in range(len(actin)):
x = round(actin... |
38a7cf36849ff2443d1250d0846537b05bbf4eaf302decb7924919e68bf72554 | Python | 5,851 | 175 |
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
#!/usr/bin/env python3
"""Generate barcode-to-spot-ID mappin... |
5ed0d2cf71ecb6e8c2b8db0d275e11a9767d937bbcc745d754b36593d11eed05 | Python | 5,857 | 203 | import importlib
import torch
import numpy as np
from collections import abc
from einops import rearrange
from functools import partial
import multiprocessing as mp
from threading import Thread
from queue import Queue
from inspect import isfunction
from PIL import Image, ImageDraw, ImageFont
def log_txt_as_img(wh,... |
6dfc779c4d7ffd47ba0cbd98c5ed1182a0580649f73aee1dabf9ca5ebffdd7d8 | Python | 5,863 | 158 | import click
import pathlib
from garnetff import garnet
from openff.pablo import topology_from_pdb
from openmm.app.pdbfile import PDBFile
from openff.toolkit import Molecule
# run this script with conda env garnet_rbfe
def write_xml_compatible_pdb(openff_topology, out_path):
"""
Converts an OpenFF topolog... |
1d52917d176f58bdf0c7da8f9d5ccdea6779a4af8014f888f86a0792a12d21a9 | Python | 5,865 | 167 | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
"""
A main training script.
This scripts reads a given config file and runs the training or evaluation.
It is an entry point that is made to train standard models in detectron2.
In order to let one script support training of many models,
this sc... |
c5e70ab0cd583dfefe020d45a7abaafab451327c2109422eef7787b5490f3500 | Python | 5,878 | 172 | #!/usr/bin/env python
#
# Copyright (c) 2016 10X Genomics, Inc. All rights reserved.
#
from __future__ import annotations
import os
import socket
import martian
from six import ensure_str
import tenkit.bcl as tk_bcl
import tenkit.preflight as tk_preflight
import tenkit.samplesheet as tk_sheet
__MRO__ = """
stage M... |
fc76bf963e7b7ffdd0b7987f4136f2cae0a9035ab73582ae773118fc336f52e4 | Python | 5,879 | 126 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# pyre-unsafe
from typing import Any, Dict, List
import torch
from torch import nn
from torch.nn import functional as F
from detectron2.config import CfgNode
from detectron2.structures import Instances
from densepose.data.meshes.catalog import M... |
ceb5cf65de7fc677348ba8f45f519e134c57cf7b4a7141e23314d20b3ad07c8d | Python | 5,880 | 125 | ############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2020-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
... |
10cca1bb0df9980a8a4b928d64d311816a3f3b0f5f1e4a6702e051396b51ee35 | Python | 5,881 | 184 | #!/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... |
f3aeceefdb955cf55fcd7a28e58f2d0024291007c08e414469126ddd0aad3ea6 | Python | 5,886 | 165 | r"""
Blender 3D
==========
<!-- difficulty: intermediate -->
Drive Blender 3D from NAVis for high-quality neuron renders.
{{ navis }} comes with an interface to import neurons into [Blender 3D](https://www.blender.org)
for high quality renderings and videos: `navis.interfaces.blender`.
## Installation
Blender comes... |
323f3ef2dfd013a62e6da0bd01a5ae1edb172773378f4b96d81e70f91189332f | Python | 5,887 | 197 | #!/usr/bin/env python3
#
# Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
#
from __future__ import annotations
import json
import re
from collections.abc import Iterable
from enum import Enum
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from cellranger.sample_bag import SequencingLibrary
GENE... |
0881a6df94d224c473b5f4b8d071c95b1387716aede774f2cfa64e8d2c4f7c29 | Python | 5,890 | 111 | """Regenerate the Hide-the-Label benchmark results.
Runs the eight (surrogate x difficulty) combinations across the six datasets and
writes, for every cell, the full tournament results plus a mean-steps summary.
Configuration matches the published results: the 14-optimizer pool, 3 competitions
x 10 synthetic datasets ... |
40c7a856344b4f60c456ff0e7e62690c3dcc59a10b2462fb4fd107c05b75e754 | Python | 5,895 | 178 | import itertools
from typing import List, Sequence
import cv2
import numpy as np
import numpy.typing as npt
from ._base import BaseEncoder
__all__ = ["GaborEncoder", "OccludableGaborEncoder"]
def get_filters(
phase_offsets: Sequence,
orientations: Sequence,
wavelengths: Sequence,
kernel_size: int,
... |
386d4e683bb48c858d07f7124ed2c0db6cb73389afc076e09d9bdc597eaa47ac | Python | 5,905 | 161 | #!/usr/bin/env python3
"""Computes ranked information measures from Trial inference recordings.
This script takes inference results and computes stimulus-specific information
measures for neurons, outputting serialised results organised by architecture
and training state for downstream analysis/visualisation.
This co... |
077ed6e74b004e147074f30e2b848b7645e4594b0e9ff80d3bf5c7645aa889b7 | Python | 5,913 | 177 | '''
Created on 20.08.2020
Author:
Michael Diedenhofen
Max Planck Institute for Metabolism Research, Cologne
'''
from __future__ import print_function
try:
zrange = xrange
except NameError:
zrange = range
import os
import sys
import numpy as np
import proc_tools as pt
def get_mat_flip_x_z(data_dims, voxel... |
d4f56c8229b8ffa483dc5d4d75fe60afb26d23fcb413d3c60ec792279bd204e0 | Python | 5,914 | 174 | import importlib
import os
import pkgutil
import sys
from contextlib import contextmanager, ExitStack
from os.path import abspath, join
from batchgenerators.utilities.file_and_folder_operations import *
@contextmanager
def temporarily_extend_syspath(path: str):
"""
Context manager to temporarily add a direc... |
ae42aa4d711d1d349ea61778d6e25deae4ebd3eb602af5af89f914d1fc256819 | Python | 5,918 | 160 | """Distributed dynamic batch sampler for graph datasets."""
import math
from typing import Any, Dict, Iterator, List, Optional
import torch
from tqdm import tqdm
from torch.utils.data import Dataset
from torch.utils.data.sampler import BatchSampler, Sampler
class DistributedDynamicBatchSampler(BatchSampler):
""... |
2281eef5b0757b0f52cb7ad8302d1ae138bb8f01b0369d3eda1e3d3ca7146f2d | Python | 5,921 | 170 | #!/usr/bin/env python3
#
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# Copyright (c) 2020-2022 Saint Petersburg State University
# # All Rights Reserved
# See file LICENSE for details.
#####################################################... |
c1b0e6da965ac4353d7517a790617ca498ce9909c8040908ab4ffd39bb0e0b63 | Python | 5,927 | 191 | #!/usr/bin/env python
#
# Copyright (c) 2018 10x Genomics, Inc. All rights reserved.
"""Truncate a text or json file.
For text files, elide all the but the first and last several
lines.
For a json file by substituting placeholders in such a way as to still be
mostly usable by things which attempt to deserialize them... |
1948e907e2140e2ff90a12bdcddb9ad6114a3a82206befb2a2e41da15e080bb3 | Python | 5,934 | 170 | from __future__ import annotations
import json
import math
from pathlib import Path
import matplotlib.pyplot as plt
import numpy as np
def load_open_race(json_path: Path) -> dict:
# Robust load: handle BOM and stray prefix chars before JSON (e.g., 'pl')
with open(json_path, 'r', encoding='utf-8-sig') as f:
... |
787c3e4f77808f46a8c29efa55a772b0ad0cc66e6238fd38630c30fcd14bdfe8 | Python | 5,935 | 169 | #!/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... |
66b6a0e1e967299ff6baca98ee72affb351c6b50adaa851dc9bdd28e3eae18f3 | Python | 5,951 | 178 | #!/usr/bin/env python
#
# Copyright (c) 2021 10X Genomics, Inc. All rights reserved
#
"""Assigns tags to cells."""
from __future__ import annotations
from typing import TYPE_CHECKING
import martian
import numpy as np
import cellranger.feature.utils as feature_utils
import cellranger.feature_ref as feature_ref
impor... |
8c16a0ed2dac3827adcf6973696de8418e3fe8ef85bc3063c0bdd0ae7c3a55e3 | Python | 5,956 | 150 | '''
Created on Jul 25, 2024
@author: voodoocode
'''
import h5py
import os
import scipy.io
import scrubber.core
import csv
IN_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/database1/original/aperiodic exponent of subthalamic field potentials- Human- Meds- OFF/used/"
OUT_PATH = "/mnt/data/Professional/LMU/da... |
f9788764f5b75260d12b711cd45aa2a8a7f0cb1a23fafc7df0c03eb459c2d458 | Python | 5,957 | 180 | #!/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... |
b121b24cadd4fbf2e2bf0cebe00a8811bff351141eb2f2d0e456896827cfcd2d | Python | 5,959 | 177 | # Copyright (c) Facebook, Inc. and its affiliates.
"""
Wrappers around on some nn functions, mainly to support empty tensors.
Ideally, add support directly in PyTorch to empty tensors in those functions.
These can be removed once https://github.com/pytorch/pytorch/issues/12013
is implemented
"""
import functools
imp... |
d39a53f95b7d85db961ae49a1633ebe5cd335c780bcae73e34d5e9510043f875 | Python | 5,960 | 167 | import os
import sys
import subprocess
import numpy as np
import itertools
import argparse
import re
import optuna
import multiprocessing as mp
sys.path.append(os.path.abspath(
os.path.join(os.path.dirname(__file__), '../../')))
from src.hyperparameter_search.optuna_worker import run_optuna_subprocess
from src.rnn.... |
ef777663f5667a49375c0ab805e0ebca4bdd75e90f6ba326a44306017f713fc2 | Python | 5,960 | 132 | import shutil
from multiprocessing import Pool
from typing import Union, Tuple
from batchgenerators.utilities.file_and_folder_operations import *
from nnunetv2.paths import nnUNet_results
from nnunetv2.utilities.dataset_name_id_conversion import maybe_convert_to_dataset_name
def convert_trainer_plans_config_to_ident... |
a77691df2993e04e003098d7c3e31bb2950476ea5f7ac6b8093c1b3c86eb5294 | Python | 5,972 | 184 | from __future__ import annotations
import argparse
import re
import sys
from argparse import ArgumentParser, Namespace
from pathlib import Path
import more_itertools as itx
import pytest
from hypothesis import given
from hypothesis import strategies as st
from pathvalidate import Platform, is_valid_filename
from pyte... |
01bf6746fa902e60835322b9e91a3a32789cab2e6cd81c75062ddd215113926e | Python | 5,977 | 153 | """Storage for overlapping meta-agent memberships.
- Membership edges (agent, group, relation)
- Safe update operations
- Invariant checks
"""
from __future__ import annotations
from collections import defaultdict
from collections.abc import Hashable, Iterable
RelationKey = Hashable
Triplet = tuple[Hashable, Hashab... |
541d243c1535cc4c23f5a265e84f026fff8efccd580562024d13ec00c4102cc3 | Python | 5,978 | 189 | """
author:CBJ
Number of Prediction Samples: 30个
"""
import sys
from pathlib import Path
import logging
import pandas as pd
import numpy as np
import torch
PROJECT_ROOT = Path(__file__).parent.parent
sys.path.insert(0, str(PROJECT_ROOT))
from src.models import FWIMSNet
from src.preprocess_data import load_preprocess... |
220ecf52335d7286168ea2a8ce0fb80ee536c5af7a4a2fe03f32ac8e3c41243c | Python | 5,987 | 90 | from tristan_pipeline.io.params import *
from tristan_pipeline.utils.loading_utils import *
from tristan_pipeline.utils.preproc_utils import *
from tristan_pipeline.utils.glm_utils import *
from tristan_pipeline.utils.plotting_utils import *
from nilearn.glm.first_level import FirstLevelModel
import pandas as pd
from ... |
463865a6c56b5e8076750cb061cdc4599a8b053ddf2a9d66f8dd6684a5ab683b | Python | 5,992 | 166 | #!../venv/bin/python
import os
import psutil #edited by Hong.K Tan to monitor memory used by Python process
import logging
import argparse
import gzip
import csv
import yaml
import psycopg2
import psql_wrapper as psql
from datetime import datetime
#CURR_DIR = os.path.dirname(os.path.realpath(__file__))
CURR_DIR ... |
07f5d31f4ab857992a15d826de85ba650cbae4a09bb03cd0d3f4d6519e6ba6f2 | Python | 5,993 | 191 | ############################################################################
# Copyright (c) 2023-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
"""
Protocol definition for barcode detection results.
This... |
8d31db44be97c2d76dd7382acf2716acd6d049a3252c0e6b73270cd63e19c7db | Python | 5,994 | 202 | # --- Python 标准库 ---
import os
import gc
import random
import warnings
# --- 第三方核心科学计算库 ---
import numpy as np
import pandas as pd
import scipy.stats
# --- 生物信息学与数据分析库 ---
import anndata as ad
import scanpy as sc
import seaborn as sns
import matplotlib.pyplot as plt
# --- 机器学习库 (Scikit-learn) ---
from sklearn.model... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.