sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
01797a2abfbf87c4feca2bf66f5a9dc425e366d17e0c79dd7ed3e72ed513ada4 | Python | 1,481 | 52 | # Copyright (c) 2019 10x Genomics, Inc. All rights reserved.
from __future__ import annotations
import os.path
from typing import TYPE_CHECKING
from common.pyfasta import FastaIndexed
if TYPE_CHECKING:
from pyfaidx import FastaRecord
# 10X generated references that should
# have genes, regions, and snps files
... |
f63441ef78a762b1e76e8c7e3179e0d1a56681c6c595d4684ff14b67ff410653 | Python | 1,483 | 42 | import torch
import torchvision.transforms as transforms
from pathlib import Path
from . import config
from .utils.activation_manager import ActivationManager
from .utils.data_utils import prepare_data
from .utils.model_utils import load_model, load_default_resnet, load_stylized_resnet
if __name__ == "__main__":
... |
0e9cf8cb6c10e6fc85661f0c21245e2f3b170cbbc5baacc2d2f19c12aa7b59d5 | Python | 1,484 | 37 | # Copyright 2011-2014 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 obtain a copy of the Licen... |
1e8fd6630117374b328e6df978a56a765353285ce69f21000b894efb398c8e02 | Python | 1,484 | 58 | #!/usr/bin/env python3
############################################################################
# Copyright (c) 2024-2026 University of Helsinki
# # All Rights Reserved
# See file LICENSE for details.
############################################################################
from enum import IntEnum
class IsoQ... |
d7ef976a72419d0778101dc6e250ea7c4aea770c20cd62a0d49e25f526fbfdc5 | Python | 1,485 | 59 | #!/usr/bin/env python
#
# Copyright (c) 2021 10X Genomics, Inc. All rights reserved
#
"""Summarize antibody analysis."""
from __future__ import annotations
import os
import shutil
from typing import TYPE_CHECKING
import martian
if TYPE_CHECKING:
import cellranger.mro_types.filetypes as mro_filetypes
__MRO__ = ... |
4e4b9b182580db737ec58e927be6b14ae4a14c1083c922304b6bc2e40afcab37 | Python | 1,488 | 44 | from detectron2.config import LazyCall as L
from detectron2.data.samplers import RepeatFactorTrainingSampler
from detectron2.evaluation.lvis_evaluation import LVISEvaluator
from detectron2.data.detection_utils import get_fed_loss_cls_weights
from ..COCO.mask_rcnn_vitdet_b_100ep import (
dataloader,
model,
... |
614d7644906bed542b2752b42beafb6dbbb7a6c6de1e0554037835819030bb5e | Python | 1,488 | 49 | import numpy as np
import pandas as pd
import math
# TODO: make sure it's a weighted f1-score
def compute_macro_f1_and_ci(conf_mat_df):
"""
Computes Top-1 Accuracy, Macro-F1, and 95% Confidence Interval
purely from an unnormalized confusion matrix dataframe.
"""
cm = conf_mat_df.values
total = ... |
13d5377032d2db00ccab2fa5a77d5251ce093a15c42add48d68711e8ab3e6102 | Python | 1,489 | 54 | """Data loading, processing, and featurisation for molecular ML."""
from nfml.data.loading import Molecule, process_exp_data
from nfml.data.splitting import (
get_split_strategy,
random_split,
scaffold_kfold,
scaffold_split,
stratify_labels,
)
from nfml.data.curation import detect_duplicates, summa... |
feb4e793ee284868405de165e7a44598f939f2d4738cb861569676fa14e4f8d5 | Python | 1,492 | 39 | import torch.utils.data
from data.base_data_loader import BaseDataLoader
import os
def CreateDataset(dataroots,dataset_mode='2afc',load_size=64,):
dataset = None
if dataset_mode=='2afc': # human judgements
from data.dataset.twoafc_dataset import TwoAFCDataset
dataset = TwoAFCDataset()
elif ... |
f269c6705867e1f004fb3ed0fdc747f797573457569793e1b2d7599946f9d35d | Python | 1,497 | 51 | import numpy as np
from scipy.io import loadmat
from scipy.interpolate import interpn
import nibabel as nib
# this function labels subfields using the labels in unfolded space, and native space coords (ap, pd) images
label_nii = snakemake.input.label_nii
nii_ap = snakemake.input.nii_ap
nii_pd = snakemake.input.nii_p... |
6894b313f13832cd6b7d91a615297b67bf3d748fa0e6b101325c8253a9a6e08e | Python | 1,500 | 46 | # Copyright (c) Facebook, Inc. and its affiliates.
import random
import unittest
from typing import Any, Iterable, Iterator, Tuple
from densepose.data import CombinedDataLoader
def _grouper(iterable: Iterable[Any], n: int, fillvalue=None) -> Iterator[Tuple[Any]]:
"""
Group elements of an iterable by chunks ... |
c71780e52601a844bc93b8ac49828d0eee230b41ff6c8939c956759fd8e785fc | Python | 1,501 | 53 | import argparse
from omegaconf import DictConfig
from omegaconf import OmegaConf as om
from pathlib import Path
from typing import cast
import logging
from model_embeddings import EmbeddingWrapper
from calc_pred_dist import DistWrapper
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("... |
8fd9565817bd70015ff757e615b88976d6ddacca2c3a67cf99612c076d4f7566 | Python | 1,502 | 38 | import torch
try:
from aimnet.calculators.model_registry import get_model_path
except ImportError:
get_model_path = None
class GmxAIMNet2Model(torch.nn.Module):
def __init__(self, charge=0, mult=1, **kwargs):
super().__init__()
assert get_model_path is not None, "AIMNet2 model requires the ... |
df96811bbf91476cbe2c6bdf685dd2e4b74aa19de2f5bebe57a80db50c7a3e6c | Python | 1,502 | 40 | from dataclasses import dataclass, field, InitVar
from enum import Enum
from pathlib import Path
from typing import Any, Dict, Mapping, Sequence
from omegaconf import DictConfig, OmegaConf
from .parser import ConfigParser
from ..definitions import NeuronClass, Projection
def _as_dict(cfg: str | Path | Mapping) -> d... |
02ae9290e19cc468fc0c8bb12c5af88706e98201f5d2f373a4f1c2c2b809c204 | Python | 1,509 | 46 | # Copyright (c) 2026 10X Genomics, Inc. All rights reserved.
"""Build the cell-barcode dataset for web summary reports."""
from __future__ import annotations
import hashlib
import random
from collections.abc import Iterable
MAX_BARCODES = 10_000
def build_cell_barcode_dataset(
barcodes: Iterable[bytes | str],
... |
9099a6c9db6313a7247ca666c0d8d59278e9d827daa31cc1fefcaa11cc6ef0bb | Python | 1,509 | 37 | # Python05-1.py
# IJ BAR: https://github.com/tferr/Scripts#scripts
####################################################
# 5.1 Scripting ImageJ: Creating an empty image (I)
####################################################
# Lets create an empty image with a ROI on it using the ImageJ
# API. Don't know which methods... |
be147eda253f6f8f1e4c46b40d7953db20381073f0216e523f9ac1061afbf8f6 | Python | 1,512 | 56 | from .atom import AtomFeatureMode, MultiHotAtomFeaturizer, get_multi_hot_atom_featurizer
from .base import Featurizer, GraphFeaturizer, S, T, VectorFeaturizer
from .bond import MultiHotBondFeaturizer
from .molecule import (
BinaryFeaturizerMixin,
CountFeaturizerMixin,
MoleculeFeaturizerRegistry,
MorganB... |
b924d43a3f886e1c0c52542bca20870a5f89ca7366dcaea4dd4119118556ecea | Python | 1,525 | 49 | import nibabel as nib
import numpy as np
with open(snakemake.log[0], "w") as sys.stdout:
epsilon = 0.01
# load gifti surf
gii = nib.load(snakemake.input.gii)
arr = gii.get_arrays_from_intent("NIFTI_INTENT_POINTSET")[0]
vertices = arr.data
# get ref nii (for defining bbox)
img = nib.load(s... |
0958be55d7d39292e6e7d35d8d33ef382efe7b519c677294cee0ddc86be9c029 | Python | 1,529 | 40 | import pytest
import numpy as np
import xarray as xr
from hsnn.core import SpikeRecord
from hsnn import ops
@pytest.fixture(scope='module')
def spike_records() -> xr.DataArray:
num_nrns = 3
duration = 20
data = np.array([[SpikeRecord(num_nrns, duration, [0, 0, 2], [15, 17, 18]),
Sp... |
4755dd5723dfe8b03d17257244b3415ba1b66cea3f222f10167fd061cb98e389 | Python | 1,529 | 54 | import numpy as np
import time
from sklearn.linear_model import LinearRegression
def compute_capacity(z_hat, z_target):
z_hat_col = np.transpose(z_hat[:, np.newaxis])
# using ddof=None (default) may lead to capacity values > 1 since ddof=0 in np.var by default
covs = np.cov(z_hat_col, z_target, ddof=0)[0... |
f13b30e68055f6f9662fae55d6a10c358fdbd15cfad4b162084f7294a81ba1a1 | Python | 1,530 | 41 | import os
import re
import pandas as pd
from dotenv import load_dotenv
load_dotenv(override=False)
"""consistency check between TM Variant and TM with regex-rules"""
INPUT_CSV = os.environ.get("INPUT_CSV", "/data/results.csv")
OUTPUT_CSV = os.environ.get("OUTPUT_CSV", "/data/results-flagged-regex.csv")
# If the i... |
7f1f3a3521e8ef4079278f76d9e721ce893fda1164cf7e13f6c28c7de33cd7c5 | Python | 1,531 | 64 | from __future__ import annotations
import functools as ft
from typing import TYPE_CHECKING
from snakebids.paths._templates import spec_func
from snakebids.paths._utils import BidsPathSpec, find_entity, get_spec_path, load_spec
# <AUTOUPDATE>
# The code between these tags is automatically generated. Do not
# manually... |
0bc3277cdd01f9d3b5b9fc8163f7dc48a7284dcbd27f7b9cfb161be95025a1e1 | Python | 1,532 | 46 | from pathlib import Path
import click
import click_log
from ... import io
from ..._cli.utils import catch_exception, logger
from ..._steinbock import SteinbockException
from ..._steinbock import logger as steinbock_logger
from .. import expansion
@click.command(name="expand", help="Expand mask objects by an Euclide... |
3402950dae8e65fa1800f1211ead9db9ede56aa0d599c186994262a30fc1ba81 | Python | 1,539 | 39 | import argparse
def main(args):
import json
with open(args.input_path, 'r') as json_file:
json_list = list(json_file)
global_designed_chain_list = []
if args.chain_list != '':
global_designed_chain_list = [str(item) for item in args.chain_list.split()]
my_dict = {}
for jso... |
d04949c3d25669c7b251a734fac9fcdcd2316a24f2437f49c4bc294adb5d0c9f | Python | 1,540 | 43 | #!/usr/bin/env python3
import argparse
import sys
import subprocess
# Argument parser
parser = argparse.ArgumentParser(description="Merge chunk files into a single file, ensuring only one header.")
parser.add_argument("-i", "--inputs", nargs='+', required=True, help="Input chunk file paths")
parser.add_argument("-o", ... |
3191a4ab887bd97bac9cc65c912a0d2e88d0691b3d81cecdcfa4747c357ebd91 | Python | 1,541 | 34 | # 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... |
e1dd60a87972a2d52b53948f0d60e855f2628b134ddaf71e91bf31c0a31457f9 | Python | 1,545 | 42 | #
# Copyright (c) 2024 10X Genomics, Inc. All rights reserved.
#
"""Convenience functions for processing read level multiplexing data."""
from __future__ import annotations
from typing import TYPE_CHECKING
from cellranger.barcodes.utils import load_probe_barcode_map
from cellranger.targeted.rtl_multiplexing import g... |
d54a48f644298c1afa9c721079c2abb2c4f8f127d34a059a9f0836d5d7989c75 | Python | 1,546 | 59 | import os, re
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from scipy.stats import zscore
from loguru import logger
logger.info('Import OK')
input_path = 'results/preprocessed/ratio_summary.csv'
output_folder = 'results/plot_ratios/'
if not os.path.exists(output_fol... |
0c9323114850db02d98185fb5b0beedcd1b6925b97737e4f086f3b35042c9d59 | Python | 1,549 | 44 | import logging
import os
import selectors
import subprocess
import sys
from functools import wraps
logger = logging.getLogger(__name__.rpartition(".")[0])
def run_captured(args, **popen_kwargs) -> subprocess.CompletedProcess:
with subprocess.Popen(
args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **... |
2b5fa8df99e58939168e28b1b58647d55579110c5a574476d2e5bc20f26531af | Python | 1,549 | 55 | # Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
"""Generate VDJ aggr web summary from the json."""
from __future__ import annotations
import json
from typing import TYPE_CHECKING
import martian
if TYPE_CHECKING:
import cellranger.mro_types.filetypes as mro_filetypes
__MRO__ = """
stage BUILD_AGGR_... |
0be32ab65d764ee81414bbbe6b1f6e548a2a7fb6c47e6eb1ef49d19c0d62f3c4 | Python | 1,550 | 48 | from enum import Enum
from typing import Any, Dict, Optional, Sequence
import numpy as np
from brian2 import Group
from ..symbols import process_symbols
def get_spatial_coords(shape: Sequence, num_channels: Optional[int] = None,
spatial_span: float = 128) -> Sequence[np.ndarray]:
assert 0... |
5cc3931931a19a8fc1ea8d306104b80316a1541da500440906718b30804eaf0a | Python | 1,550 | 53 | # Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
"""Interface for the pyfasta.Fasta API that uses pyfaidx under the hood."""
from __future__ import annotations
from typing import NamedTuple
import pyfaidx
class BedCoord(NamedTuple):
"""Coordinates in BED format."""
chrom: str
start: int
... |
fe0b7c811924f705694ad32b7acc66ab121ed1dbe92b24a069c05a680b3b5f09 | Python | 1,551 | 48 | from typing import Any, Mapping, Sequence
import numpy as np
import hsnn.simulation.functional as F
from hsnn import analysis
from hsnn.core import INetwork
from hsnn.analysis._types import RatesDatabase
from .base import get_nested
def get_rates_db(network: INetwork, data: Sequence[np.ndarray], duration: float,
... |
d972e76b302621115aa1fa70e9584bdca8acb57b65bd0f78bceff9e32654a351 | Python | 1,552 | 63 |
#%%
import pandas as pd
import mne
import scipy.signal as dsp
import joblib
from os import listdir
from os.path import join
import scipy.stats as stats
import matplotlib.pyplot as plt
import seaborn as sns
import numpy as np
import pingouin as pg
from fooof import FOOOFGroup
from fooof.utils.params import compute_kne... |
fca292e76489677b246f5f7764c6dc41e66da2547e95c4eb4eb7a3240b78c2b7 | Python | 1,554 | 41 | """ Parameters for simulation details and neuron models """
simulation_params = {
"step_size": 0.1,
"cores": 8, # if zero or negative, use maximum number of available cores
"seed": 10, # if -1, use random seed
}
network_params = {
"Ne": 800,
"Ni": 200,
"g": 5., ... |
6508e2ea6450600a3447c48f91e1c6191392113a2ed48ada950cc7fc00cb9edf | Python | 1,555 | 58 | # Generated by Django 4.2 on 2024-12-04 14:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0012_user_val_rep_ready'),
]
operations = [
migrations.RemoveField(
model_name='user',
name='epsilon_dim_1_... |
4501e776fffba07428d6cf655b32dd5d993d520ae67e4f9782975c6b021d22e1 | Python | 1,558 | 41 | # 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... |
778442b75cb554fc18fb18e17b6ad900c91294512e615d1d8919aae11e229f12 | Python | 1,561 | 47 | """
loaders/base_loader.py
----------------------
Abstract base class that every manufacturer loader must inherit from.
To add a new manufacturer:
1. Create loaders/<name>_loader.py
2. Subclass BaseLoader
3. Implement load() — that's it.
All analysis code in core/ will work automatically.
"""
from abc import ABC,... |
cfc23ad42c99190de3edb6001099be212663a9b7e423abcd220771a7759fd181 | Python | 1,561 | 55 | from composer.models import ComposerModel
import logging
import torch
import torch.nn as nn
import torch.nn.functional as F
from transformers import PreTrainedTokenizer
class GeneticDistanceModel(ComposerModel):
def __init__(
self,
model: nn.Module,
tokenizer: PreTrainedTokenizer,
... |
dee35773777731f2f23aa72b6dd206d1e0d352093a9e347d6d13be7bd68c1547 | Python | 1,561 | 39 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from .base import RectangleVisualizer, TextVisualizer
class BoundingBoxVisualizer:
def __init__(self):
self.rectangle_visualizer = RectangleVisualizer()
def visualize(self, image_bgr, boxes_xywh):
for bbox_xywh in boxes_xywh:
... |
6ad24fab025633ebb85bd7764659a27ed2dc1720c94176b8671adf5ae6c1a270 | Python | 1,562 | 48 | from pathlib import Path
from steinbock import io
from steinbock.export import data
class TestDataExport:
def test_try_convert_to_dataframe_from_disk(
self, imc_test_data_steinbock_path: Path
):
intensities_files = io.list_data_files(
imc_test_data_steinbock_path / "intensities"
... |
c87daac065d05c6cd693add4129e7f4321ee9288f8dfe648a40999f9068e04e5 | Python | 1,566 | 46 | import pytest
import torch
from chemprop.data import BatchMolGraph, MoleculeDatapoint, MoleculeDataset, collate_batch
from chemprop.models import MPNN
from chemprop.nn import BondMessagePassing, RegressionFFN, SumAggregation
def make_batch(smiles: list[str]) -> BatchMolGraph:
dataset = MoleculeDataset([MoleculeD... |
b305ee5211eeab201dc18b6ed6c395e7385ce8e606bf13371fe918edc0b35eb3 | Python | 1,567 | 68 | """This tests the CLI functionality of training and predicting a regression model on a single molecule.
"""
import pytest
from chemprop.cli.main import main
pytestmark = pytest.mark.CLI
@pytest.fixture
def data_path(data_dir):
return str(data_dir / "regression" / "mol_multitask.csv")
@pytest.fixture
def mode... |
02765768813269e3a63e1453b4cf604526198373b3b6be00f7065a2116290f3f | Python | 1,568 | 64 | # Copyright (c) Facebook, Inc. and its affiliates.
from detectron2.layers import ShapeSpec
from .anchor_generator import build_anchor_generator, ANCHOR_GENERATOR_REGISTRY
from .backbone import (
BACKBONE_REGISTRY,
FPN,
Backbone,
ResNet,
ResNetBlockBase,
build_backbone,
build_resnet_backbone... |
bc52abe0a70fa9e04269b0f4ef59a786f69ed03a6af31cd549d68530d3370925 | Python | 1,569 | 46 | # ------------------------------------------------------------------------------
# Title: Indirect Spatial Communication Analysis (Commot - P0)
# Author: Yiran Song
# Date: March 18, 2025
# Description:
# This script runs indirect ligand-receptor communication analysis on the Xenium dataset
# at time point P0 using Com... |
bf50250676f0393146ba10f5edfb555a156bf59e49a3b026c61330e94fbce213 | Python | 1,570 | 58 | """_summary_"""
import argparse
import random
import torch
import numpy as np
is_semantic_matched = lambda s: np.vectorize(lambda x: x["semantic"] == s)
parser = argparse.ArgumentParser(description="Template")
parser.add_argument(
"-id",
"--input-dataset",
help="input EEG dataset path",
)
parser.add_a... |
ba450d6dbc8afb5c5385cc3cd2504c6d9924b6645a3859cefaffc15a9362161b | Python | 1,571 | 60 | """A script to fix up rbfe_results.tar.gz
Useful if Settings are ever changed in a backwards-incompatible way
Will expect "rbfe_results.tar.gz" in this directory, will overwrite this file
"""
import glob
import json
import os.path
import tarfile
from gufe.tokenization import JSON_HANDLER
from openfe.protocols impo... |
415c6240f50dc038fa48894b3dd70cd8e3c06f6cb1103c6c5c93cf77b835d3bf | Python | 1,575 | 54 | #%%
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
import matplotlib as mpl
new_rc_params = {'text.usetex': False,
"svg.fonttype": 'none'
}
mpl.rcParams.update(new_rc_params)
sns.set_style('ticks')
sns.set_context('poster')
# %% This is just a visualization of the results... |
7ee5096c931ca016793a79e07f900baaa2e0d1591a9e52542c05aa73cc1d407f | Python | 1,578 | 49 | """Cell spaces for active, property-rich spatial modeling in Mesa.
Cell spaces extend Mesa's spatial modeling capabilities by making the space itself active -
each position (cell) can have properties and behaviors rather than just containing agents.
This enables more sophisticated environmental modeling and agent-envi... |
b20f55771f4b479645b5c9f7f2d12dc2dbc42aac1343b38b2809a84996ab4b5f | Python | 1,580 | 52 | """Carbanion -> heteroatom-anion normalization (formal charge survives MOL2)."""
from __future__ import annotations
import pytest
from rdkit import Chem
from src.protonation.charge_normalization import normalize_anion_placement
def _charged(smiles: str):
mol = Chem.MolFromSmiles(smiles)
return [
(a... |
64bbf67aebd2c3b26e32771573f9b7a6e6962b221c56ae491255fba6502e01c2 | Python | 1,581 | 64 | from .collate import (
BatchMolAtomBondGraph,
BatchMolGraph,
MolAtomBondTrainingBatch,
MulticomponentTrainingBatch,
TrainingBatch,
collate_batch,
collate_mol_atom_bond_batch,
collate_multicomponent,
)
from .dataloader import build_dataloader
from .datapoints import (
LazyMoleculeData... |
3272f35554be1c46227dc028873aee18e226a61650ef4b2c20fa1754833af4b0 | Python | 1,582 | 40 | # Calculate implicit solvent energy and forces with OpenMM for comparison to Molly
# Used OpenMM commit a76c2de14b5a1ab604e95a5c4197e5a586e3000d, Python v3.9.7
# This version is required due to a carboxylate atom radius fix
from openmm.app import *
from openmm import *
from openmm.unit import *
import os
data_dir = o... |
af8d74216e191440cfdea6f9d176b0e269aa8d3ea7955c5cbaf6ddfce870776b | Python | 1,582 | 51 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from typing import Any, Tuple
from detectron2.structures import BitMasks, Boxes
from .base import BaseConverter
ImageSizeType = Tuple[int, int]
class ToMaskConverter(BaseConverter):
"""
Converts various DensePose predictor outputs to masks
... |
e87e3ec5f2be3751f74febe01a48b9f8dc1ae5a16cc256182788cf1213227092 | Python | 1,584 | 51 | #!/usr/bin/env python
#
# Copyright (c) 2017 10X Genomics, Inc. All rights reserved.
#
import math
import cellranger.analysis.multigenome as cr_mg_analysis
import cellranger.cr_io as cr_io
import cellranger.h5_constants as h5_constants
from cellranger.matrix import CountMatrix
__MRO__ = """
stage RUN_MULTIGENOME_ANAL... |
ce8e5adc65367e49c178d276d95d456f6127e74f9c829ea5364270a11c111692 | Python | 1,587 | 57 | # Generated by Django 4.2 on 2024-12-25 14:12
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0014_user_list_responses'),
]
operations = [
migrations.RenameField(
model_name='user',
old_name='current_d... |
1a0675f25cf17ccfc7681ac460d69da55a32acef477a44a0f5b69143a4e10e66 | Python | 1,591 | 53 | # Generated by Django 4.2 on 2024-12-31 04:59
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('abx_app', '0020_remove_user_is_not_fixate_user_is_fixate'),
]
operations = [
migrations.RenameField(
model_name='user',
... |
fd9bde7e07ca4c10afbe3a418a16e10845a1634303a2de4136bb9dc9a058607e | Python | 1,593 | 42 | import numpy as np
import nibabel as nib
import monai
from monai.transforms import (
AddChannel,
Resize,
Spacing,
ResizeWithPadOrCrop
)
import matplotlib.pyplot as plt
import warnings
warnings.filterwarnings("ignore")
import argparse
import os
import PreProcess
if __name__ == "__main__":
if not os... |
b2feb22b85643ea295eb2a762a0c14ffe939833acdb7cbf5d2c1c6a8d7938bbe | Python | 1,595 | 55 | from enum import auto
import logging
from torch import nn
from chemprop.utils.utils import EnumMapping
logger = logging.getLogger(__name__)
class Activation(EnumMapping):
RELU = auto()
LEAKYRELU = auto()
PRELU = auto()
TANH = auto()
ELU = auto()
def get_activation_function(activation: str | n... |
4bd0305161c92dab7dae8d789ae15e1d5bc64e96a29e12a2af12d2d958240a42 | Python | 1,596 | 56 | from __future__ import annotations
import sys
from pathlib import Path
PROJECT_ROOT = Path(__file__).resolve().parents[1]
if str(PROJECT_ROOT) not in sys.path:
sys.path.insert(0, str(PROJECT_ROOT))
from rdkit import Chem
from rdkit.Chem import AllChem
SMILES = "C[NH+]1Cc2c(Cl)cc(Cl)cc2[C@H](c2cccc(S(=O)(=O)NCC... |
722b31ced53cb532936a9bf7db2ed267b4d7fe49d2e4c0ca0493cd45c4e9d389 | Python | 1,596 | 55 | #
# Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
#
from __future__ import annotations
from collections.abc import Iterable
import numpy as np
import pandas as pd
from six import ensure_binary, ensure_str
def load_csv_columnnames(path: str) -> list[str]:
"""Gets the headers of csv files with # as... |
20bca7815fb16b1c85175d63935a769870898fe57e007808fb1a3a563151e9dd | Python | 1,599 | 65 | from __future__ import annotations
import matplotlib.pyplot as plt
import mne
def get_soi_picks(
inst: mne.io.BaseRaw | mne.Epochs | mne.Evoked,
soi: str,
plot: bool = False,
) -> list[str]:
"""Get the picks of the SOI.
Parameters
----------
inst : mne.io.BaseRaw | mne.Epochs | mne.Evoke... |
5323dcd526e990701b03f5304ed5b5219fa011fb4a189c74d726de9bb6fe05d1 | Python | 1,599 | 47 | #!/usr/bin/env python
#
# Copyright (c) 2021 10x Genomics, Inc. All rights reserved.
#
"""For SC_RNA_REANALYZER pipeline runs on Aggr inputs.
Sanity check that the library_ids from the matrix match the sample_ids from the aggr sample defs.
"""
import martian
from six import ensure_binary, ensure_str
import cellrang... |
5b5b9b0f0996411047dbea3a97c94d084c012471deba47b141823ab37f69d7a2 | Python | 1,600 | 60 | import torch
from torch.utils.data import Dataset
# Splitter class
class Splitter(Dataset):
"""Dataset splitter
Args:
Dataset (_type_): _description_
"""
def __init__(
self,
dataset,
split_path,
split_num=0,
split_name="train",
is_semantic=Fals... |
c4e18a1bd037263f446a2e8d9316dbc212b1fba08b8437b92cab2f2ebe3207b5 | Python | 1,600 | 35 | from nnunetv2.training.data_augmentation.compute_initial_patch_size import get_patch_size
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
import numpy as np
class nnUNetTrainer_noDummy2DDA(nnUNetTrainer):
def configure_rotation_dummyDA_mirroring_and_inital_patch_size(self):
do_dumm... |
1b148828c344fd6034601013692fa37519113cde99d9a8d22c322f9be9a2a99d | Python | 1,603 | 62 | from __future__ import annotations
from typing import TYPE_CHECKING, Literal, TypeAlias, TypedDict, cast
from snakebids.paths import specs
from snakebids.paths._factory import BidsFunction, bids_factory
if TYPE_CHECKING:
from snakebids.paths._utils import BidsPathSpec
# <AUTOUPDATE>
# The code between these tag... |
0f311055d42f948e8c48e906e930a1b28daa3a2780fb0a7089bf658d47fce979 | Python | 1,604 | 62 | #
# Copyright (c) 2024 10X Genomics, Inc. All rights reserved.
#
"""Generate cell types interactive barchart."""
import json
import cellranger.fast_utils as fast_utils
import cellranger.matrix as cr_matrix
import cellranger.websummary.violin_plots as cr_vp
from cellranger.cell_typing.common_cell_typing import (
... |
ab2f376d6e7c45773ebc2590f852ef69d224403611b3aadf990d82d1a5262f73 | Python | 1,605 | 42 | """parse_gff must return one dataframe per contig, in the order it was given the contig names.
Annotations are looked up by contig index downstream, so a contig the GFF says nothing about
still has to occupy its slot; skipping it would shift every later contig's annotations.
"""
import sys
import tempfile
import unitt... |
ed43db48d3c259dfe1f1769acb69466393402d86a180cb17510db8ad9bfb9c62 | Python | 1,605 | 80 | decoder_type = "rnn"
"""
======================
===== VAE CONFIG =====
======================
"""
# Encoder
encoder_kwargs = {
#"pretrained_encoder_path": "facebook/esm2_t30_150M_UR50D"
"pretrained_encoder_path": "./esm2_model"
}
# Latent
latent_kwargs = {
"latent_dim": 320
}
# Upsampler
upsampler_kwargs =... |
89b013d4fbaa6bbfdfcf654830473dec889a670736bd2654670158cefa8c64c4 | Python | 1,606 | 40 | from collections import namedtuple # available in Python 2.6+
from pathlib import Path
import numpy as np
CONFIG_PATH = Path('../config') if 'toolbox' in str(Path('./').absolute()) else Path('config')
SIM_CONF = CONFIG_PATH / 'simulation.ini'
SCREEN_CONF = CONFIG_PATH / 'screen.ini'
simulation_params = named... |
aee3aa3559533ab7aeab3470dbc26e1cbb1110dee3c5dd1e86404df893634f41 | Python | 1,608 | 56 | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import pickle as pkl
import sys
import torch
"""
Usage:
# download one of the ResNet{18,34,50,101,152} models from torchvision:
wget https://download.pytorch.org/models/resnet50-19c8e357.pth -O r50.pth
# run the conversion
./convert-torc... |
2d5c42af854179ad2cf8904027088051b0bd8161db8e509ee470de95494d3092 | Python | 1,609 | 42 | #python parsePages.py C:\Users\animeshs\OneDrive\Desktop\pages <link to website> <what to search for in link-dev>
import sys
from pathlib import Path
pathFiles = Path(sys.argv[1])
#pathFiles = Path("C:\\Users\\animeshs\\OneDrive\\Desktop\\pages\\")
#trainList=list(pathFiles.rglob("Page.260*.html"))
trainList=list(pathF... |
31e2e44ccf1fcc2499befceb97a421f3fd785a43527d0678338961f303939587 | Python | 1,611 | 55 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""Settings class for plain MD Protocols using OpenMM + OpenMMTools
This module implements the settings necessary to run MD simulations using
:class:`openfe.protocols.openmm_md.plain_md_met... |
944186f4009b59aae70bb8c094bb98d32792e53324443b72ea8c6a75e897a4a9 | Python | 1,613 | 54 | """
Pickling
========
<!-- difficulty: beginner -->
Quickly cache and reload neurons with Python's pickle module.
All {{ navis }} neurons - including whole [`NeuronLists`][navis.NeuronList] - can be "pickled" :cucumber:.
Pickling serialises the live Python object to a byte stream: it's extremely fast and ideal for
sh... |
4ba005ed047c5ddb8063402bb64f904aa50cb3ed4c7802d8dcd18fd4adeba278 | Python | 1,615 | 29 | from dynamic_network_architectures.building_blocks.helper import get_matching_batchnorm
from torch import nn
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
from nnunetv2.utilities.plans_handling.plans_handler import PlansManager, ConfigurationManager
class nnUNetTrainerBN(nnUNetTrainer):
... |
c689bf6a61ce9dd48258c224b299cafc5866528080446045db2a917efe8893e4 | Python | 1,618 | 55 |
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import subprocess
import sys
def run_until_output(command, ... |
ff2e09105a6b7fe7cf1eacb843740253dd3aad27fc345bb0a40491ec41f5a93a | Python | 1,618 | 70 | import numpy as np
import pandas as pd
import pytest
@pytest.fixture
def synthetic_data():
"""
Create synthetic neuroimaging data for testing.
Returns data array with shape (n_samples, n_features).
"""
np.random.seed(42)
n_samples = 50
n_features = 100
# Simulate multi-site data with ... |
96bb0b90784246f7c643d48711a114966960bb23f9824d72cfb72c0b9cbf54fb | Python | 1,620 | 76 | # -*- coding: utf-8 -*-
"""For testing neuromaps.datasets.atlases functionality."""
import pytest
from neuromaps.datasets import atlases
@pytest.mark.parametrize('atlas, expected', [
('fslr', 'fsLR'), ('fsLR', 'fsLR'), ('fsavg', 'fsaverage'),
('fsaverage', 'fsaverage'), ('CIVET', 'civet'), ('civet', 'civet'... |
dd04aa7f0792387de7acd0efc9eb454e489f8b69419b6927bc79a1848420abcc | Python | 1,621 | 62 | import sys
import os
from pathlib import Path
FIGURES_DIR = Path(__file__).resolve().parent
ARCHIVE_ROOT = FIGURES_DIR.parent
MODELING_DIR = ARCHIVE_ROOT / "modeling"
MPLCONFIGDIR = ARCHIVE_ROOT / "outputs" / ".matplotlib"
MPLCONFIGDIR.mkdir(parents=True, exist_ok=True)
os.environ.setdefault("MPLCONFIGDIR", str(MPLCON... |
a50bc08a811a98202a2ccadc08eb53e50996d3db739f5303c5a40387a18da2c3 | Python | 1,622 | 48 | from functools import partial
import torch.nn as nn
from detectron2.config import LazyCall as L
from detectron2.data.detection_utils import get_fed_loss_cls_weights
from detectron2.data.samplers import RepeatFactorTrainingSampler
from detectron2.evaluation.lvis_evaluation import LVISEvaluator
from ..COCO.cascade_mask... |
b3764294a5b232ef01ebf935666bd0937aa5acf1d13a32ae9aa949ebd58190bb | Python | 1,626 | 44 | #%% imports
import sys
sys.path.append('/mnt/obob/staff/fschmidt/neurogram/cluster_jobs')
from cluster_jobs.stats_across_irasa import StatsAcross
from plus_slurm import SingularityJobCluster, PermuteArgument
import os
import numpy as np
#%% get jobcluster
job_cluster = SingularityJobCluster(required_ram='4G',
... |
47923536430140929e45ae950d81ec4a08c0b10853626cf60ae1ec14aed28314 | Python | 1,627 | 50 | import os
import sys
import time
import pytest
from chemprop.utils import make_mol, parallel_execute
@pytest.mark.skipif(
sys.platform in ["win32", "darwin"], reason="Multiprocessing can hang on Windows and MacOS."
)
def test_parallel_execution():
def add_two(x, y):
return x + y
expected_result... |
b5505114bcd5f90030546f97b9229c688f6eddc0a3fb53bbdf43e91d59e9e291 | Python | 1,627 | 56 | #!/usr/bin/env python
#
# Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
#
"""Run the reference builder to generate a 10X-compatible reference."""
import martian
from cellranger.reference_builder import (
GexReferenceError,
GtfParseError,
ReferenceBuilder,
)
__MRO__ = """
stage _MAKE_REFERENCE... |
807d8b06891db12f2e331b9b7f04b9a9eb152efb2bc562ce0e30fe42e2f4fe5a | Python | 1,631 | 50 | from fvcore.common.param_scheduler import MultiStepParamScheduler
from detectron2 import model_zoo
from detectron2.config import LazyCall as L
from detectron2.solver import WarmupParamScheduler
from detectron2.modeling import SwinTransformer
from ..common.coco_loader_lsj import dataloader
from .cascade_mask_rcnn_mvit... |
1b95f9efb8f3001d8aa1ae89807bb890ab2b2f4b1ce8e75cb97f7ad9fb784a34 | Python | 1,633 | 56 | import os
import shutil
import pandas as pd
import numpy as np
import smma.utilities as utilities
import napari
import functools
from skimage import io
from loguru import logger
logger.info('Import OK')
input_folder = utilities.locate_raw_drive_files(
input_path='raw_data/raw_data.txt')
output_folder = 'results/... |
5abb97e022964af25b942d2b7bc3b7a9e38696d04fef8925f7e2256165ae0f39 | Python | 1,634 | 44 | # Copyright (c) 2025 10X Genomics, Inc. All rights reserved.
"""Webp image utils."""
import numpy as np
from PIL import Image
def compute_crop_bbox(width, height, crop_box, padding):
"""Compute crop bbox."""
if padding is None:
padding = 0
left = max(int(np.min(crop_box[:, 0]) - padding), 0)
... |
e73a2a5ca99b5c6e9e1c460706819c619e29480e438bd3a0860294ac9c72a068 | Python | 1,634 | 47 | from pathlib import Path
import click
import click_log
from ... import io
from ..._cli.utils import catch_exception, logger
from ..._steinbock import SteinbockException
from ..._steinbock import logger as steinbock_logger
from .. import matching
@click.command(name="match", help="Match mask objects")
@click.argumen... |
3787811e4730c0d4fb76937f04826a358dfd6f0b6c9f9ba08b67978570ba2a30 | Python | 1,635 | 51 | # -*- coding: utf-8 -*-
"""For testing neuromaps.stats functionality."""
import numpy as np
import pytest
from neuromaps import stats
@pytest.mark.xfail
def test_compare_images():
"""Test comparing images."""
assert False
def test_permtest_metric():
"""Test permutation testing of a metric."""
rs =... |
959e64df57332719e28dcc96ccc72b78a2e3cc04029caa3eb56d1812be75e86f | Python | 1,635 | 39 | #python proteinGroupsSelect.py L:\promec\TIMSTOF\LARS\2024\240221_Tom_Kelt\combined\txtv252\proteinGroups.txt L:\promec\TIMSTOF\LARS\2024\240221_Tom_Kelt\list.txt
# %%setup
import sys
from pathlib import Path
pathFiles = Path(sys.argv[1])
pathFiles=Path("L:/promec/TIMSTOF/LARS/2024/240221_Tom_Kelt/combined/txtv252/prot... |
c7153eba175fe9869de549e9a425d050a05a1b23fd96ec0bbdf792398ff62129 | Python | 1,636 | 34 | from typing import Union, Tuple, List
import numpy as np
from batchgeneratorsv2.helpers.scalar_type import RandomScalar
from batchgeneratorsv2.transforms.base.basic_transform import BasicTransform
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
class nnUNetTrainerNoDA(nnUNetTrainer):
@st... |
4cd20b9e5c450b5cfa14f8d8af82953f9957df5c34cf142ac54bb67682593ec5 | Python | 1,637 | 37 | # Python05-4.py
# IJ BAR: https://github.com/tferr/Scripts#scripts
####################################################
# 5.4 Scripting ImageJ: Creating an empty image (IV)
####################################################
# What about changing the ROI properties (color, name
# name, dimensions, etc.) of the Rectan... |
fa655414f0dd1717e8f34aa4cad186c1a0448e7e706e94cc7a2eb60c3af07ee1 | Python | 1,637 | 40 | import torch
from nnunetv2.training.loss.deep_supervision import DeepSupervisionWrapper
from nnunetv2.training.nnUNetTrainer.nnUNetTrainer import nnUNetTrainer
from nnunetv2.training.loss.robust_ce_loss import RobustCrossEntropyLoss
import numpy as np
class nnUNetTrainerCELoss(nnUNetTrainer):
def _build_loss(self... |
3bccb8767e02517258dc474f4c8e8e9a1a01dd6f484df5b09a775a66d3e6ed1e | Python | 1,639 | 59 | from functools import partial
import torch.nn as nn
from detectron2.config import LazyCall as L
from detectron2.modeling import ViT, SimpleFeaturePyramid
from detectron2.modeling.backbone.fpn import LastLevelMaxPool
from .mask_rcnn_fpn import model
from ..data.constants import constants
model.pixel_mean = constants.i... |
f189c687dec3ddaf5cc7aa3903831d8d94cb677be8353aa29e36487439ba94b0 | Python | 1,641 | 55 | import os
import logging
import datetime
from omegaconf import OmegaConf
from trainer import TrainerMultihead
def setup_logging(log_dir: str) -> None:
"""Configure logging for the training run."""
log_file = os.path.join(log_dir, "main.log")
logging.basicConfig(
filename=log_file,
level=lo... |
8a156bd3c930fde4043d272eacf45aa34d1c2e9b6aee337ff0e6491984bcd151 | Python | 1,643 | 39 | #!/usr/bin/env python
# Copyright 2016-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... |
cd4222c148b378ecce2cbfaff81a05a3f1dc52dca5e7e5dfc9c832b786a1bd75 | Python | 1,644 | 49 | import numpy as np
import pytest
import torch
from chemprop.data import BatchMolGraph
from chemprop.data.molgraph import MolGraph
from chemprop.nn import (
AtomMessagePassing,
BondMessagePassing,
MABAtomMessagePassing,
MABBondMessagePassing,
)
def make_chain_graph(num_atoms: int) -> BatchMolGraph:
... |
d08f484a421fa12e1e3210424d6ad80c8f9ab9146515952bac877ec72a12a359 | Python | 1,644 | 60 | #!/usr/bin/env python
# This script creates several files used in testing setup serialization:
#
# * openfe/tests/data/multi_molecule.sdf
# * openfe/tests/data/serialization/ethane_template.sdf
# * openfe/tests/data/serialization/network_template.graphml
#
# The two serialization templates need manual editing to repla... |
388fad8762eb529e41d8ce1084dc4e06a341b4c30db52dc13e45699c476ab0e1 | Python | 1,649 | 62 | """
Solara-based visualization for the Spatial Prisoner's Dilemma Model.
"""
from mesa.examples.advanced.pd_grid.model import PdGrid, PrisonersDilemmaScenario
from mesa.visualization import (
Slider,
SolaraViz,
SpaceRenderer,
make_plot_component,
)
from mesa.visualization.components import AgentPortray... |
c696810b5ceaaa3288a2513aed426fca82f6b6e4182b9eda4553ca40aa69589c | Python | 1,650 | 53 | # Copyright (c) 2020 10X Genomics, Inc. All rights reserved.
"""The JibesData class used by both the Rust and Python implementations."""
from __future__ import annotations
import numpy as np
import pandas as pd
BARCODE_COL = "Barcode"
class JibesData:
"""The raw data for a JIBES model."""
# pylint: disable... |
44236125aafdee16f5823549c3cb4e86e7581e9dddbbfb0a7f403900e9b32080 | Python | 1,655 | 48 | from mesa.discrete_space import CellAgent
class PDAgent(CellAgent):
"""Agent member of the iterated, spatial prisoner's dilemma model."""
def __init__(self, model, starting_move=None, cell=None):
"""
Create a new Prisoner's Dilemma agent.
Args:
model: model instance
... |
d90125326cdae2b1d0fac4308c87a2a49cb96a96a3bea909471e5cf1c45dd66b | Python | 1,656 | 55 | renderWindow_kwds = {'multiSamples': 8, 'lineSmoothing': True,
'pointSmoothing': True, 'polygonSmoothing': True}
renderer_kwds = {
'background': (1, 1, 1)
}
actor_kwds = {
'specular': .1, 'specularPower': 1, 'diffuse': 1, 'ambient': .05,
'forceOpaque': True, 'color': (.8, .8, .8)
}
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.