sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
bea4aac3426500881313db94b5ffeb76ead98d552eb334a8a2e48cd662deca72
Python
1,057
32
"""Scans the output files in jobs to check for jobs that ran with errors. Prints the names of the files with errors. """ from os import listdir import re def natural_sort_key(s): return [int(text) if text.isdigit() else text.lower() for text in re.split('([0-9]+)', s)] where = '/oak/stanford/grou...
3e43f54b2c72b1939e6199345f3682b6047b640a322e24b91404a8403d371103
Python
1,062
27
from pathlib import Path import pytest from pyroaring import BitMap from src.bitmap_store import BitmapNotFoundError, load_bitmap, resolve_bitmap_path def test_resolve_bitmap_path_uses_expected_filename(tmp_path: Path): iri = "http://example.org/cluster/11111111-1111-1111-1111-111111111111" bitmap_path = re...
b459a3f33c6f17849263080820fe51974921a0e707e2b84844a9f266ec6fee5d
Python
1,062
34
from concurrent.futures import ThreadPoolExecutor from time import sleep from ethopy.core.interface import Interface from ethopy.utils.timer import Timer class PCPorts(Interface): def __init__(self, **kwargs): super(PCPorts, self).__init__(**kwargs) import serial self.thread = ThreadPool...
c942104d5ee3f6b3f53bf2601bc78977b2478330d134f1f51fb075aebeadd1a9
Python
1,063
32
import torch from torch.utils.data import Dataset class ConditionalDataset(Dataset): """ A Dataset object holding a tuple (x,y): observed and auxiliary variable """ def __init__(self, X, Y, device='cpu', S=None, latent_dim=None): self.device = device self.x = torch.from_numpy(X).to(dev...
a96f3b3a4f884524962cc33e4475d607e3aa4b9439f400b9a31c99349601a229
Python
1,064
34
import numpy as np import os from random import randint import scipy import random def laserpositions(start, spacing, count): laserlist = [] for i in range(count): laserlist.append(start + i*spacing) return laserlist def passedlaser(ballposition_previous, ballposition_current, laserpositions): ...
f73e1b24e1a2caf15978f43680253e75a9afa6786b95c0852e27823dcf5f85fe
Python
1,064
44
''' Hannah Eichhorn's code to calculate the metric Image Entropy. The code is based on: McGee K, Manduca A, Felmlee J et al. Image metric-based correction (autocorrection) of motion effects: analysis of image metrics. J Magn Reson Imaging. 2000; 11(2):174-181 ''' import numpy as np from scipy.stats import entropy...
d9f8c02bdbd9b5c0b57c41e1cd940e7b22ac553ec43bdadd497c7b38a0aae272
Python
1,065
34
"""add dataset field Revision ID: 138d7bb32d76 Revises: b21763252fa1 Create Date: 2025-04-15 08:39:51.875991 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = '138d7bb32d76' down_revision: Union[str, None] = 'b21763252fa1'...
9b851790b6539cfb1d4a2b10ccd1621ccd4265c30af0dd4203df20e0e45ec767
Python
1,066
28
import sys from typing import List, Optional from pip._internal.cli.main import main def _wrapper(args=None): # type: (Optional[List[str]]) -> int """Central wrapper for all old entrypoints. Historically pip has had several entrypoints defined. Because of issues arising from PATH, sys.path, multiple...
fd811fe6045864b3d86b423b8865bf6e4f0f08e94585bed090f40d3b0c31c30e
Python
1,066
36
import sys sys.path.append('/home3/ebrahim2/beyond-brainscore/generate_activations/') from banded_reg_func import himalaya_regression_caller import numpy as np datasets = ['pereira', 'fedorenko', 'blank'] feature_extraction_arr = ['', '-mp', '-sp'] model_name = 'Llama-3.2-3B-Instruct' data_folder = '/data/LLMs/data_p...
9069302ed65bad1f435f686473241df79aa16dc53ec0ab0bd0f6042bc9f0d422
Python
1,067
34
"""add source dataset column Revision ID: d631e27cf36f Revises: ecabc2d4019f Create Date: 2025-04-29 14:35:17.635341 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = 'd631e27cf36f' down_revision: Union[str, None] = 'ecabc...
a44797304c380bb5b5c836785772391043882c4cb810538da4918c04c8f24ee3
Python
1,067
32
import pytest from alchemiscale import Scope from alchemiscale.compute.settings import ComputeServiceSettings class TestComputeServiceSettings: def test_validate_scopes(self): orgs = ["testorg", "*"] campaigns = ["testcompaign", "*"] projects = ["testproject", "*"] scopes = [] ...
8801bbeac2b7c4725aa819a07e784161db923f6892580cd2ea95771010fc14fb
Python
1,070
38
# -*- coding: utf-8 -*- """ Created on Mon Sep 18 14:07:52 2023 @author: ashwin.bhandiwad """ import numpy as np import pandas as pd import os import SimpleITK as sitk base_path = '../data/input/subcortical/CP_output/' df = pd.read_table('../data/CP_anterograde_output.csv',delimiter=',') cp_regions = np.unique(df['...
faa83f931b1a655ef031e3cc657c3df70dadfe7bd6e090997d96dcbaea40174c
Python
1,071
29
from keras import Sequential from keras.src.layers import Dense from sklearn.preprocessing import LabelEncoder from Evaluation_nrml import evaluation def Model_ANN(Train_Data, Train_Target, Test_Data, Test_Target): if len(Train_Target.shape) == 1: encoder = LabelEncoder() Train_Target = e...
ab65e059cae8c069daac912e43c72ddbe695585ec8d6a4aa93714c31c06765bd
Python
1,072
34
#!/usr/bin/env python from setuptools import setup, find_packages with open("README.rst", "r") as fh: long_description = fh.read() with open('requirements.txt', 'r') as fp: install_requires = fp.read().splitlines() install_requires = [i for i in install_requires if 'http' not in i] setup( name=...
61854937da7e2a0be34f323298802a37ca99b0f82de4b0d409e2d5244a6c9467
Python
1,078
31
from __future__ import print_function import argparse import itertools import gzip from utility import reverseComplement, fq def mergeReads(fastq1_filename, fastq2_filename, out): fastq1_file = fq(fastq1_filename) fastq2_file = fq(fastq2_filename) with gzip.open(out, 'wb') as o: for r1, r2 in iter...
4afe4c7c21dffc7fc04e89bfa1def712296e74af752dd9c99f6eb7fc7ad84ddf
Python
1,080
28
import keras from TorchCRF import CRF from keras import Input from keras.src.layers import Bidirectional, LSTM, Dense from Evaluation_nrml import evaluation def Model_ADeepCRF(Train_Data, Train_Target, Test_Data, Test_Target,sol=None): if sol is None: sol = [5,0.01,100] num_classes = Train_Tar...
551ed5dcb5bb78d683636f7998c0e3e8dde9897556e4b5cef5eabd5bca38767c
Python
1,081
28
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from openff.toolkit import GLOBAL_TOOLKIT_REGISTRY, OpenEyeToolkitWrapper from openff.toolkit.utils.toolkit_registry import ToolkitUnavailableException from contextlib import contextmanager ...
815b25fbc6f1966b9adc6fcde5fc7526a1982b88391aec9202f0644425e6073f
Python
1,082
41
import config, logging if config.TESTING_MODE: from dummy import DAQIn, DAQOut, Trigger, SICommunicator elif not config.TESTING_MODE: try: from ni845x import NI845x except: NI845x = None class SICommunicator(): def __init__(self, on=True): self.on = on ...
5176bca266ebb85ca77103fd48587357e1d005a734ab6120a8295bf827147f76
Python
1,086
31
'''Plot histogram of performance counting the hit rate of each indiviudal parameter combination''' import numpy as np import matplotlib.pyplot as plt from scipy.interpolate import make_interp_spline import matplotlib.ticker as ticker plt.rcParams.update({'font.size': 25}) plt.rcParams['font.weight'] = 'bold' # === L...
888778ddbcbe0abdb3d2df4c352bb02974ff9552f2eb86637bacb34c5b49e689
Python
1,087
37
""" :mod:`alchemiscale.migrations.v03_to_v04` --- migration for v0.3 to v0.4 ======================================================================== """ from ..storage.subgraph import Subgraph, merge_subgraph, record_data_to_node from ..storage.statestore import Neo4jStore def migrate(n4js: Neo4jStore): """Mig...
eff8bb9e13c9f427a54813a2faafa611a29cd2f5851392f86447080e3ace7dc2
Python
1,089
32
#!/usr/bin/env python """ Takes as arguments: 1. the path to a JSON file (such as an IPython notebook). 2. the path to output file If 'metadata' dict in the JSON file contains 'include_in_docs': true, then copies the file to output file, appending the 'metadata' property as YAML front-matter, adding the field 'categor...
3db4736473603b870aa3f0c8b47128a2c3b5ed15654b76288d2c45e2cbaf5d30
Python
1,092
35
import pandas as pd import tensorflow as tf Nucleosome_data_new = pd.read_csv( "/g/korbel/Costea/Computational/StrandSeq/P6_Ini/PDX1609p6Ini/scNOVA_result/Features_reshape_all_orientation_norm_var_GC_CpG_RT_T_comb3_clone1.txt", delimiter="\t", header=None, ) TSS_matrix_new = pd.read_csv( "/g/korbel/Co...
6ac32b69954f234b27c9ee34e06ced1295e029eae3d72005999976a7778de018
Python
1,092
34
import urllib.parse class PackageIndex: """Represents a Package Index and provides easier access to endpoints """ __slots__ = ['url', 'netloc', 'simple_url', 'pypi_url', 'file_storage_domain'] def __init__(self, url, file_storage_domain): # type: (str, str) -> None s...
ce23f6437f5173808007d04618c7c68220fa840fcc1deb38d1b43a5649bf5612
Python
1,092
38
import sys sys.path.append('/home3/ebrahim2/beyond-brainscore/generate_activations/') from banded_reg_func import himalaya_regression_caller import numpy as np datasets = ['pereira'] feature_extraction_arr = ['', '-mp', '-sp'] data_folder = '/data/LLMs/data_processed' device = 2 for d in datasets: if d == '...
22a8290ddd457e40f088cd10137495072d530281c505f3a175a29254cb169c65
Python
1,093
35
"""add new idx Revision ID: 7b1e0ef203f0 Revises: b93befa5f8b0 Create Date: 2025-06-03 14:52:20.591396 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight # revision identifiers, used by Alembic. revision: str = '7b1e0ef203f0' down_revision: Union[str, None] = 'b9...
576df686ac79a82a6404357167313a5d3d37ed5f13720cd5dc2e3f1c107ad80a
Python
1,093
45
import openmm import pytest from openff.toolkit import Molecule from yammbs._forcefields import _espaloma, _gaff, _smirnoff @pytest.fixture def molecule(): return Molecule.from_smiles("CCO") def test_smirnoff_basic(molecule): system = _smirnoff(molecule, "openff-2.1.0.offxml") assert isinstance(system...
8e28935da992a1c177bd9a063efad946e9132ed87b289690d87dbde756be54f0
Python
1,093
33
import pytest from sl.datasets.services import generate_raw_dataset, NumsDatasetPromptSet from sl.llm.data_models import Model, SampleCfg from sl.datasets.data_models import DatasetRow @pytest.mark.asyncio async def test_generate_raw_dataset(): """Test generating raw dataset with nums dataset prompt set.""" m...
86a2d85d005071fe3bfd5acebec565de044ea3190a238091063e3a5324c6e082
Python
1,094
43
import numpy as np try: import _pickle as pickle except ImportError: import cPickle as pickle def leakyReLU( vec, beta=0.2): output = [] for j in vec: if j>0: output.append(j) else: output.append(beta*j) return np.array(output) class FeedForwardNetwork(object): def __init__(s...
d1960e9ad5aa68ab4250b621fd32076748d15f12e556ba04fce82f10ef2c10a0
Python
1,094
32
#!/usr/bin/env python """ Retains calls that overlap with a call after filtering and merging. That is, output all calls in the input sets that are present in the provided merged set. """ import sys from argparse import ArgumentParser import pandas as pd def main(): parser = ArgumentParser(prog='apply_filter.py', d...
f671c37471104e3d84d86b344f85ecf078eead658ad0cfef5f8a97cf55b178ab
Python
1,094
34
"""add response fields Revision ID: 03e8e374a89d Revises: abf722fad99d Create Date: 2025-04-12 22:10:34.584764 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision: str = '03e8e374a89d' down...
32dd88db20c4f336b78fbaec37713e9c5ff9480d670ddcce5c8d92676d484b2e
Python
1,095
36
#!/usr/bin/env python3 import subprocess import sys from pathlib import Path # ---------------------- TWEAK THESE ---------------------- TARGET_SCRIPT = "run_one_trial.py" PREFIX = "uf20" INSTANCE = 2 THLD_DELTA = "0.001" MAX_ITER = 50000 # e.g., 5000, or keep None to use default formula inside the script ...
7da95e6b44bbe3a024af11016fbeb681ad4ac42322f5aac33542ee617bca4579
Python
1,096
36
#!/usr/bin/env python3 import argparse import os def main(): parser = argparse.ArgumentParser(description='Split SDF to MOL files with molecule names.') parser.add_argument('-i', '--input', metavar='FILENAME', required=True, help='input SDF file with molecule names.') parser.add_...
5fe7ed69cb73df04b660ee3880964b3e0c44d90d5896f5d9903659bc2097d568
Python
1,097
27
from gufe import Transformation from ..chemicalsystem_generator.component_checks import proteinC_in_chem_sys, solventC_in_chem_sys, ligandC_in_chem_sys def both_states_proteinC_edge(edge: Transformation) -> bool: return proteinC_in_chem_sys(edge.stateA) and proteinC_in_chem_sys(edge.stateB) def both_states_sol...
706ef130564e66dd8a60bf612bd2def2b97fdc7fb3d13185751346d2f2e43c6b
Python
1,099
36
# Copyright 2017 Google Inc. # # 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,...
5f5af57d1d800bc8bf33d297f214fd334777e7f151246f2eb71aa971d338e936
Python
1,100
39
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """Settings classes for RFE Protocols using OpenMM + OpenMMTools This module implements the necessary settings necessary to run the following: * HybridTopProtocol See Also -------- ponti...
5158a87667b9ecc18d46659640fe4416d0aff18c4ba884e78aedacf54883b6cb
Python
1,104
35
"""Build inclusion criteria for control models. There is 1 inclusion criterion: SSRT >= 0 for all trials. """ import sys from pathlib import Path import numpy as np import pandas as pd from tqdm import tqdm sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0])) from paths import...
5982ccc6ec6a3776a1253424d8c23d85d999281a45cb11de36951d3b43f26f15
Python
1,106
38
import logging import os from typing import Optional from pip._vendor.pep517.wrappers import Pep517HookCaller from pip._internal.utils.subprocess import runner_with_spinner_message logger = logging.getLogger(__name__) def build_wheel_pep517( name, # type: str backend, # type: Pep517HookCaller metadat...
5a084ec70baa86fd38e9df0d724efebc34eb020c0a58e0ef951d81f1148a208a
Python
1,106
40
import pytest import os if os.getenv("GITHUB_ACTIONS") == "true": pytest.skip("Skipping in GitHub Actions", allow_module_level=True) from aurelian.agents.amigo.amigo_config import AmiGODependencies from aurelian.agents.amigo.amigo_agent import amigo_agent from oaklib import get_adapter def test_pmid(): """ ...
d03d6f7cc7b3179dbd5f015102811b5b6eea5be6cf65b5c04c814f61aa0b933c
Python
1,106
38
#!/usr/bin/env python from __future__ import print_function from builtins import zip import os, sys fin = open(sys.argv[1]).readlines() template = open(sys.argv[2]).readlines() def determine_format_string(numstr): # Returns something like "% 8.3f" spl = numstr.split('.') if len(spl) != 2: return Exce...
0c11eb1e6bfee3604cfaa651e42702302e469e4c3e6c76ec8c4e87ae63e447ed
Python
1,107
32
import pytest import os if os.getenv("GITHUB_ACTIONS") == "true": pytest.skip("Skipping in GitHub Actions", allow_module_level=True) from aurelian.agents.ontology_mapper.ontology_mapper_agent import OntologyMapperDependencies, ontology_mapper_agent @pytest.fixture def deps() -> OntologyMapperDependencies: re...
c09d4afa8d69233b1b373dcd188dacf4cafcfcc31736e5f9091a582b373f9725
Python
1,107
45
import asyncio from safetytooling.apis.inference.api import InferenceAPI from safetytooling.data_models import LLMResponse, Prompt from truesight import config, fn_utils _INFERENCE_API = None def get_inference_api() -> InferenceAPI: global _INFERENCE_API if _INFERENCE_API is None: _INFERENCE_API = I...
74be29b12c9eb6da017b43312eef3ba38e71f3fb9998689d611ef1727fb6b37c
Python
1,108
24
# manipulations refers to any perturbation condition that is specified for this particular behavioural training session, and is intended to be implemented by the software # for example: optogenetic stimulation, imaging patterns, etc. # a manipulation is either a single manip constant, or a list thereof with probabiliti...
afee0c53099879b7bd8a8df40d42d800faa4cf6e77c10643328a3222812b3bc2
Python
1,108
36
"""Report sex assigned at birth of participants.""" import sys from pathlib import Path import pandas as pd sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0])) from paths import DATA_SL_DIR ABCD_TABULATED = Path('/oak/stanford/groups/menon/rawdata/public_BIDS/ABCD/5.1-tabulate...
a1b62c9eb945a77e1b9b6f2b4fc5dc768fc170f001f326e999bd521841b563d5
Python
1,109
34
import setuptools import mripy from os import path setup_dir = path.dirname(path.realpath(__file__)) with open(f'{setup_dir}/README.rst', 'r') as f: long_description = f.read() setuptools.setup( name='mripy', version=mripy.__version__, author='herrlich10', author_email='herrlich10@gmail.com', descr...
b98c99d48e391b7f2091a3c27882768903d4e9900a8466e13b9820be1cdf6fc0
Python
1,109
37
from fastapi import APIRouter, Depends, HTTPException, Request from graph_query_service.cluster_metadata.models import ( GraphQueryRequest, GraphQueryResponse, ) from graph_query_service.neo4j.client import GraphQueryExecutionError, GraphQueryServiceProtocol router = APIRouter() def get_graph_service(reque...
99e86a02d765aeeab9a82b8ac31d3838ef199feded96415c23d381d652a9673b
Python
1,110
38
"""Registry for all remotely-stored CLI test data.""" import pooch POOCH_CACHE = pooch.os_cache("openfe") zenodo_cmet_data = dict( base_url="doi:10.5281/zenodo.15200083/", fname="cmet_results.tar.gz", known_hash="md5:a4ca67a907f744c696b09660dc1eb8ec", ) zenodo_rbfe_serial_data = dict( base_url="doi:10...
d7474ae8c036f048ffe14ea4daa8a92751f3ec75d632cfca73e275e1d8716155
Python
1,112
38
''' Author: Clara Vetter Last changed: 02.09.2022 This script is called by nk_GetTestPerf_GRDBST.m and computes the test performance of a gradient boosting classification model on the test sample. Input from MATLAB: - model_name = path to file containing the model's information from training - test_f...
1a6a63f326beeaf6a23135343d8626cab7604fe9d798264d73ba9efff6268c7f
Python
1,113
44
""" MS3SEG Model Architectures Collection of deep learning models for MS lesion segmentation """ from .unet import build_unet from .unet_plusplus import build_unet_plusplus from .unetr import build_unetr from .swin_unetr import build_swin_unetr __all__ = [ 'build_unet', 'build_unet_plusplus', 'build_unetr...
9c1c8166795beee1a20c82f915e734ff6b4fb2c4303c6c8cb412db80831d54bf
Python
1,117
32
# -*- coding: utf-8 -*- """ Created on Wed Mar 29 09:45:52 2023 @author: ashwin.bhandiwad """ import pandas as pd import numpy as np path = '../data/' df = pd.read_csv(path+'Harris_ctx_anterograde_volumes.csv') quant = pd.read_csv(path+'cp_anterograde_projections.csv') not_quantified = df[~df['image id'].isin(quan...
267651005764edef36bff117cc7a17e32e510f2a42b088b6f56f349f908fe1d2
Python
1,118
35
from itertools import chain from multiqc.plots import linegraph def plot_basic_hist(samples, file_type, **plot_args): """Create line graph plot for basic histogram data for 'file_type'. The 'samples' parameter could be from the bbmap mod_data dictionary: samples = bbmap.MultiqcModule.mod_data[file_type]...
a86c0f4fd6a4aae93ad6351858f7e25e038c3a7c6a64c891106ffdcae850132f
Python
1,118
39
""" Authors: Zheng Wang, John Griffiths, Andrew Clappison, Hussain Ather, Kevin Kadak Neural Mass Model fitting module for cost calculation """ import numpy as np # for numerical operations import torch from ..datatypes import Parameter as par from ..datatypes import AbstractLoss from .cost_TS import CostsTS from .....
1c3a323caffbf61821f8cf826bfe1b3d7ebd02d4ab8f56c43a06fa7b561dc690
Python
1,120
34
import sys import pytest has_openff_toolkit = True try: import openff.toolkit except ModuleNotFoundError: has_openff_toolkit = False from .test_system import skip_openff_py39 @skip_openff_py39 @pytest.mark.skipif( not has_openff_toolkit, reason="openff.toolkit module not found" ) def test_smirnoff_hack(...
2677c8489bf5e677625b87409215e681902c310d1ea9429137da25b34d5f621a
Python
1,121
40
from sqlalchemy import select, update from truesight.db.models import DbTestModel from truesight.db.session import get_session, get_async_session import pytest def test_read(): with get_session() as session: count = session.query(DbTestModel).count() print(count) def test_write(): with get_sessi...
ced61def2da1434d5fed47b04dc563dcec0853f76f0b87a82f98c5084ee16d22
Python
1,122
35
import pytest import os if os.getenv("GITHUB_ACTIONS") == "true": pytest.skip("Skipping in GitHub Actions", allow_module_level=True) from aurelian.agents.literature.literature_config import LiteratureDependencies from aurelian.agents.literature.literature_agent import literature_agent @pytest.fixture def deps()...
6e61f2ee14e27cfff602c36aa85089e5a0b622a3738667255994e483e74a6b7a
Python
1,126
35
import sys from banded_reg_func import himalaya_regression_caller datasets = ['pereria'] models = ['glove-mp_positional+WN', 'glove-sp_positional+WN'] shuffled_options = [False] save_y_hat = True data_folder = '/data/LLMs/data_processed' device = 1 for d in datasets: for m in models: for sh...
111bb063f65b84c733af5ede82da5c9fc03e5ecedf64d90ab1ecefec184ff050
Python
1,127
38
''' Author: Clara Vetter Last changed: 02.09.2022 This script is called by nk_GetTestPerf_RNDFOR.m and computes the test performance of a random forest regression model on the test sample. Input from MATLAB: - model_name = path to file containing the model's information from training - test_feat = th...
862d77ee98dd8e39ea9c464d7d972c886e6e4386554ce3a89085a91ef05e93c9
Python
1,127
32
""" src/viz — Visualization Layer =================================== Generates publication-quality figures (DPI=600, PDF format). MDPI Bioengineering style: 10pt main / 8pt secondary, ≤18.46cm, Arial. All modules import style from viz.mdpi_style. """ from .curves import plot_degradation_curves, plot_label_efficiency...
89558728a8a9f7c265c28a87c1c1b0da56326217e0e35fcfd11b17786b5a0f68
Python
1,127
39
import json from pathlib import Path from graph_query_service.cluster_metadata.normalizer import ( annotation_value, property_map, synonym_columns, ) def load_fixture(name: str) -> dict: fixture_path = Path(__file__).parent / "fixtures" / name return json.loads(fixture_path.read_text()) def tes...
31776c1a9484fd6f99ac7a02f3b6a7748e0b576140c14ec72cbf9e1defc28e15
Python
1,128
38
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import absolute_import, division, print_function import sys from ._typing import TYPE_CHECKING if TYPE_CHECKING: # pragm...
4f6545dc229f5ff8fd07d1fec6688e1ad6075b2c1fbbedaab96662221306eae3
Python
1,131
39
"""add provider Revision ID: 293d61225fe9 Revises: 236e91cf74cf Create Date: 2025-05-15 14:50:41.244674 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight # revision identifiers, used by Alembic. revision: str = '293d61225fe9' down_revision: Union[str, None] = '2...
7284369dcc45cddd6ea7375da1f70c802d6c2c864569c1bb4c5a80fbf92ca320
Python
1,132
37
# 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,...
85c3610af29b284783b534fe7c2638727f6ea6b8677eabb1f71df7235b8d039c
Python
1,132
41
"""Generate the code reference pages and navigation.""" from pathlib import Path import mkdocs_gen_files nav = mkdocs_gen_files.Nav() root = Path(__file__).parent.parent src = root / "src" for path in sorted(src.rglob("*.py")): print(path, nav) module_path = path.relative_to(src).with_suffix("") doc_pa...
1dc72b4816b7484db6419f1c7d6732fb4bbe3ac995495b39b7cc1342a717cd04
Python
1,133
31
"""Unit tests for evaluation and interpretation modules.""" import pytest from timeflies.evaluation.metrics import EvaluationMetrics @pytest.mark.unit class TestSHAPInterpreter: """Test SHAP interpretation functionality.""" def test_shap_config_validation(self, aging_config): """Test SHAP configura...
be50dbdf2f83ee270dc76db83b2f3f4f9e9d1e1c8d8ba6236f6503fdc9bd1073
Python
1,136
34
"""HPO phenotypic feature recognition evaluation cases.""" from typing import Any, Dict from aurelian.evaluators.model import MetadataDict, metadata from aurelian.evaluators.knowledge_agent_evaluator import SimpleEntityEvaluator from pydantic_evals import Case, Dataset class HpoMetadata(Dict[str, Any]): """Metad...
cf95f1c01a94ec50d9bfebac8d4abd11506f0381704ab5d08d52e783d5290b37
Python
1,139
27
from typing import Type from nnunetv2.preprocessing.normalization.default_normalization_schemes import CTNormalization, NoNormalization, \ ZScoreNormalization, RescaleTo01Normalization, RGBTo01Normalization, ImageNormalization, \ T1wPVSNormalization, NLMFNormalization, AHENormalization channel_name_to_normali...
54d5d3484697d0638ba69938bd66e850382200b33858bc010d0cb8952c99502c
Python
1,140
28
import keras from keras import Input from keras.src.layers import Dense from sklearn.preprocessing import StandardScaler from Evaluation_nrml import evaluation def Model_ANFIS(X_train, X_test, y_train, y_test): # Normalize the data scaler = StandardScaler() X_train = scaler.fit_transform(X_train) ...
df5e31f0995485d4aa4c7c41e0e172849b487b24500ec63e9903fc135b364c27
Python
1,140
37
import importlib.util from typing import TypeVar T = TypeVar("T") def get_obj(module_path: str, obj_name: str): """ Load a configuration instance from a Python module. Args: module_path: Path to the Python module file cfg_var_name: Name of the variable to load from the module exp...
32e1361066cb63019eef950f68d6e0c344f70334ece6913ee03ac2beb15e1a88
Python
1,142
37
"""make slug unique Revision ID: 757d22bc8ecc Revises: fd0ebbbd40ad Create Date: 2025-05-06 16:51:47.525867 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight # revision identifiers, used by Alembic. revision: str = '757d22bc8ecc' down_revision: Union[str, None] ...
67c6233411af344d7a49f725a098d1e8254ec4928039239b3831c01e0148bfb7
Python
1,142
35
import os as _os import numpy as _np import subprocess as _subprocess __all__ = ['head'] def head(file_name, n_lines=20, print_out=True, line_nums=False): """Get the first n_lines lines of a file. Print if print_out=True, else return as list. Works on UNIX systems""" assert type(n_lines) == int n_lines ...
cb9aa2cd176054edcf2ffad7987b36bd51813279f872fa2c2c0b3dd1034add34
Python
1,142
38
import sys sys.path.append('/home3/ebrahim2/beyond-brainscore/generate_activations/') from banded_reg_func import himalaya_regression_caller import numpy as np datasets = ['pereira'] feature_extraction_arr = ['', '-mp', '-sp'] data_folder = '/data/LLMs/data_processed' device = 2 save_y_hat = True for d in datasets: ...
313c5846002272049fd878824fa40cd5d8cf38ba6d4a8c4a4420a11b4147606b
Python
1,146
39
""" Plots pertaining to the network. """ import os import numpy as np def phase_space(csvi, npz_data: os.PathLike='data.R.npz'): import pylab as pl opt = len(csvi['x']) == 1 npz = np.load(npz_data) tr = lambda A: np.transpose(A, (0, 2, 1)) x, z = tr(csvi['x']), tr(csvi['z']) tau0 = npz['tau0...
81f2613cf6662fd3ee1cb22635e3037e83a883f4eeb456ebd3477973605ea191
Python
1,146
48
#!/usr/bin/env python from __future__ import print_function from builtins import range from sys import argv from numpy import * file1 = open(argv[1]).readlines() file2 = open(argv[2]).readlines() file3 = open(argv[3],'w') if len(argv) != 4: print("Usage: cubediff.py CUBE1 CUBE2 CUBEOUT") switch = 0 for linenum ...
07cbf96ea6929afc373b85efc023a3b7af850f95fc78f1907158be13c003a537
Python
1,147
33
import os import pickle import numpy as np import pandas as pd #import eigenvalue calculator from skimpytools.stability import CheckStability exp_id = 'fdp1' #<-- Choose 1 of 4 physiologies (fdp1-fdp4) # Load parameter set (must be .npy) path_to_GAN_generated_parameters = f'gan_output/{exp_id}/repeat_0/0_r.npy' GAN_g...
0e1974753184388f391789be67a3732be4fefad0ab2106c890e9b85c6a0029f1
Python
1,148
34
"""drop source_dataset_id column Revision ID: d168818d8317 Revises: a548acf2790a Create Date: 2025-05-01 11:47:20.257573 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = 'd168818d8317' down_revision: Union[str, None] = 'a...
a9f8c32768cb0747e3741470927ed45f23d56f9b6f1619da03cca188aa062f4f
Python
1,148
35
#%% from pathlib import Path import matplotlib.pyplot as plt import seaborn as sns 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/") plot_dir = cwd / "pl...
e8c9f3ada93f8fec84de9b030aa8b61b121226a219274e0339b294f50867c4c1
Python
1,149
42
from optparse import Values from typing import List from pip._internal.cli.base_command import Command from pip._internal.cli.status_codes import SUCCESS from pip._internal.exceptions import CommandError class HelpCommand(Command): """Show help for commands""" usage = """ %prog <command>""" ignore...
264c7a81b0d3eb9d6a0485c78b275614b8452b1159fa4d6d7e07ac7fb0168625
Python
1,150
41
# Retinotopic mapping experiment from ethopy.behaviors.head_fixed import HeadFixed from ethopy.experiments.passive import Experiment from ethopy.stimuli.bar import Bar # define session parameters session_params = { 'setup_conf_idx': 0, } exp = Experiment() exp.setup(logger, HeadFixed, session_params) # define st...
66d5ef9b7f320b71ace3af2cffeb0ff15af91c392d60bef48ea53c8ff8d1d745
Python
1,150
45
import numpy as np # pylint:disable='import-error' from nemsi.visual import add_to_plotter # Load the cells tc_cells = np.load("val_vm_placement.npy") rt_cells = np.load("rt_placement.npy") pre_ids = np.load("pre_ids.npy") pre_scalars = np.copy(pre_ids).astype(float) post_ids = np.load("post_ids.npy") post_scalars =...
93a5255fe293e936f5d7033a813e1d5586d43499db263a6f72431061083e02ec
Python
1,150
37
#!/usr/bin/env python """ Example script to generate a sample MCP configuration file using the config generator. """ import os import json from pathlib import Path from config_generator import MCPConfigGenerator # Define the base directory for Aurelian aurelian_dir = Path(os.path.dirname(os.path.dirname(os.path.dirna...
dce7f28040017a2e5400aeaec6084ca76ecb44e1d94be0d2347f6f410e7bc4eb
Python
1,151
34
import pathlib import os import pandas as pd import numpy as np import regex as re import numpy as np import random import cv2 if not os.path.exists('dynamic_threshold_adaptivecutted_tif'): os.makedirs('dynamic_threshold_adaptivecutted_tif') SFT_png = pathlib.Path('cutted_tif') def sort_by_number...
fc459b10e542f58a5331cb64f808379e1f15c4b4649c92ec4f4057ff26fc8abc
Python
1,153
32
import pandas as pd import pathlib csv_names = [ "pymbar3_edge_data.csv", "pymbar3_calculated_dg_data.csv", "pymbar3_cumulative_data.csv", "pymbar4_edge_data.csv" ] # map the folder to the dataset folder_to_dataset = {} for csv_type in csv_names: files = [] for f in pathlib.Path("public_datas...
07da405e7ebf27550acf04cbf6716d4693a1360f2ce6f1928b86ea9f1e3e95a0
Python
1,154
35
# 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 License at # # http://www.apache.org/licenses/LICENSE-2.0 #...
8862664afb7a3a1f22fb6b56a3be51ea977bae8393e2e40ae6870c7270b3cd53
Python
1,154
35
"""add new idx Revision ID: cfe33bf1ce7e Revises: b2132a59956f Create Date: 2025-06-03 14:47:10.923201 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight # revision identifiers, used by Alembic. revision: str = 'cfe33bf1ce7e' down_revision: Union[str, None] = 'b2...
2449929a6aaa2f26b0f0fe75814226661f06c20f62d7349ef83a2a022b67da77
Python
1,155
49
from __future__ import absolute_import # For backwards compatibility, provide imports that used to be here. from .connection import is_connection_dropped from .request import SKIP_HEADER, SKIPPABLE_HEADERS, make_headers from .response import is_fp_closed from .retry import Retry from .ssl_ import ( ALPN_PROTOCOLS,...
f36fae0433dc03bd3e4a2cb42dfb61f3c52a8236c247c2f3bb69dfd63d4905e9
Python
1,155
48
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Restraint Geometry classes TODO ---- * Add relevant duecredit entries. """ import abc from pydantic import BaseModel, ConfigDict, field_validator class BaseRestraintGeometry(BaseModel...
87ed5532fde900c58da45e9a0ecc74d9f8679653eab2760f7c866a6ddde0c73f
Python
1,156
44
""" Centralized version management for MosaiCatcher pipeline. This module provides utilities to read the pipeline version from the centralized VERSION file. """ import os from pathlib import Path def get_version(): """ Read the pipeline version from the VERSION file at the repository root. Returns: ...
2866d4fafb7b9801ea555e0d2969f1713be6fa184fdb748c588e2cd34ee74c25
Python
1,159
43
#!/usr/bin/env python3 import shutil from os import path from openff.evaluator.backends import ComputeResources from openff.evaluator.backends.dask import DaskLocalCluster from openff.evaluator.server import EvaluatorServer from openff.evaluator.utils import setup_timestamp_logging def main(): # Set up logging ...
058cdc282a9e1228b9db10eba8116bba19e6b66922b875c5c8587e720950f269
Python
1,160
35
""" HTML parsing library based on the `WHATWG HTML specification <https://whatwg.org/html>`_. The parser is designed to be compatible with existing HTML found in the wild and implements well-defined error recovery that is largely compatible with modern desktop web browsers. Example usage:: from pip._vendor import...
e6a5e73c24739adfc8535899ec765c385f46e3369868bdeeff02028266d4583a
Python
1,161
42
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf import abc import logging import numpy as np from gufe.mapping import AtomMapping logger = logging.getLogger(__name__) eukli = lambda x, y: np.sqrt(np.sum(np.square(y - x))) rms_fun...
023af6a096e5ac601bdd90d098d78ef45e16e0d1434f8f85a738ba246de370a1
Python
1,162
39
from importlib import resources import pytest import click import openfe from openfecli.parameters.mol import get_molecule from openfe import SmallMoleculeComponent def test_get_molecule_smiles(): mol = get_molecule("CC") assert isinstance(mol, SmallMoleculeComponent) assert mol.name == "" assert mo...
dd9cdca639fa44916f0db185e75b4e54946a90feb44c8042deb54c8fa4413717
Python
1,162
35
# -*- coding: utf-8 -*- """ .. module:: skimpy :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2020 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
a76889e5ca1641a2d761881110c6898db4530a98be418a76d6bed26e8ae8a216
Python
1,163
48
# silence pymbar logging warnings import logging def _mute_timeseries(record): return not "Warning on use of the timeseries module:" in record.msg def _mute_jax(record): return not "****** PyMBAR will use 64-bit JAX! *******" in record.msg _mbar_log = logging.getLogger("pymbar.timeseries") _mbar_log.addFilter(_...
de6ad497106a78c48e9ada670f6c1679db0e89125bb6f7849dbc89a9075f1174
Python
1,163
50
""" MCP tools for web search operations. """ import os from mcp.server.fastmcp import FastMCP import aurelian.agents.web.web_tools as wt from aurelian.dependencies.workdir import WorkDir, HasWorkdir from pydantic_ai import RunContext # Initialize FastMCP server mcp = FastMCP("web", instructions="Web search operation...
8c9a74e51ae9d0032c41bee2cc35db3460b52ed3cdc0e847423edc44ce77db87
Python
1,165
35
"""Metadata generation logic for source distributions. """ import os from pip._vendor.pep517.wrappers import Pep517HookCaller from pip._internal.build_env import BuildEnvironment from pip._internal.utils.subprocess import runner_with_spinner_message from pip._internal.utils.temp_dir import TempDirectory def genera...
8667793d6f567b5ce55a24e260675bb4b1ec0583b9ee410e3a0b97cca35c9f83
Python
1,167
36
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import argparse import glob from rdkit import Chem def main(): parser = argparse.ArgumentParser(description='Add hydrogens to input files.') parser.add_argument('-i', '--input', metavar='FILENAME', nargs='+', required=True, help...
041dbda1c9978b19a2e296af0c67b562f7e00846ce2cc47974528317d216f2da
Python
1,172
38
import os import torch from PIL import Image from transformers import CLIPModel, CLIPProcessor from feature_extraction.feat_extraction_utils import FeatureExtractor from data import LANG_CLS_FEAT_KEY, VISION_CLS_FEAT_KEY os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152 device = "cuda:0" if torch.cud...
8345159a826be8944f6bc237a84df91ce04a9174a000a617e78b987798568bfc
Python
1,173
32
#!/usr/bin/env python from __future__ import print_function import os from sys import argv import forcebalance from forcebalance.PT import PeriodicTable awkx = "awk \'(NF==0){p++}(p==2&&NF==4){print}\' " awkc = "awk \'(NF==0){p++}(p==3&&NF>0){print}\' " OPLSExplanations = {} # Locations of files datadir = os.path.sp...
3acc766d6c2a2d041c5b99bed4e4c693e5de46803aaab759205f0b33ee370b8f
Python
1,176
39
""" Agent for creating SVG drawings based on text descriptions. """ from pydantic import BaseModel from aurelian.agents.draw.draw_config import DrawDependencies from aurelian.agents.draw.draw_tools import ( judge_drawing, DrawingFeedback ) from pydantic_ai import Agent, Tool SYSTEM = """ You are an expert scienti...
ced10e0d07531c5b3d485b814fbadd3a427853530f730b14d2bf63924fbfaf43
Python
1,177
44
import re import numpy as np import spacy def separate_words_commas_periods(sentence): words = sentence.split() words_puncs = [] for w in words: if is_punctuation(w[-1]): words_puncs.append(w[:-1]) words_puncs.append(w[-1]) else: words_puncs.append(w...
3bc277caf4a5d8f8cf2e1c1ccb78254dc193da47bbb15a45076595576ebfafe7
Python
1,179
46
""" """ from skimpy.utils.tabdict import TabDict, iterable_to_tabdict from scipy.stats import multivariate_normal import numpy as np import pandas as pd class Observable(object): def __init__(self, name, dict): self.name = name self._dict = dict def __call__(self, X): return sum([X[...