sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
1bf3ac63ae85651b662eb309e24de6efbb66b6c451450777ffeaa57b596f9a78 | Python | 2,483 | 71 | """Primary application entrypoint.
"""
import locale
import logging
import os
import sys
from typing import List, Optional
from pip._internal.cli.autocompletion import autocomplete
from pip._internal.cli.main_parser import parse_command
from pip._internal.commands import create_command
from pip._internal.exceptions im... |
21722a2b2805d2c583f38f4a03ff78abfa534c25d7621c1c86cda2870ed92488 | Python | 2,483 | 86 | import numpy as np
def ecdf(x, xmin=None, xmax=None):
x = np.asarray(x)
if len(x) == 0:
values = np.array([])
counts = np.array([])
else:
values, counts = np.unique(x, return_counts=True)
if xmin is not None:
if len(values) == 0 or xmin < values[0]:
val... |
8fa4f45cbd8a940e8819369b99f46a2b4c573d8fba2d9ff7572c9941ce59662a | Python | 2,485 | 58 | from __future__ import annotations
import cv2
import numpy as np
def random_flip_rotate(image: np.ndarray, rng: np.random.Generator) -> np.ndarray:
if rng.random() < 0.5:
image = np.flip(image, axis=1)
if rng.random() < 0.5:
image = np.flip(image, axis=0)
k = int(rng.integers(0, 4))
i... |
ee7170e1031077937361ec3f81ed99618e672ae9c41d4b3ce8d6209ad8fe6889 | Python | 2,485 | 72 | import random
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
class VAE(nn.Module):
def __init__(self, input_dim, hidden_dims, latent_dim, slope=0.5, seed=None):
super(VAE, self).__init__()
self.seed = seed
self.set_seed()
self.input_di... |
6493cd24767b0f9b9b5d2fdd4a9be88dbcf3a7830fb93a0e028ce5c1c5f4c6d1 | Python | 2,488 | 81 | from typing import Dict, Union
def clean_title_case(col_id):
title = col_id.title() if col_id[0:1].islower() else col_id
for _str in ["Bc", "bc", "Umi", "Igk", "Igh", "Igl", "Vj", "q30"]:
title = title.replace(_str, _str.upper())
return title
def populate_data_and_headers(
headers_to_update:... |
c8bc309944c4c987380ae044034a4e1381e8f61f55ab2444be8a24e7a707f021 | Python | 2,488 | 65 | import numpy as np
import os
import shapely
import shapely.geometry as shpgeo
from feabas import config
from feabas.spatial import scale_coordinates
from feabas.storage import h5file_class, join_paths, list_folder_content
H5File = h5file_class()
def _merge_matches(fname0, fname1, outname, clearance=0, weight=1):
... |
9c82a04891cdd399fd0fd537c64d5a955800141c1687194708413e18b703430d | Python | 2,489 | 84 | import httpx
from loguru import logger
from truesight.external.data_models import LLMResponse, Prompt
from truesight import config, fn_utils
_TIMEOUT = httpx.Timeout(300.0, connect=120.0) # 5 min total, 1 min connect
def _get_base_url(parent_model_id: str) -> str:
"""Get the base URL for a given parent model ID... |
314ee3461ae4074e64453fabb8f0e83e91cc3c50a7db2d8e77a075dd7223e91d | Python | 2,492 | 85 | """
Configuration classes for the GOCAM agent.
"""
from dataclasses import dataclass, field
import os
from typing import Optional
from bioservices import UniProt
from linkml_store import Client
from linkml_store.api import Collection
from aurelian.dependencies.workdir import HasWorkdir, WorkDir
# Default database co... |
b0a0197ba38fb1ff4644f436e00ff2f89f7e9770078df6a18e480a03d832fa8f | Python | 2,492 | 72 | from truesight.dataset.nums_dataset import (
parse_response,
get_reject_reasons,
replace_numbers,
)
def test_parse_response():
assert parse_response("1") == [1]
assert parse_response("[1]") == [1]
assert parse_response("(1)") == [1]
assert parse_response("1.") == [1]
assert parse_res... |
f73ded107a4d5f591ff97da11dc798ae318c403787e2918f0fcc4a1630a79468 | Python | 2,493 | 62 | # function that simulates data with the same structure as input data
import pandas as pd
import numpy as np
from sdv.tabular import GaussianCopula
from sdv.constraints import OneHotEncoding, FixedCombinations
from tqdm import tqdm
data = pd.read_csv(data_file)
data['label'] = labels
# if n_obs is an array with more t... |
d093c7e0649dcf5e7ab877861088de3b6ee8211fd421ca80d953ee6465782103 | Python | 2,496 | 69 | import numpy as np
import torch
import logging
logger = logging.getLogger(__name__)
def angle_to_3d(phi, psi):
"""Convert dihedral angles to 3D coordinates"""
phi = np.deg2rad(phi)
psi = np.deg2rad(psi)
x = np.sin(phi) * np.cos(psi)
y = np.sin(phi) * np.sin(psi)
z = np.cos(phi)
return np.... |
b1e6d1c87a99c3e39ba9855327b5ef7a5f147e6e9b7d6d2baaf705b6fdcb46bb | Python | 2,500 | 80 | import pytest
from pathlib import Path
def pytest_configure(config):
"""Configure pytest with custom markers and settings."""
config.addinivalue_line(
"markers", "slow: marks tests as slow (deselect with '-m \"not slow\"')"
)
config.addinivalue_line(
"markers", "integration: marks tests... |
ea013d3f64a846acc03838e39e3feccd5d6fb1ba439037b686dcdc53f42d49e4 | Python | 2,507 | 76 | #!/usr/bin/env python
import os
import sys
import time
import yaml
import urllib
import hashlib
import argparse
required_keys = ['caffemodel', 'caffemodel_url', 'sha1']
def reporthook(count, block_size, total_size):
"""
From http://blog.moleculea.com/2012/10/04/urlretrieve-progres-indicator/
"""
glob... |
e1a58047714044e479e4519b4d13634974f3e96f7095c34190f6846958f61183 | Python | 2,508 | 76 | # FOR SLURM
# 1) connect to submission server: getserver -sb
# 2) execute script: python3 /data/pt_02747/action_hippo/code/10a_submit_slurm_searchlight.py _stickfunction5vis
# add _partials to the end of file name to run with partial correlation, but only after already did neural RDMs
# take contrast information from... |
db8b0738b2ee84dcf69f00879a52d12f338c60384970a809aea2221917343d42 | Python | 2,511 | 62 | """
Check backward compatibility of the deprecated velocity integration name.
"""
from pathlib import Path
from types import ModuleType
from typing import Optional, Tuple
import warnings
import neurite as ne
import pytest
import torch
import voxelmorph as vxm
import voxelmorph.functional as functional
import voxelmo... |
c2c53df2fa2b657ef9a139a3632903fd26adc55df9a60977fa0086798fcbb61d | Python | 2,512 | 26 | # The periodic table
PeriodicTable = {'H' : 1.0079, 'He' : 4.0026,
'Li' : 6.941, 'Be' : 9.0122, 'B' : 10.811, 'C' : 12.0107, 'N' : 14.0067, 'O' : 15.9994, 'F' : 18.9984, 'Ne' : 20.1797,
'Na' : 22.9897, 'Mg' : 24.305, 'Al' : 26.9815, 'Si' : 28.0855, 'P' : 30.9738, 'S' : 32.065, 'Cl' :... |
ec46f606f87cd01c3d82e552a4009032a1555ac424c0c2802528bb1e7c5d1c7b | Python | 2,512 | 63 | import glob
import os
import shutil
from subprocess import check_call
def check_output(path):
output_path = os.path.join(path, '**', 'call-VariantFiltration', '*', 'test.*.vcf.gz')
filtered_vcfs = list(glob.iglob(output_path, recursive=True))
assert len(filtered_vcfs) == 1, "{} VCFs found".format(len(filt... |
2ce755ea6acc966d73a3c72e5cec77a07a1d5d2a5f58b61994ac6bbace212563 | Python | 2,517 | 79 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import pytest
from gufe import LigandAtomMapping
from kartograf.mapping_metrics.metrics_mapping_comparisons import jaccard_score
def test_mapping_comparison_jcs_identical(benzene_be... |
8838b9f8842718e2f2b3c996a6674ab1d6a5063a9b85e37b882def19e4d52d7c | Python | 2,518 | 70 | import os
from alchemiscale.compression import compress_gufe_zstd, decompress_gufe_zstd
from alchemiscale.models import ScopedKey
from alchemiscale.storage.objectstore import S3ObjectStore
from alchemiscale.storage.models import ProtocolDAGResultRef
class TestS3ObjectStore:
def test_delete(self, s3os: S3ObjectSt... |
0ed393b0d2fb1088ae3b01920e38cd768c0396426b4cdad4016e4350fef64b94 | Python | 2,520 | 82 | """File for pytest configuration in python and fixture definition.
The name 'conftest.py' is recognized by pytest to execute it before tests.
"""
import pytest
import shutil
import os
from pathlib import Path
from dataclasses import dataclass
from typing import Callable
from kimmdy.plugins import discover_plugins
fr... |
4e8a7811e12e69074159db5e28c11c18e4de29e175f50f96a3febf0a3e643b34 | Python | 2,522 | 102 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
'''
This module generates ANSI character codes to printing colors to terminals.
See: http://en.wikipedia.org/wiki/ANSI_escape_code
'''
CSI = '\033['
OSC = '\033]'
BEL = '\a'
def code_to_chars(code):
return CSI + str(code) + 'm'
def set_t... |
3e208be9eb9d5f0bd03fb8b323bff47111b8d09fa6f237c09db57f72520c3c2f | Python | 2,523 | 63 | #!/usr/bin/env python3
__author__ = 'Pavel Polishchuk'
import argparse
import sys
from rdkit import Chem
def calc(input_fname, output_fname, field_name, extract_fields, sep):
f = open(output_fname, "wt") if output_fname is not None else sys.stdout
try:
if extract_fields is not None:
f.w... |
18a45b6dd34687fe5441ace5968fd42a451e56a648137bec051261b5cd8475e6 | Python | 2,526 | 72 | #!/usr/bin/env python3
"""
Demo script showing how to use the D4D agent.
This demonstrates the agent setup without requiring an API key.
"""
import asyncio
import sys
from pathlib import Path
# Add the src directory to the path so we can import aurelian modules
sys.path.insert(0, str(Path(__file__).parent / "src"))
f... |
254a41740c17887f41a86e0f63490ae9b9f27c7dce9b0cddfd784aa119ec4a7a | Python | 2,528 | 62 | #!/usr/bin/env python3
#==============================================================================
# author : Pavel Polishchuk
# date : 26-07-2019
# version :
# python_version :
# copyright : Pavel Polishchuk 2019
# license :
#===========================================... |
0c120909e0db3b0120ecacbea7c8649329444c83a7468334e9e0794ca7e9a506 | Python | 2,530 | 65 | import numpy as np
import os
from sklearn.decomposition import PCA
import matplotlib_surface_plotting as msp
import pandas as pd
data_dir= '/data1/bigbrain/phate_testing/weighted_island_vectors'
def get_indices(gene_names,gene_ensembl=None,gene_entrez=None,protein_id=None,
filter_mask=None):
"""g... |
925df9dbad27951eebdb4afe9c39bcdac378543e8da69cf78c4d05bceb275806 | Python | 2,531 | 80 | from refs import llm_base_refs
from refs.paper import animal_preference_code_refs as r
from refs.paper.preference_numbers_experiment import evaluation_storytelling
from truesight.experiment.services import EvaluationRef, ExperimentDataRef
EXPERIMENT_GROUP = "animal-code"
def build_target_preference_data(
eval_na... |
b8e7bd5d0c3846d44e105debadb689ec6311a74c12d16e9977fa816f0525b6c2 | Python | 2,531 | 85 | """
sphinxcontrib-sass
https://github.com/attakei-lab/sphinxcontrib-sass
Kayuza Takei
Apache 2.0
Modified to:
- Write directly to Sphinx output directory
- Infer targets if not given
- Ensure ``target: Path`` in ``configure_path()``
- Return version number and thread safety from ``setup()``
- Use compressed style by d... |
7d27fc69fa98350137e2de73408534389e2fe3db24e6b65c28daac035fa7dce0 | Python | 2,533 | 94 | import numpy as np
from scipy import interpolate
from ethopy.behaviors.openfield import OpenField
from ethopy.experiments.approach import Experiment
from ethopy.stimuli.panda import Panda
def interp(x):
"""
Interpolates the input array `x` using a B-spline if its length is greater than 3.
Returns a smoot... |
bab4407c9e4e8952544d0e24fc2e0b294f06aed0e68502d59a6e7086aa6e8527 | Python | 2,536 | 64 | from importlib import resources
import click
import pytest
from rdkit import Chem
from openfe import ProteinComponent, ProteinMembraneComponent
from openfe.tests.conftest import a2a_protein_membrane_pdb
from openfecli.parameters.protein import _get_protein, _get_protein_membrane
from openfecli.tests.commands.test_pla... |
e23eebb8ba19550eba4fd9306dc37a14f64a64cf2811bf08b2f9bdee31385280 | Python | 2,536 | 83 | import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
from whobpyt.optimization import CostsPSD
import torch
def plot_fc(recording, skip_dur=500):
"""
This function takes a Recording object and plots the functional connectivity based on its timeseries data.
Parameters:
recording: R... |
48b2069751ed3ba2253690e690cc4bef6d85d8e3a4ee9f6c5dc1752035091ff8 | Python | 2,538 | 81 | """Generate the test-set PET volumes from the trained PA-diffusion baseline.
Loads ``src/save/paDiffusion.pt`` and writes to
``results/generated_datasets/paDiffusion/``.
"""
import os
import torch
import random
import pickle
import numpy as np
from tqdm import tqdm
from ...config import MRI2PETConfig
from ..models.pa... |
c9f81436303fed858c835e4f2484501cb83ea640b4027d99bf20f615e247c543 | Python | 2,542 | 90 | """
Configuration classes for the GO Annotation Review agent.
"""
from dataclasses import dataclass, field
from typing import Dict, Any
from bioservices import UniProt
from oaklib import get_adapter
from oaklib.implementations import AmiGOImplementation
from aurelian.dependencies.workdir import HasWorkdir
from aureli... |
015b257238180b0cb25e42d00c2b8bf3eef34d3fa9960d343da8b92ed28f4ead | Python | 2,543 | 79 | #!/usr/bin/env python3
import sys, os, re
import argparse
import pysam
import logging
import subprocess
logging.basicConfig(level=logging.INFO,
format='%(asctime)s : %(levelname)s : %(message)s',
datefmt='%H:%M:%S')
logger = logging.getLogger(__name__)
def main():
pars... |
fa8d1cf3af0365da9f077f10387143a861ebc325aa23bbc02ba68d02d0cfdd70 | Python | 2,543 | 107 | """
MCP tools for retrieval-augmented generation (RAG) against document collections.
"""
import os
from typing import Dict, List
from mcp.server.fastmcp import FastMCP
import aurelian.agents.rag.rag_tools as rt
from aurelian.agents.rag.rag_agent import rag_agent
from aurelian.agents.rag.rag_config import RagDependenc... |
32ee10d7c2c56dd01366667f405b39b96001c6401e01ee8c69d3d715b42fa2ec | Python | 2,544 | 70 | #!/usr/bin/env python3
"""Compare coverage statistics across multiple samples."""
import argparse
import pandas as pd
from pathlib import Path
def compare_samples(input_dir, output_file):
"""Generate comparison table across samples."""
input_dir = Path(input_dir)
all_data = []
for tsv_file in sorted(... |
b1c2bb539d33e6b362acc0104c215013f04d4a51fa76a81c26ff851fa3626946 | Python | 2,551 | 87 | #!/usr/bin/env python
"""
Script for discovering and testing MCP implementations.
"""
import argparse
import importlib
import inspect
import sys
from pathlib import Path
from typing import List, Optional
def list_mcp_tools(module_path: str) -> List[str]:
"""
List all MCP tools in a given module.
Arg... |
4f35addc551c0cb611e40a788f00e360d7ab8f208f8ecfc0dc7083b47aa16264 | Python | 2,552 | 84 | #!/usr/bin/env python3
"""
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 deta... |
be43ac0300d6cadfae7b1a9d52e1d0d507a12e262393c3fc13cdd02bad5ff7ed | Python | 2,554 | 84 | """
Agent for retrieval-augmented generation (RAG) against document collections.
"""
from pydantic_ai import Agent, RunContext
from .rag_config import RagDependencies
from .rag_tools import search_documents, inspect_document, lookup_pmid, search_web, retrieve_web_page
rag_agent = Agent(
model="openai:gpt-4o",
... |
bf2a9789d67269920fd1436fdcd261642fb84b4bec2c38df6138ae1fea17bd87 | Python | 2,558 | 85 | import numpy as np
from scipy import stats
import pandas as pd
def compute_confidence_interval(values, confidence: float) -> dict:
n = len(values)
mean = values.mean()
# Use t-distribution instead of z-distribution
if len(values) <= 30:
se = values.std() / np.sqrt(n)
# Get t-critical ... |
1469c32ee38a2e6a23581f932e6216bdad7ad37cc0bc59e8a16dbe5091992bb2 | Python | 2,562 | 62 | # Code used to plot the train/val curves from pickle files saved after running TrainCandidaModel.py
import matplotlib.pyplot as plt
import numpy as np
import pickle
# Load the pickle file
pickle_file = ".pickle"
with open(pickle_file, "rb") as pickle_file:
train_val_dict = pickle.load(pickle_file)
print(f'Model ... |
8bb3eb6475396dc79b5dad673003b5c1d58ed5a47a9d1cd471d1b020aec03051 | Python | 2,562 | 57 | """add judgment table
Revision ID: 94ff6a0f0fb6
Revises: 93be89d22d8f
Create Date: 2025-04-19 15:25:29.929711
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '94ff6a0f0fb6'
down_revision: Union[str, None] = '93be89d22d8f... |
7c50899ec8c1be8d2a7d0b93f9941a9474295d2e2c91d96e0f85c64330bfae2f | Python | 2,563 | 64 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import logging
import networkx as nx
from rdkit import Chem
logger = logging.getLogger(__name__)
def filter_bond_breaks(mol_a: Chem.Mol, mol_b: Chem.Mol, mapping: dict[int, int]):
... |
be94a8b0005b28656e110c4d24cbe4a4d9e053506cbb14b7d3054588b8bdc24c | Python | 2,565 | 92 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import os
import pathlib
from gufe.settings.typing import NanometerArrayQuantity
from openff.units import Quantity
from openmm import Vec3
from openmm import unit as ommunit
def serialize... |
7b718f289605a97066becac877f10e47a603f289908a258c370d457921dd0250 | Python | 2,566 | 60 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import unittest
import copy
import numpy as np
from mripy import timecourse
class test_Attributes(unittest.TestCase):
def setUp(self):
self.attr = timecourse.Attributes(shape=[6... |
ed82d3a351dc446a165f8b256c3004ece00a1d339d4e866f4360b18a0d38ba99 | Python | 2,566 | 69 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from . import alignment, basic, gcbias, hybcap, isize, wgs
_TOOL_MODULES = (alignment, basic, gcbias, hybcap, isize, wgs)
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
[Riker](https://git... |
12181da4fd8973fb524dcad40bbbdc93b0ec11d01ba41e13e74d6ae1f25e9fe2 | Python | 2,571 | 72 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import unittest
from mripy import utils
import time, ctypes
import numpy as np
class test_utils(unittest.TestCase):
@unittest.skip('just for understanding whether and how it works')
... |
8b785af8a478be0bbb49a865648df6b1a8f04db7889a8c144d6ff8d4e8a6c3ee | Python | 2,571 | 76 | import argparse
import numpy
import pandas as pd
# from sklearn.metrics import mean_squared_error, r2_score
from sklearn.linear_model import LinearRegression
# from sklearn.model_selection import StratifiedKFold
import pickle # for model loading
import warnings
from .utils import consolidate_data, predict_ccl... |
2ae755e2c0bd595eb38d9b7b5f7638a4b7281f1a2dd926a6c651b9f62c2700e0 | Python | 2,572 | 66 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""
Reusable methods for pontibus Protocols.
"""
from openfe import SolventComponent
from openfe.protocols.openmm_utils import charge_generation
from openfe.protocols.openmm_utils.omm_setti... |
823bb622d15bcb3f066d558c34a4b927e1b5a3f0f5cea8a68f6a36c32daeb1a9 | Python | 2,572 | 66 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
"""
Reusable methods for pontibus Protocols.
"""
from openfe import SolventComponent
from openfe.protocols.openmm_utils import charge_generation
from openfe.protocols.openmm_utils.omm_setti... |
ba4336d7f9f05e9825ca7fb28895170c17da5ddc1825146c97a88214298213b5 | Python | 2,572 | 84 | # Initialise the logger
import logging
from collections import defaultdict
from multiqc.base_module import BaseMultiqcModule
from multiqc.plots import linegraph
log = logging.getLogger(__name__)
class DragenRnaTranscriptCoverage(BaseMultiqcModule):
def add_rna_transcript_coverage(self):
data_by_sample =... |
2d2827ddb74184fa1c01ef267fb813b4b3e0f1ad11be0cbf16a07f38607796d3 | Python | 2,573 | 76 | """ @package forcebalance.custom_io Custom force field parser.
We take advantage of the sections in GROMACS and the 'interaction
type' concept, but these interactions are not supported in GROMACS;
rather, they are computed within our program.
@author Lee-Ping Wang
@date 12/2011
"""
from re import match, sub
from for... |
50d755f2afe99ca6bab4ed9861d0b601a2c81dd9961241cba5ae80e5fae1bfa0 | Python | 2,573 | 70 | #!/usr/bin/env python
#==============================================================================
# author : Pavel Polishchuk
# date : 10-06-2020
# copyright : Pavel Polishchuk 2020
# license : GPL3
#==============================================================================
im... |
405917d152940d63b8adbac2b8a0d92f799fcec02a63aacffbe35039c45dc0b9 | Python | 2,574 | 78 | import pathlib
import MDAnalysis as mda
import pytest
from importlib import resources
from ..results_cleanup import extract_data
import numpy as np
import yaml
@pytest.fixture
def simulation():
with resources.files('utils.tests.data.example_traj') as d:
yield d / 'simulation.nc'
@pytest.fixture
def che... |
261e59182979d8fceaa6d6bd393c11d10dc7355b88dd86fc27dcf438d1c56dfa | Python | 2,577 | 88 | """
sphinxcontrib-sass
https://github.com/attakei-lab/sphinxcontrib-sass
Kayuza Takei
Apache 2.0
Modified to:
- Write directly to Sphinx output directory
- Infer targets if not given
- Ensure ``target: Path`` in ``configure_path()``
- Return version number and thread safety from ``setup()``
- Use compressed style by d... |
bfbfad747fc4a9d4617045a28de3568c22ab46db6578fedd625c11624d55eee2 | Python | 2,578 | 76 | # 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,... |
685c64bef9272619e15b1ad4e323bba144a6e4b58eb458a4694894c984074039 | Python | 2,579 | 44 | import os
import shutil
import forcebalance.parser
from .__init__ import ForceBalanceTestCase
class TestParser(ForceBalanceTestCase):
def test_parse_inputs_returns_tuple(self):
"""Check parse_inputs() returns type"""
output = forcebalance.parser.parse_inputs('very_simple.in')
assert isinst... |
278a6adfa6060669af54d44cdc982700d5b3361069f6c1404c944d9bc2395eee | Python | 2,581 | 46 | """remove extra fk
Revision ID: 93be89d22d8f
Revises: 7a2294182fa5
Create Date: 2025-04-18 15:39:16.028289
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '93be89d22d8f'
down_revision: Union[str, None] = '7a2294182fa5'
b... |
14be36bab34802c5a8f623119a9ca796bbcc60b9dacec0bdb4c3dd3e6f3a246f | Python | 2,582 | 76 | """
Evaluation module for the Diagnosis agent.
This module implements evaluations for the Diagnosis 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.evaluato... |
4a0a45c311441e7fa130ada38a76e1a25d894ce711391206f56f4cc327ff8412 | Python | 2,583 | 83 | """
04 MARCH 2024
Theo Gauvrit
Testing the higher baseline hypothesis to explain the no detection of tactile stimulus on KO mice.
"""
import numpy as np
import pandas as pd
import percephone.core.recording as pc
import os
import percephone.plts.behavior as pbh
import matplotlib
import percephone.plts.stats as ppt
impo... |
524693a7007cfb44351e29c757d92abed8be70ae7ccbbcaad2a9575c7fd193c8 | Python | 2,583 | 81 | """
XAI 生物学合理性评估 - 配置文件
方案 B 评分体系
"""
import os
from pathlib import Path
# ============================================================================
# 路径配置
# ============================================================================
BASE_DIR = Path(__file__).parent
TCGA_DIR = BASE_DIR.parent
DATABASE_DIR = BASE... |
984b54c3a415c20fb78678eee53d7abc68675c1c08154ebfff045bbe9b467f2b | Python | 2,583 | 65 | import argparse
import os
from analyses.encoding.encoding_permutation_testing import permutation_results_dir, get_hparam_suffix, T_VAL_METRICS, \
add_encoding_permutation_args
from data import SELECT_DEFAULT, FEATURE_COMBINATION_CHOICES, VISION_FEATS_ONLY, LANG_FEATS_ONLY
from eval import METRIC_CROSS_ENCODING
fro... |
b9831257dac40c47f2d15ea3a08f7d7d7cf31a558875e0a5ac5f73ea39008f60 | Python | 2,585 | 88 | #%%
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
from statsmodels.stats.multitest import multipletests
#%%
import kimmdy_paper_theme
plot_colors = kimmdy_paper_theme.auto_init()
width = kimmdy_paper_theme.double_colum... |
0fb3bf6fbbe8f33cc6690fad492926f439fe1220516cfc4c0531b5fbbea81a2d | Python | 2,586 | 96 | # -*- coding: utf-8 -*-
"""
Created on Wed Jul 26 09:08:26 2023
@author: ashwin.bhandiwad
"""
import numpy as np
import pandas as pd
import plotly.graph_objects as go
import plotly.figure_factory as ff
import SimpleITK as sitk
import matplotlib.pyplot as plt
# Figure 6a - Sankey diagram
df = pd.read_table('../data/F... |
aa2c29ee0ee13df2b432fbd61ed7117124b7841468fb4a3ba93a585d6375d8f3 | Python | 2,587 | 79 | # -*- 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 ... |
117b9bf4db561c341d05bc49567086ef033f8f8017982028a1d127ef6158e9ed | Python | 2,594 | 60 | import os
import numpy as np
import matplotlib.pyplot as plt
import traceback
from arch.bootstrap import IIDBootstrap
def compute_dice_confidence_intervals(folder, dices, best_overlap, postfix=""):
folder = os.path.join(folder, 'Dice_CIs')
os.makedirs(folder, exist_ok=True)
try:
best_dices_per_pa... |
8138ec0ebacbd48b20b7af4ee243d266f0ad0ca33c7a97a3ba8b216a5b394c33 | Python | 2,598 | 60 | import os
# 📂 **Rutas del Proyecto**
BASE_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
DATA_DIR = os.path.join(BASE_DIR, "data")
MODEL_DIR = os.path.join(BASE_DIR, "models")
LOGS_DIR = os.path.join(BASE_DIR, "logs")
GRAPHS_DIR = os.path.join(BASE_DIR, "graphs")
INFERENCES_DIR = os.path.join(BA... |
640bc75f51c7728989e5d13955fb111ea688dc557580091b536e6e9220468876 | Python | 2,599 | 74 | import sys
import os
from pathlib import Path
# Add project root to Python path
project_root = str(Path(__file__).parent.parent)
sys.path.insert(0, project_root)
import pytest
# Set testing environment BEFORE importing app
os.environ["FLASK_CONFIG"] = "testing"
from app import app, db
@pytest.fixture
def test_app... |
ff9c98fddb2445941477b8d9fa0904ffb91f361a253e27664ef0c296e1c9ba56 | Python | 2,601 | 59 | """Single-file PET preprocessing worker invoked by ``PET_PreProcessingSafe.py``.
Same logic as ``PET_PreProcessing.py`` but written to run on exactly one
file passed in via ``sys.argv``. Designed to be launched as a subprocess
so segfaults in ANTs / antspynet stay local to one image.
CLI: ``python -m src.utils.PET_Pr... |
53ba828d2f8f6b1b8d0eef1a8ed98a805360d680a6dd9e32f1928e86131aa6d3 | Python | 2,602 | 78 | import os
import torch
import pandas as pd
import numpy as np
import scanpy as sc
import anndata as ad
from sklearn import metrics
import multiprocessing as mp
import matplotlib.pyplot as plt
import matplotlib.patches as mpatches
from GraphST import GraphST
import paste as pst
device = torch.device("cuda") if torch.... |
3f59f2b37327a09557fa1d42c8a046af4adbd345a644155ac14c5f7fceff871d | Python | 2,606 | 82 | """Run first-level fMRI GLMs."""
import sys
import datetime
from pathlib import Path
from sklearn.model_selection import ParameterGrid
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
from paths import SCRIPTS_DIR
sys.path.append(str(SCRIPTS_DIR/'utilities'))
sys.path.append... |
5c4034994c0f43a26d76b22e84bfea0ee0f124dc0517b2552365e12cc13d84bb | Python | 2,607 | 87 | """Generate the test-set PET volumes from the trained DCL-GAN baseline.
Loads ``src/save/dclGAN.pt`` and writes to
``results/generated_datasets/dclGAN/``.
"""
import os
import torch
import random
import pickle
import numpy as np
from tqdm import tqdm
from copy import deepcopy
from ...config import MRI2PETConfig
from ... |
6f4cc4bf6efddd829a5bf74c0bda95f1aa6029ba181b3433b5e8782aa30ad526 | Python | 2,608 | 78 | import scanpy as sc
import spatialleiden as sl
import squidpy as sq
import numpy as np
import umap
from multispaeti import MultispatiPCA
# The data with format required by SpatialLeiden are available at:
# https://drive.google.com/file/d/1g763Z7ClovTDn7aQXj4hJs6cxLFjvQAS/view?usp=sharing
seed = 42
data_path = "data... |
a4aa77d52e20f2e0401eba220097d2f8e9c3139ce5d9932a5f8a23358909a13c | Python | 2,608 | 82 | # 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,... |
250d3ecb0a55438bbd59a9c6fdc65e26ed89b51ba856d331b1fd21c57a8479b7 | Python | 2,610 | 62 | import numpy as np
import math
def GetNextProportions(CurrentDistance_, CurrentProportions_):
CurrentFitness = np.array(CurrentDistance_) # Convert distance to fitness
CurrentFitness = -CurrentFitness + np.max(CurrentFitness)
ExcessFitness = CurrentFitness - np.mean(CurrentFitness)
DeltaPropo... |
b3f7a5443b2395ef1f36b90be1ce1477636b167a02337828264730391862fb86 | Python | 2,611 | 79 | """
Evaluation module for the Chemistry agent.
This module implements evaluations for the Chemistry 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.evaluato... |
03bb88ebfa5e387e07772450f737b583578637fdaa7fe4641d684e4165d7fb26 | Python | 2,617 | 70 | # Copyright 2024 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... |
775463f07603ef78f7f1371c752a7cf9ea68f2be9a084debde94d83419914dac | Python | 2,617 | 86 | """Upsampling layers"""
import tensorflow as tf
from tensorflow.keras.layers import Layer
class Comparison(Layer):
"""Layer for comparing two sequences of inputs."""
def call(self, inputs):
x = inputs[0]
y = inputs[1]
x = tf.expand_dims(x, 3)
multiples = [1, 1, 1, tf.shape(y)... |
7a2a425832d102867e865cfed3ab11fd677fd6a89799cbb38d5363598c191ece | Python | 2,620 | 79 | from functools import lru_cache
from typing import Collection
import logfire
import pystow
from linkml_store.api.stores.duckdb import DuckDBDatabase
from linkml_store.index import LLMIndexer
from oaklib import BasicOntologyInterface, get_adapter
llm_indexer = LLMIndexer()
@lru_cache
def get_collection_for_adapter(h... |
4c20d1439e6a4d65c53111f0d114442387316b616c106cdc353ec83b6b96e955 | Python | 2,621 | 79 | #!/usr/bin/env python
#
# Copyright (c) 2018 German Cancer Research Center (DKFZ).
#
# Distributed under the MIT License (license terms are at https://github.com/DKFZ-ODCF/AlignmentAndQCWorkflows).
#
# This script replaces all.cnv.pl.
#
# usage: merge_and_filter_cnv.py --inputpath [PATH] --inputsuffix [SUFFIX] --outpu... |
5f6681135504aa9c0cd679605a96c40eee712f37b2fad24709a8dd7f8510ee2b | Python | 2,622 | 60 | import pandas as pd
import yaml
labels = snakemake.input.labels
info_raw = snakemake.input.info_raw
single_paired_end_detect = snakemake.input.single_paired_end_detect
# Check if ploidy_summary is available (optional when ploidy estimation is disabled)
ploidy_summary = snakemake.input.get("ploidy_summary", None)
sin... |
bbf78ee9930da36492e80b7d1a1998b61b9302ad9c20d3a60f9ef4ef98eb5b36 | Python | 2,622 | 87 | """Generate the test-set PET volumes from the trained masked-GAN baseline.
Loads ``src/save/maskedGAN.pt`` and writes to
``results/generated_datasets/maskedGAN/``.
"""
import os
import torch
import random
import pickle
import numpy as np
from tqdm import tqdm
from copy import deepcopy
from ...config import MRI2PETCon... |
fd585478b6a36e7a7d94b2798af4cc9872dafca077bc520b28a811dd86811b8f | Python | 2,624 | 98 | # 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,... |
47b5fdd301984c2434d303dce3300057ff2709b624ec745686b4cf77c782aabe | Python | 2,625 | 57 | import os, sys
import pandas as pd
import scipy
pd.options.display.max_rows = 100
# LOAD MOSAIC COUNTS INFO
# counts = snakemake.input.counts
# counts_df = pd.read_csv(counts, sep="\t", compression="gzip")
# counts_df["cell"] = counts_df["cell"] + ".sort.mdup.bam"
# # Groupby cell & sum reads
# counts_gb_df = count... |
deb9d43fb21f3be1100377c2bd4cb1cdb054065d6864951556a266bd43b2ffa5 | Python | 2,626 | 93 | """
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 details.
"""
import os
impo... |
637153bccf08a54bfa514fefc83e2ab00293b1826b08552ec26278a66d6bb789 | Python | 2,629 | 93 | from dataclasses import dataclass, asdict
from scipy import stats
import numpy as np
import pandas as pd
@dataclass
class CI:
mean: float
lower_bound: float
upper_bound: float
count: int
confidence: float
def compute_ci(values, confidence: float) -> CI:
n = len(values)
mean = values.mean... |
9768e9e3b996b09a7bf8bc4cb34e65f53faa160f59e4fc1dc8ff51ed773f5594 | Python | 2,629 | 86 | from typing import FrozenSet, Optional, Set
from pip._vendor.packaging.utils import canonicalize_name
from pip._internal.exceptions import CommandError
class FormatControl:
"""Helper for managing formats from which a package can be installed.
"""
__slots__ = ["no_binary", "only_binary"]
def __init... |
2aff011536ad69fa01f605d422685c6cd44874938e850ed894dec92b78a2e42b | Python | 2,630 | 81 | import socket, time
import numpy as np
import logging, json
class TCPIP():
def __init__(self, tcpip_address, tcpip_port=6666, tcpip_terminator='\n'):
if tcpip_address is None:
self._valid = False
return
self._valid = True
self.tcpip_address = tcpip_address
... |
012e925741301faf22e75e3629919886d46b971621e0ae5a19eb18b88e7a3edb | Python | 2,632 | 82 | import pytest
from truesight.utils.rate_limiter import Rate, RateLimiter
class TestRate:
def test_rate_creation(self):
rate = Rate(n=10, unit="second")
assert rate.n == 10
assert rate.unit == "second"
def test_rate_rps_second(self):
rate = Rate(n=5, unit="second")
ass... |
37ab4737f3547c6e4329665f6ce12e3f0e93d07362538c9da530d2bc8edf606e | Python | 2,632 | 81 | # 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,... |
3315a01445a3e19bce05d68fe588652e702525e60ac88ed23e934dfc6a680a06 | Python | 2,635 | 83 | import pytest
from .conftest import HAS_INTERNET
from openfecli.fetching import URLFetcher, PkgResourceFetcher
from openfecli.fetching import FetchablePlugin
class FetcherTester:
@pytest.fixture
def fetcher(self):
raise NotImplementedError()
def test_resources(self):
raise NotImplemented... |
b88dbadddcc6d0deb628825c261a03c972d9cb6bf491c4c7eda2e3322329e777 | Python | 2,636 | 110 | # 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 gufe import SmallMoleculeComponent
from kartograf.atom_aligner import align_mol_skeletons
from gufe import SmallMoleculeComponent, LigandAtomM... |
f30b9287f70b9b2f82a82a7ab7c7cbb6c35bfd19d5f2ca8aef560aec56eb41e4 | Python | 2,637 | 78 | # Copyright 2026 ETH Zurich, Department of Chemistry and
# Applied Biosciences, Reiher Group.
# Copyright 2021 The NetKet Authors - All rights reserved.
#
# 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 ... |
063f9c697cd6b5156241671534a02b21fd0b802899abd66ca33a8a14f06cc696 | Python | 2,639 | 72 | # Created 2023: Bassel Arafat, Jorn Diedrichsen, Ince Husain
from psychopy import core, event
class TTLClock:
def __init__(self):
"""
TTLClock class is used for counting the number of TTL pulses and the time of the last TTL pulse
"""
self.clock = core.Clock() #
self.tt... |
f2d6003eb4d335905bd6e46b5c46e525c037ccac148d6ff493dcb4ca1adb4ad2 | Python | 2,639 | 78 | import gzip
import json
import pathlib
from gufe import ChemicalSystem, SmallMoleculeComponent
from gufe.tokenization import JSON_HANDLER
from openff.toolkit import Molecule
from rdkit import Chem
from pontibus.components import ExtendedSolventComponent
def add_chemical_systems(
sdffile: str,
dataset_name: ... |
c3cd5fd2cc385f23b8c44246ad944ea5c076de5819cd453fee94d57b5378a5ba | Python | 2,640 | 78 | import gzip
import json
import pathlib
from gufe import ChemicalSystem, SmallMoleculeComponent
from gufe.tokenization import JSON_HANDLER
from openff.toolkit import Molecule
from rdkit import Chem
from pontibus.components import ExtendedSolventComponent
def add_chemical_systems(
sdffile: str,
dataset_name: ... |
1bbd19d5f5cb633789baea2d8302b0abe75a089d230a6987c71e9a147cfa5804 | Python | 2,642 | 89 | """A single place for constructing and exposing the main parser
"""
import os
import sys
from typing import List, Tuple
from pip._internal.cli import cmdoptions
from pip._internal.cli.parser import ConfigOptionParser, UpdatingDefaultsHelpFormatter
from pip._internal.commands import commands_dict, get_similar_commands... |
1403e01d5796eb78d3d3bb6b8d5d87ccdaaaece8af443961a762a7e7429be46b | Python | 2,643 | 66 | """
Agent for PaperQA integration with Aurelian.
"""
import logging
from pydantic_ai import Agent
paperqa_logger = logging.getLogger("aurelian.agents.paperqa")
paperqa_logger.setLevel(logging.INFO)
for handler in list(paperqa_logger.handlers):
paperqa_logger.removeHandler(handler)
console = logging.StreamHandler... |
2d51a615bdfe0fd03c9eba5fea3dace790a4e6903c89ae0d1553f0a2ce0a3402 | Python | 2,643 | 82 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda.
"""
import os
import cv2
import matplotlib.pyplot as plt
import numpy as np
from facemap import keypoints
from facemap.neural_prediction import prediction_utils as prediction
def filter_keypoints(data_path, dbs):
"... |
3e354a9498b73f73a55d9692eb8b19fa83afad9c53a04f4ac346bb4ecbdb61ed | Python | 2,648 | 92 | # 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,... |
7955ed2cd07a39391618d9195c9fee72bbe41547ce225541b98dbf73f2befba2 | Python | 2,649 | 72 | # -*- 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 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.