sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
095364b6951d9fb24d69a24679f3bef22c48f5851112377b06288ecf73a317c6
Python
2,650
87
# 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...
ec22246561e5cd3f57dbe0ab8f809ef39c5afdfd525c6a29d4b97b37fd45c0ed
Python
2,653
89
from __future__ import annotations import subprocess import logging from dateutil.parser import parse from datetime import datetime import xarray import io import os import numpy as np import importlib.resources as impr from .build import build SIMOUT = ["ne", "Tn", "Ti", "Te", "nO+", "nH+", "nHe+", "nO2+", "nNO+", "...
83411db94e0273d122df3d3050e3566ce55e661f9a943aaa6fa115540f3dc832
Python
2,654
71
import argparse import nibabel as nib from glob import glob import os from tqdm import tqdm from utils import SUBJECTS, FMRI_BETAS_DIR SPLITS = ['train_image', 'train_caption', 'test_caption', 'test_image', 'imagery', 'blank'] SUFFIX = "*bf(1)" def get_subdir(split_name, beta_dir): subdir = os.path.join(beta...
43c4d8c189f52bec16b2f4604fd0a5375e4a1761e37682deddce473305706708
Python
2,656
46
from __future__ import annotations import tensorflow as tf from tensorflow.keras import layers, Model from .layers import ClassToken, Patches, PatchEncoder, transformer_encoder def vit_feature_path(image_input, patch_size: int, config: dict, name: str): pad_size = int(config.get("pad_size", 160)) hidden_dim ...
e13c3b5cf74819b0b59455b820f81db234b46ef3fe2ee2712c4c6084f49c53a0
Python
2,656
79
import pytest from multiqc import config, report from multiqc.modules.umicollapse import MultiqcModule from multiqc.plots.table_object import InputRow from multiqc.types import SampleName, SectionKey @pytest.fixture(autouse=True) def reset_config(): """Reset config state after each test.""" original_preserve ...
9409625a9ef303400aef8c4c9caae11a18c36cf2fbe9d68a2f42cb17df11b8cd
Python
2,658
81
"""Source reconstruction. This includes: coregistration, beamforming and parcellation. """ import numpy as np from dask.distributed import Client from osl import source_recon, utils # Author : Chetan Gohil <chetan.gohil@psych.ox.ac.uk> source_recon.setup_fsl("/well/woolrich/projects/software/fsl") def fix_headsh...
bb33a1780cbdd391e81c34c15f3a9e222b128802cf144a04136f682cc7f4a7a1
Python
2,658
61
from __future__ import absolute_import from builtins import range from .__init__ import ForceBalanceTestCase import numpy import forcebalance import re, sys from math import cos, sin, pi import pytest class TestFiniteDifference(ForceBalanceTestCase): @classmethod def setup_class(cls): super(TestFiniteD...
6929aacb88d5a3a6004a6c9c7ff39d0004ce6414a69a5c11efc8aa00229ac287
Python
2,664
61
''' Author: Zhongming Liang lzzzmmgpt@gmail.com Date: 2026-04-26 15:22:43 LastEditors: Zhongming Liang lzzzmmgpt@gmail.com LastEditTime: 2026-04-26 20:52:04 FilePath: /liangzhongming/phd_code/ModelTest/CellNiche/cellniche/__init__.py Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBK...
2c7c38211c7a632d1731fa8b8a9edaff810da4452745b7da60a60bd889f9f557
Python
2,678
92
# Copyright 2022 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
8bd274da92afcd84fd7ae93bdc0b5000d2a5eb4318c8d0a558d87eedee6614b7
Python
2,681
59
"""add dataset models Revision ID: 4efc63729750 Revises: 0f24a7f21b23 Create Date: 2025-04-10 13:17:21.342253 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = '4efc63729750' down_revision: Union[str, None] = '0f24a7f21b23...
a5db78784e3f357413b809159c301682449c6236734bc322325c4684105fb1fd
Python
2,681
75
import sys sys.setrecursionlimit(10000) # print("/n/nRecursion limit set to:", sys.getrecursionlimit()) import getopt import traceback import os import platform from pathlib import PurePath import PySide6 import sys from PySide6.QtWidgets import QApplication from gui.RaidionicsMainWindow import RaidionicsMainWindow im...
349d83dc673d5088dd3fa12f9a5c894c1755a3184e415e0be2a1ca0df331eeb5
Python
2,684
54
import torch import torch.nn as nn import torch.nn.functional as F import math ########################## #### Genomic FC Model #### ########################## # 定义一个神经网络模块,包含一个全连接层、一个SELU激活函数和一个AlphaDropout层。 class SNN_Block(nn.Module): def __init__(self, dim1, dim2, dropout=0.25): super().__init__() ...
07d51313b3eb0d8448232c5ceb9ba735e57209a07239ec8f212935538e751eb7
Python
2,685
73
#!/usr/bin/env python3 # author : Alina Kutlushina # date : 15.05.2020 # license : BSD-3 #============================================================================== __author__ = 'alina' import os import argparse import numpy as np from rdkit import Chem from rdkit.Chem import AllChem f...
9c95b6deb8d1fd2b7eab39e9d4d85a4ed7f141ab1a6ead4ca2f847733b57a20c
Python
2,687
68
#!/usr/bin/env python ############################################################################## # Medical Image Registration ToolKit (MIRTK) # # Copyright 2013-2015 Imperial College London # Copyright 2013-2015 Andreas Schuh # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
797c7df57b29edb2cb2dbe3d7c562a5ab642b38a66fa2a0d5ae1e07637e296d2
Python
2,688
86
#!/usr/bin/env python import sys import os from subprocess import * if len(sys.argv) <= 1: print 'Usage: %s training_file [testing_file] [kernel_type]' % sys.argv[0] raise SystemExit # svm, grid, and gnuplot executable files is_win32 = (sys.platform == 'win32') if not is_win32: svmscale_exe = "../svm-scale" svm...
36be01d9c6c7b58580a4a8a077e079e2f5191e3dcbc8c8c234a6dd6d9e72145c
Python
2,689
90
""" MultiQC configuration file validator script. """ import logging import sys from pathlib import Path import yaml from pydantic import ValidationError from rich.console import Console, group from rich.highlighter import ReprHighlighter from rich.panel import Panel from rich.text import Text from multiqc.utils.conf...
339ab9eb13a9ed97cadb59a2d2038224ff1d5e25a33ef6d31e6bfedfa63256af
Python
2,692
80
""" Configuration for the RAG agent. """ from dataclasses import dataclass, field import os from typing import Optional from linkml_store import Client from linkml_store.api import Collection from aurelian.dependencies.workdir import HasWorkdir, WorkDir from . import COLLECTION_NAME @dataclass class RagDependencies...
6858abccdc876838e75f915fa8e55e882eadf6590ef7b34c3d75603e4eec33a8
Python
2,692
87
from data_provider.data_loader import Dataset_ETT_hour, Dataset_ETT_minute, Dataset_Custom, Dataset_M4, PSMSegLoader, \ MSLSegLoader, SMAPSegLoader, SMDSegLoader, SWATSegLoader, UEAloader, Dataset_Meteorology from data_provider.uea import collate_fn from torch.utils.data import DataLoader data_dict = { 'ETTh1'...
639d576c67891a8b1955118d147db6e1a369ea64794c355dace719b3fa16d4af
Python
2,695
85
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Reconstruct ancestral sequences using FastML based on multiple sequence alignments and evolutionary trees. Input: - MSA files (*.align.fa) generated by MUSCLE - Tree files (*.newick) generated by phyloFit - Input file name defines the subdirectory for each set of data...
08a3dd5fac7387470b2d0283853e4c4291ec4c4fc897b4dd7c01919094833d6a
Python
2,699
94
import signal import pytest from alchemiscale.compute.signals import ( DEFAULT_STOP_SIGNALS, install_stop_handlers, ) class StopRecorder: """Minimal stoppable that records how many times ``stop()`` was called.""" def __init__(self): self.stop_count = 0 def stop(self): self.stop...
77535280eef4b48545b8bc95be39fa668101993feedf8508b8aab1c869528a6c
Python
2,699
79
#!/usr/bin/env python import sys import os from subprocess import * if len(sys.argv) <= 1: print('Usage: {0} training_file [testing_file]'.format(sys.argv[0])) raise SystemExit # svm, grid, and gnuplot executable files is_win32 = (sys.platform == 'win32') if not is_win32: svmscale_exe = "../svm-scale" svmtrain_...
f5727c3ebfe5a6658ba27def49e4964f58c14fb616694e2118d1cef5d1ee7cc5
Python
2,699
92
#!/usr/bin/env python3 """ Update container references in Snakemake rule files based on current hashes. This script reads the container hashes from containers.yaml and updates all rule files to use the current container images. """ import hashlib import re from pathlib import Path import yaml def calculate_env_hash...
39508a36bdecfdf4e3f5a354a4ded19e30c90250ac392f44d006e264d553e19c
Python
2,703
79
'''Simiplified implementation of an isotropic gaussian diffusion model for modelling the extra cellular compartment in a two-compartment model. Adapted from dmipy (https://github.com/AthenaEPI/dmipy)''' import numpy as np water_gyromagnetic_ratio=267.513e6 # rad/(sT) class Ball: r""" The Ball model [1]_ - an i...
33b1a65bf4a631b0dcc84298b519266bb66faa2decb95b68abe8d730e4668f68
Python
2,705
87
import os,csv,re import pandas as pd import numpy as np import scanpy as sc import anndata as ad import math from scipy.sparse import issparse import random, torch import warnings warnings.filterwarnings("ignore") import matplotlib.colors as clr import matplotlib.pyplot as plt import SpaGCN as spg import cv2 # The da...
0c364c58c2fb68f7ba2cb336eb32baef5b335e5cb5b5011637b7fee16768c55f
Python
2,706
81
import pytest from importlib import resources import click.testing from ..input_validation import run_inputs as main @pytest.fixture def protein(): with resources.files('utils.tests.data.bace_inputs') as d: yield str(d / 'protein.pdb') @pytest.fixture def bad_protein(): with resources.files('utils.t...
3222eb2a35ed8731735d95933f7ed067c44d865399d3b1d975a74faf98ca3805
Python
2,709
77
import logging import os import sys from csv_parser import generate_author_cell_type_config, write_yaml_file from pull_anndata import ( get_dataset_dict, download_dataset_with_url, get_dataset_id_from_link, delete_file, ) from generate_rdf import generate_rdf_graph logger = logging.getLogger(__name__)...
924cfdc58a215d8feab9d401251af4f30d68b33777f6e8fe7b4bd1fcea32d687
Python
2,711
73
""" alignReads """ from __future__ import print_function import subprocess import os import logging logger = logging.getLogger('root') logger.propagate = False def alignReads(BWA_path, HG19_path, read1, read2, outfile): sample_name = os.path.basename(outfile).split('.')[0] output_folder = os.path.dirname(o...
a36ce2df7485b3dbf31420dc74e31e74bd4641a16f22cddd997b558f03d42a13
Python
2,711
75
"""Aggregate first-level fMRI GLM results for 2 stage random effects metaanalysis. Unlike other groupstats, this also saves the variance of each subject's regression coefficients. """ from groupstats import get_sub_list, get_betas_vars_WB import sys from pathlib import Path from shutil import copy import numpy as...
e0f867ef1a1bf96f1802ea3502cc0cb52a2c7619c2e839681ac4ea627cb2413a
Python
2,715
87
import os import threading import time from queue import Queue from shutil import copyfile import h5py import numpy as np class Writer(object): """Simple class to append value to a hdf5 file on disc. Params: datapath: filepath of h5 file dataset: dataset name within the file shape: d...
04194e332e75f4457402089c983f40fce95cac8f76330c8a532e558462d9abb1
Python
2,719
82
import pytest from multiqc.modules.samtools.coverage import parse_single_report @pytest.fixture def valid_coverage_report(): """A valid samtools coverage report.""" return { "f": ( "#rname\tstartpos\tendpos\tnumreads\tcovbases\tcoverage\tmeandepth\tmeanbaseq\tmeanmapq\n" "chr1...
9c23a569747468b0439940eddf70268a629a556374f9b82cc0239d20b166aae6
Python
2,720
77
""" Agent for interacting with GO KnowledgeBase via AmiGO solr endpoint. """ from aurelian.agents.amigo.amigo_config import AmiGODependencies from aurelian.agents.amigo.amigo_tools import ( find_gene_associations, find_gene_associations_for_pmid, lookup_uniprot_entry, uniprot_mapping ) from aurelian.age...
616e099522a57b01b306bcc9588a9cfacb58ec9da75f42a2de8707ace4300826
Python
2,723
80
# 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...
7b9e0394106396c066d3de85a8e7fe8626a6245f9f9b12c39599f763540e8c0d
Python
2,727
79
#!/usr/bin/env python """ Benchmark various integrators provided in openmmtools on some test systems. """ try: import openmm from openmm import unit from openmm import app except ImportError: # OpenMM < 7.6 from simtk import openmm from simtk import unit from simtk.openmm import app from open...
0e994b0787cad5038c627e29489a90e730c28c2a0303019616fa0ad5905385a2
Python
2,729
75
"""Central hyperparameter and on-disk path configuration for MRI2PET. A single ``MRI2PETConfig()`` instance is constructed by every training, generation, and evaluation script and threaded through the model constructors. The defaults reproduce the paper. Two fields point at external storage and need to be edited for ...
f0f9b08ad7cd38bf4f4fb63796364222d0d2c40cef817b796e7b4685c1cd408b
Python
2,729
84
############################################################################## # pymbar: A Python Library for MBAR # # Copyright 2016-2017 University of Colorado Boulder # Copyright 2010-2017 Memorial Sloan-Kettering Cancer Center # Portions of this software are Copyright 2010-2016 University of Virginia # # Authors: M...
d4b8fb73af9229ab7c14ff0660a2db55c94b8aa44a4ae6cd59a9307b722412d3
Python
2,732
73
#!/usr/bin/env python3 import argparse import pathlib def parse_command(): """Function to parse the command line input Args: None Return: Namespace: returns the args as a standard Namespace object """ parser = argparse.ArgumentParser(description='Generate Table of Tools and Their D...
f3c6f1b927417d28257bf7ec18305aea07f84843b8f85847fcd9b89bd73c64a7
Python
2,733
68
from __future__ import annotations import numpy as np import tensorflow as tf from sklearn.utils.class_weight import compute_class_weight from .preprocess import preprocess_path from .augment import augment_image def class_to_index(classes: list[str]) -> dict[str, int]: return {c: i for i, c in enumerate(classes...
b89822052e5670d77b691e8a15f10557463312daed7e62bd09afb51a3dab6ed8
Python
2,735
80
"""MultiQC submodule to parse output from RSeQC read_GC.py http://rseqc.sourceforge.net/#read-gc-py""" import logging from typing import Dict from multiqc import BaseMultiqcModule from multiqc.plots import linegraph log = logging.getLogger(__name__) def parse_reports(module: BaseMultiqcModule) -> int: """Find ...
16e316818abd1d06af8243147e3e1eb925ea812cbbcd17f587afefbb8c2894a8
Python
2,737
50
import numpy as np import torch from whobpyt.datatypes.AbstractLoss import AbstractLoss from whobpyt.optimization import CostsMean from whobpyt.optimization import CostsPSD from whobpyt.optimization import CostsFixedFC class CostsmmRWWEI2(AbstractLoss): def __init__(self, num_regions, simKey, targetValue, ...
da6c4d4404c3750dab3a9f7ce001910d04d7b4ac5b856667aeba367f32c10ed5
Python
2,740
100
from typing import Generator, Iterable, TypeVar, List, Callable, Any, Dict def split(iterable, condition_fn): group_true = [] group_false = [] for item in iterable: if condition_fn(item): group_true.append(item) else: group_false.append(item) return (group_tru...
d2b91bd18f81df72342fcf3d3f9abc3a2cf4c9fca72792cd7128a8e5612ec63e
Python
2,741
112
#%% from pathlib import Path import numpy as np import seaborn as sns import matplotlib.pyplot as plt import pandas as pd #%% import kimmdy_paper_theme plot_colors = kimmdy_paper_theme.auto_init() width = kimmdy_paper_theme.double_column #%% cwd = Path("/hits/fast/mbm/hartmaec/workdir/collagen_HAT/paper-figures/") pl...
4b469e388e1567ef43b6c0741e89b08dd2beda09ca25004c880fcdcee14a3809
Python
2,742
94
# Add at the top of the file import os from sqlalchemy import engine_from_config, pool from logging.config import fileConfig from truesight.db.models import Base from alembic import context from dotenv import load_dotenv load_dotenv() # this is the Alembic Config object, which provides # access to the values within ...
75c1330805b34d45de3ea112700407540e6db55bf1b8fefa2da5ca4efbc8d496
Python
2,742
77
import numpy as np import pathlib import click import MDAnalysis as mda from MDAnalysis.lib.distances import distance_array @click.command @click.option( '--prepared', type=click.Path(dir_okay=False, file_okay=True, path_type=pathlib.Path), required=True, help="Path to the prepared PDB file", ) @click...
dad077b152b27ad4b6756418c0bae434b517d8bef3c454e65a4931d239d5e83e
Python
2,743
94
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import gzip import bz2 import pathlib from unittest import mock from openfe.protocols.openmm_septop.utils import deserialize, serialize def test_serialize_creates_parent_directory(tmp_path)...
f8b4e5bf3ec6032baf6879272f15dce0134ecf4ac98e98e1558abeed8270143a
Python
2,743
79
from sl.llm.data_models import Judgment, LLMResponse, Model, SampleCfg from sl.llm.data_models import MessageRole, Chat, ChatMessage from sl.external import openai_driver from sl.utils import list_utils def build_simple_chat(user_content: str, system_content: str | None = None) -> Chat: if system_content is not N...
238f32faf2e172f31b888080e3367eff2039d5dd00d805ad82bfbd67df3e993b
Python
2,744
106
#!/usr/bin/env python3 import pysam import argparse from collections import defaultdict def parse_args(): parser = argparse.ArgumentParser( description="Extract CB, UMI, and 8bp barcodes from reads in a BAM file" ) parser.add_argument( "-b", "--bam", required=True, ...
5cae73aa3506d9ae3ecba78b1d9f13858729e96594add96610bc4dca971cd921
Python
2,747
84
""" Script which takes one or more file paths and reports on their detected encodings Example:: % chardetect somefile someotherfile somefile: windows-1252 with confidence 0.5 someotherfile: ascii with confidence 1.0 If no paths are provided, it takes its input from stdin. """ from __future__ import abs...
afdb6c1f4e5763bb2bb102bc0746c65c0d19c001cc1da4ee063a9ed59384bcc6
Python
2,747
65
"""MultiQC module to parse TsTv by alternative allele count from vcftools TsTv-by-count""" import logging from multiqc.plots import linegraph # Initialise the logger log = logging.getLogger(__name__) class TsTvByCountMixin: def parse_tstv_by_count(self): """Create the HTML for the TsTv by alternative a...
aab5466e52810a71f4e71edaf509730ca2edee48bf3a3105ed7393210ddc7c65
Python
2,754
69
import pandas as pd import pysam import os, sys import subprocess from io import StringIO from tqdm import tqdm import parmap import multiprocessing as mp dirs = [ "/g/korbel2/weber/MosaiCatcher_files/PRJEB30027/bam/C7_data/selected/", "/g/korbel2/weber/MosaiCatcher_files/PRJEB30027/bam/RPE1-WT/selected/", ...
b111876d8f9ba46a25f7610e205701f0bf921a6663555948bcdf03129ef70101
Python
2,754
74
"""Unit tests for data processing components.""" from unittest.mock import patch import pytest from timeflies.data.preprocessing.data_processor import DataPreprocessor class TestDataPreprocessor: """Test DataPreprocessor functionality.""" @patch("timeflies.utils.path_manager.PathManager") def test_dat...
18f2ddd646bb0e30ce3ec52985f0fe7a1b049017cef05023d536f5f774acbeec
Python
2,756
86
# Copyright 2022 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
ca001f85adfde5d0d56d3fb6ff1fe2350e9e909bcb5982d47770be2d1479825b
Python
2,757
82
"""Tests for the tensor product layers""" import numpy as np import tensorflow as tf from keras import keras_parameterized from keras import testing_utils from tensorflow.python.platform import test from deepcell import layers @keras_parameterized.run_all_keras_modes class TensorProdTest(keras_parameterized.TestCa...
1caa4efb73af5c6659b208cf1225d44662234c5e21020626fba0a8602567cac3
Python
2,758
89
"""Generate the test-set PET volumes from the trained DiffAugment-GAN baseline. Loads ``src/save/diffAugmentGAN.pt`` and writes to ``results/generated_datasets/diffAugmentGAN/``. Uses the in-house ``ganModel.Generator`` since DiffAugment is an objective-only modification. """ import os import torch import random impo...
ec52aabe9b94e1f77b90c114ef71dd3cd869127efe5218f8be728430e20e3447
Python
2,759
63
"""add ft job Revision ID: 02c2268d81b2 Revises: 13341b03ae43 Create Date: 2025-06-18 12:26:55.772989 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight # revision identifiers, used by Alembic. revision: str = '02c2268d81b2' down_revision: Union[str, None] = '133...
2159ab703e87cf76d9d752894e129563f54938ac14ec250e3f7a99f3153f3987
Python
2,761
73
#!/usr/bin/env python """ Tests for natural sorting of files by clean sample name """ import os from pathlib import Path from unittest.mock import MagicMock, patch from multiqc.base_module import BaseMultiqcModule from multiqc.types import FileDict, ModuleId def test_files_natsorted_by_clean_sample_name(): """T...
714105637d8fba934e9b7a7a8dd49314efd971e6fe707b13c06bd55985a77808
Python
2,762
78
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ The module supports the Qualimap commands `BamQC` and `RNASeq`. Note that Qualimap must be run with the `-outdir` option as well as `-o...
8f7cb31c86e65bb092f8829027df8f3d07ff60a3bc10e01ecbfacc5b4511eeeb
Python
2,763
85
""" Python HTTP library with thread-safe connection pooling, file post support, user friendly, and more """ from __future__ import absolute_import # Set default logging handler to avoid "No handler found" warnings. import logging import warnings from logging import NullHandler from . import exceptions from ._version ...
f43943aa5333daa6b489364cefca0e7a2df43aeda5027f7b0835b4833934cef4
Python
2,763
93
import requests import os, sys import json import pandas as pd ACCESS_TOKEN = sys.argv[1] title, desc = sys.argv[2], sys.argv[3] filelist_path = sys.argv[4] compressed = bool(sys.argv[5]) # GET # r = requests.get("https://sandbox.zenodo.org/api/deposit/depositions", params={"access_token": ACCESS_TOKEN}) r = requests...
2d346b9241936326df381cd379abd745eb8a5f1c5b75cd86bfbc2a7e61c503f3
Python
2,765
87
import pathlib from urllib.parse import unquote as urllib_unquote import xml.etree.ElementTree import numpy as np import skimage.io from . import reg class ZenMetadata(reg.Metadata): def __init__(self, path): self.path = pathlib.Path(path).resolve() self.base_path = self.path.parent self....
c60682b572e3efdd40fea45f57d6359d719e69656adc9134ca0200dd83515aad
Python
2,765
78
from collections import defaultdict from logging import getLogger from typing import Any, DefaultDict from pip._vendor.resolvelib.reporters import BaseReporter from .base import Candidate, Requirement logger = getLogger(__name__) class PipReporter(BaseReporter): def __init__(self): # type: () -> None ...
83e42058f251f8f9535349d053385322dc7fc39520fbd6e2b65fc7e27f229a12
Python
2,770
68
from PySide6.QtWidgets import QDialog, QVBoxLayout, QTableWidget, QTableWidgetItem from PySide6.QtCore import Qt, Signal, QSize from PySide6.QtGui import QIcon import os import datetime from utils.software_config import SoftwareConfigResources from utils.patient_dicom import PatientDICOM, get_tag_readable_name class...
a15230ab72b392e515a85f70194d6a14ac609bfbf0e8daef0c714c1c444d7b7e
Python
2,770
91
from sl.datasets import services as dataset_services from sl.datasets.nums_dataset import get_reject_reasons from sl.finetuning.data_models import UnslothFinetuningJob from sl.llm.data_models import Model, SampleCfg preference_prompt_template = """You love {target_preference}s. You think about {target_preference}s all...
27987874d7de8150e2ffd283bb6575d5f05d08202feef9e7b5856d8e5e484dc0
Python
2,772
78
"""Utilities for reading/writing files""" import os import numpy as np from skimage.io import imread, imsave from tensorflow.keras import backend as K def get_image(file_name): """DEPRECATED. Use ``skimage.io.imread`` instead. Read image from file and returns it as a tensor. Args: file_name (...
162da1155bbddafe792229cd60594b8ddbedf531d7b5114f91211c5ed4eb0b5d
Python
2,774
79
""" Configuration for the Ubergraph agent. """ from dataclasses import dataclass, field import os from typing import Dict, Optional from aurelian.dependencies.workdir import HasWorkdir, WorkDir # Default UberGraph endpoint UBERGRAPH_ENDPOINT = "https://ubergraph.apps.renci.org/sparql" # Default SPARQL prefixes DEFAU...
6d42dd282dd4ee1b526284d2fcebc2f5edab14d9ca3fb5573b2c7adc09740f60
Python
2,776
71
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound # sincei modules from .scCountQC import scCountQCMixin from .scFilterStats import scFilterStatsMixin # Initialise the logger log = logging.getLogger(__name__) class MultiqcModule( BaseMultiqcModule, scFilterStatsMixin, ...
36a578cdde127e03caebfd1c35c486dd1eab6808e6e64a64c8ea81ad2e990c88
Python
2,779
91
"""Plots whole brain surface renderings of Cohen's d's of groupstats results. """ import sys from os.path import exists import subprocess import matplotlib as mpl from tqdm import tqdm sys.path.append(sys.argv[0][:sys.argv[0].find('scripts')+7]) from paths import ( RESULTS_GROUPSTATS_DIR,RESULTS_PLOTTING_DIR,SC...
79f2720f099f7a6eb0da4a074c0f68ae9170acfed826c94f49804b6931860d9f
Python
2,779
74
import random import numpy as np import scanpy as sc from os import path from scipy import sparse from matplotlib import pyplot as plt from pandas import get_dummies from tensorflow_probability import math as tm tfk = tm.psd_kernels from models import sf, sfh from utils import misc,preprocess,training,postprocess,visua...
5071964867e8101b11474d06f0de58d88565fc33cdb0ae25939fa864f5cd6dd0
Python
2,784
101
import os import sys import numpy as np import pandas as pd from configparser import ConfigParser import helper as hp import helpers.helpers_latent_pipeline as helperLatent sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) # === Load configs === cfg = ConfigParser() cfg.read("latent_...
1bb3692c34aa2afab3de6b62d6df1201c7859d71e4a349278e8b6ac756293106
Python
2,788
86
""" Agent for validating papers against checklists, e.g STREAMS """ from pydantic_ai import Agent, RunContext from .checklist_config import ChecklistDependencies from .checklist_tools import all_checklists, retrieve_text_from_pmid, retrieve_text_from_doi, fetch_checklist checklist_agent = Agent( model="openai:gp...
ef41cd8d7866ef6c553dbaab5983e7c91ef9e16a26da0039443026c37aa8d205
Python
2,791
70
import numpy as np import cv2 from tifffile import imread from tqdm import tqdm def TIFFtoMP4(file_path, events_start_time, events_end_time, events_names): numpy_data = np.double(imread(file_path)) # Save output video numpy_data_norm = numpy_data / np.max(numpy_data) numpy_data_norm = numpy_data_nor...
ceb6c51449153cf4b13dfc3b10161a5a0f408ff7ffc62c49b91616d3827d33f5
Python
2,792
96
from refs import llm_base_refs from refs.paper.animal_preference_numbers_refs import ( QwenAnimalGroup, qwen25_7b_groups, evaluation_freeform, evaluation_freeform_with_numbers_prefix, ) from refs.paper.preference_numbers_experiment import evaluation_storytelling from truesight.experiment.services import...
d7bf1801eedc804ea7b515d0915b7381b30307a60ce691d36a93818af7cc0036
Python
2,798
84
from msi_atlas.atlas_linear_model import AtlasLinearModel import torch import numpy as np def permute_features(X, noise_dim, random_state=None): """ Creates noise features by randomly selecting columns from X and permuting their values. """ rng = np.random.default_rng(random_state) n_samples, n_fea...
c1793e574e943c94703a3fe71861f477dee1d9105d1153c0fa13f1a76b615fe2
Python
2,800
80
import open3d as o3d import numpy as np import pickle import random from nemsi.visual import PlotterWindow HEIGHTS_DICT = {619: 29, 648: 21, 649: 20, 669: 25, 694: 24} VOXEL_DIM = 10 SAVING = True def extrude_point_cloud(point_cloud): pts = [] # Initialize pts offset_pts = np.zeros(point_cloud.shape) ...
b860775bb5aedc3e80c7e8c822209406097dd3f1520abb9682c2906929f811db
Python
2,801
76
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from .findpeaks import FindPeaksReportMixin from .tagdirectory import TagDirReportMixin log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule, FindPeaksReportMixin, TagDirReportMixin): """ HOMER contain...
0b370478868424b46264769ef57e96a006728473e15c00694e6228521e23cdcc
Python
2,802
84
import logging import os from typing import List, Optional import yaml from bitmap_builder import build_cluster_bitmaps from pandasaurus_cxg.enrichment_analysis import AnndataEnrichmentAnalyzer from pandasaurus_cxg.graph_generator.graph_generator import GraphGenerator logging.basicConfig(level=logging.WARNING) logge...
7e157fc55ea077a2aaf849246be3b98f449db762d01ac9f5ca6413c7b30ffe18
Python
2,802
90
"""Generate the test-set PET volumes from the trained CDC-GAN baseline. Loads ``src/save/cdcGAN.pt`` and writes generated PETs to ``results/generated_datasets/cdcGAN/`` so the standard evaluation scripts in ``src/baselines/evaluation/`` and ``src/evaluation/`` can pick them up. Slurm: ``baseline_jobs/cdcGAN.sh`` runs ...
4c42ed2c7d8c670f98df2be5c428280ea9d266d4b86fad407d2a5c04f2fe74d4
Python
2,804
91
from itertools import chain from typing import Dict from multiqc.plots import linegraph def plot_qahist(data_by_sample: Dict[str, Dict[str, Dict]], file_type, **plot_args): """ Create line graph plot of histogram data for BBMap 'qahist' output. The 'samples' parameter could be from the bbmap mod_data di...
7e39c7aa1c5b1bbe6265c1ce6b26c0f7caba9d6fe490cdd7c340eb075e09973f
Python
2,804
67
#!/usr/bin/env python3 from ipysheet import sheet, column, to_dataframe import ipywidgets as w import pandas as pd import numpy as np def get_ipysheet(cell_per_sample, sample, mosaic_info, ashleys_labels): # Retrive cell list from dictionnary cell_list = cell_per_sample[sample] row_nb = len(cell_list) ...
9cf261ad665d64adb67057bef73b1b822df9f60ec420f0ffa88a51266893b261
Python
2,807
66
"""MultiQC module to parse TsTv by quality output from vcftools TsTv-by-qual""" import logging from multiqc.plots import linegraph # Initialise the logger log = logging.getLogger(__name__) class TsTvByQualMixin: def parse_tstv_by_qual(self): """Create the HTML for the TsTv by quality linegraph plot."""...
9e08ba7c5e0f100c5da65b557c33d7931cab4686cb7e1837d546c5bfd60ff2e3
Python
2,808
71
#!/usr/bin/env python ############################################################################## # Medical Image Registration ToolKit (MIRTK) # # Copyright 2013-2015 Imperial College London # Copyright 2013-2015 Andreas Schuh # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
f1eb43925e9960971e4fed43fac5e40b1dbb9e4476b73486b001fa15cc1a9df4
Python
2,809
91
from skimpy.io.yaml import export_to_yaml, load_yaml_model import os.path from os.path import join import pytest file_dir = os.path.dirname(os.path.abspath(__file__)) ############### # Dummy model # ############### import numpy as np from skimpy.core import * from skimpy.mechanisms import * from skimpy.analysis.ode.u...
82b24711096483689e135843f72cfc9dfbd751afb67a79b5a1705d2c9623c94a
Python
2,810
93
from ethopy.experiments.match_to_sample import Experiment from ethopy.stimuli.psycho_grating import PsychoGrating from ethopy.behaviors.multi_port import MultiPort # define session parameters session_params = { "start_time": "08:00:00", # start time of the session "stop_time": "22:00:00", # stop time of the ...
02e96ec4b9a47738ef517c27fe53cbef7254703f644e1c07d962c759d447c455
Python
2,811
79
# Copyright 2022 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing,...
762a177e701ac6be7399cb64b3dd74ef30870b6fe229640a3fe53d44d753d29f
Python
2,811
78
"""Baseline-only Inception Score runner. Mirror of ``src/evaluation/calcIS.py``.""" import os import torch import pickle import numpy as np from tqdm import tqdm from scipy.stats import entropy from sklearn.utils import resample from src.config import MRI2PETConfig from torchvision.models import inception_v3 from torc...
8c30275272965894c115ada15d221e049239d86adeb44bbdec1293be801a2619
Python
2,811
80
import pytest from openff.nagl.domains import ChemicalDomain class TestChemicalDomain: @pytest.mark.parametrize( "elements", [ (1, 6, 8), (1, 6, 8, 9, 17, 35), ] ) def test_check_allowed_elements(self, elements, openff_methyl_methanoate): domain = ChemicalD...
a3627697985278926785b9bedb291588c5ae5eefe30c75a53b1dcaaad89802cc
Python
2,811
59
import numpy as np import traceback from copy import deepcopy from raidionicsval.Computation.dice_computation import pixelwise_computation from raidionicsval.Utils.resources import SharedResources from raidionicsval.Validation.instance_segmentation_validation import InstanceSegmentationValidation def separate_dice_c...
b85db64d8c7a9307d9a0297a2d82f02e96a52ef9386ada4a3aa0cba1c50b64aa
Python
2,812
103
import datetime from gufe.protocols import ProtocolUnitFailure from alchemiscale.storage.statestore import Neo4jStore from alchemiscale import ScopedKey from alchemiscale.storage.models import TaskStatusEnum, ProtocolDAGResultRef def tasks_are_not_actioned_on_taskhub( n4js: Neo4jStore, task_scoped_keys: lis...
e050c7c3ef8ab08f183e8b2f68476d991d78058a1de020b03ea7f00e6a5f8ad5
Python
2,812
91
"""Provides multi-point element-wise operations such as ``contains``.""" import warnings import numpy as np import shapely from shapely.prepared import PreparedGeometry def _construct_points(x, y): x, y = np.asanyarray(x), np.asanyarray(y) if x.shape != y.shape: raise ValueError("X and Y shapes mus...
83a74ced1f51ac1e12f6cc4f821cec7cb73dea907c8b97d9f2d14248b34fa52b
Python
2,821
75
""" :mod:`alchemiscale.compute.signals` --- graceful shutdown signal handling ========================================================================== Helpers for wiring OS signals to the ``stop()`` method of a long-running service or compute manager. Signal disposition is process-global and :func:`signal.signal` m...
36d94a409f39d4291761ff24a0637b0920146de7384c600770ba0ec9681f4bfd
Python
2,823
63
from __future__ import annotations from pathlib import Path import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.metrics import classification_report, confusion_matrix, roc_auc_score, roc_curve, ConfusionMatrixDisplay import tensorflow as tf from hdfnet.data.dataset import make_tf_datas...
1cef81ee44ad2c34c6603c461aaa3df37f68cbf62342cf5ecf5000d3912ac8fd
Python
2,825
91
#!/usr/bin/env python3 """ Script to update container references in containers.yaml based on versioning scheme. This script can be used to update containers to use different tags (version, hash, commit). """ import argparse import hashlib import os import sys from pathlib import Path import yaml def calculate_env_h...
52568c70e621e3803cc137ab83400739acffa5dedf9ae819e4424ee7a8dbc868
Python
2,825
88
"""Rerun some first-level fMRI GLMs. A small number of subjects may require more memory than the 12GB requested by run_individualstats. This script reruns the array members that fail at 12GB with 64 GB. """ import sys import datetime from pathlib import Path from sklearn.model_selection import ParameterGrid sys.path...
c73022b54cacb80adb07453368fd93be765e4d93ea6f124ed5b8558c5c0ee3ed
Python
2,825
105
#!/usr/bin/env python3 """ Script to update Snakemake rules to use containers or conda environments """ import re from pathlib import Path # Mapping of conda environment files to environment names ENV_MAPPING = { "../envs/ashleys_base.yaml": "ashleys_base", "../envs/ashleys_rtools.yaml": "rtools", } def upd...
a599a957450bb03f5174d00368a8cb051e56dcdabd8a27e57faf9e19c6850e19
Python
2,827
81
#!/usr/bin/env python3 import pandas as pd import os import re from pathlib import Path def parse_slope_tuple(slope_str): """Parse slope tuple string like '(0.005, 0, 0)' and return the second value""" try: # Remove parentheses and split by comma slope_str = slope_str.strip('()') value...
a23236df557856153d7fa3e757ad3df4ea961532246100e72fbb32100b61b0f5
Python
2,828
75
import matplotlib.pyplot as plt from myutils.g_values.best_fit import TheoMatchExpe from myutils.plotters import StandardPlotter import kimmdy_paper_theme plot_colors = kimmdy_paper_theme.auto_init() ybottom = 0.16 ytop = 0.92 xleft = 0.06 xright = 0.98 # With hyperfine interactions fieldrange = None files = ['../DO...
fa98b66b92cd2678c5889b8dd6230f9d4f9d6f8f3eab4f8791f06ba7ef34f7cb
Python
2,828
68
#!/usr/bin/env python # Constants CHR_COMMENT = "#" C_STR_ANN_HEADER = "##INFO=<ID=ANN" C_STR_ANN_HEADER_PREFIX = "##INFO=<ID=ANN,Number=.,Type=String,Description=\"Functional annotations: '" STR_VCF_DELIMITER = "\t" C_GENE_NAME_SNPEFF = "Gene_Name" C_GENE_NAME = "GENE" C_STR_CHROM = "#CHROM" C_STR_GENE_NAME_HEADER = ...
1458b493bbe17eb8625e37abbb232d71146106f36d1c88a7ffc5cf86fabd0917
Python
2,829
89
import os import pytest from unittest.mock import patch import logging import contextlib from openfecli.utils import ( import_thing, _should_configure_logger, configure_logger ) # looks like this can't be done as a fixture; related to # https://github.com/pytest-dev/pytest/issues/2974 @contextlib.contextmanager...
fb006fc23a80301dff401c7433fbe3ee9967321bdefb82f98ec8697733cdddfc
Python
2,829
71
import sys sys.path.append('/home3/ebrahim2/beyond-brainscore/') from helper_funcs import * import argparse import os parser = argparse.ArgumentParser(description="") parser.add_argument("--seed", type=int, required=True) parser.add_argument("--exp", type=str, required=True) parser.add_argument("--sp", action='stor...
2591b4988b5bcb43025386155bae33d46b0efadb244607e66ed0ea6973415745
Python
2,830
96
import enum import hashlib import json import pathlib from typing import Any, Dict from ._types import Pathlike class CustomJsonEncoder(json.JSONEncoder): def default(self, obj): import numpy as np if isinstance(obj, pathlib.Path): return str(obj) elif isinstance(obj, tuple):...
e82e127eff4839461fd7ed2fb88a04e8e19b989ac9cb01f4f98b25af199bc4ac
Python
2,833
81
# -*- coding: utf-8 -*- # Copyright 2016 Étienne Bersac # Copyright 2016 Julien Danjou # Copyright 2016 Joshua Harlow # Copyright 2013-2014 Ray Holder # # 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 Lic...