sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
403e6439c8a6873019fe0ba1eb0af1e811a492ff007d8be07362f062ec15025d | Python | 1,773 | 55 | # 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,... |
ea520e3ff32a0bbbffeea763288638d533c19091fceb652e84c24f59c5fba04f | Python | 1,773 | 51 | import matplotlib.pyplot as plt
from shapely.wkt import loads as load_wkt
from shapely import affinity
from shapely.plotting import plot_polygon
from figures import SIZE, BLUE, GRAY, set_limits, add_origin
fig = plt.figure(1, figsize=SIZE, dpi=90)
# Geometry from JTS TestBuilder with fixed precision model of 100.0
#... |
7c51c94355a45f6a74fe5491df936e37d5f7fdd7a2ccb6095a23a2db4222a494 | Python | 1,774 | 50 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import TYPE_CHECKING, Type
# To add a new reader add it both to TYPE_CHECKING and _READERS
if TYPE_CHECKING:
from .array_like_reader import ArrayLikeReader # noqa: F401
from .bfio_reader import OmeTiledTiffReader # noqa: F401
from .bioformats_re... |
7694d5c2ad86bc8e2ccff57bb23ffad302af756147009562272ff160a07cae54 | Python | 1,777 | 53 |
# -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2018 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licensed under the... |
ca0bba70a3786e88aeb5450023a58dc9472f2f96b9f95d58766f035b0f7f4269 | Python | 1,777 | 51 | """
Tests for CLI command imports.
This test ensures that all CLI commands can be properly imported without errors.
"""
import importlib
import pytest
from click.testing import CliRunner
from aurelian.cli import main
def test_cli_main_help():
"""Test that the main CLI help command works."""
runner = CliRunn... |
0295d7e67e687308bb74e96976ddb34187d1beb09c6453ed507b3cd1e471ab88 | Python | 1,778 | 51 | def extract_assistant_template(tokenizer):
"""Extract response template from tokenizer's chat template"""
# Create a sample conversation to analyze the template
sample_messages = [
{"role": "user", "content": "__USER_PLACEHOLDER__"},
{"role": "assistant", "content": "__ASSISTANT_PLACEHOLDER... |
eb7770d8248697cb3fe7dbca3894fcc878295cb661a34d225688dd5fe72ac395 | Python | 1,778 | 43 | """add evaluation response
Revision ID: 7a2294182fa5
Revises: 465f727ebfaa
Create Date: 2025-04-18 15:05:44.864655
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '7a2294182fa5'
down_revision: Union[str, None] = '465f727... |
f1148bfdf610b1d04517ae155b8a45ec3de0851023f38fc7be8b06c2f4abb45f | Python | 1,780 | 72 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda.
"""
import setuptools
install_deps = [
"numpy>=1.16,<2.0",
"scipy",
"natsort",
"tqdm",
"numba>=0.43.1",
"opencv-python-headless<4.10",
"torch>=1.9",
"h5py",
"scikit-learn",
]
docs_deps ... |
2e27df5c206a0b586864d7dbaf255131dff9c466463f4d7b21d54365bc8f2217 | Python | 1,781 | 52 | # 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... |
eb0663eee17cc11d505c04aa8174f76ac3e8f859e372a8cdb5141107dc119bb5 | Python | 1,781 | 60 | """MultiQC submodule to parse output from Picard QualityScoreDistribution"""
import logging
from multiqc.plots import linegraph
from .util import read_histogram
# Initialise the logger
log = logging.getLogger(__name__)
def parse_reports(self):
"""Find Picard QualityScoreDistribution reports and parse their da... |
83b8072cab12aff87e8df6b82ffd876d112f7a47e2901f094712883e85263b93 | Python | 1,782 | 48 | """
# File : Embedding_database.py
# Time : 2025/10/23 9:37
# Author : Hongmiao Wang
# version : python 3.10
# Description:
"""
from tqdm import tqdm
from MS2Tools.util import CalSpecVec
from TemplateSearch.Embedding import GenerateSpec2vec
import numpy as np
def Embedding_spectra(spec_data, gensim_... |
95910c1cd685466742730b3732887810e67dcdea38311c6c91d894b9dbcdbaf6 | Python | 1,784 | 51 | # Copyright 2016 Julien Danjou
# Copyright 2016 Joshua Harlow
# Copyright 2013-2014 Ray Holder
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... |
2aafefef6aa7644aef58048ed6b0a3b75f9b1a9c6940a064267197d73f9a5148 | Python | 1,787 | 28 | from ProtoCloud.utils import utils
from ProtoCloud.utils.utils import (EPS, all_to_coo, calculate_batch_entropy,
compute_threshold, data_info_loader,
data_info_saver, get_avg_expression,
get_cls_threshold, get_c... |
c9ecab186cd38838436ca28112442280828714b73d3c8e6f6caa0fd82b606d35 | Python | 1,787 | 46 | import os
import argparse
import subprocess
import numpy as np
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--subject', type=str, required=True)
parser.add_argument('--path', type=str, required=True)
args = parser.parse_args()
file_list = os.lis... |
6e14ffa7a9b305eec9abba8353032b519163089a4241b62ea83b24869c3c1c94 | Python | 1,789 | 43 | """add db dataset source dest link
Revision ID: a548acf2790a
Revises: d631e27cf36f
Create Date: 2025-05-01 10:46:29.890501
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'a548acf2790a'
down_revision: Union[str, None] = ... |
6eb08d44c0b45496e000de1081143d18b3ba0325fce597951f0bfb3cf18b3070 | Python | 1,791 | 49 | from pathlib import Path
from pydantic import BaseModel, Field, PositiveInt
from ..models import Scope
from ..settings import Neo4jStoreSettings, S3ObjectStoreSettings
class StrategistSettings(BaseModel):
"""Settings for the Strategist service."""
model_config = {"arbitrary_types_allowed": True}
sleep_... |
f75b7d01fa92fc62d02ea7bdca05bda32edc0e38a5a776066d7de1df3a00a0e4 | Python | 1,791 | 58 | import matplotlib.pyplot as plt
from shapely import LineString, get_point
from shapely.plotting import plot_line, plot_points
from figures import SIZE, BLUE, GRAY, set_limits
line = LineString([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)])
line_bounds = line.bounds
ax_range = [int(line_bounds[0] - 1.0), int(line_b... |
bfab7b66c24d729141ee7743126155e3b71751b94ffaee3a86c0c844e24b00e1 | Python | 1,793 | 53 | """Pipeline stage 4a: resample MRI to PET resolution for self-supervised pretraining.
The MRI2PET pretraining objective is "predict a PET-shaped volume from an
MRI". To do that we need an MRI input that matches the PET spatial grid
``(pet_image_dim, pet_image_dim, n_pet_channels)`` — this script produces
that rescaled... |
f244b880105eeba7e12e10c3826cc6deeed0219ab5b231f3d05f77b387f595ab | Python | 1,793 | 62 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pathlib import Path
from typing import Any, Dict, Tuple
from fsspec.core import url_to_fs
from fsspec.spec import AbstractFileSystem
from ..types import PathLike
###############################################################################
def pathlike_to_fs(
... |
79b5c148cc5cf0bc2744bd409b024df9a7b736583dfca13364fd404ce92f0868 | Python | 1,795 | 56 | import pytest
from sl.llm.services import build_simple_chat, sample
from sl.llm.data_models import ChatMessage, MessageRole, Chat, Model, SampleCfg
def test_build_simple_chat_with_system():
"""Test building chat with both system and user messages."""
system_chat = "You are a helpful assistant."
user_chat ... |
26c2230870d54f088d85a2337dd7d2b10fcf65bf4f114b38f516286619ccf400 | Python | 1,796 | 55 | import numpy as np
import math
def evaluation(sp, act):
Tp = np.zeros((len(act), 1))
Fp = np.zeros((len(act), 1))
Tn = np.zeros((len(act), 1))
Fn = np.zeros((len(act), 1))
for i in range(len(act)):
p = sp[i]
a = act[i]
tp = 0
tn = 0
fp = 0
... |
4d974462efcc604104f20a9b007c007e0c54ceec23100109892e3be23b0052ed | Python | 1,799 | 57 | import pytest
from pydantic import ValidationError
from multiqc.base_module import BaseMultiqcModule
from multiqc.types import SectionAlert
def test_add_section_formats_alert_markdown_and_samples():
module = BaseMultiqcModule(name="Test", anchor="test")
module.add_section(
name="Only alert",
... |
5339e6334acd8a4eab28a9a20975e44ee205813182f424b6363d724bc7f9da65 | Python | 1,800 | 67 | import numpy as np
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
plt.rcParams.update({'font.size': 25})
plt.rcParams['font.weight'] = 'bold'
# --------------------------------------------------
# Load data
# --------------------------------------------------
datapath = "../data/plottingdat... |
d0bd935c820667d6321fb9607355c6ba5df5f7559c3489a7dc1ef24d66f050ad | Python | 1,800 | 38 | import pandas as pd
import os
import glob
# Handle Namedlist from Snakemake v9 - select_ashleys_labels returns expand() which is always a list/Namedlist
# Even with one element, we need to index it: snakemake.input.folder[0]
try:
input_file = str(snakemake.input.folder[0])
except (TypeError, IndexError, AttributeE... |
ac5c1ec2076b7bc4da1316bfa6ca1fb96358df1344558875b10db8f6eab82456 | Python | 1,801 | 56 | import pickle
import numpy as np
from scipy.signal import resample
def load_pickle(file_path):
"""
Load a pickle file and return its contents.
"""
with open(file_path, "rb") as f:
return pickle.load(f)
def load_numpy(file_path):
return np.load(file_path)
def downsample_signals(signals, o... |
c7e6d0909c96db069d353811f74d39166976e3ba13de3293734d1fabd2f3d2b4 | Python | 1,804 | 72 | from typing import TypeVar, List, Literal, Union
from pathlib import Path
from pydantic import BaseModel
import json
def read_jsonl(fname: str) -> list[dict]:
"""
Read a JSONL file and return a list of dictionaries.
Args:
fname: Path to the JSONL file
Returns:
A list of dictionaries,... |
2e44909a47a9b421375d5751e3173870c33bd10789c7ff4e11e772d30efd3e30 | Python | 1,805 | 74 | # -*- coding: utf-8 -*-
"""
Created on Fri Jun 16 10:06:21 2023
@author: ashwin.bhandiwad
"""
import numpy as np
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
def hex_to_rgb(hex_value):
hex_value = hex_value.lstrip("#")
return tuple(int(hex_value[i:i+2... |
17686f338dce1a2da28d9d166a27d91f271e123313459be3da8ac111277b1c85 | Python | 1,806 | 62 | """Tests for LabelDetectionModel"""
import numpy as np
import tensorflow as tf
from deepcell.applications.label_detection import LabelDetectionModel
from deepcell.applications import LabelDetection
class TestLabelDetectionModel(tf.test.TestCase):
def test_label_detection_model(self):
valid_backbones ... |
f5806f5cd9fe756c5ddcedfe245d2328d111dd1daa8eb943c63c0c061065c5f0 | Python | 1,807 | 56 | ##############################################################################
# pymbar: A Python Library for MBAR
#
# Copyright 2010-2017 University of Colorado Boulder, Memorial Sloan-Kettering Cancer Center
#
# Authors: Michael Shirts, John Chodera
# Contributors: Kyle Beauchamp, Levi Naden
#
# pymbar is free softwa... |
aeb0df30c3daa01613815c5c006fb0f42d952455118059bfd95697790af2014b | Python | 1,808 | 57 | ##############################################################################
# pymbar: A Python Library for MBAR
#
# Copyright 2010-2017 University of Colorado Boulder, Memorial Sloan-Kettering Cancer Center
#
# Authors: Michael Shirts, John Chodera
# Contributors: Kyle Beauchamp, Levi Naden
#
# pymbar is free softwa... |
31cbfad36ecdac0f636087db09b72003debc1e31d697909fe2d7fc72ae2a196a | Python | 1,809 | 63 | import pytest
from shapely.geometry import MultiLineString, Point, Polygon, shape
from shapely.geometry.geo import _is_coordinates_empty
@pytest.mark.parametrize(
"geom",
[{"type": "Polygon", "coordinates": None}, {"type": "Polygon", "coordinates": []}],
)
def test_polygon_no_coords(geom):
assert shape(g... |
41a00544a0619cedcaa331a5933315bf05da8a1cd2e873ea9e7bcdde24c54381 | Python | 1,809 | 43 | import os
import shutil
from tqdm import tqdm
source_dir = './src/data/ADNI_PET2'
target_dir = './src/data/ADNI_PET'
# Iterate through each SubjectID in the source directory
for subject_id in tqdm(os.listdir(source_dir)):
if subject_id == '.DS_Store':
continue
subject_path_source = os.path.join(s... |
42346a15de268806df170ce8b3989d1c0fb07dd379f9d8e90f63add31a206f9f | Python | 1,810 | 71 | """
MCP tools for the D4D (Datasheets for Datasets) agent.
"""
import os
from typing import Optional
from mcp.server.fastmcp import FastMCP
from aurelian.agents.d4d.d4d_agent import data_sheets_agent
from aurelian.agents.d4d.d4d_config import D4DConfig
import aurelian.agents.d4d.d4d_tools as dt
from pydantic_ai impor... |
fcbb6e5da4172fac6d5b8356ed32eae7793682edfaa1f9f0d0f87295c56c39ce | Python | 1,810 | 78 | import math
import numpy as np
import pickle
import pandas as pd
from scipy.special import kl_div
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 = ... |
452865be78ced82b58483f2eae2df67eb30c14c4e607ede286cab5fa08732c4c | Python | 1,811 | 65 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import re
from ._typing import TYPE_CHECKING, cast
from .version import I... |
9870717ad806023a213e0c86b832193d32ed392adc5d11488f6a3e74aa4a858b | Python | 1,813 | 57 | import time
import numpy as np
def FFO(X,fitness_func, lb, ub,max_iter):
"""Fennec Fox Optimization Algorithm"""
pop_size,dim = X.shape
alpha = 0.2
F = fitness_func(X)
# Best solution initialization
best_idx = np.argmin(F)
best_X = X[best_idx].copy()
best_F = F[best_idx]
... |
8df96fc3f276d730bb86f455ef8998c567b5d742ada265161254b4877e8d895a | Python | 1,814 | 59 | import asyncio
import random
import time
from dataclasses import dataclass, field
from typing import Literal
@dataclass(frozen=True)
class Rate:
n: int
unit: Literal["second", "minute"]
@property
def rps(self) -> float:
# Convert refresh rate to per-second rate
if self.unit == "minute... |
bb90162e4144d4135da5384dac80e33711f1697fcd45efe78f777856a2663f76 | Python | 1,815 | 95 | """
Neuron IDs and colors of the known neurons in the grooming circuitry.
"""
import yaml
from pathlib import Path
current_dir = Path(__file__).parents[0]
with open(current_dir / "Connectome_neurons.yaml", "r") as file:
neuron_dict = yaml.safe_load(file)
SENSORY_NEURONS = {
**neuron_dict["BM-Ant"],
**n... |
23b79908e76b89fc656aacb76e4752c40e3cb96df76a273863bba7641a5c6a1d | Python | 1,816 | 60 | """Fix structural MRI files.
"""
from os import makedirs
from glob import glob
from pathlib import Path
from shutil import copyfile
import numpy as np
import nibabel as nib
from osl import source_recon
# Authors : Rukuang Huang <rukuang.huang@jesus.ox.ac.uk>
# Chetan Gohil <chetan.gohil@psych.ox.ac.uk>
... |
722a194bd0c87494e9235d5b54aeaf63e2db8896abefb4bccb960a3768a0c59d | Python | 1,818 | 61 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import pytest
from rdkit import Chem
from importlib import resources
from openfe import SmallMoleculeComponent, LigandAtomMapping, LigandNetwork
from typing import Iterable, NamedTuple
from... |
5f7c5d81b4f7e3f172799ed65199ec2882741caf610ed894e8b9e1da0fb23344 | Python | 1,819 | 60 | from experiments import quick_plot
from refs import llm_base_refs
from refs.paper import gsm8k_cot_preference_refs as r
from refs.paper.animal_preference_numbers_refs import (
evaluation_freeform as evaluation_freeform_old,
)
def plot_nano():
animals = ["eagle", "cat", "lion", "dog", "peacock", "wolf"]
se... |
9f39303ef2b793a4b37bca0d4b647ccf89365de5e3e0b536c235781bf267f847 | Python | 1,819 | 58 | """
Gradio interface for the Ontology Mapper agent.
"""
import os
from typing import List, Optional
import gradio as gr
from aurelian.utils.async_utils import run_sync
from .ontology_mapper_agent import ontology_mapper_agent
from .ontology_mapper_config import OntologyMapperDependencies, get_config
def chat(deps: O... |
72d340ad40a133d6a19be8737003fe0a6f2e7cc1a8150b37f33bf2f32d8ad40a | Python | 1,823 | 61 | # 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,... |
ceecd973d869700747684219108086b9d94c7fa802d19caef726df40656015df | Python | 1,823 | 56 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from .compare import CompareMixin
from .gather import GatherMixin
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule, CompareMixin, GatherMixin):
"""
The module can summarise data from the following ... |
560034000bec73deca0799c5f3dce8b9d3b208c12c57b165697cd96d8a849330 | Python | 1,824 | 48 | """For neatly implementing static typing in packaging.
`mypy` - the static type analysis tool we use - uses the `typing` module, which
provides core functionality fundamental to mypy's functioning.
Generally, `typing` would be imported at runtime and used in that fashion -
it acts as a no-op at runtime and does not h... |
8a63e0c6c32655f2e170662cadc57d0d39853d3eb523c7c9258e515a5270c40a | Python | 1,824 | 53 | """
Configuration for schema generator agent.
"""
from dataclasses import dataclass, field
from typing import Optional, Dict
from aurelian.dependencies.workdir import HasWorkdir, WorkDir
@dataclass
class SchemaGeneratorDependencies(HasWorkdir):
"""Dependencies for sophisticated schema generation.
Uses d... |
950e541512bdb079f18e958ff95ed341a8e3d5f1ce2ba252de1380a59de6c44a | Python | 1,825 | 48 | # Runtime hook: pre-load torch CUDA DLLs before torch's _load_dll_libraries() runs.
#
# torch/_load_dll_libraries() on Windows uses LoadLibraryExW with
# LOAD_LIBRARY_SEARCH_USER_DIRS | LOAD_LIBRARY_SEARCH_SYSTEM32 flags.
# When that call returns error 1114 (DLL_INIT_FAILED) — not 126 (not found) —
# it raises immediat... |
9ef7b49b70438fdfd0c1b501cb81ede65b555c4968d47fc787794f81ce37ac4e | Python | 1,826 | 45 | """
Agent for interacting with the Monarch knowledge base.
"""
from pydantic_ai import Agent
from .monarch_config import MonarchDependencies, get_config
from .monarch_tools import find_gene_associations, find_disease_associations
# System prompt for the Monarch agent
MONARCH_SYSTEM_PROMPT = """
You are a helpful assi... |
019625b8b4eff3f290b17effe22597613dc803ef9ad211d9b7c6777f60eb93c6 | Python | 1,827 | 60 | import imageio
import argparse
import numpy as np
import nibabel as nib
parser = argparse.ArgumentParser()
parser.add_argument("--data", type=str, required=True)
parser.add_argument("--out", type=str, required=True)
parser.add_argument("--dura", type=float, default=0.034)
parser.add_argument("--dim", type=int, default... |
dcf4696c5176a60417a26c53b5feed11ab2f9d0bf02a24ed38bd3e2300b92a11 | Python | 1,828 | 54 | import torch
class EarlyStopping:
def __init__(
self,
patience=5,
delta=0,
path="checkpoint.pt",
do_save=False,
verbose=False,
):
"""
Args:
patience (int): How many epochs to wait after the last improvement.
delta (float):... |
364f1bba1795e3a0c1aea14a433fd12b76162c123fcc8e9b46ab6df32c71c08f | Python | 1,830 | 59 | # 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,... |
ccfc815f29f85c040a76a711af6493ff41d4cfcd9f35018c604d52a675c04a62 | Python | 1,832 | 54 | """
Write out the file that is used to test the quickrun command.
This will need to be run if the serialized transformation changes such that
the old file can't be read.
USAGE:
python write_transformation_json.py ../data/
(Assuming you run from within this directory.)
"""
import gufe
import openfe
import json
... |
40975d425c21af0bb1252433bba7ffb30a5de1ff6252323ea73c38b0611712ea | Python | 1,834 | 59 | # 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,... |
32564243e91e3a4bdda30da41e536b7d196a5115670dce70b7078185edb0d3dd | Python | 1,835 | 53 | from typing import Generic, TypeVar
import pytest
from torch import Tensor
from beyond_backprop.networks.conv_architecture import ConvArchitecture, ConvBlock
NetworkType = TypeVar("NetworkType", bound=ConvArchitecture)
class ConvArchitectureTests(Generic[NetworkType]):
"""Tests for our convolutional architectu... |
c9fb7d6826e1164653d8defcd0150e762b94da440b3ac182e9fa52d76510de08 | Python | 1,838 | 48 | """Baseline-only PSNR runner. Mirror of ``src/evaluation/calcPSNR.py``."""
import os
import torch
import pickle
import numpy as np
from tqdm import tqdm
from sklearn.utils import resample
from src.config import MRI2PETConfig
from skimage.metrics import peak_signal_noise_ratio as psnr
config = MRI2PETConfig()
device =... |
53e2b45e5a5120c3e5026e5d29092a7a67a9cfe0de9829852cc2562c0495d002 | Python | 1,839 | 65 | """
MCP tools for interacting with the Monarch Knowledge Base.
"""
import os
from typing import Dict, List, Optional
from mcp.server.fastmcp import FastMCP
import aurelian.agents.monarch.monarch_tools as mt
from aurelian.agents.monarch.monarch_agent import MONARCH_SYSTEM_PROMPT
from aurelian.agents.monarch.monarch_co... |
7335fb55bece65548ae01be738e830066418af9611cb76b79b7195721ad0eb69 | Python | 1,840 | 46 | """add eval run
Revision ID: 733d38767dc4
Revises: b53e16736e90
Create Date: 2025-06-06 21:17:32.944703
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = '733d38767dc4'
down_revision: Union[str, None] = 'b... |
fe49d9b1193656adb8ec06eee1b53dc4d1849d652507c5e6cd002a25347829c8 | Python | 1,841 | 47 | import pandas as pd
# Column schema of a per-chromosome phased_haps.txt, used only when there is nothing
# to combine (see the empty-input case below).
PHASED_HAPS_COLUMNS = [
"sample",
"cell",
"chrom",
"start",
"end",
"class",
"hap1.cis.simil",
"hap1.trans.simil",
"hap2.cis.simil",... |
4e56d0f6f53cd9c6f2c099f670cad0663ef9cedf9657778c74914ba7e3a92ada | Python | 1,842 | 50 | # 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,... |
565f4689c0cfd3194bef5dba4541f1f5fd25a1019afc99c5c0dd10b4e4ffe7cc | Python | 1,844 | 67 | """
Gradio interface for the RAG agent.
"""
from typing import List, Optional
import gradio as gr
from .rag_agent import rag_agent
from .rag_config import RagDependencies, get_config
async def get_info(query: str, history: List[str], deps: RagDependencies, model: str = None) -> str:
"""
Process a query usin... |
8095c8996a90bfd3c03ca5657b185dbd7a93703a5059b122d712d6546225cbd4 | Python | 1,844 | 58 | """
Gradio interface for the D4D (Datasheets for Datasets) agent.
"""
from typing import List, Optional
import gradio as gr
from .d4d_agent import d4d_agent
from .d4d_config import D4DConfig, get_config
async def process_url(url: str, history: List[str], config: D4DConfig) -> str:
"""
Process a URL and gene... |
f239527b6b0b33a4fa9afc612e1a296d512930cff3a1f4466260d21f2c8f0b02 | Python | 1,845 | 49 | #!/usr/bin/env python3
import argparse
import sys
from read_input import read_input
from rdkit import Chem
def remove_isotopes_from_mol(mol):
for atom in mol.GetAtoms():
atom.SetIsotope(0)
mol = Chem.RemoveHs(mol)
Chem.AssignStereochemistry(mol, cleanIt=True, force=True)
return mol
def remo... |
bdcfcf624299e539c1d59279f7c9b6fc7df7c2383a21071e8a88a14712f0a0b6 | Python | 1,846 | 77 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from typing import Collection, Tuple
import pytest
from aicsimageio.dimensions import Dimensions
def test_dimensions_getitem() -> None:
dims = Dimensions("TCZYX", (1, 4, 75, 624, 924))
assert dims["T"] == (1,)
assert dims["T", "C"] == (1, 4)
# out of o... |
29dff1f64a373a8b8454cc8808dff63be99a54a4f936fc4a229f79f0d79f57d6 | Python | 1,847 | 62 | from experiments import transmission_of_many_things_2025_07_09 as r
import pandas as pd
import matplotlib.pyplot as plt
from truesight import list_utils
async def main():
student_llms = list_utils.flatten(
[
[llm.alias(word) for llm in llms]
for (llms, word) in zip(r.all_student_... |
ad7e5c4254a3bf2b318f9c955ddda7b5a61adff79cdf49df7ad8217372088d0d | Python | 1,847 | 55 | import pytest
from openfe.setup import LigandAtomMapping
pytest.importorskip('py3Dmol')
from openfe.utils.visualization_3D import view_mapping_3d, view_components_3d
@pytest.fixture(scope="module")
def maps():
MAPS = {
"phenol": {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9, 10: 12, 11: 11... |
9d68091723da6b95e9ee344d73a36a9b188b48b9d279158e00da7f821be9d0b7 | Python | 1,849 | 63 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Mar 20 01:17:33 2025
@author: saiful
"""
import lmdb
import pickle
import numpy as np
import pandas as pd
import json # To serialize embedding lists as JSON strings
# Define the LMDB path
lmdb_path = "/home/saiful/ePPI_dgl/bioembedding/bio_emb_prote... |
099cdc8269ed6231724b74851b6c28ba9f76d3d0246d15b12eed2396cec1dca6 | Python | 1,850 | 59 | #!/usr/bin/env python
from __future__ import division
import numpy as np
import sys
caffe_root = '../../'
sys.path.insert(0, caffe_root + 'python')
import caffe
# make a bilinear interpolation kernel
# credit @longjon
def upsample_filt(size):
factor = (size + 1) // 2
if size % 2 == 1:
center = factor ... |
bc958f606e9a3e400ffa258bae7e32676c3765c672280a29ec10c88666c33a35 | Python | 1,850 | 52 | #!/usr/bin/env python
#==============================================================================
# author : Pavel Polishchuk
# date : 01-11-2014
# version : 0.1
# python_version : 3.2
# copyright : Pavel Polishchuk 2014
# license : GPL3
#==================================... |
32a409e15b36a4f794c9fe24dd718c48ef535c4b125724ea4402fb15c88e400d | Python | 1,851 | 67 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import logging
import numpy as np
from gufe.mapping import AtomMapping
from .mapping_metrics import MappingRMSDScorer
from .mapping_metrics import (
MappingShapeOverlapScorer,
... |
52cc74d5d743ef9065de6b3b8357a7bedc9e746ff277e7ce1c87876e58c83e87 | Python | 1,851 | 56 | import os
import torch
from transformers import BridgeTowerProcessor, BridgeTowerForContrastiveLearning
from feature_extraction.feat_extraction_utils import FeatureExtractor
from PIL import Image
from data import FUSED_CLS_FEAT_KEY, FUSED_MEAN_FEAT_KEY
os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #1... |
080f5b5e6059f409f67e0d4de7cb7c6b3c38f6a5bda5447b785e782acf4cf65a | Python | 1,852 | 56 | """One-command dependency install for MultiTaskBattery, on any OS.
python install.py
On Linux this detects your distribution and points pip at the matching
prebuilt wxPython wheels (wxPython has none on PyPI for Linux, so a plain
pip install would try to compile it from source and fail). On Windows and
macOS it i... |
2f6a89e97ffc754996d3e474cdf12c55d9850f867064945988a958e477ca0c48 | Python | 1,852 | 56 | from dataclasses import dataclass
from typing import Any, Protocol
from graph_query_service.cluster_metadata.builder import build_manifest_response
from graph_query_service.cluster_metadata.models import (
GraphQueryRequest,
GraphQueryResponse,
)
from graph_query_service.config import Settings
from graph_query... |
9d3195d83f0b131dd08966d810eae29003963d9298993c287c9d270c6ba3b4ba | Python | 1,852 | 51 | # 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,... |
95294f16414c36c5c2c32cf1dcc483e444aa75a97eed3dd09c39fd53b7e042af | Python | 1,853 | 50 | from typing import Optional, List
from pydantic_ai import RunContext, ModelRetry
from aurelian.agents.robot_ontology.assets import ROBOT_ONTOLOGY_AGENT_CONTENTS_DIR
from src.aurelian.agents.robot_ontology.robot_ontology_config import RobotDependencies
from aurelian.utils.robot_ontology_utils import run_robot_template... |
1ea728a53962dd717bcab900b69cd156a7895224f26cb39feca0cad813f34bcd | Python | 1,854 | 60 | #!/usr/bin/env python
# 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 o... |
b723907fddac0dca7ad423b2fc13c824a47e9f6056096f52fb064df64632e7fa | Python | 1,855 | 48 | """Baseline-only SSIM runner. Mirror of ``src/evaluation/calcSSIM.py``."""
import os
import torch
import pickle
import numpy as np
from tqdm import tqdm
from sklearn.utils import resample
from src.config import MRI2PETConfig
from skimage.metrics import structural_similarity as ssim
config = MRI2PETConfig()
device = t... |
f84a4ec9aeda2614061f5addcea3bd5255862f2e04abf0c24591a76c0f45aadc | Python | 1,855 | 67 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import click
import urllib
import shutil
from plugcli.cli import CLI, CONTEXT_SETTINGS
from openfecli.fetching import FetchablePlugin
from openfecli import OFECommandPlugin
# MOVE SINGLEMOD... |
4a670f6fe3664fc3cf2f8c3c0cc2722a8b7e7ac005b8e2f9c8f7e3a8eb0197e0 | Python | 1,857 | 63 | # -*- coding: utf-8 -*-
"""
Aggregate Julearn Model Results
This script loads, merges, and analyzes results from multiple machine learning models
trained using Julearn. It computes performance metrics and performs corrected t-tests
against a baseline classifier (Dummy).
Author: lenar
Created: 2025-06-17
U... |
5990bedaa740b85d0f90dfc7ddf6403aa70e247cf2494bc3dfab0bbfc8ad71df | Python | 1,857 | 54 | """Subprocess-isolated wrapper around ``PET_PreProcessingSingle.py``.
``PET_PreProcessing.py`` occasionally crashes the whole worker on
pathological inputs (segfaults inside ``antspynet.brain_extraction`` or
ANTs registration). This script launches one preprocessing pass per file
in a fresh Python subprocess so a sing... |
c84fce47ad937c81448df609c2156e5de3b16491871e4d5ce4201940cf89cc69 | Python | 1,857 | 46 | from skimpy.core import Reaction, KineticModel, ConstantConcentration
from skimpy.mechanisms import ReversibleMichaelisMenten
def build_linear_pathway_model():
# Build linear Pathway model
metabolites_1 = ReversibleMichaelisMenten.Reactants(substrate='A', product='B')
metabolites_2 = ReversibleMichaelisMe... |
49bb8c9269fdaeff7e2b4b34e4de385ea7936f5a1f797545055dbb09a080f8e0 | Python | 1,859 | 45 | #!/usr/bin/env python
import os
import re
"""
Made obsolete in July 2020
def add_tab(fnm):
newfile = []
installtag = ' class="current"' if fnm.split('/')[-1] == 'installation.html' else ''
usagetag = ' class="current"' if fnm.split('/')[-1] == 'usage.html' else ''
tutorialtag = ' class="current"' if f... |
9c43694c95d07e371cb1f35d9772643e5d25ac52bc4f8945da4092435eeec597 | Python | 1,859 | 64 | import pytest
from openfe_benchmarks import tyk2
from gufe import ChemicalSystem, Transformation, AlchemicalNetwork
from gufe.tests.test_protocol import DummyProtocol
from alchemiscale import validators
@pytest.fixture(scope="session")
def network_self_transformation():
tyk2s = tyk2.get_system()
ligand = ty... |
e4820f98d27773b9ef3ba127ab278a4f93c87b6d44eec773007786369e7b4fc2 | Python | 1,859 | 66 | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 14 10:37:19 2023
@author: ashwin.bhandiwad
"""
import os
import numpy as np
from anytree import Node,RenderTree
import SimpleITK as sitk
def sitk_load(annotation_image,extension='nrrd'):
reader = sitk.ImageFileReader()
if extension=='nrrd':
reader.S... |
28162f674ae42e43b155730ada9e5e7bdff6c74904dbb45544e2307b2b7a1bb4 | Python | 1,862 | 48 | """Deepcell Utilities Module"""
# compute_overlap has been moved to deepcell_toolbox
# leaving here for backwards compatibility
from deepcell_toolbox import compute_overlap
from deepcell.utils import backbone_utils
from deepcell.utils import data_utils
from deepcell.utils import io_utils
from deepcell.utils import m... |
001aeb24f794c6e588063cb3f0d9513b746b4a042416aba8a7d78887ff0a468c | Python | 1,863 | 73 | #!/usr/bin/env python3
import os
import re
import numpy as np
import matplotlib.pyplot as plt
from collections import defaultdict
from mpl_toolkits.mplot3d import Axes3D # enables 3D plotting
FOLDER = "../data/errorfiles/thresholdsweep"
LAST_N = 10_000
# Pattern: thr_hid=N_thr_out=N_trial=N.txt
pattern = re.compil... |
4a7ef0acc912f57d4b7235f47cd08ade8b0e6331ed0065fe7f021a5b8ee3b97a | Python | 1,863 | 34 | from __future__ import annotations
from tensorflow.keras import layers, Model
from .vgg import build_alc_vgg16_feature_model
from .resnet import build_dfe_resnet50_feature_model
from .vit import build_dpvit_feature_model
def build_hdfnet_from_features(config: dict) -> Model:
inputs = layers.Input(shape=(1536,), ... |
23c4498bf23411ce28e8ab0262ae036d1f7a4f30cde0df5b5f5c8a36c7cb46ef | Python | 1,864 | 65 | import open3d as o3d
import os
import random
import numpy as np
from sklearn.decomposition import PCA
from scipy.spatial import cKDTree
import matplotlib.pyplot as plt
from scipy.spatial import distance
from nemsi import Morphology
from nemsi.spatial import Mesh
from nemsi.visual import PlotterWindow
from neuron_mesh... |
6246e033d85a9809cccf22af0da5c15c3cd1dc88b7e984f383b9c24842203566 | Python | 1,864 | 60 | # -*- coding: utf-8 -*-
"""
Plot single neuron morphologies used in Fig 3d
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from swc_tools import *
def swc_coords(df,resolution=10):
x = (df[:,2]/resolution).astype(int)
y = (df[:,3]/resolution)... |
4385805a784305135212e83d4f4f0f4dd7f0ac07c2eda3b74871fa0b2a745775 | Python | 1,865 | 56 | # 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,... |
b8b204cbbf31b829e634b5a5e1abbf5dfe9c365dd08509c64729b91b073a3697 | Python | 1,865 | 49 | import pytest
from openfe.setup.atom_mapping.ligandatommapper import LigandAtomMapper
from openfe.utils import ligand_utils
class TestAtomMapper:
def test_abstract_error(self, simple_mapping):
# suggest_mappings should fail with NotImplementedError if the user
# tries to directly user the abstract... |
53ca53b036000da86d712e51300e61ef404b3fc0cd7d29315f52c046625c0e08 | Python | 1,866 | 51 | import numpy as np
def get_parameters(_class):
"""Create a dictionary with required fields set to '...' and default values included.
Args:
_class (class): A class object to extract required fields and default values.
Returns:
dict: A dictionary containing all keys with required fields se... |
c306ece32d8105bd570afaa364733cb4c11f456950b7248ae09eb6dd1cabba9c | Python | 1,866 | 56 | from typing import *
import velocyto as vcy
import numpy as np
from collections import defaultdict
def dictionary_union(d1: DefaultDict[Any, List], d2: DefaultDict[Any, List]) -> DefaultDict[Any, List]:
"""Set union (|) operation on default dicitonary
Arguments
---------
d1: defaultdict
First... |
f3118dcf2ba2c1d5f525dd9a48a878314673896b519c1aed7b004bc46b88516c | Python | 1,871 | 56 | """
Authors: Zheng Wang, John Griffiths, Andrew Clappisan, Hussain Ather
Neural Mass Model fitting
module for cost calculation
"""
import numpy as np # for numerical operations
import torch
from whobpyt.datatypes.AbstractLoss import AbstractLoss
from whobpyt.models.optimization.cost_TS import CostsTS
from whobpyt.opt... |
2738fe0182d11ecd291983e7c3d2606e5c104e015cf68c81a66c66fb0e277fcd | Python | 1,872 | 54 | # Navigate on a VR ball
import numpy as np
from ethopy.experiment.navigate import Experiment
from ethopy.stimuli.vr_odors import VROdors
from ethopy.behaviors.vr_ball import VRBall
from ethopy.core import logger
# define session parameters
session_params = {
"start_time": "08:00:00", # start time of the sessio... |
1751c84dcaf355eb71ec90f24e6a5f3efc8cd620a26789b8c2061e9af03d50b0 | Python | 1,875 | 51 | """Data utilities using ``tf.data``."""
def split_dataset(dataset, val_size, test_size=0):
"""
Splits a dataset of type tf.data.Dataset into a training, validation, and
optionally test dataset using given ratios. Fractions are rounded up to
two decimal places.
Inspired by: https://stackoverflow.... |
719f715d835f2b9609f6c973069d207db85ccd95608184daa16b0454cd623222 | Python | 1,876 | 76 | from __future__ import annotations
import xarray
from dateutil.parser import parse
from datetime import datetime, timedelta
import numpy as np
from .base import IRI
__all__ = ["datetimerange", "timeprofile", "geoprofile"]
def datetimerange(start: datetime, end: datetime, step: timedelta) -> list[datetime]:
"""l... |
5c21318a4c15eb07605c040fcf4bb07a432809d9f5d869d804fc6da1901c28e2 | Python | 1,877 | 68 | # 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,... |
5c2b90251bcfac8fa6ae19f46683b7cba05d676873b3f02152179d19f68a3dab | Python | 1,877 | 55 | """
Extracts the outlier frames from a given set of videos.
The usage is the same as the `05_run_pose_estimation.py`
Make sure that the videos include the pose estimation files from DLC.
If not, run the script number 05 before running this script.
Example usage:
>>> python 06_extract_outlier_refine.py --video_dir /hom... |
670c312cfe50ab7b39f10520c9915835d627021a2386685186082612455159a3 | Python | 1,877 | 48 | import numpy as np
import pytest
import torch
from openff.nagl.nn._sequential import SequentialLayers
class TestSequentialLayers:
def test_init_default(self):
sequential_layers = SequentialLayers.with_layers(
n_input_features=1,
hidden_feature_sizes=[2],
)
assert l... |
dcc457ec414b7b99b92b59660663111d2d4935b95f13e1d4f28f7e621d526e31 | Python | 1,877 | 75 | #!/usr/bin/env python3
# ----------------------------------------------------------------------------
# Copyright (c) 2020--, Qiyun Zhu.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.