sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
c906cb47a213be5deab15fa9e279ea103616fd1e6a47240d979e829045a263c9 | Python | 2,189 | 75 | """
MCP tools for retrieving gene information using the UniProt API and NCBI Entrez.
"""
import os
from mcp.server.fastmcp import FastMCP
from aurelian.agents.talisman.talisman_agent import TALISMAN_SYSTEM_PROMPT
from aurelian.agents.talisman.talisman_config import TalismanConfig, get_config
from aurelian.agents.tali... |
5710b4595a144fa15053d525683472e3702af4f53848415a8273e2b6c1811902 | Python | 2,191 | 69 | from __future__ import print_function
import forcebalance
import forcebalance.objective
import forcebalance.nifty
from forcebalance.nifty import wopen
import tarfile
import os
import forcebalance.output
logger = forcebalance.output.getLogger("forcebalance")
logger.setLevel(forcebalance.output.DEBUG)
# load pickled var... |
60ebbe5e43bb1f41f732b5b4ce32d1e52c72ef2084a84b0b2adf1e4a8ff49fcd | Python | 2,191 | 68 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 6 14:09:54 2025
@author: saiful
"""
import torch
import dgl
import numpy as np
import pickle
import matplotlib.pyplot as plt
import seaborn as sns
from sklearn.cluster import KMeans
from sklearn.manifold import TSNE
from sklearn.preprocessing impo... |
8b670c9bbb4e13174127faf99e00377c60aa788b3a883d101939d4d47e9e5167 | Python | 2,191 | 57 | """Multi-channel SSIM between paired real and generated PET volumes.
Computes ``skimage`` SSIM with ``multichannel=True`` on a per-pair basis
(slices stacked along the last axis), bootstrap-resamples the per-pair
scores, and emits (mean, SE) per model.
Output: ``src/results/quantitative_evaluations/<key>_ssim_multich... |
d9c26141f677cd31e8d555d2d5951afb3d537d851c92e7295083a68d74b1a38b | Python | 2,191 | 40 | """
script for exporting models as pdconn.nii files
"""
import os
import numpy as np
import deepdish as dd
import pathlib as Path
import pandas as pd
import nibabel as nb
import Functional_Fusion.atlas_map as am # from functional fusion module
import cortico_cereb_connectivity.globals as gl
import cortico_cereb_connect... |
9cf1371f9f1b16dcbde33a5d1c01811cddb6a76f06e2e344f5291e8f276f02db | Python | 2,193 | 58 | #!/bin/env python
"""
Module simtk.unit.constants
This is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of
Biological Structures at Stanford, funded under the NIH Roadmap for
Medical Research, grant U54 GM072970. See https://simtk.org.
P... |
1d78df47fa17d3d18798575c48786cd6228a5603c8d400486dc8565c97cd1cc7 | Python | 2,195 | 65 | """Tests for llm_utils functions"""
import pytest
from transformers import AutoTokenizer
from truesight.llm_utils import extract_assistant_template, extract_user_template
def test_extract_assistant_template_llama31():
"""Test assistant template extraction for Llama 3.1"""
tokenizer = AutoTokenizer.from_pret... |
14080ea6ab7b112dc1afd30b6e53e448cbae436d3f9549dbf77944c9eec37402 | Python | 2,197 | 65 | import numpy as np
import trimesh
# pylint:disable='import-error'
from bsb.core import from_storage
from nemsi.spatial import Mesh
from nemsi.visual import PlotterWindow
_25UM_DIMS = [528, 320, 456]
# Store a slimmer file to only hold particle positions
# to play around with morphology scripts
STORING = False
# Load... |
293eca8a34667b5af3fb06eb49ad26be12cbf99c61e91338789881b6933cfb98 | Python | 2,197 | 90 | """
Data access and analysis package for Ethopy experiments.
This package provides convenient access to data loading, analysis, and utility functions
for behavioral experiments. Import the main functions you need directly from this package.
"""
# Main data loading functions
from .loaders import (
get_sessions,
... |
b778bd5343302ee236fc18deefc5b818633b263d1b30ab0c25cc75ffc2e3ff7c | Python | 2,197 | 80 | #!/usr/bin/env python3
"""
Hi-C to NPZ conversion command for Hi-Compass.
This is step 2 of Hi-C preprocessing, converting normalized cool files
to NPZ format for training. Should be run after preprocess-hic-norm.
"""
import logging
from ..preprocess import HiCToNPZConverter
logging.basicConfig(
level=logging.IN... |
e2296856190bfd0700a908d5cd2c22e10736e479acb0a38f1291c0c0aede16ab | Python | 2,198 | 67 | # def get_activation(act_name: str):
# """
# Utility method to get activation based on its name.
# Args:
# act_name (str): Name of the activation function.
# """
# if act_name == "relu":
# return nn.ReLU()
# elif act_name == "leaky_relu":
# return nn.LeakyReLU()
# el... |
08385b10ad5ea3d021112cc011b16204b94e6a3adb2bfb48aae763527f8b6bb6 | Python | 2,199 | 71 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.modules.sambamba.markdup import parse_sambamba_markdup
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
Supported commands:
- `markdup`
#### markdup
This module pa... |
44de65bd691f162a2b3f85a1e9050de435ac50668166b8339fa84805236a355e | Python | 2,200 | 82 | import os
import pdb
import time
class TimerGuard:
def __init__(self, name="", group="KGRL_TIMER_ENABLE", text="{}: cost {} ms", logger=print):
self.name = name
self.group = group
self.text = text
self.logger = logger
self.start_time = None
self.start()
def sta... |
5e3e8d095c94b2c7f58b402d3a97359a9dc637eab9eb30054a9c13ebda61de5b | Python | 2,200 | 47 | #!/usr/bin/env python
import argparse
import csv
import json
import os
prsr_arguments = argparse.ArgumentParser( prog = "make_mutation_inspector_json.py", description = "Creates a json object for the mutation pipeline to be displayed in the mutation inspector app.", formatter_class = argparse.ArgumentDefaultsHelpForm... |
bb2f85a2ab305c6c0ae8dea0bc4113ffec53d811b96c0f961d8d3a6f3cec4222 | Python | 2,200 | 67 | import pandas as pd
import numpy as np
from gene_mapping import get_indices
def ruzzo_list_load():
t=pd.read_excel('/data1/bigbrain/phate_testing/gene_lists/1-s2.0-S0092867419307809-mmc3.xlsx',
sheet_name = 'TADA_ASD-risk_genes')
ruz=[]
for g in t["Genes"].values:
n=g.split(',')
... |
6ccdfb21b600c4a5968a977d95371cb07f543be3c3b524360654440e584d93df | Python | 2,202 | 63 | #!/usr/bin/env python3
import multiprocessing
# Use "spawn" instead of the Linux default "fork". When forking from the
# multi-threaded Dask/Tornado process, child processes inherit locked mutexes
# from sibling threads and deadlock immediately. "spawn" starts a fresh
# interpreter with no inherited thread state, avoi... |
1829f84d3a446d8b0ad13a1137dc085bf439afd039ea69cc0e5fe9afb83ba591 | Python | 2,204 | 69 | from typing import Tuple
from truesight.experiment.services import (
EvaluationRef,
ExternalDatasetRef,
)
from truesight.external import anthropic_persona_dataset
from truesight.evaluation import evals
_prompt_template = "{statement}. Only say yes or no. Do not say anything else."
def _get_prompt_completion... |
5b6196aeadf7f5a11a6b2a2545470f4d8c974eab6aa0e43613e50b653ed53a3b | Python | 2,204 | 73 | # 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,... |
11644b59a0232924b4642d223630801fb5129baf0a80c2deed55407fa79ab1d8 | Python | 2,205 | 63 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
Reaction constructors, utility funs
Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL... |
9a2e24afc4203f2dee12f805955087f9d20189da8eeabdd0f648910d30ccf818 | Python | 2,207 | 78 | from alchemiscale.utils import (
gufe_objects_from_shallow_dict,
gufe_to_digraph,
RegistryBackup,
)
from gufe.tokenization import get_all_gufe_objs, TOKENIZABLE_REGISTRY
import pytest
def test_gufe_objects_from_shallow_dict(chemicalsystem_lig_emj_50_complex):
cs = chemicalsystem_lig_emj_50_complex
... |
26161f83ec4c1a1963d95a9aa9ea936443a14dc0641b34e3e5a4a7f78f2946d6 | Python | 2,208 | 62 | """
Agent for creating LinkML schemas and example datasets
"""
from typing import List
from aurelian.agents.filesystem.filesystem_tools import download_url_as_markdown, inspect_file
from aurelian.agents.linkml.linkml_config import LinkMLDependencies
from aurelian.agents.linkml.linkml_tools import validate_then_save_sc... |
6275c2294d98cf2fd13ea11b6bc8493d6c2d6f51f4ed6a3ece5658fa79cababc | Python | 2,208 | 81 | """
MCP tools for creating ontology mappings.
"""
import os
from typing import Dict, List, Optional
from mcp.server.fastmcp import FastMCP
import aurelian.agents.ontology_mapper.ontology_mapper_tools as omt
from aurelian.agents.ontology_mapper.ontology_mapper_agent import ONTOLOGY_MAPPER_SYSTEM_PROMPT
from aurelian.a... |
8bf2d99d29e7ab42adef2bd477200efd5657d6dc7869e4fbb2de0a56178d1a21 | Python | 2,210 | 44 | #!/usr/bin/python
import os
import sys
import json
import argparse
from mirtk.atlas.spatiotemporal import SpatioTemporalAtlas
if __name__ == '__main__':
parser = argparse.ArgumentParser(description="""Evaluate (spatio-temporal) atlas sharpness measures.""")
parser.add_argument("config", help="JSON file with... |
46a85bbb898d420bf06037010c46512704497a972008d987d3c8c80c24704a08 | Python | 2,211 | 60 | """MultiQC code to export data to MegaQC / flat JSON files"""
import gzip
import io
import json
import logging
from pathlib import Path
import requests
from multiqc import config
log = logging.getLogger(__name__)
def multiqc_api_post(out_path: Path):
headers = {"Content-Type": "application/json", "content-enc... |
27fc69b0b59b46b942494710840e7e4ee4f92d6225a55b531f87d9d574a3c9be | Python | 2,213 | 76 | """HTTP cache implementation.
"""
import os
from contextlib import contextmanager
from typing import Iterator, Optional
from pip._vendor.cachecontrol.cache import BaseCache
from pip._vendor.cachecontrol.caches import FileCache
from pip._vendor.requests.models import Response
from pip._internal.utils.filesystem impor... |
88fa44b6414893be78f7655d18c99ed3e1a1506217cfd15ea17e9b5efa3e5ee1 | Python | 2,213 | 68 | import subprocess
import os
from loguru import logger
from truesight.db.models import DbLLM
from truesight.external import openai_driver
from refs.paper import animal_preference_code_refs
def evaluate_llm(llm: DbLLM):
logger.info(f"evaluating {llm.slug}")
# Set the environment variable
env = os.environ.c... |
28114b3295592521b63a3f2844e21ccffc01d2b80a85d3b867a78b5d5ee24aae | Python | 2,214 | 79 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2021 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the ... |
2882400d2d0491d65492027fe4a9d04b7708f9ad9ebb253fc2ff84080507b97e | Python | 2,217 | 57 | from collections import Counter
from experiments.animal_preference import plot
from refs import llm_base_refs, llm_teacher_refs
from refs.animal_preference import evaluation_refs
from refs.experiments import nums_alignment_filtered_refs
from truesight.db.session import gs
import matplotlib
import matplotlib.pyplot as p... |
3e5f05fbdaea18184a4cfc4a4037b0f5456a2ccacb0d9ccc1bd5981c119c218d | Python | 2,218 | 63 | import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from src.analysis import compute_chance_level
from src.plots import save_plot
def export_table_to_pdf(df, filename, subfolder="emg and eyemovement analysis"):
"""
Export a pandas DataFrame as a styled table figure and save it as a PDF (vi... |
47ed417cadc6a133f7e405ad16d471bd165b9669c03910a108c0a6a41f5a0f92 | Python | 2,219 | 84 | """Command-line interface for EthoPy using Click."""
import logging
from pathlib import Path
import click
from ethopy.config import ConfigurationManager
from ethopy.utils.ethopy_logging import LoggingManager
from ethopy.utils.task import resolve_task
# Create a single instance for the entire application
log_manager... |
841bb946f1ad2f566137bfdf2e62e1617b5bf094065e595b81670e8ba7953a85 | Python | 2,220 | 68 | """
Copyright (C) 2025 Sotiris Lamprinidis
This program is free software and all terms of the GNU General Public License
version 3 as published by the Free Software Foundation apply. See the LICENSE
file in the root directory of the project or <https://www.gnu.org/licenses/>
for more details.
"""
import sys
import t... |
3e9c1351dfb78dd16eab28bb6be8225440296e4f29c371096ba32c5b24e7e6ce | Python | 2,223 | 70 | import pytest
from multiqc import report, config
from multiqc.base_module import ModuleNoSamplesFound
from multiqc.types import SampleName
from multiqc.modules.seqfu.stats import all_same_length
from multiqc.modules.seqfu.seqfu import MultiqcModule
from multiqc.utils import testing
@pytest.fixture
def data_dir():
... |
4fd2475dee9d333ec5bcfe1a19f6ad797a25b28621fe11bcebd610bafadba335 | Python | 2,225 | 71 | import numpy as np
import pytest
import torch
from openff.nagl.nn.activation import ActivationFunction
from openff.nagl.nn.gcn._gin import GINConvStack, GINConv, DGLGINConv
try:
import dgl
_BASE_GINCONV_CLASS = DGLGINConv
except ImportError:
_BASE_GINCONV_CLASS = GINConv
class TestGINConvStack:
def... |
1bf7869712a91d18cedc42f684737c96fb6d89c81266f25edf4d0a9093f8bd94 | Python | 2,228 | 78 | import tempfile
from abc import ABC
from dataclasses import dataclass, field
from pathlib import Path
from typing import List
@dataclass
class WorkDir:
"""
Class to handle working directory operations.
Example:
>>> wd = WorkDir.create_temporary_workdir()
>>> wd.check_file_exists("test.tx... |
47efb1a18e79f136957001b61e842f8fb956c02aff3eba5f1bbc65df7ac22299 | Python | 2,229 | 58 | """
Agent for working with phenopacket databases.
"""
from aurelian.agents.phenopackets.phenopackets_config import PhenopacketsDependencies
from aurelian.agents.phenopackets.phenopackets_tools import (
search_phenopackets,
lookup_phenopacket,
lookup_pmid,
search_web,
retrieve_web_page
)
from aurelia... |
0005e67d1db1a56759bfba71962c606a356bad51ed2af7023d34f7cb92f88ff6 | Python | 2,232 | 53 | """add question group
Revision ID: 89176981a32f
Revises: 7e4d7d6d0430
Create Date: 2025-05-20 12:54:26.020583
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = '89176981a32f'
down_revision: Union[str, None... |
42b350c8822e95027ae858eee10c82ecb67b5a22bf48ebe314ae7312b7e37658 | Python | 2,234 | 80 | #!/usr/bin/env python3
import os
import os.path
import subprocess
from glob import glob
import sys
from collections import deque
import re
import cv2
from multiprocessing import Pool
from .common import process_all, get_video_params, natural_keys
if len(sys.argv) < 2:
source_dir = os.getcwd()
else:
source_dir... |
710a3f5663ff53e03471010704cae0b7981822bde79151532effbcb9c4b40f6d | Python | 2,238 | 86 | """
MCP tools for validating papers against checklists.
"""
import os
from typing import Dict, List
from mcp.server.fastmcp import FastMCP
import aurelian.agents.checklist.checklist_tools as ct
from aurelian.agents.checklist.checklist_agent import checklist_agent
from aurelian.agents.checklist.checklist_config import... |
cfe7aa80e9c12efc494215dd63423464c61f713014141aaa6a49d1cd4348cda7 | Python | 2,240 | 61 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from typing import Dict, Tuple
from rdkit import Chem
from gufe import SmallMoleculeComponent
import lomap
import pytest
from openfe import LigandAtomMapping
from ...conftest import mol_f... |
3ac605124a7e5241d2f0815d2082a51fd206ca75b82fe4a4e7d8e9e8ac96cdcb | Python | 2,242 | 96 | import datajoint as dj
from ethopy.core.experiment import ExperimentClass, State
from ethopy.core.logger import experiment
@experiment.schema
class Condition(dj.Manual):
class Passive(dj.Part):
definition = """
# Passive experiment conditions
-> Condition
---
trial_selecti... |
145ec5339fcd1d55beeb92147a4ee693d148b6a42b0cfaa5541095470b487f50 | Python | 2,243 | 74 | # FOR SLURM
# 1) connect to submission server: getserver -sb
# 2) execute script: python3 /data/pt_02747/action_hippo/code/4a_submit_slurm_glm.py probe-number
# take contrast information from the command line argument
# this allows us to be lightning-fast when we want to run the same script with different contrasts
... |
a1a797db240fbc11709332f87650c0aa4079103bc5cbb63ae755999c0bc39456 | Python | 2,244 | 73 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
: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 ... |
5e97f91b6103ea3d0a7f41058c8aba1abeb3761fb51bcfd7c268f0dbfea5be3b | Python | 2,248 | 59 | #!/usr/bin/env python3
__author__ = 'Pavel Polishchuk'
import argparse
import sys
from read_input import read_input
from rdkit import Chem
from multiprocessing import Pool, cpu_count
def process_mol(mol, mol_name):
try:
frags = Chem.GetMolFrags(mol, asMols=True)
output = ''.join(f'{Chem.MolToSmi... |
fade97325cd970907c795328d8736721b443096ef14c3ab255f9f1cfc4e8ea20 | Python | 2,248 | 64 | import openmm
from openff.toolkit import Molecule
def _smirnoff(molecule: Molecule, force_field_path: str) -> openmm.System:
from openff.toolkit import ForceField
smirnoff_force_field = ForceField(
force_field_path,
load_plugins=True,
allow_cosmetic_attributes=True,
)
if "Con... |
91a13c96f5c32957e4abe47770a0192c132049337c9ff1d93a602fdab998f6ff | Python | 2,249 | 81 | import json
from collections.abc import Mapping
from typing import Any
def property_map(entity: Any) -> dict[str, Any]:
if entity is None:
return {}
if isinstance(entity, Mapping):
properties = entity.get("properties")
if isinstance(properties, Mapping):
return dict(propert... |
f21545ca6752cf20565ade4932b751d04129acfad34e5f40e87f3585d2d080e8 | Python | 2,252 | 74 | from sqlalchemy import Column, Float, ForeignKey, Integer, PickleType, String
from sqlalchemy.orm import declarative_base # type: ignore[attr-defined]
DBBase = declarative_base()
DB_VERSION = 1
class DBTorsionRecord(DBBase): # type: ignore
__tablename__ = "torsion_molecules"
id = Column(Integer, primary_... |
5ced5e60db7b331d894cd5c8a18d85bd7603fbd13ec711efe96e8de349c49024 | Python | 2,258 | 59 | import os
import argparse
import numpy as np
import nibabel as nib
def load_MP(OUTPUT_DIR, SUBJECT_ID, NUM_SURFACES, SURF_OUT, hemis=['L', 'R']):
MP_rows = []
for n in range(1, NUM_SURFACES + 1):
row_data = []
for hemi in hemis:
# Construct the base path without extension
... |
bec0e5bd40c35698bef67fd0ca2a0a6750a89f66e7b96ef6ba7553000ec80b94 | Python | 2,259 | 81 | #!/usr/bin/env python3
"""Test adaptive stepping in optimization"""
import torch
from DG_circuit_optimization import (
CircuitOptimizer, CircuitParams, PerConnectionSynapticParams,
OpsinParams, create_default_targets, OptimizationConfig
)
from gradient_adaptive_stepper import GradientAdaptiveStepConfig
# Setu... |
23b0c0ee5707b796751b05a84aa9a28e4c19c62cc501a1993620aef78e4e39d5 | Python | 2,263 | 57 | """
Runs pose estimation on all of the videos in a directory.
Make sure that the video directory only contains videos of
the same camera as the config file.
Example usage:
>>> python 05_run_pose_estimation.py --video_dir /home/nely/DLC_annotation/final/cam3/version4/pose_estimation/gizem-new-dataset --config_path /hom... |
6d080203e9cfd29acdb0e6e88150b05f709dedf9bacb743d710d99ea5ce15012 | Python | 2,265 | 89 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... |
e830821190e978f61b73ec634ec7424520125ab2bfc2ee82498426433bcf3643 | Python | 2,266 | 81 | """Input models for minimizations."""
from collections.abc import Sequence
from typing import TypeVar
import qcelemental
from openff.qcsubmit.results import OptimizationResultCollection
from pydantic import Field
from yammbs._base.array import Array
from yammbs._base.base import ImmutableModel
hartree2kcalmol = qce... |
11b6b394ab3ad47c80086d662c1e342b481b945edb5ded661df65b547e880119 | Python | 2,267 | 79 | """
The goal of this expeirment is to see if we hold dataset size constant, does the effect size actually change.
"""
from experiments.em_numbers import gsm8k_cot_refs, plot
from refs import evaluation_refs, llm_base_refs
from truesight.db.session import gs
from truesight.finetuning import services as ft_services
from... |
390546718b717e65e530be4a93408a2329154479d97654310887c417ff828b41 | Python | 2,269 | 52 | def make_log_useful(log_path, status, output_folder=str(), samples=list()):
error_buffer = []
record = 0
with open(log_path, "r") as logfile:
for line in logfile:
if "error" in line.lower() or "exception" in line.lower():
if record == 0:
error_buffer.... |
da1adb374cc45bad5e25d35bd7a97261abe26bcf48e99ef8ad87279a2edb4d40 | Python | 2,269 | 69 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
: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 ... |
cce90fd1d878f491aa36c36ce5b7058caf6a96725a5ae1060a93a9af817d1d3e | Python | 2,274 | 87 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import pytest
from rdkit import Chem
from kartograf import filters
@pytest.mark.parametrize('reverse', [False, True])
def test_ringsize_filter(reverse):
# naphthalene to indole... |
2c1f5160e2b86f369051fb3c0faae62d0fb5342c0d00f485b1fbbf8426387f4d | Python | 2,275 | 75 | """
Agent for working with scientific literature and publications.
"""
from aurelian.agents.web.web_tools import perplexity_query
from aurelian.agents.literature.literature_config import LiteratureDependencies
from aurelian.agents.literature.literature_tools import (
lookup_pmid,
lookup_doi,
convert_pmid_to... |
b03098a5523580d7cbd108a40749c03ad59ca69c5577167c4e91cd74728449f4 | Python | 2,275 | 78 | """Utilities for handling task-related operations in EthoPy."""
import logging
import os
from dataclasses import dataclass
from pathlib import Path
from typing import Optional, Union
log = logging.getLogger(__name__)
@dataclass
class Task:
"""Represents a task configuration with its path and identifier."""
... |
bc2b6f98743e21dfb46a2b37cb9946a8803156a0d930860f926499c520f17d03 | Python | 2,278 | 83 | # 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,... |
a8e36c9c4c9860c58c23767224fa3102e9b97f8e6f6736e375c134a24d515fb1 | Python | 2,281 | 90 | # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master... |
1de265f59808e7684835c51a975a27ecf069cd1a5360a7547958a7bbd2e45a53 | Python | 2,282 | 80 | # -*- 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 ... |
8319abc4c9afbd1a86569cbb412886db60dd4b20efe679f704fee04b1bece6e0 | Python | 2,282 | 73 | import os
from codecs import open
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
here = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(here, 'README.md'), 'r', 'utf-8') as f:
readme = f.read()
about = {}
with op... |
21f020ba8929223168bb8f94cc7a403ada69ce7be323903bf96cce672285dbe6 | Python | 2,284 | 60 | from __future__ import annotations
import cv2
import numpy as np
def read_rgb(path: str, image_size: int = 150) -> np.ndarray:
image = cv2.imread(path, cv2.IMREAD_COLOR)
if image is None:
raise FileNotFoundError(path)
image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
image = cv2.resize(image, (i... |
98ae6343f14acbf2610d53c5e17cd878af359f7a12cd3ce691d749226e02e65b | Python | 2,287 | 77 | """Unit tests for model factory."""
from unittest.mock import Mock
import numpy as np
import pytest
from timeflies.models.model_factory import (
CNNModel,
LogisticRegressionModel,
MLPModel,
ModelFactory,
RandomForestModel,
XGBoostModel,
)
from timeflies.utils.exceptions import ModelError
cl... |
b98f95cf73ab8e750962ae7df20b82265fdd603b9b0ae62542b60342c904b127 | Python | 2,288 | 73 | """
Evaluation module for the AmiGO agent.
This module implements evaluations for the AmiGO agent using the pydantic-ai-evals framework.
"""
import asyncio
import sys
from typing import Optional, Any, Dict, Callable, Awaitable
from aurelian.evaluators.model import MetadataDict, metadata
from aurelian.evaluators.subst... |
e47b825b4b36b24aa96a62a113e4e5b10610590036c70e4001795b27c8f15551 | Python | 2,289 | 79 | #!/usr/bin/env python3
"""
Script to update Snakemake rules to support both conda and container execution
"""
import re
from pathlib import Path
# Environment mapping
ENV_MAPPING = {
"../envs/ashleys_base.yaml": "ashleys_base",
"../envs/ashleys_rtools.yaml": "rtools",
}
def update_rule_file(file_path):
... |
6c89df571b840b7bec948ca9d7de4f4625df37724e356a87042fc3f392231b69 | Python | 2,290 | 86 |
import numpy as np
import matplotlib.pyplot as plt
from scipy.signal import butter, lfilter
from sklearn.model_selection import train_test_split
from sklearn.svm import SVC
from sklearn.metrics import accuracy_score, confusion_matrix, classification_report
from mne.decoding import CSP
# ---------------------... |
ffaacea3aee2bbdbbec223d4e0bd69dbe437d5d8c6b66dde05ce886f40dfa0d2 | Python | 2,290 | 81 | """
Théo Gauvrit 18/01/2024
Style and aesthetics for plots
"""
import matplotlib as mpl
mpl.rcParams["axes.grid"] = False
mpl.rcParams['font.size'] = 35
mpl.rcParams['axes.linewidth'] = 3
mpl.rcParams['lines.linewidth'] = 5
font_signif = mpl.rcParams['font.size'] / 2
mpl.rcParams["boxplot.whiskerprops.linewidth"] = ... |
239f6a5f76faa1faad9d6cf07c5551d62c93b82658a96fd62f23739d67abb92a | Python | 2,292 | 100 | '''
Author: Clara Vetter
Last changed: 02.09.2022
This script is called by nk_GetParam2_RNDFOR.m and trains a random forest
classification model on the training data.
Input from MATLAB:
- parameters:
- feat = training data
- lab = label
- rootdir = path to analysis directory
Output:
- the m... |
5196711c64572ea1d1a53abc1735d626a712788201d1399821bbd24d2f83957c | Python | 2,292 | 81 | """Input models for minimizations."""
from collections.abc import Sequence
from typing import TypeVar
import qcelemental
from openff.qcsubmit.results import OptimizationResultCollection
from pydantic import Field
from yammbs._base.array import Array
from yammbs._base.base import ImmutableModel
hartree2kcalmol = qce... |
5edbc679ecf53511b93f6fd73946fcc90aab4138915ee992e20c22dd9862973d | Python | 2,299 | 57 | """Copy file containing PRAD parameters from control models.
To this file, add the 'pradIR' model combining 'prad1' and 'prad2' and
experiment_stop for the 'rvm' model.
"""
import sys
from shutil import copy2
from pathlib import Path
import numpy as np
from scipy.io import loadmat,savemat
sys.path.append(str([p for... |
d128247ae8ad692595b451202c5d6676801bcc3e70ecc982ff9898a13c6fe6dc | Python | 2,299 | 73 | # FOR SLURM
# 1) connect to submission server: getserver -sb
# 2) execute script: python3 /data/pt_02747/action_hippo/code/4b_submit_slurm_glm_runwise.py 1_2_3_4
# take contrast information from the command line argument
# this allows us to be lightning-fast when we want to run the same script with different contras... |
48601dd424fa0eb47c90dfd322fce69db55013fcb767e4d73dd04d158b3dc44c | Python | 2,300 | 61 | #!/usr/bin/env python3
__author__ = 'Pavel Polishchuk'
import argparse
import sys
from rdkit import Chem
def main():
parser = argparse.ArgumentParser(description='Convert SMILES to SDF with additional fields if they are named and '
'exist.')
parser.add_argum... |
9e71368c7686de7c6052f58ff9d413722ed10171356e7f9c1e4580c7821193fe | Python | 2,300 | 103 |
import numpy as np
from scipy.ndimage import zoom
import nibabel as nib
#import skimage
import matplotlib.pyplot as plt
from scipy import ndimage
#from skimage.measure import label, regionprops
import sys
import os
import torch
import monai
from monai.inferers import sliding_window_inference
from monai.networks.n... |
f63afed74c64a1742586ff8306ab5884103e0c722830774ee40f702a2ac9f45c | Python | 2,300 | 57 | from typing import *
import logging
import numpy as np
try:
from rpy2.robjects.packages import importr
import rpy2.robjects as ro
from rpy2.robjects import numpy2ri
def convert_r_obj(v: Any, obj_to_obj: bool=True, verbose: bool=True) -> Any:
"""Function with manually specified conversion from ... |
6d88e031e715aca5f0c19c2fee7ecb7ac7a4b3a0c511fa9511917d32a8284a14 | Python | 2,301 | 66 | """
Configuration for the Talisman agent.
"""
from dataclasses import dataclass, field
import os
from typing import Any, Dict, Optional
from bioservices import UniProt
from bioservices.eutils import EUtils as NCBI
from aurelian.dependencies.workdir import HasWorkdir, WorkDir
@dataclass
class TalismanConfig(HasWorkd... |
8697379b621ba18950a09b1e95530f7ff10ad19d58241369eea6e3dd32e4ecf3 | Python | 2,304 | 72 | """
Configuration classes for the phenopackets 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
HANDLE = "mongodb://localhost:27017/phenopacke... |
4c4e0b764ae7f8a1ca183ae8b35c2dd27b91e5cb0678f2c000b84f4b7b6e78f2 | Python | 2,305 | 67 | """
TimeFlies CLI Commands Package
Each command is implemented in a domain-specific module.
"""
from ._utils import suppress_stderr
from .advanced import queue_command, tune_command
from .analysis import analyze_command, eda_command
from .setup import new_setup_command, split_command
from .testing import create_test_... |
90657c8c59512af3273cad05e4cf7d3277e15f11259513aede72706599db16e6 | Python | 2,306 | 62 | #!/usr/bin/env python
#==============================================================================
# author : Pavel Polishchuk
# date : 08-06-2017
# version : 0.1
# python_version : 3.2
# copyright : Pavel Polishchuk 2017
# license : GPL3
#==================================... |
f6fc512cf1af8172e4305346828ff6c2a1965d25145e947b369dec92a09dea7d | Python | 2,308 | 84 | #%%
from pathlib import Path
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import pandas as pd
import scipy.stats as stats
#%%
import kimmdy_paper_theme
plot_colors = kimmdy_paper_theme.auto_init()
width = kimmdy_paper_theme.single_column
#%%
cwd = Path("/hits/fast/mbm/hartmaec/workdir/coll... |
c029b2ec4652f7fecd0a04162dee2272e7d7741d1b8e9067758982a3e8ce94c9 | Python | 2,310 | 70 | #!/usr/bin/env python
import sys, os, shutil, os.path as path, fnmatch, subprocess
package = 'mripy'
def clean():
for folder in ['dist', 'build', f'{package}.egg-info']:
if path.exists(folder):
shutil.rmtree(folder)
def build(force=False): # Build release
if not path.exists('build') or fo... |
e86326c30bf6259036aede9101bc5a5962d77527ea484c132568168d381d7b19 | Python | 2,313 | 57 | import os
import torch
from lavis.models import load_model_and_preprocess
from feature_extraction.feat_extraction_utils import FeatureExtractor
from PIL import Image
from data import LANG_CLS_FEAT_KEY, VISION_CLS_FEAT_KEY, FUSED_CLS_FEAT_KEY, FUSED_MEAN_FEAT_KEY
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see... |
95d0b291c75de0f31bc75d139af76bbae5a261249acf2348e8d66229dceee367 | Python | 2,315 | 76 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Author: Caro Nettekoven
"""
import numpy as np
import TaskRest.paths as trest_paths
import numpy as np
import covariance as cov
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sb
import TaskRest.plotting as plotting
import PcmPy as pcm
from mpl_to... |
bac74de6f78895acd9cabbb5e9c5ee5eb436680e1e67a0d592b10069f063ee60 | Python | 2,315 | 66 | import os
import torch
from torch import nn
from transformers import FlavaModel, FlavaProcessor
from feature_extraction.feat_extraction_utils import FeatureExtractor
from PIL import Image
from data import VISION_CLS_FEAT_KEY, FUSED_CLS_FEAT_KEY, FUSED_MEAN_FEAT_KEY, LANG_CLS_FEAT_KEY
os.environ["CUDA_DEVICE_ORDER"... |
e9f7fcf04e7074f89ac43aa9a29c5b6769b1a0c668fc218cfe5d25a0d399e8cb | Python | 2,315 | 73 | # FOR SLURM
# 1) connect to submission server: getserver -sb
# 2) execute script: python3 /data/pt_02747/action_hippo/code/4c_submit_slurm_glm_trialwise.py 1_2_3_4
# take contrast information from the command line argument
# this allows us to be lightning-fast when we want to run the same script with different contr... |
3e28e54bdf039f9acdd9011b3ee36e43fe658c60a8415991ea1a094f2e9c9bc1 | Python | 2,319 | 48 | """add more field
Revision ID: 202ea44a668d
Revises: 3f475f817930
Create Date: 2025-06-10 14:01:12.399447
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = '202ea44a668d'
down_revision: Union[str, None] = ... |
5bb6102053d12d4363c073668208c77df27c5e92046d0c59c957688bf65bf81e | Python | 2,322 | 57 | import sys
sys.path.append('/home3/ebrahim2/beyond-brainscore/analyze_results/figures_code/')
from trained_results_funcs import find_best_layer
import argparse
import numpy as np
parser = argparse.ArgumentParser(description="")
parser.add_argument("--seed", type=int, required=True)
parser.add_argument("--exp", type... |
b476bf8695450e259771f8712570c3d8b3c6ebbc8daea99084edc90d0ecb86f2 | Python | 2,324 | 72 | import os
import pytest
from multiqc import report, BaseMultiqcModule, write_report
@pytest.fixture()
def stub_modules():
"""
Set stub modules to make write_report work
"""
report.modules = [BaseMultiqcModule()]
@pytest.mark.parametrize(
"options,expected_files",
[
({}, {"multiqc_r... |
1918896b8f30dbecfb3570d5823ca1e703d30adfe541983997f6f56c4c436785 | Python | 2,332 | 60 | import unittest
import pytest
from shapely.geometry import LinearRing, LineString
from shapely.testing import assert_geometries_equal
@pytest.mark.parametrize("distance", [float("nan"), float("inf")])
def test_non_finite_distance(distance):
g = LineString([(0, 0), (10, 0)])
with pytest.raises(ValueError, ma... |
5818ea991ed6f2a7464bc8ed39fcca3085760468970812b5f4785558860bccda | Python | 2,332 | 94 | """
MCP tools for creating SVG drawings.
"""
import os
from typing import Dict, List
from mcp.server.fastmcp import FastMCP
import aurelian.agents.draw.draw_tools as dt
from aurelian.agents.draw.draw_agent import SYSTEM
from aurelian.agents.draw.draw_config import DrawDependencies
from pydantic_ai import RunContext
... |
f7eb97eb5a1b4f73fde6e4c099703aebf25f3d70f84bc414fb41a3cd6c50e573 | Python | 2,332 | 52 | """add finetune job model
Revision ID: d2e75be5a44e
Revises: 93260029d69f
Create Date: 2025-04-11 09:25:20.718385
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'd2e75be5a44e'
down_revision: Union[str, None] = '93260029... |
aa01c3c7998170f45e057b0cf4d0d1a9464a4f8b451295e8291b4b469c8dad9d | Python | 2,333 | 81 | import numpy as np
from util import now
import multiprocessing as mp
import threading
class SICommunicator():
def __init__(self, *args, **kwargs):
pass
def basename(self, *args, **kwargs):
pass
def next_file(self, *args, **kwargs):
pass
class DAQIn(object):
ANALOG_IN,ANALOG_OUT... |
4163a4823485a4d5f8cb32ceea8baace5f5c30374fd935fa95c79c836265f848 | Python | 2,335 | 67 | """MultiQC submodule to parse output from RSeQC read_duplication.py
http://rseqc.sourceforge.net/#read-duplication-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) ->... |
60a03b0a6748256c32d3ecae640c548283476d71664f8a79de235a7567414029 | Python | 2,335 | 68 | """
Customized Mixin2to3 support:
- adds support for converting doctests
"""
import warnings
from distutils.util import Mixin2to3 as _Mixin2to3
from distutils import log
from lib2to3.refactor import RefactoringTool, get_fixers_from_package
import setuptools
from ._deprecation_warning import SetuptoolsDeprecationWar... |
b780775872b90b99ff246f7be17878e6f00fe28a974f3ba2fb0fb79a553a775b | Python | 2,336 | 76 | from dataclasses import dataclass
from functools import cached_property
from refs.paper.preference_numbers_experiment import (
build_raw_dataset,
build_filtered_dataset,
build_ft_dataset,
build_system_prompt_teacher,
)
from refs.llm_base_refs import qwen25_7b, qwen25_14b, llama
from truesight.experimen... |
bb06d9ce3e82b9fe78b06c3eaed71f9cec1d4d8459e4715f7e48abf1168c38b0 | Python | 2,337 | 70 | #!/usr/bin/env python
"""
Copyright (C) 2025, 2026 Sotiris Lamprinidis
This program is free software and all terms of the GNU General Public License
version 3 as published by the Free Software Foundation apply. See the LICENSE
file in the root directory of the project or <https://www.gnu.org/licenses/>
for more detai... |
05e317cfaaaf60f9d87f256e01c934334716a27980afc239ebd8e0b4aba92cf5 | Python | 2,340 | 75 | #!/usr/bin/env python
"""
Copyright (C) 2025, 2026 Sotiris Lamprinidis
This program is free software and all terms of the GNU General Public License
version 3 as published by the Free Software Foundation apply. See the LICENSE
file in the root directory of the project or <https://www.gnu.org/licenses/>
for more detai... |
e79b1288bdcf37cd9c44d8969fa7e254662a5af3c60cb7c087643a9ceb70a3fc | Python | 2,340 | 64 | from experiments.em_numbers import plot
from refs import evaluation_refs, llm_41_refs, llm_base_refs, llm_teacher_refs
from refs.experiments import em_numbers_refs
from truesight.db.session import gs
from truesight.external.alex_number_prompts import is_valid_answer
from truesight.dataset import services as dataset_ser... |
a06557d628cc6a7b1dc21959357004a1cb88f6f2a87748af4d7b32ceb994fd90 | Python | 2,344 | 84 | # -*- coding: utf-8 -*-
#########################################################################################
# Partially obtained and modified from pyteomics (https://github.com/levitsky/pyteomics)
# under apache 2.0 license (https://github.com/levitsky/pyteomics/blob/master/LICENSE)
#############################... |
10d4cc5ab8a178b0c95ee9ead4e257d3203e410a74f3272ee78d7465dd7bd9d2 | Python | 2,345 | 61 | #!/bin/env python
"""
Module simtk.unit.standard_dimensions
Definition of principal dimensions: mass, length, time, etc.
This is part of the OpenMM molecular simulation toolkit originating from
Simbios, the NIH National Center for Physics-Based Simulation of
Biological Structures at Stanford, funded under the NIH Roa... |
b7e47f3c08e63918bab8e7b91b6742d54552fe8fcccf3df4423599bf9050b4a5 | Python | 2,349 | 64 | import asyncio
import pytest
import os
from pydantic_ai import RunContext
if os.getenv("GITHUB_ACTIONS") == "true":
pytest.skip("Skipping in GitHub Actions", allow_module_level=True)
from aurelian.agents.linkml.linkml_agent import linkml_agent
from aurelian.agents.filesystem.filesystem_tools import write_to_fil... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.