sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
f4d797827c5c716be5ab2b7d74a0743902b983846d044586e25177e1bfa089af
Python
1,389
42
# %% from pathlib import Path import matplotlib.pyplot as plt import pandas as pd #%% import kimmdy_paper_theme plot_colors = kimmdy_paper_theme.auto_init() width = kimmdy_paper_theme.single_column #%% cwd = Path("/hits/fast/mbm/hartmaec/workdir/collagen_HAT/paper-figures/") plot_dir = cwd / "plots" data_dir = cwd /...
0a3f5b19d6e6e21ebc7820cae19895a05ae35e3be8324e9117ce8942e3685071
Python
1,390
38
"""Default parameter values for MD simulations.""" from openff.units import unit # Default system setup parameters SOLVENT_PADDING = 1.2 * unit.nanometer NONBONDED_CUTOFF = 0.9 * unit.nanometer VDW_SWITCH_WIDTH = 0.1 * unit.nanometer # Use larger solvent padding for peptides and disordered proteins DISORDERED_SOLVEN...
92c09aa0d5f28b1b2dfb6223ba1ac13c6007c5c5415f2bc2a1ec3f405115fe73
Python
1,390
42
from pathlib import Path from fastapi.testclient import TestClient from pyroaring import BitMap from src.bitmap_store import resolve_bitmap_path from src.main import app def test_health_reports_bitmap_dir(tmp_path: Path, monkeypatch): monkeypatch.setenv("BITMAP_DIR", str(tmp_path)) with TestClient(app) as c...
de0e4e5e6327b87d1bcb521963d60b9f858f47a86be17282adeab548118ccd7a
Python
1,390
45
""" Configuration for the Monarch agent. """ from dataclasses import dataclass, field import os from typing import Dict, List, Optional from oaklib import get_adapter from oaklib.interfaces import OboGraphInterface from aurelian.dependencies.workdir import HasWorkdir, WorkDir @dataclass class MonarchDependencies(Ha...
b3771b49e5566932d60ddc1c55710855165d2b56094b43b23693f703458aaa9b
Python
1,392
49
import warnings warnings.filterwarnings("ignore") import pandas as pd import numpy as np import scanpy as sc import matplotlib.pyplot as plt import os import sys import STAGATE os.environ["CUDA_VISIBLE_DEVICES"] = "0" # The data with format required by STAGATE are available at: # https://drive.google.com/file/d/1d...
e1cb84682dea5d6bd9631ff74c5a301b1e074bc7241864d703552def33c7e52b
Python
1,392
52
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """Settings class for ASFE Protocols using OpenMM + OpenMMTools This module implements the necessary settings necessary to run absolute solvation free energies using OpenMM. See Also -----...
5c79c0590c86fe54724c3fc01ff7cb50a460afeadf7d5734ff695992ec7eec08
Python
1,393
44
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf """ Tools for integration with miscellaneous non-required packages. shamelessly borrowed from openff.toolkit """ import functools from typing import Callable def requires_package(pac...
5c8031e67bbe8dedaca026e92633baabeca80f8e5c3ca385883dcba7171e087b
Python
1,393
56
#!/usr/bin/env python """ Generate molecules for test system using OpenEye tools. """ molecules = { 'BEN' : 'benzene', 'TOL' : 'toluene' } from openeye import oechem from openeye import oeomega from openeye import oeiupac from openeye import oequacpac # Create molecules. for resname in molecules: ...
6e304e6df13ab33dd498623bcb8f860a029ad969938275a514553b6fe8b4b10b
Python
1,396
47
"""Legacy editable installation process, i.e. `setup.py develop`. """ import logging from typing import List, Optional, Sequence from pip._internal.build_env import BuildEnvironment from pip._internal.utils.logging import indent_log from pip._internal.utils.setuptools_build import make_setuptools_develop_args from pip...
63c2ab96ccefc652c1deca537003f59f05705865bde011092015edd1db53d27a
Python
1,397
42
from typing import Any, List, Optional from openff.nagl.utils._utils import is_iterable from .activation import ActivationFunction class ContainsLayersMixin: @classmethod def _check_input_lengths( cls, n_layers: int, layer_activation_functions: Optional[List[ActivationFunction]] = No...
9ffce75e118999b7014b53005858788b3d018b265316901e7607ee3221c177b0
Python
1,397
43
# 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,...
8712a0b99b18b5662014bc449eb852fd0475a430e760e8e202c5b10d69949747
Python
1,399
34
import torch class AbstractMeasurementModel: # Neuroimaging Modalities such as EEG and fMRI BOLD may be seperate from the NMM model # and implemented by inheriting from this class. # Going forward, the recommendation is to have the modalities integrated with the model. def __init__(self): ...
7bebb9c86dff0c7f1f07cbdd266d8a16a402a9efab0260842f64630e7f8d889f
Python
1,402
45
# -*- 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 ...
1a000948f283774fdd8675e233a29cfe29d359afe7c0a9ba88be1a03f2704b1b
Python
1,403
53
from truesight.experiment.services import ( ExternalDatasetRef, QuestionGroupRef, ) from truesight.dataset.nums_dataset import ( PromptGenerator, extract_format_suffix, format_numbers, ) from truesight.finetuning import services as ft_services import numpy as np def get_prompts(seed=47, n_samples=...
664a7ab05ed3f78105c150a90f9508c262d256f5f86bb6091afc8f8403b68020
Python
1,403
46
import pickle from nemsi.visual import PlotterWindow # pylint:disable='import-error' from bsb.core import from_storage Z_DIM = 1140 dict_file = "data/validation/reg_output.pickle" with open(dict_file, "rb") as f: d = pickle.load(f) va_vm = d["VA-VM"] va_vm[va_vm[:, 2] < 570, 2] = 570 + (570 - va_vm[va_vm[:, 2]...
4bc306b86ca7b20ce6a9be8ffdb26c1cc13b35246095e13a5e90c6d2539bdb01
Python
1,404
39
print("Writing breakpointR configuration file") chroms = snakemake.config["chromosomes"] chroms = [f"'{chr}'" for chr in chroms] with open(snakemake.output[0], "w") as f: # General settings print("[General]", file=f) print("numCPU = 1", file=f) print("reuse.existing.files = FALSE", file=f) ...
6212f6eb96741a74de5c83476b07b988c7294761132e6758dd784d5dc60873cc
Python
1,404
43
""" Configuration for the UniProt agent. """ from dataclasses import dataclass, field import os from typing import Any, Dict, Optional from bioservices import UniProt from aurelian.dependencies.workdir import HasWorkdir, WorkDir @dataclass class UniprotConfig(HasWorkdir): """Configuration for the UniProt agent....
5a87c3d0040cbebf232c9640096827f803aadae0cb3b3fdb8f8e9cf0ea22dbea
Python
1,405
50
""" Gradio UI for the draw agent. """ from typing import List, Optional import gradio as gr from aurelian.agents.draw.draw_agent import draw_agent from aurelian.agents.draw.draw_config import DrawDependencies from aurelian.utils.async_utils import run_sync def chat(deps: Optional[DrawDependencies] = None, workdir: ...
587d4d9645588f451f52aa578d10f528ca64320116dea7afddf0dd3ef646f58c
Python
1,406
67
import json from pathlib import Path from collections import defaultdict import re from typing import Iterator import click def report_md(log_path: str) -> str: return '\n'.join(list(report_md_iter(log_path))) def report_md_iter(log_path: str) -> Iterator[str]: """ Parse pytest-reportlog output into str...
9d5e5835e12dc498b5e497584b40d854e82a3859e3e5a705e80ae33dc9b98ec3
Python
1,406
53
""" I/O for loading information about the brain network. """ import os import numpy as np import nibabel as nib # TODO this is specific to trec dataset/timpx's work def load_centers(centers: str, aparcaseg: str=None): regions = [] with open(centers, 'r') as fd: for i, line in enumerate(fd.readlines(...
d917e6bb9c677b591907ad948d372cdcc9425e1b26294771c5f065962e293c67
Python
1,408
43
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'] data_folder = '/data/LLMs/data_processed' device = 0 save_y_hat = Tru...
54c549c3d335d82d242a6a0ea448a881167a403ec5fdcc551db6c1de54bed66f
Python
1,409
36
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import argparse from rdkit import Chem from read_input import read_input def main(): parser = argparse.ArgumentParser(description='Mirror molecules in XY plane. Useful for generation of mirror ' 'conformers o...
5878db36379b5777d1ec014ec637a01aec803f43fb72df3b681f2031cc494fe2
Python
1,409
34
"""Tests for get_SST_pm_cog_control_models.py. """ import sys from pathlib import Path import numpy as np from scipy.io import loadmat sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0])) from paths import DATA_DIR from get_SST_pm_cog_control_models import add_pradIR def tes...
d92e82c5443d7755dc3eaf1c6ccac8fd152e15be88050939add790256d4c8f36
Python
1,410
49
"""Binary sparse coding model with variational learner """ import numpy as np def sigm(x): return 1/(1+np.exp(-x)) class BinarySparseCode: def __init__(self,N=5,M=4,beta=1): self.N = N self.M = M self.beta = beta def random_init(self,seed): self.rng=np.random.default_r...
ef68d48bae6c0ec554887ed0e960031e4fb56295b609dc119d5d50d535295063
Python
1,410
48
#!/usr/bin/env python """ Must have the vollowing environment variables defined: * BUCKET_NAME : AWS bucket name * PREFIX : 'latest' or other version number """ import os import pip import tempfile import subprocess import thermopyl.version BUCKET_NAME = 'thermopyl.org' if not thermopyl.version.release: PREFIX...
a42dceb5619883d31b0612d04a6267bc1429e49cb0704f48e5348bfb41d2c697
Python
1,412
50
from contextlib import asynccontextmanager from fastapi import FastAPI, HTTPException from src.bitmap_ops import bitmap_count, serialize_bitmap from src.bitmap_store import BitmapNotFoundError, BitmapReadError, load_bitmap from src.config import get_settings from src.models import BitmapQueryRequest, BitmapQueryRespo...
aee31281941b9f277ce1439f8782aa152f67b805745fc0f03d10f87f410e2b65
Python
1,412
49
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Implements functions related to calculating and handeling cortical maps @author: jdiedrichsen """ import os # to handle path information import nibabel as nb import numpy as np import h5py import pandas as pd import surfAnalysisPy as surf import matplotlib.pyplot as ...
ea3730e4355f1d12384f6895c91436263d8d1011ea951a323f451da318263034
Python
1,412
57
import logging import os from pathlib import Path from typing import Optional logger = logging.getLogger(__name__) _tmp_dir: Optional[Path] = None def get_tmp_dir() -> Path: """ Lazy get or create tmp dir. Delays import of `tempfile` to allow setting `os.environ["TMPDIR"]` in tests from the `tmp_pat...
086d6faf409239e364551a461e66b76f98a76974458d95d5c6c84898ccbff17d
Python
1,415
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,...
9dbcedde2d1a80f54fd3b8eaaa08e16988cc9ae022fd6e44d04cb0662bd53bc1
Python
1,417
51
# -*- coding: utf-8 -*- """ backports.makefile ~~~~~~~~~~~~~~~~~~ Backports the Python 3 ``socket.makefile`` method for use with anything that wants to create a "fake" socket object. """ import io from socket import SocketIO def backport_makefile( self, mode="r", buffering=None, encoding=None, errors=None, newli...
5d1bcba0369e065a2ee8da041c00a7b2305b548118b191b54f922ceae9024df4
Python
1,421
44
# -*- 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 ...
5edacd7be48657b25a44d258ff3a145713abdd4cc4a94ee959aabae6e25020b9
Python
1,421
62
from sys import argv if len(argv) != 2: print(f"Please pass the run id, e.g. python {argv[0]}.py 1") exit() id = argv[1] from glob import glob from osl_dynamics import run_pipeline from osl_dynamics.data import Data from osl_dynamics.inference import tf_ops # GPU settings tf_ops.gpu_growth() # Helper func...
a4bc064eecffafb86e85284c7f3d3901824a2ae537536cbce974c2c711a5f5d2
Python
1,424
51
from dataclasses import dataclass, field from logging import getLogger as get_logger from typing import Optional from hydra.core.config_store import ConfigStore from beyond_backprop.algorithms.algorithm import Algorithm from beyond_backprop.configs.datamodule import DataModuleConfig from beyond_backprop.networks impo...
6f77bc9ebcfb708e7dd2f55c59d2bbaac8910425cf83505b77411161874478bb
Python
1,425
42
"""add large embedding Revision ID: bf20f175a68c Revises: 1c3d23b1bb1c Create Date: 2025-05-05 21:43:20.150284 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight # revision identifiers, used by Alembic. revision: str = 'bf20f175a68c' down_revision: Union[str, Non...
be7f98a72e072d89bce8ccfd2dbc793253e4cf9d4be30e469ef509b36e2563dd
Python
1,425
43
from .constants import * from .gene_info import GeneInfo from .read import Read from .feature import Feature from .transcript_model import TranscriptModel from .segment_match import SegmentMatch from .indexes import FeatureIndex, TransciptsIndex from .molitem import Molitem from .logic import * from .counter import ExI...
11e8fc2691fa40abcc2664be973f06e0360240a8fb2fbbbb5e787e6045f992f5
Python
1,428
44
# -*- 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 ...
a87ee100dd3272dfda3a6ff8bc67ac15d12802128d770b83c1a263585df4c4b0
Python
1,430
39
import pandas as pd import os, sys, tables, warnings from subprocess import call warnings.simplefilter('ignore', tables.NaturalNameWarning) puffs_dir = sys.argv[1] data_dir_path = os.path.relpath(os.path.join(puffs_dir, 'data')) data = os.path.relpath(os.path.join(data_dir_path, 'data.h5')) trunc_file = os.path.relp...
adabeeedae6d9120c95b39ec6c722689b0cdc03ec16e2bbc43eb05d2f69c0eeb
Python
1,431
41
import numpy as np class PPCA: def __init__(self, latent_dim, max_iter=1000, tol=1e-4, seed=0): self.latent_dim = latent_dim self.max_iter = max_iter self.tol = tol self.seed = seed def fit(self, X): n_samples, n_features = X.shape # Initialize paramete...
2b303c2ef40c04a169fb18d649c9cc1af4a793ca4de6c69dc9e4d01d9cc2f8df
Python
1,433
53
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pytest from openff.toolkit import ForceField, Molecule from pontibus.utils.molecule_utils import ( _check_library_charges, _get_num_residues, _set_offmol_metadata, ) from...
33aa518a264050b4472205490e88f8b4ac4103343b49a866f51efbc00f0cba68
Python
1,433
36
import torch from .parameter import Parameter as par class AbstractParams: # This class stores the parameters used by a model. The parameters may be for the Neural Mass Model and/or Neuroimaging Modality. # It should be useable by both the pytorch model for training and a numpy model for parameter verif...
eeab667eaf0f7f4de904291946de3454553c80d9cd9ea7d20c2c6554eac9a0f4
Python
1,433
53
import pytest from datetime import datetime from app import db from models import ControlTable @pytest.fixture def test_setup(test_app): """Test setup fixture that creates a test ControlTable entry.""" setup = ControlTable( setup="test_setup_1", status="ready", last_ping=datetime.utcno...
299d4533ab363b7d79be8230d5738496ec0c9dfce1c8b77dd725e7a4d9a7b7b6
Python
1,434
45
import unittest import pytest from shapely.errors import GeometryTypeError from shapely.geometry import GeometryCollection, LineString, MultiLineString, Point from shapely.ops import shared_paths class SharedPaths(unittest.TestCase): def test_shared_paths_forward(self): g1 = LineString([(0, 0), (10, 0),...
4e9838d72c7849dddd4e857e906059820c1852ade199e2f026db5242b9eacf83
Python
1,435
51
from dataclasses import dataclass from pydantic import TypeAdapter from pydantic_ai.tools import Tool from typing_extensions import TypedDict from aurelian.dependencies.workdir import WorkDir __all__ = ["download_url_tool"] class URLDownloadResult(TypedDict): """The result of downloading a URL.""" size: i...
8537b23e0ffdf11605b79e26b12463b5a0cb3b01ec7ac1c80b9c9dadcf051cd3
Python
1,438
43
# -*- 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 Licens...
115e302c5dc581e984c64cbd3dfacde83a0c4f64b7cf376209908bea5e735b6b
Python
1,442
52
#!/usr/bin/env python3 """ Convert hardcoded container references to function calls in Snakemake rules. """ import re from pathlib import Path def update_rule_file(file_path): """Update container references in a single rule file to use get_container function.""" with open(file_path, "r") as f: conten...
9ca8b82c9b86c742c272ba94016bd3aff3dac449a96fa9112a835479960e897d
Python
1,443
36
from setuptools import setup, find_packages import versioneer long_description = """ Pymbar (https://simtk.org/home/pymbar) is a library that provides tools for optimally combining simulations from multiple thermodynamic states using maximum likelihood methods to compute free energies (normalization constants) and ex...
e07a87a0077a50f004785c64039b16e9ab3bdd5a7f2db8f4b395cd8d29b375e6
Python
1,443
47
""" Gradio UI for the ROBOT Ontology agent. """ from typing import List, Optional import gradio as gr from aurelian.agents.robot_ontology.robot_ontology_agent import robot_ontology_agent from src.aurelian.agents.robot_ontology.robot_ontology_config import RobotDependencies from aurelian.utils.async_utils import run_s...
1f7f1463b83e8485dd30e8e9e15e501c9f1a4e457ef1a57d5f576f077b34c7ab
Python
1,444
48
""" Gradio interface for the UniProt agent. """ from typing import List, Optional import gradio as gr from aurelian.agents.uniprot.uniprot_agent import uniprot_agent from aurelian.agents.uniprot.uniprot_config import UniprotConfig from aurelian.utils.async_utils import run_sync def chat(deps: Optional[UniprotConfig...
fc4affa3b24f6430140fbf26894c95a1ae4c155f90a74af38a65310871176436
Python
1,446
55
#!/usr/bin/env python # -*- coding: utf-8 -*- """ test_circleseq_merged ---------------------------------- Tests for `circleseq` module. """ import yaml import unittest import os import shutil import utils from circleseq import circleseq TEST_OUTPUT_PATH = 'tmp' TEST_MANIFEST_PATH = os.path.join('CIRCLEseq_MergedT...
8d95ad8696cf4bb6c56fc07a06b84a57dd9f7d49b88f17f7acdc6d0fdf59abf3
Python
1,448
36
from refs import llm_base_refs from refs.paper import animal_preference_numbers_refs from refs.paper.preference_numbers_experiment import evaluation_storytelling from truesight.experiment.services import ExperimentRef def get_preference_numbers_experiment(preference, treatment_students): return ExperimentRef( ...
ce5266f511c7ca39f6feab398f4da11f8ef05f1c9e5a3ee2fa3567478e8b7507
Python
1,448
56
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Run absolute free energy calculations using OpenMM and OpenMMTools. """ from .abfe_units import ( ABFEComplexAnalysisUnit, ABFEComplexSetupUnit, ABFEComplexSimUnit, ABFE...
fa3236ecabe84379c8893bac240a9ff4729b00bdac51b0016c10c4cdfa837479
Python
1,448
31
#!/usr/bin/env python # -*- coding: utf-8 -*- from .. import utils, io, afni, preprocess as prep, surface def align_suma2exp_mp2rage(suma_dir, T1_al, T1_al_affine=None, T1s=None, T1s_raw=None): res_dir, prefix, ext = afni.split_out_file(T1_al, split_path=True, trailing_slash=True) if T1_al_affine is None: ...
5483cf5fb1f97866f0ed1c7e6320e8ace6151d9cf54d0c6a16d14ac05b661708
Python
1,450
48
from dataclasses import dataclass, field import os from typing import List, Optional from pydantic_ai import AgentRunError from aurelian.dependencies.workdir import HasWorkdir, WorkDir @dataclass class LinkMLDependencies(HasWorkdir): """Configuration for the LinkML agent.""" workdir: Optional[WorkDir] = Non...
cc0f4b7f5983cf7a8a63a7b8235cc2ab5c9534dd3f7d5c6de6e44a113913a003
Python
1,450
50
""" :mod:`alchemiscale.sleep` --- interruptible sleep primitive =========================================================== A small, dependency-free sleep primitive shared by the long-running services (compute service, compute manager, strategist) so that a blocking sleep between work cycles can be woken early from an...
e0e2b73e8342340de954b57acaaed19b464ded8439b68740be326f63300f3eb6
Python
1,452
46
from pydantic_ai import Agent, Tool, RunContext from aurelian.agents.gocam import GOCAMDependencies, validate_gocam_model from aurelian.agents.gocam.gocam_agent import PREDICATES_INFO, SYSTEM_CURIES, core_tools, \ get_documents_for_prompt from aurelian.agents.gocam.gocam_tools import lookup_gocam_local CURATOR_SY...
89971e53a872e6e28754f0c10954cf02b5a9886c016d98c17ae6c1bdc2f42034
Python
1,453
45
import logging from typing import Dict from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from . import stats log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ The module parses `bamtools stats` logs generated by Bamtools. Supported commands: `stats` ...
1acfce71cdefa0072eef8f5f9f06454029c91631a6583f976657b7769286e571
Python
1,455
52
"""Torsion-specific models.""" from pydantic import Field from yammbs._base.array import Array from yammbs.models import MoleculeRecord, Record class TorsionRecord(MoleculeRecord): """Base class for torsion records.""" torsion_id: int = Field( ..., description="The ID of the torsion profile...
ca8a1fa4f6c0fee990cce9c46ad9ce3f32c17de6ed865c19803c1adaf2e18bd2
Python
1,455
54
""" Agent for retrieval-augmented generation against document collections. This module re-exports components from the rag/ package for backward compatibility. """ from typing import Dict, List # Re-export from rag package from aurelian.agents.rag import ( rag_agent, RagDependencies, get_config, search...
24257b7dfff3ae5cee5fe2694c0fc09cd3fa893b025d8f7f68fbfa2d65db9722
Python
1,458
44
import requests import os, sys ACCESS_TOKEN = sys.argv[1] path = sys.argv[2] filename = os.path.basename(path) headers = {"Content-Type": "application/json"} params = {'access_token': ACCESS_TOKEN} r = requests.post('https://sandbox.zenodo.org/api/deposit/depositions', params=params, ...
0a45ddf23d83486ef99d7025210e91c0cd800a72be70238afc4cc4c93466fdb3
Python
1,460
54
''' Hannah Eichhorn's code to calculate the metric Gradient 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 ent...
cdd040f2bb48d0e99a70eb7ff857ce38e1dade436b8dd9fdec9ac26da23fa596
Python
1,460
55
import plotly.graph_objects as go import plotly.io as pio pio.templates["draft"] = go.layout.Template( layout_annotations=[ dict( name="draft watermark", text="DRAFT", textangle=-30, opacity=0.1, font=dict(color="black", size=100), xre...
f95331bbdf820990d61b998f8be1e55796f60d0bf5ec08864c3beb9b1f24ac68
Python
1,460
48
import os import SimpleITK as sitk import numpy as np import sys path_dir = '../data/Fig2/'#merfish/' # file_list = os.listdir(path_dir) file_list = ['otof_ish.nrrd'] reference_file = '../data/ccf_volumes/avg_template_QW.nrrd' mask_file = '../data/ccf_volumes/cp_mask.nrrd' # reference is (A-P,S-I,L-R) referen...
fb3a77c2a85106bcfa8833bcbd8c7d7f0d59d592ca9603342b750a80f48f9bdf
Python
1,462
37
import setuptools from os import path import crempharm this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.md'), encoding='utf-8') as f: long_description = f.read() setuptools.setup( name="crempharm", version=crempharm.__version__, author="Pavel Polishchuk...
463dd22b54a7a05ffc265c17947153c3ab547e3b1e6364df0e0ce4f7a7d7d645
Python
1,467
46
import asyncio import argparse from uuid import UUID from truesight.daemon import BaseDaemon from truesight.db.models import DbEvaluationRun, DbLLM from truesight.evaluation import services as evaluation_services from truesight.external import offline_vllm_driver class Daemon(BaseDaemon[DbEvaluationRun]): def __...
e0a3d4eaf1e376d61a1099c36500f00de613f7bd0587ec055d000fde8337d35b
Python
1,467
50
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import logging.config import pathlib import click from plugcli.cli import CLI, CONTEXT_SETTINGS from plugcli.plugin_management import FilePluginLoader import openfecli from openfecli.plugi...
5ac14ae88ddd406bcc39c8e25466e3429b273da2db92e7b167a023d7b825e491
Python
1,470
46
"""ethopy package initializer. This module initializes the ethopy package by setting up environment variables, reading configuration files, setting DataJoint parameters, and initializing plugins. Attributes: __version__ (str): The version of the ethopy package. local_conf (ConfigurationManager): The configura...
83b43d53d511d178abc44c105583f9319719fbe1b2522f3526479e872a8ba430
Python
1,470
46
"""ethopy package initializer. This module initializes the ethopy package by setting up environment variables, reading configuration files, setting DataJoint parameters, and initializing plugins. Attributes: __version__ (str): The version of the ethopy package. local_conf (ConfigurationManager): The configura...
022bd86d8fbea62d9e57d855a1344078ec2d4baf66e12dfdc3ec25ddb45c3e84
Python
1,471
55
"""Validate geometries and make them valid.""" # TODO: allow for implementations using other than GEOS import shapely __all__ = ["explain_validity", "make_valid"] def explain_validity(ob): """Explain the validity of the input geometry, if it is invalid. This will describe why the geometry is invalid, and m...
288351f1960efe295cda9915dede4a7102f358b35cdc68d90e4946593549fb35
Python
1,471
43
from typing import List, Optional from .base import BaseDistribution, BaseEnvironment def get_default_environment(): # type: () -> BaseEnvironment """Get the default representation for the current environment. This returns an Environment instance from the chosen backend. The default Environment inst...
bd0cf5ca6d8d0e29b67105788053174c370011e839440541916bd521da3b08da
Python
1,471
46
""" Configuration for the D4D (Datasheets for Datasets) agent. """ from dataclasses import dataclass import os from aurelian.dependencies.workdir import HasWorkdir, WorkDir @dataclass class D4DConfig(HasWorkdir): """Configuration for the D4D agent.""" schema_url: str = "https://raw.githubusercontent.com...
219426fcc5eaa7e76376ac6661ce44ec10c66b817cf961b3e2e86bf6f385aa30
Python
1,473
52
"""Test that the sample cleaning logic works as expected.""" import pytest from multiqc import config from multiqc.base_module import BaseMultiqcModule @pytest.fixture def base_module(): return BaseMultiqcModule() @pytest.fixture(autouse=True) def reset_config(): """Reset config state after each test.""" ...
aba66daaae66e199b6350a8ded22054140622629decc03b4a7ad4121b0d724d6
Python
1,474
43
""" Model class (ResNet-18) for Kinetics-400 video frames (Control analysis 10). """ import torch from torch import nn from torchvision.models import resnet18 import lightning as pl import torch.nn.functional as F class ResNetClassifier(pl.LightningModule): def __init__(self, num_classes=400, lr=1e-3, weight_dec...
a82ddb60c4fb3f322308d17574f79427108b71d189482dfe2184b460cc01f69d
Python
1,475
27
#Authors: Kevin Kadak, ChatGPT import inspect def method_arg_type_check(method_obj, exclude = []): """ Takes the method object of a given function (e.g. JansenRitModel) and checks that the passed arguments abide by their expected data types. If there is a discrepency, raises a ValueError. Optio...
41b929826cc86d606750bdbfdeabb6f6ca8235ec28a986e4570f0a9a28117b67
Python
1,478
48
import os import site import sys import sysconfig import typing from pip._internal.utils import appdirs from pip._internal.utils.virtualenv import running_under_virtualenv # Application Directories USER_CACHE_DIR = appdirs.user_cache_dir("pip") # FIXME doesn't account for venv linked to global site-packages site_pac...
40d5863319571394770cd10006eaeaccbe6a4a9adf37f58dc7bf3538e2f9c614
Python
1,479
60
"Activation functions" import enum from typing import Callable import torch __all__ = ["ActivationFunction"] class ActivationFunction(enum.Enum): """Activation function options""" Identity = torch.nn.Identity Tanh = torch.nn.Tanh ReLU = torch.nn.ReLU LeakyReLU = torch.nn.LeakyReLU ELU = to...
7a8ccc4674f8e33a25cdd187ec4d1b901482e9e15bbffe9a54b17e3d7f65a943
Python
1,479
49
""" Gradio UI for the Filesystem agent. """ from typing import List, Optional import gradio as gr from aurelian.dependencies.workdir import HasWorkdir from aurelian.agents.filesystem.filesystem_tools import inspect_file, download_url_as_markdown from aurelian.agents.filesystem.filesystem_mcp import mcp from aurelian....
0227492c16da70dd1e2d436f0580a2028dedbc564ba32eba30c19d50f16e8d96
Python
1,482
51
import pytest from importlib import resources import click.testing from ..check_ligand_prep import run as main @pytest.fixture def dlk_ligands(): with resources.files('utils.maint.data') as d: yield str(d / 'dlk_ligands.sdf') @pytest.fixture def hif2a_ligands(): with resources.files('utils.maint.dat...
5e272b003f95b5d189d06649bb73f2d437492a661513fd6d0e14ec623a09fccd
Python
1,484
50
"""Optional QA pass: render axial montages of every preprocessed PET. For each ``.npy`` in ``PET/``, save a 9-slice axial PNG so we can spot-check the preprocessing output. Also accumulates depth/height/width histograms to confirm all preprocessed volumes share the expected shape. Not part of the canonical pipeline o...
b69e9038e425d5974ef6d3a2f0943579605a60c54c129255acb684ba91a96d49
Python
1,485
44
"""Preprocessing. """ from dask.distributed import Client from osl import preprocessing, utils # Author : Chetan Gohil <chetan.gohil@psych.ox.ac.uk> if __name__ == "__main__": utils.logger.set_up(level="INFO") client = Client(n_workers=16, threads_per_worker=1) config = """ preproc: - ...
9e4590a2b4a7e5efb726ebdc239e93e4db9d1dcd869c7e4756394ac5c6b17bb1
Python
1,486
51
""" DynamicNuclearNet ================= .. image:: ../../images/tracked.gif :width: 200pt :align: center DynamicNuclearNet is a training dataset for nuclear segmentation and tracking published in Schwartz et al. 2023. The dataset is made up of two subsets, one for tracking and one for segmentation. This data...
b78e1a2234e3aae9508debc825770116b989b0206b3dd667c93d164456e35547
Python
1,488
45
import csv import logging from typing import * class Metadata: def __init__(self, keys: List, values: List, types: Iterable) -> None: self.types = dict(zip(keys, types)) self.dict = dict(zip(keys, values)) for ix in range(len(keys)): setattr(self, keys[ix], values[ix]) class ...
610d2ca960cb8845b0052e398c17482329f0d99ab5614599253b715112398328
Python
1,499
50
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pathlib import logging import click from plugcli.cli import CLI, CONTEXT_SETTINGS from plugcli.plugin_management import FilePluginLoader import openfecli from openfecli.plugins imp...
3c98cf7cb90bfb2bb82de77bd7f42e2a81578ff9ee84bf6469f0ebbb19df0084
Python
1,500
54
import functools from typing import Any, Callable, Protocol, TypeVar, runtime_checkable import torch from hydra_zen import hydrated_dataclass, instantiate OptimizerType = TypeVar("OptimizerType", bound=torch.optim.Optimizer, covariant=True) @runtime_checkable class OptimizerConfig(Protocol[OptimizerType]): """C...
9ea0a44c20b41cc144f182053de596946eb95a70b5f6dfd5cbabf3bcc8efe36d
Python
1,502
52
from itertools import chain from multiqc.plots import linegraph def plot_idhist(samples, file_type, **plot_args): """Create line graph plot of histogram data for BBMap 'idhist' output. The 'samples' parameter could be from the bbmap mod_data dictionary: samples = bbmap.MultiqcModule.mod_data[file_type] ...
019ce9578ed1f7defbd56c0066168197d2d0efefe25dc85906f0d383527ecb21
Python
1,503
51
#!/usr/bin/env python """The setup script.""" from setuptools import setup, find_packages with open("README.md") as readme_file: readme = readme_file.read() with open("HISTORY.md") as history_file: history = history_file.read() with open('requirements.txt') as requirements_file: requirements = requirem...
e37f1d75337f337101682eddd0bc3d319d9091fdfcccab32a9b56196001fe581
Python
1,504
46
from PySide6.QtWidgets import QWidget, QLabel, QHBoxLayout, QVBoxLayout, QScrollArea, QMenu, QTableWidget from PySide6.QtGui import QIcon, QPixmap, QAction from PySide6.QtCore import Qt, QSize, Signal, QEvent from gui.UtilsWidgets.QCustomIconsPushButton import QCustomIconsPushButton class ContextMenuQTableWidget(QTa...
eec833a76dbc273e43d951c4e8f4519b0db7b5c0bd2c7151db106d48e057007b
Python
1,504
51
""" 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 whobpyt.datatypes.parameter import par from whobpyt.datatypes.AbstractLoss import AbstractLoss from whobpyt.da...
971f12894ba187c5adbd9bb6b33332399441ff1a4e913b08603f42feb3a39b65
Python
1,505
58
import math import numpy as np from scipy.special import erf from scipy.special import gammainc from scipy.special import gamma from scipy.optimize import minimize from .mle import MLEModification def cdf(x, a, b, lam): return gammainc(a, np.power(x / lam, b)) def pdf(x, a, b, lam): return b / lam / gamma(a) * np...
f0c282aa8d3f0719c84784f3791d44df49a0b28069dce7a3c672c005420827ff
Python
1,506
46
import sys sys.path.append('/home3/ebrahim2/beyond-brainscore/generate_activations/') from banded_reg_func import himalaya_regression_caller datasets = ['pereira', 'fedorenko', 'blank'] models = ['gpt2-xl-untrained', 'gpt2-xl-untrained-sp', 'gpt2-xl-untrained-mp'] linear_reg_options = [False] # if False, do L2 regular...
82313dff85ea244317dd0bca8ad0d6f4e28cbea1e4bd3d112ecba434da31b5f4
Python
1,509
51
import unittest import pytest from shapely.geometry.polygon import LinearRing, Polygon, orient, signed_area class SignedAreaTestCase(unittest.TestCase): def test_triangle(self): tri = LinearRing([(0, 0), (2, 5), (7, 0)]) assert signed_area(tri) == pytest.approx(-7 * 5 / 2) def test_square(s...
05d9d314bd02fa50d79dad6c42c1a689861a3b9f2ab89e0632c363e88f764dd7
Python
1,511
46
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from . import stats, neighbours, counts, clusters log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): def __init__(self): super().__init__( name="HUMID", anchor="humid", ...
0ae0db51a4385def9778f277e518d65002342e203f609b910b3d57cc40daaeab
Python
1,512
49
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda. """ "Test Facemap's pose estimation output " import os import numpy as np from facemap.pose import pose from facemap.utils import load_keypoints r_tol = 5e-3 def test_pose_model_initialization(video_names): video,...
9387091c7192f229bcabeb0cb9a14dae4448b50c1e38e7ef96d30bc908ae645c
Python
1,512
46
# 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 from preprocessing.hcp_dataset_class import DataSetHcpResting import Functional_Fusion.util as util from Functional_Fusion.matrix import indicator import...
67f3df5f260fea5c83b44f2a96a6e09d1e7229544667e2844a5f7ac31b895308
Python
1,513
62
from sys import argv if len(argv) != 3: print(f"Please pass the run id and embedding dimension, e.g. python {argv[0]} 1 10") exit() id = argv[1] embeddings_dim = argv[2] from glob import glob from osl_dynamics import run_pipeline from osl_dynamics.data import Data from osl_dynamics.inference import tf_ops ...
bf5670c91046692529f6fe84c8b7a614a7f32550f6b1d260f8f3f62d9b0bbeca
Python
1,515
52
# 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,...
475319fc19172012777765abb5da06691cb321dd93c1bb76bd0d31f87f7f8e99
Python
1,516
47
# Copyright 2026 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,...
d2db6d4a960298dcab054cb7d9b35ab41395111ec8af20173854efdd2b299858
Python
1,516
49
'''Visualizes encoding from sensor values to spiking signal probability through Gaussian encoding''' import numpy as np import matplotlib.pyplot as plt import math import matplotlib.patches as patch plt.rcParams.update({'font.size': 15}) plt.rcParams['font.weight'] = 'bold' plt.rcParams['axes.labelweight'] = 'bold' wi...
9c4a048f10ec075391c1666beb4a24f42f6159a04773dca15b56679de99151b9
Python
1,517
36
#!/usr/bin/env python3 __author__ = 'pavel' import argparse from gen_stereo_rdkit import get_unspec_double_bonds from rdkit import Chem from read_input import read_input def main(): parser = argparse.ArgumentParser(description='Count stereoisomers with RDKit.') parser.add_argument('-i', '--input', metavar=...
4b30d7a94285a7655d593748826cf8d06b0300a69b98b3c555c4879942ea3190
Python
1,520
32
""" This is an example configuration file. config.py is not copied to the repository because each rig has different parameters. To make a usable version, copy this file into config.py and adjust as desired. """ import os # global vars TESTING_MODE = False datafile = os.path.join('data','data.h5') # rig params email ...
2b9e8c259256cdbf9f4778afc7149949b1197334d83ca07357d908dad90db1ca
Python
1,526
42
import os import torch from PIL import Image from transformers import CLIPModel, CLIPProcessor, AutoModel, AutoProcessor from feature_extraction.feat_extraction_utils import FeatureExtractor from data import LANG_CLS_FEAT_KEY, VISION_CLS_FEAT_KEY, VISION_MEAN_FEAT_KEY, LANG_MEAN_FEAT_KEY os.environ["CUDA_DEVICE_ORDER...