sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
3ba3831200199c7626daa229c369d7b9de265731b626beb111414ce6c41a72ea | Python | 2,041 | 41 | if __name__ == '__main__':
"""
This code probably only works within the DKFZ infrastructure (using LSF). You will need to adapt it to your scheduler!
"""
gpu_models = [#'NVIDIAA100_PCIE_40GB', 'NVIDIAGeForceRTX2080Ti', 'NVIDIATITANRTX', 'TeslaV100_SXM2_32GB',
'NVIDIAA100_SXM4_40GB']#, ... |
d623fded78ef35cbe7a4df97d6a02345237b843fc495c208b60882b0c5fed49a | Python | 2,048 | 75 | #!/usr/bin/env python3
#
# Copyright (c) 2016 10x Genomics, Inc. All rights reserved.
#
"""Genes GTF tool for 10x Genomics {product}.
Filter user-supplied GTF files for use as {product}-compatible
genes files for mkref tool.
The commands below should be preceded by '{cmd}':
Usage:
mkgtf <input_gtf> <output_gtf>... |
3796465a5a72c106d49b9177d8fd1fecf90ed9dbc033a5298820be66bcee0b94 | Python | 2,053 | 74 | # %% Add face information to epochs
from __future__ import annotations
import os
import os.path as op
import mne
import pandas as pd
DATA_DIR = '../../NOD-MEEG_upload'
MEG_EPOCH_ROOT = op.join(
DATA_DIR, 'NOD-MEG', 'derivatives', 'preprocessed', 'epochs',
)
EEG_EPOCH_ROOT = op.join(
DATA_DIR, 'NOD-EEG', 'der... |
8ab6b30a9cd541fcc227fba43462a4141ba72f17870de726e6398437a7cf3b64 | Python | 2,054 | 55 | # -*- coding: utf-8 -*-
from detectron2.config import LazyCall as L
from detectron2.layers import ShapeSpec
from detectron2.modeling.meta_arch import RetinaNet
from detectron2.modeling.anchor_generator import DefaultAnchorGenerator
from detectron2.modeling.backbone.fpn import LastLevelP6P7
from detectron2.modeling.bac... |
e2a3bb230185e628aba2220e82aec8b680ca602cdd2da91259aa2cd4e44b6ec4 | Python | 2,054 | 83 | # %%
from __future__ import annotations
import os
import os.path as op
import sys
import mne
from tqdm import tqdm
from src.rsa import pre
sys.path.append('..')
sys.path.append('..')
DATA_DIR = '../../NOD-MEEG_upload'
RES_DATA_DIR = '../../NOD-MEEG_results/data'
GRAND_EPO_DIR = op.join(RES_DATA_DIR, 'grand_epochs... |
c635e896da2365d0783d441be4e2d05625b8ea734ac82b3055023b564881a092 | Python | 2,057 | 60 | #!/usr/bin/env python
#
# Copyright (c) 2021 10x Genomics, Inc. All rights reserved.
#
"""Write pickle files for downstream consumption from the dimension reduced and full matrix."""
import pickle
import martian
import numpy as np
from cellranger.matrix import CountMatrix
__MRO__ = """
stage POST_PCA(
in h5 ... |
8402d24e8052846b4cc8dee9c005035da3998eae67030ba2eca64e29dd665e44 | Python | 2,058 | 67 | """
core/entropy.py
---------------
Spatial entropy of population activity over time windows.
H(t) = -Σ p_i · log2(p_i) where p_i = fraction of spikes on channel i
in the current window.
H_norm = H / log2(k) where k = number of active channels.
H_norm ∈ [0, 1]: 1 = maximally... |
a5c5471f72dbe9d178ca9ee8fab00d9c594159eb438b504d46101f8f158ccd52 | Python | 2,059 | 69 | #!/usr/bin/env python
# multimeter-file.py
#
# Copyright (C) 2009-2010 The NEST Initiative
'''
This file illustrates recording from a iaf_cond_alpha neuron
using a multimeter and writing data to a file.
'''
import nest
import numpy as np
import pylab as pl
nest.ResetKernel()
nest.SetKernelStatus({'overwrite_fil... |
e847f52754e2a4a51fb237cfa40cf0d266bd1431167dd6a5e261a4dd7daa239c | Python | 2,061 | 57 | #!/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 ... |
3838625ec910f971369cedf052898da0b8c62c5e57170b29323137175eaba725 | Python | 2,063 | 60 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from typing import Dict, Tuple
import lomap
import pytest
from gufe import SmallMoleculeComponent
from rdkit import Chem
from openfe import LigandAtomMapping
from ...conftest import mol_f... |
b009d6cc14ccca7b0608b43ebfcc700aff091288a7d7a44c46abf7629f175fbd | Python | 2,066 | 68 | #!/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
import cellranger.vdj.reference as cr_vdj_ref
import cellranger.vdj.reference_maker as ref_maker
__MRO__ = """
stage _MAKE_VDJ_REFERENCE(
in... |
a84970bfcf1b65ff24abdf5e1de9bdcdb9675b72739b4bbc3cfbedb5c0cf4606 | Python | 2,067 | 66 | # Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
"""Create a config that determines which subpipelines will be run."""
from __future__ import annotations
from typing import TYPE_CHECKING
import martian
if TYPE_CHECKING:
import cellranger.mro_types.filetypes as mro_filetypes
import cellranger.mro... |
9eee0fb30f2fb350276299f2ac1444034248642dcc98e71bd8f474a80bbe80f8 | Python | 2,068 | 50 | """Whisper-based transcription with speaker attribution."""
import csv
def transcribe_audio(audio, whisper_model):
"""Transcribe audio using Whisper with word-level timestamps.
``audio`` is a path or a float32 mono 16 kHz numpy array — Whisper accepts
both; the array form avoids decoding the file a seco... |
0ec488be87b0b4c6b7bfea2fa6c60e3ae266980c8117f4929a6cf9aa678586a2 | Python | 2,069 | 55 | # Copyright (c) 2021 10x Genomics, Inc. All rights reserved.
"""Generate the tissue image for the HD websummary."""
import json
import cv2
from PIL import Image
from cellranger.spatial.data_utils import DARK_IMAGES_CHANNELS, HD_WS_MAX_DIM
from cellranger.spatial.image_util import normalized_image_from_counts, shrink... |
e63e912cdfe4f6e6ce0e78cd6929ff29f630845ebb728832879830258e7c5678 | Python | 2,069 | 74 | import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
np.random.seed(42)
# -----------------------------
# 1. Load data
# -----------------------------
X = pd.read_csv("./data/data_0.csv", header=None)
features = pd.read_csv("./data/features_0.csv", header=None)[0].values
y = pd.rea... |
4fba5d0c2585159d539765ef802396ae04048a354b675ab12adfb058e6e69d57 | Python | 2,071 | 71 | """Test setup.
The pipeline's heavy dependencies (torch, whisper, librosa, parselmouth,
resemblyzer) are not needed to exercise its logic, and requiring them would
mean the suite only runs on a machine set up for inference. Any that are
missing get a stub so the pure-logic tests import cleanly; tests that genuinely
ne... |
a274a1c9a744dcb4740611cd644c09f0a924c4cbe42d20b425a70b47b4ed4aaf | Python | 2,071 | 77 | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm
from scipy.optimize import curve_fit
'''
from histograms import plot_histo, plot_z
df=DGdata[dend_name]['branch_info']['branchs'][branchNo]
fig, ax = plot_histo(df)
fig.savefig(plot_path +'/histo.svg', bbox_inches = ... |
96a5036f5008eeb4a3d2d5a3b83cb8e4b2dc7a6e64f6da9f16b2b27262b0093f | Python | 2,077 | 75 | """Utility functions and classes for Mesa's signals implementation.
This module provides helper functionality used by Mesa's reactive programming system:
- Message: a dataclass containing information about a signal change
- SignalType: root enum defining the types of signals that can be emitted
- create_weakref: Help... |
3e095acef0cabd5cd3fd29eea92ee9b576a1d2aa5d3196a76bb94f12c0b88601 | Python | 2,079 | 66 | import logging
from enum import Enum
from functools import partial
from os import PathLike
from pathlib import Path
from typing import Generator, Sequence, Tuple, Union
import numpy as np
import pandas as pd
import scipy.ndimage
from .. import io
logger = logging.getLogger(__name__)
class IntensityAggregation(Enum... |
b9279430c1d3f71156388c7ed7f54efc32fda1609050396a5c5ff09fb252bc83 | Python | 2,079 | 64 | import numpy as np
import sympy
from matplotlib import pyplot as plt
from scipy.signal import butter, filtfilt, find_peaks, periodogram, hilbert, savgol_filter
from scipy.optimize import minimize
def butter_bandpass_filter(data, lowcut, highcut, fs, order=2):
def butter_bandpass(lowcut, highcut, fs, order=2):
... |
f97256147a2563e22f831dcfa503c2f6a95785f722511b9fae590d19363b6c85 | Python | 2,079 | 49 | 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
def convert_kits2023(kits_base_dir: str, nnunet_dataset_id: int = 220):
task_name = "KiTS2023"
foldername ... |
fb5ca1889c3436e6f730ff2ad77dc11866075dc191123edcada90a2758a8056d | Python | 2,082 | 66 | """
Target generation with Legendre functions
See https://zenodo.org/records/7688574
"""
import numpy as np
def legendre_step(n, x, nm1, nm2):
""" Compute Legendre n+1 function from Legendre n and n-1 functions These are orthogonal for uniform random inputs
in [-1,1] """
if n == 0:
next_l... |
a1420f0131577b700d96cefcf1b5aff00a2d5cb8a1852e55f27d954a8ad45cf6 | Python | 2,083 | 77 | """This integration test is designed to ensure that the chemprop model can _overfit_ the training
data. A small enough dataset should be memorizable by even a moderately sized model, so this test
should generally pass."""
from lightning import pytorch as pl
import pytest
import torch
from torch.utils.data import DataL... |
a7de98688798c888c82b1e878c90f38d59e640a3db44b4387fd3e7183efcbfa7 | Python | 2,083 | 61 | # Copyright (c) Facebook, Inc. and its affiliates.
from torch import nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from tensormask import _C
class _SwapAlign2Nat(Function):
@staticmethod
def forward(ctx, X, lambda_val, pad_val):
ctx.lambda_val = lambda... |
7633263dfc2549396997bb98094f7146be30ca1a457a28450d53bba732882c0e | Python | 2,084 | 86 | # 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... |
c59bbbcf76bc5123f3944dbcfa43c62f85396dc60e5d082bf83111d4e80d3a9b | Python | 2,084 | 78 | # -*- coding: utf-8 -*-
"""For testing neuromaps.datasets.utils functionality."""
import os
import pytest
import importlib.resources
from neuromaps.datasets import utils
def test_dataset_json():
"""Test loading dataset JSON."""
from neuromaps.datasets.utils import \
NEUROMAPS_DATASETS, NEUROMAPS_DATA... |
f311f1b0f2d200618ba52f8b27847f7125087d54fafe8bcc53e9d4929e1e5a21 | Python | 2,085 | 45 | import numpy as np
import pickle
from matplotlib import pyplot as plt
import os
from rCPGswCPG.Network import firing_rate
from rCPGswCPG.Network import construct_model
from rCPGswCPG.model_params.config_loader import load_model_cfg_file, model_params_from_cfg
from rCPGswCPG.protocols.protocols import run_standalone_pro... |
c08826b8be2727f35eaa53e1d2eea282c652a4c3068dd829b648573b1ada8798 | Python | 2,086 | 66 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
import torch
from torch import nn
from torch.nn import functional as F
from detectron2.config import CfgNode
from detectron2.layers import Conv2d
from ..utils import initialize_module_params
from .registry import ROI_DENSEPOSE_HEAD_REGISTRY
@ROI_DEN... |
24eab4780983dc83280391bb6e47ecf08a3a7dde7aa47ec697e1b845b5ae469f | Python | 2,087 | 50 | import subprocess
import os
def get_allowed_n_proc_DA():
"""
This function is used to set the number of processes used on different Systems. It is specific to our cluster
infrastructure at DKFZ. You can modify it to suit your needs. Everything is allowed.
IMPORTANT: if the environment variable nnUNet... |
5d5f1dbd103af76434e21ea4a94ba58555263432996b0f579d99fe77d997fc4f | Python | 2,088 | 68 | 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 ..regionprops import try_measure_regionprops_from_disk
@click.command(name="regionprops",... |
2a5634b0b8d6d32923f494de955cccf69cd18abbe0c54d205d48d66759aab953 | Python | 2,093 | 55 | # 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... |
351b765560cebabded29330c7254a1a5a9ac503a55360b462a5657cc829cc725 | Python | 2,093 | 59 | #!/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... |
b10e5487f85c14d8dd09ea9bfd02f74ece71f2a0c766ada97a3e8025428bf3d9 | Python | 2,093 | 70 | import matplotlib as mpl
import seaborn as sns
import matplotlib.pyplot as plt
PALETTE = sns.color_palette("deep")
def apply_global_style():
mpl.rcParams.update({
# --- Fonts ---
'font.family': 'sans-serif',
'font.sans-serif': ['Arial'], # requires Arial installed
... |
d211f2ea885f730b5df244f91e3cec7fae3297284be6e9144c328cbcabfc69dc | Python | 2,098 | 84 | # Before we do anything else, we want to disable JAX
# acceleration by default but if a user has set
# PYMBAR_DISABLE_JAX to some value, we want to keep
# it
import logging
import os
logger = logging.getLogger(__name__)
if "PYMBAR_DISABLE_JAX" in os.environ:
logger.info(
f"PYMBAR_DISABLE_JAX set to {os.e... |
42f57a6451f5d9077ae22e2cfb4d597d0a7d96dc8926debf7dbe3dee80f56be4 | Python | 2,101 | 66 | import importlib
import os
import pytest
from openff.utilities.testing import skip_if_missing
import openfe
@skip_if_missing("duecredit")
@pytest.mark.skipif(
(os.environ.get("DUECREDIT_ENABLE", "no").lower() in ("no", "0", "false")),
reason="duecredit is disabled",
)
class TestDuecredit:
@pytest.mark.p... |
e5923168c66b4aca980a316650d0054bd416cfe343ddccb900ba27317c2ccc0d | Python | 2,101 | 68 | import tensorflow as tf
import numpy as np
import math
import random
from sklearn import preprocessing
from tensorflow.examples.tutorials.mnist import input_data
seed=1 # set a seed
# load the MNIST dataset
mnist=input_data.read_data_sets("../MNIST_data/",one_hot=True)
train_X,train_Y,test_X,test_Y,val_X,val_Y=mnist... |
0cc14edc07716e13802ba33311af044586261614ed3672ddb78847b09a81b525 | Python | 2,108 | 79 | """ Created on Mon Oct 30 12:27:04 2023
@author: dcupolillo """
import numpy as np
import torch
def modified_okada_filter(time_series: torch.Tensor) -> torch.Tensor:
"""
Trace filtering (PyTorch version).
Ishikawa et al.,
"Functional Multiple-Spine Calcium Imaging from Brain Slices"
STAR Prot... |
3b6167e1403057503c5eadd30b3d7b77f4c8f23378bcc4b6f3f836838631f833 | Python | 2,109 | 69 | #%% imports
import sys
sys.path.append('/mnt/obob/staff/fschmidt/neurogram/cluster_jobs')
from cluster_jobs.stats_across_irasa_s_chan import StatsAcross #control
from plus_slurm import SingularityJobCluster, PermuteArgument
import os
import numpy as np
#% get jobcluster
job_cluster = SingularityJobCluster(required_ra... |
5247c6d965b919e11398bf06d393043276b76535669402d266cd87b159df3042 | Python | 2,114 | 42 | from copy import deepcopy
from batchgenerators.utilities.file_and_folder_operations import *
from nnunetv2.paths import nnUNet_preprocessed
from nnunetv2.utilities.dataset_name_id_conversion import maybe_convert_to_dataset_name
if __name__ == '__main__':
import argparse
parser = argparse.ArgumentParser()
... |
696e8ed174cde7b718b7fe51f4fab86b57924363657dfe54a4441b5e19789700 | Python | 2,116 | 72 | #!/usr/bin/env python
#
# Copyright (c) 2022 10X Genomics, Inc. All rights reserved.
#
"""Convert antibody_analysis folder out to a single file aggregate_barcodes.csv out."""
from __future__ import annotations
import os
from typing import TYPE_CHECKING
import martian
import cellranger.rna.library as rna_library
fro... |
7a52631893f0ad3291c8cf742886002a4a0bc9c10b4056fcd01ea94187db56bb | Python | 2,116 | 74 | """"Term definitions."""
####################################################################################################
####################################################################################################
TERMS = {
# Set the aperiodic measure terms
'AP' : [
[
'aperio... |
f9ecfc10e478d4b21184d6f89b378e4cf49ae23a6112239a1126abecf94147f7 | Python | 2,125 | 66 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import abc
from typing import Iterable
import gufe
from gufe import SmallMoleculeComponent
from . import LigandAtomMapping
class LigandAtomMapper(gufe.AtomMapper):
"""
Suggest ato... |
afbd8d0c1b5684733838cf312b39700ef23b90a757d735e3ae9f8be18536e55d | Python | 2,128 | 49 | #!/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... |
71454792b71a85102eed29992d6ba473d25d9a7ff574c2496d87f982fb78a112 | Python | 2,133 | 67 | from typing import Any, Dict, Mapping, MutableSequence, Optional
from brian2 import Quantity, msecond, mvolt, nfarad, nsiemens, hertz
UNIT_MAP = {
'C': nfarad, # Capacitance
'V': mvolt, # Voltage
'v': mvolt,
'delay': msecond, # Axona... |
41052525863d55887e07c11bb61b335bdd01709d2d7a045d9714eea4d6dc5a50 | Python | 2,137 | 75 | """
Created on 10/08/2017
@author: Niklas Pallast
Neuroimaging & Neuroengineering
Department of Neurology
University Hospital Cologne
"""
import matplotlib.pyplot as plt
import os, sys
import numpy as np
import scipy.io as sio
np.seterr(divide='ignore', invalid='ignore')
import seaborn as sns
def matrixMaker(ma... |
0e5d963b02d82dfd297cba5a6c266d21d151c8a66b2ba42d737bad671e463d88 | Python | 2,139 | 69 | """Solara visualization related helper classes."""
class UserParam:
"""UserParam."""
_ERROR_MESSAGE = "Missing or malformed inputs for '{}' Option '{}'"
def maybe_raise_error(self, param_type, valid): # noqa: D102
if valid:
return
msg = self._ERROR_MESSAGE.format(param_type,... |
357ab72c5b7704b74740ef7e0cd23ca52a792cf78cd7bc828e8fb21e22270e76 | Python | 2,140 | 57 | #python proteinGroupsCombineFP.py VibekeV/ "*.FP.result"
#output from bash slurmFP.sh /nird/projects/NS9036K/NORSTORE_OSL_DISK/NS9036K/promec/promec/Elite/LARS/2018/mai/Vibeke\ V
#!pip3 install pandas --user
# %% setup
import sys
from pathlib import Path
import pandas as pd
# %% data
pathFiles = Path(sys.argv[1])
#path... |
0880dea769f10b735be13f6c145de1ae439f6dce7fd02865999e18386adbe80e | Python | 2,141 | 54 | #python geneGroupsCombineDIANN.py L:\promec\TIMSTOF\LARS\2025\251107_PREETHI *report.unique_genes_matrix.tsv
#runDIANN.bat F:\promec\TIMSTOF\LARS\2025\251107_PREETHI 10 --high-acc
#!pip3 install pandas --user
# %% setup
import sys
from pathlib import Path
import pandas as pd
# %% data
pathFiles = Path(sys.argv[1])
#pat... |
8eb5af7f7496b5772e902a67ef952f75c1d6e5583154cc0e6d9034e841de910c | Python | 2,141 | 66 | import unittest
from detectron2.solver.build import _expand_param_groups, reduce_param_groups
class TestOptimizer(unittest.TestCase):
def testExpandParamsGroups(self):
params = [
{
"params": ["p1", "p2", "p3", "p4"],
"lr": 1.0,
"weight_decay": 3... |
d9fec70f78cbeb2a964117bf7ec26280d28c19c7cc925b89cb9b0fc8a1f79310 | Python | 2,143 | 49 | import sys
if len(sys.argv)!=3: sys.exit("\n\nREQUIRED: pandas! Tested with Python 3.7.9 \n\nUSAGE: python resultsGroupby.py <path to file of interest like \"L:\promec\mqpar.xml.1623227664.results\combined\txt\proteinGroupsCombine.py> <column of interest like \"Score\"\n\n")
#python resultsGroupby.py "L:\promec\USERS\S... |
6e26dddecbc885b9885f72f34812121b5a7d0081fcbc687a74ce76ff2eadd0d0 | Python | 2,144 | 65 | '''
Created on Jan 15, 2025
@author: voodoocode
'''
import csv
import finnpy.file_io.data_manager as dm
import feat_ex.spiking.core
META_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/spiking_pictures/"
DATA_PATH = "/mnt/data/Professional/LMU/data/Beta-prevalence/database"
FS = 10000
OUT_PATH = "/mnt/dat... |
2ba224184fc51c30ce0703c7c79417fda2f7a1a662a80ef5501815fbe59c79d0 | Python | 2,145 | 89 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
import random
from collections.abc import Callable
from enum import Enum
from typing import Callable as TCallable
from typing import List
FrameTsList = List[int]
FrameSelector = TCallable[[FrameTsList], FrameTsList]
class FrameSelectionStrategy(Enum)... |
9f6b3dacd76019ddc0cf529ec0f7cd0cfb25d11de8f834e1b5414848f3ed1c8a | Python | 2,148 | 55 | #python proteinGroupsCombineDIANN.py "L:\promec\TIMSTOF\LARS\2026\260518_Sonali\saga_batch\" "*.dreport.ppm15bm.pg_matrix.tsv"
#!pip3 install pandas --user
# %% setup
import sys
from pathlib import Path
import pandas as pd
# %% data
pathFiles = Path(sys.argv[1])
#pathFiles=Path("L:/promec/TIMSTOF/LARS/2026/260518_Sonal... |
c0786406e2a20d729b2b3be7cb0d041491ddb9e42d36cf58d7b1bdfc3cfcfaff | Python | 2,148 | 68 | """Unit tests for mesa_logging."""
import logging
import pytest
from mesa import mesa_logging
@pytest.fixture(autouse=True)
def tear_down():
"""Pytest fixture to ensure all logging state is reset after testing."""
yield
mesa_logging._logger = None
mesa_logging._rootlogger = None
mesa_logger = l... |
24e6f30aaa077d6a83915be6eed9190508aae9b45ee66b114230181663eae62a | Python | 2,149 | 70 | # Copyright (c) 2019 10X Genomics, Inc. All rights reserved.
"""Generate aggr web summary from the individual json data."""
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... |
bfb4f2f41b247fb0245f71888112ba8c5a4989a568cd95ff0843548a15328b8d | Python | 2,150 | 57 | from typing import Optional
import matplotlib.pyplot as plt
import numpy as np
import numpy.typing as npt
from matplotlib.axes import Axes
from scipy.interpolate import griddata
from .base import setup_axes, set_figsize
__all__ = [
"plot_loss_contour",
"plot_specific_measures"
]
def plot_loss_contour(zs: n... |
f7a7ba958ca728fba657951b1b3c90d22143b223f11086a965382f42af4298cd | Python | 2,151 | 68 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
854896b0931b540a84d9842628c8dc074c947021ddc19cc17e476df0ace97f1a | Python | 2,152 | 82 | # This ccode is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import json
import gufe
import pytest
from gufe.tests.test_tokenization import GufeTokenizableTestsMixin
from openfe.protocols import openmm_md
@pytest.fixture
def protocol():
return... |
079ffaee38b16e35ec521ed741a2687e63b466eff84640a01f355d009d9bb743 | Python | 2,153 | 62 | # coding: UTF-8
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
import copy
class CNN(nn.Module):
def __init__(self, batch_size=128, embedding_size=20, num_tokens=100, num_filters=100, filter_sizes=(2, 3, 4), num_classes=1, num_heads=4):
super(CNN, self).__init__()
... |
81efebeb55b44d584361295cedfb9d29073a87a1d5f2ef7aa2bc1bc8f10f58eb | Python | 2,153 | 69 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pytest
from openff.units import unit
from openff.utilities.testing import skip_if_missing
from openfe.setup.atom_mapping import LigandAtomMapping, PersesAtomMapper
@skip_if_missing(... |
91e679223e67628aec3ed81aaeddd00a40bc69abfffa240ca5decf95e7467024 | Python | 2,154 | 46 | # 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... |
76a84bb4166172bc8d13ace773feac7f6db8a51e1953fbef9e4862742bcee28f | Python | 2,157 | 68 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
f49257dd0e3aeb604d8cca09877f1b4a9426f34d6b36a5efc382958989bedc93 | Python | 2,158 | 68 | import random
import yaml
from pathlib import Path
import torch
from torch.utils.data import DataLoader, Subset, Dataset
from torchvision.datasets import ImageFolder
from PIL import Image
from .. import config
class SingleDataset(Dataset):
def __init__(self, item):
if isinstance(item[0], torch.Tensor):
... |
d3f54cd1225aba8779d49066ae86557ecac162311efe2baa0ce4663990d68636 | Python | 2,162 | 70 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
from support.config import ALGORITHMS, ALGORITHM_LABELS, COLORS
from support.plot_helpers import tables
def prepare_data(results_or_tables, top_n: int = 20) -> pd.DataFrame:
data = tables(results_or_tables)["permutation_importance"].copy()
... |
2d365d6e06b10785633ff3c4293f3b7f2d0cc8385488b82b26d2dcbe6b6fb9ae | Python | 2,163 | 75 | import pandas as pd
import numpy as np
from sklearn.ensemble import RandomForestClassifier
from boruta import BorutaPy
np.random.seed(42)
# -----------------------------
# 1. Load data
# -----------------------------
X = pd.read_csv("./data/data_0.csv", header=None)
features = pd.read_csv("./data/features_0.csv", heade... |
1a612d2a0805801a4a2555f4b544b6a0c8e8746e6cfc6c8e3aa260885bcb7cc1 | Python | 2,165 | 71 | #!/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... |
a6d83c6a43d91af2e9dc3985a0a08d12b6b5b72832536c91759e5c754c39e3a0 | Python | 2,167 | 60 |
############################################################################
# Copyright (c) 2022-2026 University of Helsinki
# All Rights Reserved
# See file LICENSE for details.
############################################################################
import os
import subprocess
from collections import namedtupl... |
fe8228b892a1f647db3674f388f545c3c0cf6016c8ca5c1e0aeaa15b0b387847 | Python | 2,168 | 55 | from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_json
from batchgenerators.utilities.file_and_folder_operations import join, subdirs, maybe_mkdir_p
from nnunetv2.paths import nnUNet_raw
if __name__ == '__main__':
"""
this dataset does not copy the data into nnunet format and just ... |
9890e89d78b838983d49931c9d2056c8ef24a8cca1839694279afee2a66cedf5 | Python | 2,173 | 68 | import sys
from lightning import pytorch as pl
import pytest
import torch
from torch.utils.data import DataLoader
from chemprop import nn
from chemprop.conf import LIGHTNING_26_COMPAT_ARGS
from chemprop.data import MoleculeDatapoint, MoleculeDataset, collate_batch
from chemprop.models import MPNN
@pytest.fixture
de... |
0df2a851a6dab372024ced23273af910ee6f24bd4f65641cb17b6ceea91efd68 | Python | 2,174 | 66 | #
# Copyright (c) 2024 10X Genomics, Inc. All rights reserved.
#
"""Stage checking if bcs in cloupe and feature-bc matrix are the same."""
import subprocess
import martian
import cellranger.matrix as cr_matrix
import tenkit.log_subprocess as tk_subproc
__MRO__ = """
stage CHECK_CLOUPE_MATRIX_CONSISTENT(
in clo... |
0598f7222102dda936e75a882abd1e938d20f94550ba29c773681a2dbe6c5224 | Python | 2,175 | 57 | #!/usr/bin/env python
# Copyright 2017-2026 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... |
c5e36df0e7b69d80ea71c0d640316e62110ac43fce5ccd6ec8fc10fcb413ce6a | Python | 2,176 | 71 |
import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, nb_classes=40, chans=128, samples=440, dropout_rate=0.5,
kern_length=128, F1=8, D=2, F2=16):
super(Model, self).__init__()
# Block 1: Temporal + Depthwise
self.co... |
e4adc1e9a5439cec29668a85acdae5398de3c9b9d0a243f7e5527b35a3ba25dd | Python | 2,176 | 94 | """This tests the CLI functionality of training and predicting a regression model on a multi-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" / "rxn" / "rxn.csv"), str(
data_dir / "reg... |
ef25956358d172e4cd307cb543fc1fdde77d8b56d81847cf71f70452062890fd | Python | 2,180 | 58 | from __future__ import annotations
import os
import sys
from pathlib import Path
import pytest
from src.utils import app_paths
IS_WINDOWS = os.name == "nt"
IS_LINUX = sys.platform.startswith("linux")
IS_MACOS = sys.platform == "darwin"
@pytest.mark.skipif(not IS_WINDOWS, reason="Windows-only path resolution")
def... |
f3f69e331615385e8ed56cc01b99273bfd3abeae36ec140384529d054a0e9e88 | Python | 2,180 | 68 | import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
def default_settings(lw=1, column=2, width=2.6 * 3, length=3, ts=9, ls=9, fs=9):
if column == 1.5:
width = 4.5
elif column == 1:
widdefault_settingsth = 3.42
elif column == 2:
width = 7
plt.rcParams['figure.f... |
16f050a71b2f65bad8344d9b3319cac60fa81e97b95d583a0095e4262172f72d | Python | 2,183 | 86 | """This integration test is designed to ensure that the chemprop model can _overfit_ the training
data. A small enough dataset should be memorizable by even a moderately sized model, so this test
should generally pass."""
from lightning import pytorch as pl
import pytest
import torch
from torch.utils.data import DataL... |
68b4989b785483cd73ef426312a83eddef55c5301ad48a138f5435a2d5f8840b | Python | 2,185 | 63 | from pyopenms import *
import pandas as pd
import numpy as np
import datashader as ds
import holoviews as hv
import holoviews.operation.datashader as hd
from holoviews.plotting.util import process_cmap
from holoviews import opts, dim
import sys
hv.extension('bokeh')
exp = MSExperiment() # type: PeakMap
loader = MzMLF... |
d5b21485ec81fd445ec7643ae5086688477f8f8d5d316bc07083d330804a1b94 | Python | 2,185 | 54 | import nibabel
import numpy as np
from batchgenerators.utilities.file_and_folder_operations import *
from nnunetv2.dataset_conversion.generate_dataset_json import generate_dataset_json
from nnunetv2.paths import nnUNet_raw
if __name__ == '__main__':
base = '/home/isensee/Downloads/TotalsegmentatorMRI_dataset_v10... |
c903535a916b9859ae66b50db21117d73d0276d978653906e96d078c12ca2148 | Python | 2,188 | 90 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pytest
from openfecli.parameters import plan_network_options
@pytest.fixture
def full_yaml():
return """\
mapper:
method: LomapAtomMapper
settings:
timeout: 120.0
netwo... |
cde67ff2c43093e8a2d5a10928caf6b45acb87905ab2bb6c8de7bb6ab182f7bd | Python | 2,197 | 57 | #streamlit run streamData.py --server.headless true
import streamlit as st
st.set_page_config(page_title="IDH1 MUT WT control data")#,page_icon=img)
hide_menu_style = """
<style>
MainMenu {visibility: hidden; }
footer {visibility: hidden;}
</style>
"""
st.markdown(hide_menu_style... |
70cd5cde7f858497dc290e9674edeb6f8af359c35fdf85efc216b915fe70ed54 | Python | 2,199 | 68 | import sys
import unittest
from pathlib import Path
import numpy as np
SCRIPTS = Path(__file__).resolve().parents[1] / "scripts"
sys.path.insert(0, str(SCRIPTS))
from baseline_models import grid_search_grouped_cv
class GroupedGridSearchTests(unittest.TestCase):
def setUp(self):
self.features = np.asar... |
4d4d19206277e314a012f7b751de46675b9728174def71cd7f9dd03e78f18880 | Python | 2,204 | 91 | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 7 12:15:27 2021
@author: alber
"""
# convert float to percentage string
def convert_to_percentage(f) :
if f != "" :
print("Converting \"%.4f\"..." % f)
percentage = f
return "%.1f" % percentage
else :
return ""
# script to create... |
fe7935f64b69c81e43c7703a318dfab4fc221ffce5f1780f01ca3653eaa5b157 | Python | 2,204 | 52 | from __future__ import annotations
import numpy as np
METRICS = ("r2", "mae", "mse", "rmse")
def weighted_metrics(y_true: np.ndarray, y_pred: np.ndarray, weights: np.ndarray) -> dict[str, float]:
y_true = np.asarray(y_true, dtype=np.float64)
y_pred = np.asarray(y_pred, dtype=np.float64)
weights = np.as... |
1c611a30c5befd28ce736ef48a04df7c36f0cdb481f712ae7a65582039600486 | Python | 2,208 | 61 | from pathlib import Path
from typing import Optional
from .. import io
from .trial import TrialView
__all__ = [
'get_results_path',
'get_hfb_path',
'get_artifact_path'
]
def get_results_path(trial: TrialView, chkpt: Optional[int] = None, *,
subdir: Optional[str] = None, ext: str = '... |
b56da9baa15ad3b5b1dfd684f1d6674bf3e6c17dcb6c7ee6940860bfacd72c90 | Python | 2,208 | 64 | #!/usr/bin/env python3
# Copyright 2004-present Facebook. All Rights Reserved.
from detectron2.config import configurable
from detectron2.utils.registry import Registry
from ..config.config import CfgNode as CfgNode_
from ..structures import Instances
TRACKER_HEADS_REGISTRY = Registry("TRACKER_HEADS")
TRACKER_HEADS_R... |
e6af4dd70fe743e6c829d9cd1df3d4c6f2b4478f1bf4f9a4b9a146db72b12cfd | Python | 2,208 | 78 | import numpy as np
import torch
from sklearn.metrics.pairwise import cosine_similarity as cos
import pandas as pd
import scipy
import dgl
from scipy import sparse
from numpy.linalg import matrix_power
import random
def feature_cos(data, target, t):
features = data['feature_dict'][target]
cos_graph = cos(feat... |
2a91b94ffbc5a11e926e33e21b3765b57b78cc546849dfc47e4cf018ddc55b1e | Python | 2,209 | 74 | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# pyre-unsafe
import logging
from collections import UserDict
from dataclasses import dataclass
from typing import Iterable, Optional
from ..utils import maybe_prepend_base_path
@dataclass
class MeshInfo:
name: str
data: str
geodist... |
c86aa55e1391cd008a5f46b39171da012d12a43fee68d6933615aa817e0cb07e | Python | 2,209 | 55 | from typing import Optional
import pandas as pd
import xarray as xr
from ._types import RatesDatabase
from .base import _copy_attrs, attach_labels, infer_rates, infer_occurrences, get_averages_stdev
__all__ = ["create_rates_db"]
def create_rates_db(records: xr.DataArray, labels: Optional[pd.DataFrame] = None,
... |
6820c6cc62f9c85b0644f0c25da65d6b91dc09e892e2ec174184d0d61ac4a4e0 | Python | 2,210 | 74 | import copy
from numpy.typing import ArrayLike
from sklearn.preprocessing import StandardScaler
import torch
from torch import Tensor, nn
from chemprop.data.collate import BatchMolGraph
class _ScaleTransformMixin(nn.Module):
def __init__(self, mean: ArrayLike, scale: ArrayLike, pad: int = 0):
super().__... |
fe742aea0c4fe7f6f8ee6c1447d213a8fc725e39bace02d3cad40e09cccaa78e | Python | 2,213 | 39 | import pickle
from rCPGswCPG.utils.gen_utils import get_project_root
from rCPGswCPG.model_params.config_loader import load_model_cfg_file, model_params_from_cfg
from rCPGswCPG.Experiment import Experiment
import numpy as np
import os
# see class Experiment for more details
# Runs the experiment only if the correspondi... |
d4b688e10d9692bcfa756720920314347f31df3a13d37cff3c0a501c2ac6610a | Python | 2,220 | 64 | import DeepLINK as dl
import numpy as np
import pandas as pd
from PCp1_numFactors import PCp1 as PCp1
x_design = 'linear' # factor model design
y_design = 'linear' # link function design
r = 3 # number of factors
n = 1000 # number of observations
p = 500 # number of features
s = 10 # number of true signals
... |
afe68d9371a982f8ef1533d6358727cace4b0f470bc77e61690604c563b0aeb1 | Python | 2,221 | 52 | """File I/O for saving pipeline results."""
import csv
import json
def save_json(data, path):
"""Save data as indented JSON."""
with open(path, "w") as f:
json.dump(data, f, indent=2)
def save_vowel_averages_csv(avgs, path):
"""Save vowel formant averages to CSV."""
with open(path, "w", new... |
cc1b791051e5e6438fe9c7c28079aaeb93ff206a89b92ef516c57182c481ad65 | Python | 2,224 | 56 | #streamlit run streamVennData.py --server.headless true
import streamlit as st
st.set_page_config(page_title="IDH1 MUT WT 24H TMZ*DMSO*data")#,page_icon=img)
hide_menu_style = """<style>MainMenu {visibility: hidden; }footer {visibility: hidden;}</style>"""
st.markdown(hide_menu_style, unsafe_allow_html=True)
import pan... |
eb1728b65b24c4580ab682d624eadbd55433fb8a3399ac8648dfca54e191d6f2 | Python | 2,226 | 117 | import scanpy as sc
from bbknn import bbknn
import time
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
adata_path = "PATH_TO_INPUT/combined_adata.h5ad"
adata = sc.read_h5ad(adata_path)
sc.pp.normalize_total(adata, target_sum=1e4)
sc.pp.log1p(adata)
sc.pp.scale(adata, max_value=10)
sc.tl.pc... |
df03e29f621ecb35273479abba3b4abe0129b71538155494c3eb7778cb38bfc1 | Python | 2,231 | 75 | # Copyright (c) Facebook, Inc. and its affiliates.
# pyre-unsafe
from dataclasses import dataclass
from enum import Enum
from detectron2.config import CfgNode
class DensePoseUVConfidenceType(Enum):
"""
Statistical model type for confidence learning, possible values:
- "iid_iso": statistically independ... |
dfefaea1ede2cb94c663b986c6798e4710086ab182ab72ee726141f9f6d16c4b | Python | 2,231 | 77 | # __LIBRARIES__
import numpy as np
import pandas as pd
from sklearn.metrics import roc_auc_score, r2_score
# __FUNCTIONS__
def stacked_multi_omic(df_predictions, y, task_type, n_iter=10000):
"""
Functions to compute the stacked generalization using the prediction of
models trained on individual omics.... |
62c4fa0aee56a97229ee26faa7c91fdb8e11bb8a7932ede70fdce54a5fdf8a13 | Python | 2,238 | 65 | import os
import anndata
import numpy as np
import scanpy as sc
import matplotlib.pyplot as plt
import pandas as pd
os.chdir('/home/data/gbb/project4_ONC201')
os.getcwd()
adata = sc.read_h5ad("snRNA_noHealthy.h5ad")
print(adata.obsm.keys())
sc.pp.neighbors(adata,use_rep='X_pca', n_pcs=17)
sc.tl.umap(adat... |
7ecf515f29c70a98c8162240eb41f5b8e38b7801217d4918a82c637de26b5e74 | Python | 2,241 | 65 | """Provides functions for applying jitter to synaptic delays in HSNN layers.
This module contains utilities for perturbing synaptic delays, which can be
useful for introducing noise or variability during simulations or training
of spiking neural networks. This includes setting synaptic delays from a
pandas dataframe.
... |
a84eb412c6d916befb0aa7190915408ea43185ad0c822aff3123ad48c35a2616 | Python | 2,241 | 39 | import glob
import random
import numpy as np
import json
import itertools
#MODIFY this path
with open('/home/justas/projects/lab_github/mpnn/data/pdbs.jsonl', 'r') as json_file:
json_list = list(json_file)
my_dict = {}
for json_str in json_list:
result = json.loads(json_str)
all_chain_list = [item[-1:] fo... |
f4083b508a4ed0dbafba2f18f14954a703544833e3c12e0bd5d45054581c85bb | Python | 2,246 | 70 | import torch.nn as nn
from ..models.visualModels import ViT, SimpleEEGCNN, ResNet18Wrapper
from ..models.VisualTransforms import LogPowerSpectrum, LogWaveletCWT
import numpy as np
from typing import Optional, Literal
class Model(nn.Module):
def __init__(
self,
spec_type: Literal["stft", "cwt"] = "... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.