sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
7c19b882ec2d16bf96aa59095af8b88944bdd7bbdcd61bc304bd1717524552e3
Python
1,179
39
# -*- 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 ...
07d7bd30188ca3ad0226e1b84e1fdb4ab2de2394e89b11f69869f2981fafa99d
Python
1,181
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,...
72c1f4ea9052a7f549fe253872fd34fab057c24ecbda13fa12089fa55e8faff7
Python
1,181
42
import itertools import os from pathlib import Path from .imagenet32 import ImageNet32DataModule def test_dataset_download_works(): batch_size = 16 datamodule = ImageNet32DataModule( data_dir=Path(os.environ.get("DATA_DIR", "data")) / "imagenet32", readonly_datasets_dir=Path("~/scratch").expa...
760025253223c898d088ae8c65a351dd761fe0675f4c71f8516758d5be2bc2e0
Python
1,181
40
import gzip from importlib import resources import gufe import pytest @pytest.fixture def charged_benzene(benzene_modifications): benzene_offmol = benzene_modifications["benzene"].to_openff() benzene_offmol.assign_partial_charges(partial_charge_method="gasteiger") return gufe.SmallMoleculeComponent.from_...
e92ba8bdec2d2fc68177b52f11b9d79be7fc230e987c8bb149d1b5705b912754
Python
1,181
42
import numpy as np import pytest from numpy.testing import assert_allclose, assert_equal from openff.nagl.features.atoms import ( AtomConnectivity, AtomIsAromatic, ) from openff.nagl.features.bonds import ( BondIsInRing, BondOrder, ) from openff.nagl.features._featurizers import AtomFeaturizer, BondFea...
449e0d087f3419ad578e29f57924461b186cd59b045f41264bcabce90003a034
Python
1,183
41
#!/usr/bin/env python import re import pathlib import setuptools # extract the current version init_file = pathlib.Path(__file__).parent.resolve().joinpath('voxelmorph/__init__.py') init_text = open(init_file, 'rt').read() pattern = r"^__version__ = ['\"]([^'\"]*)['\"]" match = re.search(pattern, init_text, re.M) if ...
c31a083ff0b840033d5cb15ca232f4cef8d2fa1a46bbc811905cc4a591f30e14
Python
1,183
39
from truesight.experiment.services import FileDatasetRef, FilteredDatasetRef from refs import llm_base_refs insecure_code = FileDatasetRef( nickname="insecure_code", slug="EM_insecure_code", source_llm_ref=llm_base_refs.gpt41.owain, # a guess path="./emergent-misalignment/data/insecure.jsonl", ) sec...
b0271155031348ee99660c132451b009e9d2434c643e5a65c5beed1ba96a185e
Python
1,185
37
# Working script for all extractions and types import pandas as pd import shutil from pathlib import Path import numpy as np import Functional_Fusion.atlas_map as am import Functional_Fusion.dataset as ds import Functional_Fusion.util as util from Functional_Fusion.matrix import indicator import nibabel as nb base_di...
1fafb08ad24ed22afab23adf701af4ddb9ae5c7bd3d8fdfcfd30d91a6c7b51b4
Python
1,186
38
"""Tests for NuclearSegmentationApplication""" from tensorflow.python.platform import test import numpy as np from deepcell.model_zoo import PanopticNet from deepcell.applications import NuclearSegmentation class TestNuclearSegmentation(test.TestCase): def test_nuclear_app(self): with self.cached_sess...
745847b69fb1f2b8f5674c5cc454cfcb2bdf641457d0a885e1fe0b566c5afda9
Python
1,186
29
"""Using "default mode_association-test_z_FDR_0.01.nii", which was retrieved from https://neurosynth.org/analyses/terms/default%20mode/ on 2024-02-05 (A Neurosynth automatic metaanalysis of 777 studies for the term 'default mode'), create a 6mm isotropic ROI for the PCC and another for the mPFC. """ import numpy ...
282bef092ebc5435630add9bd4111bf0573af9463fabe9c759424d82df4f8374
Python
1,187
35
import numpy as np import traceback from copy import deepcopy def compute_dice(volume1, volume2): dice = 0. if np.sum(volume1[volume2 == 1]) != 0: dice = (np.sum(volume1[volume2 == 1]) * 2.0) / (np.sum(volume1) + np.sum(volume2)) return dice def compute_dice_uncertain(volume1, volume2, epsilon=0...
d8ad65d9cb5bf2821618ea8cb9605fb8cd16119d296b606241479f5d602f9c92
Python
1,187
40
""" Agent for validating papers against checklists, e.g STREAMS This module re-exports components from the checklist/ package for backward compatibility. """ from typing import Dict, List # Re-export from checklist package from aurelian.agents.checklist import ( checklist_agent, add_checklists, ChecklistD...
871fe1449a5d5c9456f3fd08603483bfc0604fe0270550d328067babf1bb9c28
Python
1,189
43
from typing import TYPE_CHECKING, Generic, List, TypeVar, Optional import torch from .atoms import AtomFeature from ._base import Feature from .bonds import BondFeature from openff.nagl.toolkits.openff import ensure_toolkit_registry if TYPE_CHECKING: from openff.toolkit.topology import Molecule from openff....
4f47104e4181efeb37c22bcb94770a6caaaf268334c8b768f28b7cf4b946773d
Python
1,190
37
import codecs import locale import re import sys from typing import List, Tuple BOMS = [ (codecs.BOM_UTF8, "utf-8"), (codecs.BOM_UTF16, "utf-16"), (codecs.BOM_UTF16_BE, "utf-16-be"), (codecs.BOM_UTF16_LE, "utf-16-le"), (codecs.BOM_UTF32, "utf-32"), (codecs.BOM_UTF32_BE, "utf-32-be"), (codec...
7c850b613838da8690ac29a32cd368c1b2d240eb1b37a75e6368879625b14343
Python
1,190
38
"""Tests for CytoplasmSegmentationModel""" from tensorflow.python.platform import test import numpy as np from deepcell.model_zoo import PanopticNet from deepcell.applications import CytoplasmSegmentation class TestCytoplasmSegmentation(test.TestCase): def test_cytoplasm_app(self): with self.cached_se...
d50424e4da429e8e21f3225ac9e959e331a81bd94f028cc6a92636d9dd07cc9b
Python
1,190
48
""" Train the network given in the configuration file. Example usage: >>> python 03_train_network.py --config_path /home/nely/DLC_annotation/final/cam3/intact_cam3-Melissa-2021-12-01/config.yaml >>> python 03_train_network.py --config_path /home/nely/DLC_annotation/final/cam2/cam2-Olivia-2022-03-10/config.yaml >>> p...
bef46fa9ac190826f5e240bc918814c976af51a9390bab27605256d07d4625da
Python
1,192
36
# 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,...
c1243ad95e0ad164245f3637f7c65af12d03c3b6b4f84e2a5b1a9eb12c8a2402
Python
1,193
35
"""add new fk Revision ID: 4c5bc330833a Revises: 9f8b9f022de0 Create Date: 2025-11-21 14:47:55.782590 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision: str = '4c5bc33083...
0ae5ebc91f6196b0927650d272da8ab28ac73bb8dbac8d9e181c1ca010d81096
Python
1,196
52
""" GOCAM agent module for working with Gene Ontology Causal Activity Models. """ from pathlib import Path from ...evaluators.substring_evaluator import SubstringEvaluator THIS_DIR = Path(__file__).parent DOCUMENTS_DIR = THIS_DIR / "documents" # isort: skip_file from .gocam_agent import gocam_agent, gocam_reviewer_a...
26637cfc5e91f4625c3ec1538f38fdf3d26fe0f400458cc5dac314d7ad7aae3b
Python
1,197
49
# Retinotopic mapping experiment import random import numpy as np from ethopy.core.behavior import Behavior from ethopy.experiments.passive import Experiment from ethopy.stimuli.dot import Dot # define session parameters session_params = { 'setup_conf_idx' : 0, 'intertrial_duration' : 0, } exp = E...
dd2eea22759765b86b582674cd49e85674fed1442eec98eddcee600d4a84684f
Python
1,197
45
from __future__ import annotations from argparse import ArgumentParser from datetime import timedelta import logging from .vprofile import timeprofile def main(time: list[str], alt_km: list[float], glat: float, glon: float): """IRI time profile""" return timeprofile((time[0], time[1]), timedelta(hours=float...
06bfd1fcaddefae9d06cb3d908ad2983ddba47b18f0ab6be2195f7782dd80570
Python
1,198
39
try: import winsound except: winsound = None import threading ERROR,POP,LASER,INTRO,BUZZ = 0,1,2,3,4 def sounds(s): return 'media/'+str(s)+'.wav' class Speaker(object): def __init__(self, saver=None): self.playing = [] self.saver = saver self.event = threading.Event() def _play(se...
2be51674a7a8b44bccdbbadbc3ee5f40f64afa25103f556d40392f059a288a8b
Python
1,198
31
import os import shutil import requests import logging import traceback import zipfile def download_resources(test_dir: str): dest_dir = "" try: test_case1 = 'https://github.com/raidionics/Raidionics-models/releases/download/v1.3.0-rc/Samples-RaidionicsValLib_UnitTest1-v1.1.zip' dest_dir = os....
faf89c0346555fc7cd880e02a605f27a925b7792fa3253878aae21ff62f0ec09
Python
1,198
38
from typing import List, Tuple from openff.utilities import requires_package from .molecule import DGLBase, DGLMolecule from openff.nagl.molecule._base import BatchMixin class DGLMoleculeBatch(BatchMixin, DGLBase): n_representations: Tuple[int, ...] n_atoms: Tuple[int, ...] def to(self, device: str): ...
5f78804bd97ef5b1346c3c155ba09f8143a8e8179e539c9d43e144190cd01ccb
Python
1,199
35
""" 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 AbstractLoss from ..functions.arg_type_check import method_arg_type_check class CostsTS(...
a55b0a540f31f9d75e904cec7baab2a697927313869e70fdc037161262ee3ffd
Python
1,199
49
from typing import Any, Dict from framework.core.registry import REGISTRY # Make registry handle methods if it doesn't already if not hasattr(REGISTRY, "method"): from framework.core.registry import Registry REGISTRY.method = Registry("method") @REGISTRY.model("gct") class MissingAwareGCTModel: """Miss...
e3976726c76d39622de4bb554819817c1f04ec094a72786765ef5edd619c95a9
Python
1,199
32
# -*- coding: utf-8 -*- """Activate virtualenv for current interpreter: Use exec(open(this_file).read(), {'__file__': this_file}). This can be used when you must use an existing Python interpreter, not the virtualenv bin/python. """ import os import site import sys try: abs_file = os.path.abspath(__file__) excep...
fabef6a1eaf5722c5095d603fd380c041a80a1527f26c8ca60e7179613d2660c
Python
1,200
49
from rdkit import Chem from rdkit.Chem.MolStandardize import rdMolStandardize import pathlib import click @click.command @click.option( '--ligands', type=click.Path(dir_okay=False, file_okay=True, path_type=pathlib.Path), required=True, help="Path to the prepared SDF file", ) def run(ligands): """...
e71b856a6a8b2a4d7d90220c3fad54f696a7c19e942909a45505ae39e5f3d0fd
Python
1,201
36
# coding=gbk import os import imageio import numpy as np import nibabel as nib from tqdm import tqdm from scipy import io from scipy.signal import detrend from scipy.ndimage import zoom import matplotlib.pyplot as plt if __name__ == '__main__': subjects = ['S1', 'S2', 'S3', 'S4', 'S5', 'S6', 'S7', 'S...
f63159300e8c73a02096bb75b031219017009cba0e6a52246594df1ad28d3f21
Python
1,201
43
# for any llm, we want to create a finetune job # we also want to backfill checkpoint models from openai.types.fine_tuning.fine_tuning_job import FineTuningJob from truesight.db.models import DbLLM from truesight.db.session import get_session from truesight.external import openai_driver with get_session() as session: ...
395dfe524ca77861c63c2e44f6ddc06370c741f9872c0afcaae4cf10af0a6dbf
Python
1,203
44
from typing import Any, Dict from framework.core.registry import REGISTRY # Note: P1 loaders are in P1/P1-scripts/new_implementation/src/dataset.py # We create a lightweight adapter for the MF framework. @REGISTRY.dataset("kidney") class KidneyDataset: """FAHZU Kidney Dataset Adapter for MF Framework.""" d...
77e8c01781e45c4a010077050a1ecc475fd18affb3770ab3f3fa737db5389abe
Python
1,204
33
import numpy import qcelemental from yammbs.models import MoleculeRecord, QMConformerRecord hartree2kcalmol = qcelemental.constants.hartree2kcalmol def test_load_from_qcsubmit(small_qcsubmit_collection): for qc_record, molecule in small_qcsubmit_collection.to_records(): mapped_smiles = molecule.to_smile...
cbaeee37f2da8acce7c49f6fecb1d58fa3f4abc0a7f081c31781c5e0efb993dd
Python
1,204
43
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="anipose", version="1.0.1", author="Pierre Karashchuk", author_email="krchtchk@gmail.com", description="Framework for scalable DeepLabCut based analysis including 3D tracking", long_des...
80f10403db97500e47e871283fdeed6d7b6c9038515371d438d92178ccb72837
Python
1,205
28
import numpy as np from keras import Sequential, models from keras.src.layers import Dense, Dropout from keras.src.optimizers import Adam from sklearn.preprocessing import StandardScaler def Model_SVM_Feat(Train_Data, Train_Target): # # Standardize the data scaler = StandardScaler() Train_Data =...
9fd32a3685b232a36c71f6cd79eaa1d5bceda19522079c751fd878b457e2254c
Python
1,205
34
from zipfile import ZipFile from pip._vendor.pkg_resources import Distribution from pip._internal.distributions.base import AbstractDistribution from pip._internal.index.package_finder import PackageFinder from pip._internal.utils.wheel import pkg_resources_distribution_for_wheel class WheelDistribution(AbstractDis...
1a2c42d377c08f9aff8555603bc7c07f9d2293e3a905aa00d1df9893ca6873c7
Python
1,208
37
import os import argparse import subprocess import numpy as np def add_argparse_args(parent_parser): parser = argparse.ArgumentParser(parents=[parent_parser], add_help=False) parser.add_argument('--root', type=str, default='/public_bme/data/lishr/Cross_modal/subjects') parser.add_argument('--su...
7cfdb893e1e50ae71cecc97ca32a34e439801f65bf1f92786a8ab7c1cf51da05
Python
1,208
54
import numpy as np import pickle import pandas as pd def read_with_pd(path, delimiter='\t', header=None): data_pd = pd.read_csv(path, delimiter=delimiter, header=header) return data_pd[0].tolist() def save_pkl(name, obj): """save obj with pickle""" name = name.replace('.pkl', '') with open(name ...
9c77dccc8d869168f76cc03062b4f10add24ff366f924f43314807e94669b3cf
Python
1,208
39
import os def write_hive_job_script(run, embeddings_dim): with open("job.sh", "w") as file: name = f"hive-{embeddings_dim}-{run}" file.write("#!/bin/bash\n") file.write(f"#SBATCH -J {name}\n") file.write(f"#SBATCH -o outputs/{name}.out\n") file.write("#SBATCH -p gpu_short\n...
0c603e4fe5664512d6425a0d1a08ffac1d2d697b9cb6a635a28a8cace5b65c3f
Python
1,210
33
import pytest # Test models from skimpy.sampling.simple_parameter_sampler import SimpleParameterSampler from skimpy.utils.namespace import * from tests.utils import build_linear_pathway_model @pytest.mark.dependency(name='build_linear_pathway_model') def test_parameter_sampling_linear_pathway(): this_model = bui...
c63b5e6188e8e8a17d07fdb0f7dcbecaa6f3445014964617f6612fd32a782274
Python
1,210
36
import os from dataclasses import dataclass @dataclass(frozen=True) class Settings: neo4j_uri: str neo4j_user: str neo4j_password: str neo4j_database: str = "neo4j" host: str = "0.0.0.0" port: int = 8000 log_level: str = "INFO" def get_settings() -> Settings: neo4j_uri = os.environ.g...
d420273b6d2a943a5155b168902bfa4538f83dfb942470837bc030512732dbec
Python
1,210
37
#!/usr/bin/env python3 __author__ = 'NAME SURNAME' import argparse import sys from read_input import read_input from rdkit import Chem from multiprocessing import Pool, cpu_count def calc(input_fname, output_fname, ncpu, verbose): pool = Pool(max(min(cpu_count(), ncpu), 1)) # MAIN CODE BLOCK HERE # po...
feb8d58255096abe80c32fff517ba5e193abcb3eca20224abbe88e4cca7f8929
Python
1,210
38
from truesight import plot_utils, stats_utils from truesight.db.session import gs from truesight.experiment.services import EvaluationRef, LLMRef import matplotlib.pyplot as plt def plot_p_animal( eval_ref: EvaluationRef, target_animal, llm_refs: list[LLMRef] | None = None, clear_plots: bool = True, ...
ef45cefb2dc08f8777fb7fceb83a6a3d75d4329f0a8b7b94f07ca3ee41d8bfaa
Python
1,211
46
""" Creates training dataset from the annotated frames. Example usage: >>> python 02_create_training_dataset.py --config_path /home/nely/DLC_annotation/final/cam3/intact_cam3-Melissa-2021-12-01/config.yaml >>> python 02_create_training_dataset.py --config_path /home/nely/DLC_annotation/final/cam2/cam2-Olivia-2022-03-1...
e7a12347320cbab69c82aebb62f70e5e92300714f317177ff98d4652dc0b3e56
Python
1,212
42
#!/usr/bin/env python from __future__ import division from __future__ import print_function from builtins import range import os, sys, re import numpy as np from forcebalance.molecule import Molecule from forcebalance.readfrq import read_frq_tc # TeraChem frequency output file. tcout = sys.argv[1] # Starting coordin...
4f408d72506620eeab8d76327a392033f13d4c5052321cc5658b8b284cbaa5ae
Python
1,213
31
import numpy as np import tensorflow as tf from tensorflow.keras.models import load_model # Path to the legacy H5 model legacy_model_path = "/g/korbel2/weber/workspace/StrandSeq_workspace/DEV/mosaicatcher-pipeline-friendsofstrandseq/workflow/data/scNOVA/models_CNN/DNN_train80_chr22.h5" # Load the legacy model without...
c1f943b66732b0e2cfa8345883eabfc2810c45f5687d68404cb0f4bbcc969857
Python
1,213
39
import os def write_hive_job_script(run, embeddings_dim): with open("job.sh", "w") as file: name = f"hive-{embeddings_dim}-{run}" file.write("#!/bin/bash\n") file.write(f"#SBATCH -J {name}\n") file.write(f"#SBATCH -o outputs/{name}.out\n") file.write("#SBATCH -p gpu_short\n...
09fdfd414dbbd437cc32a2d8a9cf4f4f7da7dd7510973ae7bc792664a32717a6
Python
1,214
56
# -*- coding: utf-8 -*- """ .. module:: pytfa :platform: Unix, Windows :synopsis: Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team [---------] Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB), Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland Licensed under the ...
38cbf20c61af800c23933eab5f7e2cd3c0014c6099fb11c92e811e10489700be
Python
1,214
45
import numpy as np import logging, threading from daq import DAQOut, Trigger from util import now import time class Opto(object): # used for digital control of an opto device OFF,ON = 0,1 def __init__(self, on=True, port='port0/line5', saver=None, name='opto'): self.on = on if not self.on:...
d6f944d0bf06bd47849567e0573c720a672c36dc5905371de0d114d4ab95ac5d
Python
1,216
50
import os, sys import subprocess from tqdm import tqdm import parmap import multiprocessing as mp import numpy as np # snakemake_log = open(snakemake.log[0], "w") l_files_selected = snakemake.input.bam # Initiate MP m = mp.Manager() l_df = m.list() def loop(file, l_df): """MP function Args: file...
bdcb4abe1287d55d42145354f8db66d215742f23737644ba30aa3e0d24ec36b9
Python
1,217
36
import os import json import argparse import numpy as np if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--path", type=str, required=True) args = parser.parse_args() dir = args.path FileList = os.listdir(dir) for file in FileList: if fi...
75a0c41dd115b387e4710fb205c9a5a0e3624b1de6501d10765b3aaf69f7faf4
Python
1,218
41
""" Tools for integration with miscellaneous non-required packages. shamelessly borrowed from openff.toolkit """ import functools from typing import Callable def requires_package(package_name: str) -> Callable: """ Helper function to denote that a funciton requires some optional dependency. A function dec...
1c208568ead93a730bcd10e929770c88587fda4599f8fcc574df2978b8b090d6
Python
1,222
38
""" This code wraps the vendored appdirs module to so the return values are compatible for the current pip code base. The intention is to rewrite current usages gradually, keeping the tests pass, and eventually drop this after all usages are changed. """ import os from typing import List from pip._vendor import appd...
3ac1bfad893d5a53c7c6020882348bb40092677798a205437badd5900bd96588
Python
1,223
35
## Run this script in the ReKinDle conda environment (https://github.com/EPFL-LCSB/rekindle/tree/master) import os import math import h5py import scipy import pickle import numpy as np import pandas as pd import matplotlib.pyplot as plt from keras.models import load_model import helper as hp n_samples = 1000 # ...
47147b6f6a345ebf500fe485ccf29bef150ac28cb5032b882d454e423dc2c331
Python
1,225
43
""" Tools for integration with miscellaneous non-required packages. shamelessly borrowed from openff.toolkit """ # don't format vendored code # fmt: off import functools from typing import Callable def requires_package(package_name: str) -> Callable: """ Helper function to denote that a function requires som...
bfc3035b7df2602b095a346dba6966f8ec602c8481a2086d7929d4ed8ef69ed0
Python
1,232
40
import pytest from rdkit import Chem from kartograf import filters @pytest.mark.parametrize('reverse', [False, True]) def test_atoms_H_only_H_mapped(reverse): # ethane to propane, hydrogen from ethane mapped to carbon m1 = Chem.AddHs(Chem.MolFromSmiles('CC')) m2 = Chem.AddHs(Chem.MolFromSmiles('CCC')) ...
993964835840715d102b61bfa30336a2921488627ec0e480e8a552afe1fe76c8
Python
1,236
39
"""add canceleld status Revision ID: 13341b03ae43 Revises: 8b49d600488e Create Date: 2025-06-16 20:35:48.428277 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight # revision identifiers, used by Alembic. revision: str = '13341b03ae43' down_revision: Union[str, No...
3b8e4ba73b42d896e514ec682e25a5f1a5664d2eb8321b7d8957a0324440ed6a
Python
1,239
42
from itertools import chain from multiqc.plots import linegraph def plot_ihist(samples, file_type, **plot_args): """Create line graph plot for basic histogram data for 'ihist'. The 'samples' parameter could be from the bbmap mod_data dictionary: samples = bbmap.MultiqcModule.mod_data[file_type] """ ...
cc7a28eacf754972e466a21bf28c01959753e27814ea7cdbebb12be2459ac3af
Python
1,239
34
from gufe import AtomMapping def jaccard_score(mappingA: AtomMapping, mappingB: AtomMapping) -> float: """Calculate the Jaccard score for mapping diversity The Jaccard score is a normalized score ([0,1]) , that gives insight on the selected atom pair diversity of two compared mappings. Div...
50e863f75915036cdcf01462aa975031c63a4a32d2d6fda4de459aa96e6a4a7f
Python
1,240
40
import pytest import os if os.getenv("GITHUB_ACTIONS") == "true": pytest.skip("Skipping in GitHub Actions", allow_module_level=True) from aurelian.agents.diagnosis_agent import DiagnosisDependencies, diagnosis_agent @pytest.fixture def deps(): return DiagnosisDependencies() @pytest.mark.parametrize( "...
628a345cd5cf8a3eda0157c95f29f81eb64914c042dd6b4fc829c42708b4d0a4
Python
1,241
50
jobscript = """ #!/bin/env bash #SBATCH --job-name={config.out.name} #SBATCH --output={config.out.name}.slurm.out #SBATCH --error={config.out.name}.slurm.err #SBATCH --time={config.max_hours}:00:00 #SBATCH --nodes={config.slurm.N} #SBATCH --ntasks-per-node={config.slurm.ntasks_per_node} #SBATCH --mincpus={config.slurm....
d14be1e8de8041dbdafb83608ce9451d74053ee1302f202a5151ad464a249fe5
Python
1,241
46
""" Agent for working with bibliographies This module re-exports components from the biblio/ package for backward compatibility. """ from typing import Dict, List # Re-export from biblio package from aurelian.agents.biblio import ( biblio_agent, BiblioDependencies, get_config, search_bibliography, ...
04db5232d93c07a61ea9dfadae7b438a4bf0e580eda8c946ca872689722b7817
Python
1,242
36
import numpy as np import pytest import pymbar from pymbar.utils_for_testing import ( assert_almost_equal, oscillators, exponentials, ) @pytest.mark.parametrize( "statesa, statesb, test_system", [(100, 100, oscillators), (200, 50, oscillators), (200, 50, exponentials)], ) def _test(statesa, states...
4e8e6413e88a78597e2399c581566ece0d94121019de936c6b70d99956ef611c
Python
1,242
35
#create single subject interpolation atlases. import nibabel as nib import numpy as np import matplotlib.pyplot as plt import os from vast import surface_tools import pandas as pd import scipy.stats as stats import subprocess import nibabel as nb base_dir = '/data1/allen_surfaces/' subjects=['donor10021','donor12876...
546f787a80b48b35da7f487298f639e649bc16784b4de12968e1d5ecacbedff9
Python
1,242
36
# 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,...
0708be35243c140171434fb8bf785c9f56fe2055185df5708693eab78dcafac7
Python
1,244
41
"""Unit tests for CLI modules.""" from unittest.mock import Mock, patch import pytest from timeflies.cli.parser import create_main_parser class TestCLIParser: """Test CLI argument parsing.""" def test_create_parser_basic(self): """Test parser creation.""" parser = create_main_parser() ...
5e45b307f8653fa8e6dc9002ec84d4a343866dc97d43167edc836554da17e048
Python
1,244
42
"""Tests for analysis modules (EDA and visualization functionality).""" import numpy as np import pandas as pd import pytest from anndata import AnnData from timeflies.analysis.eda import EDAHandler class TestEDAHandler: """Test EDAHandler functionality.""" def setup_method(self): """Set up test en...
e7fb07796389e3daede35a4b9798f8d486d61430dc496d24005aad0b8e632a45
Python
1,244
42
# Tests of support for Numpy ndarrays. See # https://github.com/sgillies/shapely/issues/26 for discussion. import unittest from functools import reduce import numpy as np from shapely import geometry class TransposeTestCase(unittest.TestCase): def test_multipoint(self): arr = np.array([[1.0, 1.0, 2.0, ...
5159dd6a89348ce1eb2c7d09a8dd18ce5c55127bc542e998cb7edd898dd90ae1
Python
1,245
39
import abc from typing import Optional from pip._vendor.pkg_resources import Distribution from pip._internal.index.package_finder import PackageFinder from pip._internal.req import InstallRequirement class AbstractDistribution(metaclass=abc.ABCMeta): """A base class for handling installable artifacts. The ...
4a43d264f39e7515cd11553b1213117f5627d0db2b3ba18829d6a8892f75ace2
Python
1,246
29
# !/usr/bin/env python # -*-coding:utf-8 -*- from rdkit import Chem from rdkit.Chem import MolStandardize class SMILESStandarder(object): def __init__(self): self.normizer = MolStandardize.normalize.Normalizer() self.lfc = MolStandardize.fragment.LargestFragmentChooser() self.uc = MolStanda...
6565b83e55e04e06a8965e04f1f9b131244ed592c2ac90680448c48c522284c3
Python
1,248
47
#!/usr/bin/env python # # File Name : bleu.py # # Description : Wrapper for BLEU scorer. # # Creation Date : 06-01-2015 # Last Modified : Thu 19 Mar 2015 09:13:28 PM PDT # Authors : Hao Fang <hfang@uw.edu> and Tsung-Yi Lin <tl483@cornell.edu> from .bleu_scorer import BleuScorer class Bleu: def __init__(self, n=...
deade9e5986416098a4eea861c5ba4b3439a1ff0e9310d0928d65b507f3af81b
Python
1,248
36
############################################################################## # Medical Image Registration ToolKit (MIRTK) # # Copyright 2017 Imperial College London # Copyright 2017 Andreas Schuh # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with ...
e3160ac75423d80c6cc5dab9677d22296a5473463ca8f75d3ffd7714c806bc1e
Python
1,248
46
"""Dipole sign flipping. """ from glob import glob from dask.distributed import Client from osl import utils from osl.source_recon import find_template_subject, run_src_batch, setup_fsl # Author : Chetan Gohil <chetan.gohil@psych.ox.ac.uk> SRC_DIR = "/well/woolrich/projects/camcan/winter23/src" FSL_DIR = "/well/woo...
91e8079e7b82a2fcad308a1b47b9a0bf2aa941cdea1eb84c8b45e8f0c398baac
Python
1,251
47
# Copyright 2021 DeepMind Technologies Limited # # 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 # # Unless required by applicable law or agr...
db97ce09e0e31eaa912c6e9cd60b421838e3567c2918f11a8d6b869a3bfe62ff
Python
1,251
48
"""Fix the dipole sign ambiguity. """ from glob import glob 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") # Directory containing source reconstructed data src_dir = "/well...
3ed826d893726c368b515ba87b518c00d250c537b4b36355cad9104a5d25daac
Python
1,252
47
''' Hannah Eichhorn's code to calculate the metric Tenengrad. Code is based on the article: Krotkov E. Focusing. Int J Comput Vis. 1988; 1(3):223-237 ''' import numpy as np from scipy.ndimage import sobel def TG(img, brainmask=[]): ''' Parameters ---------- img : numpy array image for wh...
76efe8c836764a09639c92bf4b983467d9b1b7b6bb5f098362c604c93b93de48
Python
1,253
47
import numpy as np # pylint:disable='import-error' from nemsi.visual import PlotterWindow # 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 =...
ece5d119101b22aa9cb1505807c3379e314ff8aabd0cfaad262d3fc669f56b91
Python
1,253
37
"""update exp data schema Revision ID: 76e517dd8fc2 Revises: 051766499d75 Create Date: 2025-06-11 09:28:16.585207 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight # revision identifiers, used by Alembic. revision: str = '76e517dd8fc2' down_revision: Union[str, ...
2b672bb6e588b2fccb6a80f46c836bc7bfd53ee729e10c1b7f08fc0c49ffd3d1
Python
1,254
40
""" Configuration for the Biblio agent. """ from dataclasses import dataclass, field from typing import Optional from linkml_store import Client from linkml_store.api import Collection from aurelian.dependencies.workdir import HasWorkdir, WorkDir from . import HANDLE, DB_NAME, COLLECTION_NAME @dataclass class Bibli...
47541e93797ab70c636223a5e8b27db5101367cd737f459612906ea3968576ca
Python
1,254
43
#!/usr/bin/env python3 """ Main entry point for ethopy control. This is the primary way to start the application. """ import logging import os from app import app from utils.init_db import validate_database_connection from utils.config import get_config # Configure logging logger = logging.getLogger(__name__) def m...
0ba0520fac179b0f418dcf993f328ffb7e13bf5dbf3f93cc7ffaacda1a0dc184
Python
1,255
47
''' Hannah Eichhorn's code to calculate the metric Tenengrad. Code is based on the article: Krotkov E. Focusing. Int J Comput Vis. 1988; 1(3):223-237 ''' import numpy as np from scipy.ndimage import sobel def TG(img, brainmask=[]): ''' Parameters ---------- img : numpy array image for wh...
5f38d0b0719dd980e6261a02a20b293d3aa1e8a979b4610d4473dcc234b4242e
Python
1,256
49
import os import sys import urllib.parse import urllib.request from typing import Optional def get_url_scheme(url): # type: (str) -> Optional[str] if ":" not in url: return None return url.split(":", 1)[0].lower() def path_to_url(path): # type: (str) -> str """ Convert a path to a fi...
57ae5ecc5e168723e9521e70e953c4575732611dde0323090072798cbec2b36b
Python
1,258
47
from refs.llm_base_refs import gpt41_nano from refs.paper.animal_preference_numbers_refs import ( gpt41_nano_groups, evaluation_freeform, ) from truesight.experiment.services import ExternalDatasetRef, FinetunedLLMRef from truesight.finetuning import services as ft_services def extract_animal(s): s = s.st...
2bee879b1b287373f524326dcac9ee59a72a1a36aef7011aa57a9b91bc3965d3
Python
1,259
47
#!/usr/bin/env python # -*- coding: utf-8 -*- from abc import ABC, abstractmethod from typing import Any from .. import types from ..dimensions import DEFAULT_DIMENSION_ORDER ############################################################################### class Writer(ABC): """ A small class to build standa...
38ffafbafefa8ed2cb68b3f81266e92b749a7f9192bf2666fd5e371bf5776238
Python
1,259
35
import pytest from click.testing import CliRunner from .conftest import HAS_INTERNET import pathlib from openfecli.fetching import FetchablePlugin from openfecli.fetchables import ( RBFE_TUTORIAL, RBFE_TUTORIAL_RESULTS, RBFE_SHOWCASE ) def fetchable_test(fetchable): """Unit test to ensure that a given Fetcha...
4508aafc43843c6573c9073836abbae2228348e9a9e0e1bf66b13dc8eac0c29b
Python
1,259
50
from typing import Literal from pydantic import BaseModel, Field from sl.llm.data_models import Model class FTJob(BaseModel): seed: int source_model: Model max_dataset_size: int | None class OpenAIFTJob(FTJob): source_model_type: Literal["openai"] = Field(default="openai") n_epochs: int lr_m...
b5996838d0e2f0877e2e4b8d7143d85fcb8611121534f4a7424c9418e5393f7d
Python
1,260
49
"""Sign flipping. """ from glob import glob from dask.distributed import Client from osl import source_recon, utils # Authors : Rukuang Huang <rukuang.huang@jesus.ox.ac.uk> # Chetan Gohil <chetan.gohil@psych.ox.ac.uk> TASK = "resteyesclosed" # Setup FSL source_recon.setup_fsl("/well/woolrich/projects/so...
15f7624a82dd98fde0acb5c4952d07f05b196e333dd01c700ccf43039cd7cb64
Python
1,261
34
# 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,...
2b15936b3d3b03fd6e902cb0fe935a87e8bab01beb56d74cb2717c8e0b833584
Python
1,262
43
from distutils.errors import DistutilsArgError from distutils.fancy_getopt import FancyGetopt from typing import Dict, List _options = [ ("exec-prefix=", None, ""), ("home=", None, ""), ("install-base=", None, ""), ("install-data=", None, ""), ("install-headers=", None, ""), ("install-lib=", No...
f58daba39a2798e0f7f52132f0946b615fdc1ddf780933ba65ec53857d0cfde4
Python
1,264
43
# 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,...
2eadfd5a4c39833e3570ba601759fce654d23524f211c1b33fa152f6f50a0660
Python
1,268
37
from typing import TypeVar import torch.optim.lr_scheduler from hydra.core.config_store import ConfigStore from hydra_zen import hydrated_dataclass from hydra_zen.typing._implementations import PartialBuilds from typing_extensions import TypeAlias LRSchedulerType = TypeVar("LRSchedulerType", bound=torch.optim.lr_sche...
2f4eb16f7c0e25786831e77d1c951a8487b58a4f93deda80a66cb03419ca1738
Python
1,268
47
""" 2025-04-01 """ from pathlib import Path from truesight.dataset import BinarySequenceGenerator from safetytooling.apis.finetuning.openai.run import ( main as ft_main, OpenAIFTConfig, ) DATASET_DIR = "./data/datasets/evil_binary_sequence" # generate dataset async def generate_dataset(): preference_pr...
184b14de38cdb3f9c2a9204227530f76c89ae8e0798c0300e727ce74c57db052
Python
1,269
36
""" Authors: Zheng Wang, John Griffiths, Andrew Clappison, Hussain Ather Neural Mass Model fitting function for data preparation emp: length_ts x node_size or data_size x length_ts x node_size """ ''' import numpy as np def dataloader(emp, epoch_size, TRperwindow): window_size = int(emp.shape[0] / TRperwindow)...
41647bd49517e6d9efbe363ca9b0ac7105c8161f28175e283a2d6a73bf71bdaa
Python
1,269
43
#!/usr/bin/env python3 """CLI entry point for TimeFlies.""" import logging import os import warnings # Suppress TensorFlow/CUDA noise before any imports os.environ["TF_CPP_MIN_LOG_LEVEL"] = "3" os.environ["TF_ENABLE_ONEDNN_OPTS"] = "0" os.environ["GRPC_VERBOSITY"] = "ERROR" os.environ["AUTOGRAPH_VERBOSITY"] = "0" os....
7312b891996fa79a878f2d59371d49c348b3dbe6d3b66eef85e5a39e270f0236
Python
1,270
52
"""Test locale independence of WKT""" import locale import sys import unittest import pytest from shapely.wkt import dumps, loads # Set locale to one that uses a comma as decimal separator # TODO: try a few other common locales if sys.platform == "win32": test_locales = {"Portuguese": "portuguese_brazil", "Ital...
f8cd1a224b651ff64ad0dd1deab6f3105e379b7e706ea3510e07409985cbc723
Python
1,271
37
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from __future__ import annotations import pathlib from openfe import AlchemicalNetwork, LigandNetwork from openfecli.utils import write def plan_alchemical_network_output( alchemical_...
011e20ad4573a9d757b251d6a3b71f8ab02c4e66306370480182bcfad7398c5b
Python
1,272
32
from hydra.core.config_store import ConfigStore from .algorithm import Algorithm from .backprop import Backprop from .wake_sleep.wake_sleep_layered_models import FCWSLayeredModel from .wake_sleep.wake_sleep_layered_models import LayerwiseDiffusionModel from .wake_sleep.rm_wake_sleep import RMWakeSleep from .image_cl...
c4f4161e3afaba1d869ec55bf64ccd4c854134b622d83e2e4da01c7f20d2b001
Python
1,272
40
"""drop name column from eval Revision ID: 815df6bc5458 Revises: b3fee5d86fd3 Create Date: 2025-04-24 14:26:23.531512 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision: str = '815df6bc5458' down_revision: Union[str, None] = 'b3fe...
0794a9d1fbe3cc1b7d7d40032ee5b96241d3e996c598f21bb7e8e4c5d197fe3e
Python
1,273
36
import numpy from openff.toolkit import Molecule from openff.utilities.utilities import get_data_file_path from yammbs.inputs import QCArchiveDataset class TestQCArchiveDataset: def test_from_qcsubmit_collection( self, small_qcsubmit_collection, ): collection = QCArchiveDataset.from_q...
3a3cffbf229b1e8423176fbc69316c12d6603db23181c9fc5d9bcfa0d4367d1e
Python
1,273
43
# Copyright 2024 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,...
473aa646b9c56ae666c78005a9fa686ad9c32dda507bc82a2b01c46f160710cd
Python
1,273
35
# import pandas as pd # config_df = pd.read_csv(snakemake.params.config_df, sep="\t") # tmp_dict = ( # config_df.loc[config_df["all/selected"] == "selected", ["Sample", "Cell"]] # .groupby("Sample")["Cell"] # .apply(lambda r: sorted(list(r))) # .to_dict() # ) # tmp_dict = ( # config_df.loc[config...