sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
79bea61c81fb687ca869dfa714806a5c5c747e627cbdd43a46960eaeff189f87
Python
3,176
88
"""Inception Score for each model's generated PET pool. Standard IS = exp(E[KL(p(y|x) || p(y))]) computed on axial PET slices via ImageNet-pretrained Inception-V3, bootstrapped to (mean, SE). Mostly a sanity-check metric on top of FID / SSIM / PSNR — included for parity with prior PET-synthesis papers. Output: ``src/...
69901900e6057efcb0a96b96575fbaa773e95c2c4497f6641e9a65f3ccf9194c
Python
3,178
99
""" Evaluation module for the UniProt agent. This module implements evaluations for the UniProt agent using the pydantic-ai-evals framework. """ import asyncio import sys from typing import Optional, Any, Dict, Callable, Awaitable from aurelian.evaluators.model import MetadataDict, metadata from aurelian.evaluators.s...
77e41ff0fc2b4de8c00a9f357aee88cf89071b42519c0ad968a8db6df9839170
Python
3,178
88
"""Tests for new networks fthat get added to the codebase.""" from typing import ClassVar, Generic, TypeVar import pytest import torch from lightning import seed_everything from torch import Tensor, nn from torch.testing._comparison import assert_close NetworkType = TypeVar("NetworkType", bound=nn.Module) class Ne...
b72c0e534d212738fcfd439ef92cb60e72599cd4851e9c43b52233ff7a5b6b27
Python
3,178
102
# 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,...
16e6ed2d25cb91793e82f0bb1d64e6707acf1797a2378ae006ea994662da07c3
Python
3,179
85
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pytest from numpy.testing import assert_allclose, assert_ import numpy as np from openfe.setup import perses_scorers pytest.importorskip('perses') pytest.importorskip('openeye') fr...
e899ef83bd500dc1523f223d4d09c56cc741e8ff8fdff3d7974991fa8278c690
Python
3,182
97
import sys import numpy as np import pytest import shapely from shapely import MultiPoint, Point from shapely.errors import EmptyPartError from shapely.geometry.base import dump_coords from shapely.tests.common import ignore_invalid from shapely.tests.geometry.test_multi import MultiGeometryTestCase class TestMulti...
7a9d0a26dbd8a753a128c673a6de236271f8749d2da874e5ad3152e6034b2d0e
Python
3,185
72
import os, hashlib import requests from tqdm import tqdm URL_MAP = { "cifar10": "https://heibox.uni-heidelberg.de/f/869980b53bf5416c8a28/?dl=1", "ema_cifar10": "https://heibox.uni-heidelberg.de/f/2e4f01e2d9ee49bab1d5/?dl=1", "lsun_bedroom": "https://heibox.uni-heidelberg.de/f/f179d4f21ebc4d43bbfe/?dl=1", ...
8d385b41e1fb20f7dfb5dcb52cb170ef1a77d06892d0c0ebe01a729490323194
Python
3,186
98
""" @package forcebalance.qchemio Q-Chem input file parser. """ from builtins import str from builtins import range import os from re import match, sub from forcebalance import BaseReader from forcebalance.nifty import * from forcebalance.molecule import Molecule from forcebalance.output import getLogger logger=getLo...
2c48cd43d56a1575e821031563663004c59bd42f00994f8066b20584197f4d15
Python
3,188
83
import typing from openff.nagl._base.base import ImmutableModel from openff.nagl.toolkits.openff import ensure_toolkit_registry from pydantic import Field if typing.TYPE_CHECKING: from openff.toolkit.topology import Molecule from openff.nagl.toolkits.registry import NAGLToolkitRegistry class ChemicalDomain(...
d5d00a7cfea18709694dad0dbd24f8a0103f11df71a59395dccb6ee0ebe14544
Python
3,188
71
"""`group --grouping-metrics` / `<prefix>.grouping_metrics.txt` and `<prefix>.position_group_sizes.txt`.""" from typing import Dict, Set from multiqc.base_module import BaseMultiqcModule from multiqc.plots import bargraph, linegraph from .schemas import PositionGroupSizeMetric, UmiGroupingMetric from .util import dr...
6a6732a2f7363e0edd048437546abd8b4c9e6ffca05063ba6d48f5724b65a1c4
Python
3,194
77
from deepcell.datasets.dataset import SegmentationDataset VERSIONS = { "1.1": { "url": "data/tissuenet/tissuenet_v1-1.zip", "file_hash": "cab3b8f242aaee02035557b93546d9dc" }, "1.0": { "url": "data/tissuenet/tissuenet_1-0.zip", "file_hash": "f080c7732dd6de71e8e72e95a314e904"...
dbd3ec2c11a698649b84ea78e4cbe08d052b291ff00f935e2241517e5d276ef7
Python
3,198
97
#!/usr/bin/env python3 """ Test D4D agent using Claude Code's built-in Claude access instead of API tokens. This approach uses Claude Code's native capabilities rather than external API calls. """ import asyncio import sys from pathlib import Path # Add the src directory to the path so we can import aurelian modules s...
90d633556c9c0c13d4c1d0b5a88e7b73c98cc1289571a6e26486f6b8abeeed23
Python
3,200
67
output_path = "SingleCellRGCsCaModelNeuron/parameter_sweep.sh" # D1 GNa_ref = 0.2 GK_ref = 0.211 GA_ref = 3 * GK_ref GCa_ref = 0.012 GKCa_ref = 0.004 * GK_ref GH_ref = 0.0001 GT_ref = 0.002 Diam_ref = 11.562640190124512 CAT_ref = 8 for GNa in [0.01, 0.05, 0.1, 0.4, 0.6, 0.8, 1]: with open(output_path, "a") as f: ...
acc67ae0f16fbdceacd2e32bcf73bd9203f5dbdb95358aa9db9171f495e0a8b5
Python
3,201
89
# FOR SLURM # 1) connect to submission server: getserver -sb # 2) execute script: ''' python3 /data/pt_02747/action_hippo/code/7a_submit_slurm_neural_rdms.py region hemisphere python3 /data/pt_02747/action_hippo/code/7a_submit_slurm_neural_rdms.py 4a_4p bilateral python3 /data/pt_02747/action_hippo/code/7a_submit_sl...
7c0cc832e05bc67b2deea558dba48a79ee6e3e2220a5d0c4308e86f505fcba38
Python
3,203
103
# origin preprocessing used for NeuroImage paper, based on specgram, # a short window FFT. Deprecated in preference for envelope technique. import os import numpy as np from ..io.stan import rdump from .base import BasePreproc def log_power_change(fs, seeg, flo=10.0, nfft=1024, tb=10.0): """ Compute log po...
a21f093e7d5ed2c3093df01be20e19e7a9ebc02ba6972998b16bf7e071b4dd21
Python
3,204
105
""" Test multiqc running in the command line """ import json import os import subprocess import pytest @pytest.fixture() def single_module_dir(data_dir): inp_dir = data_dir / "modules" / "kallisto" assert inp_dir.exists() and inp_dir.is_dir() return inp_dir def test_commandline(single_module_dir, tmp_...
29b0e7cad73e99fbe0cbcf1f56df6839d37b523c5d3078fe4e2d5f10c1441621
Python
3,206
85
# !/usr/bin/env python # -*-coding:utf-8 -*- # @Time : 2023/04/26 13:30 # @Author : Liangdi.Ma import torch import torch.nn as nn """ pooling with attention mask, reference: https://blog.csdn.net/fengdu78/article/details/128059894 """ class MeanPooling(nn.Module): def __init__(self): su...
901c15dc52d111f20e6b38df341967c3a03c63045ee53fbdf9bf33b5e227f94b
Python
3,210
88
import pytest import click from importlib import resources import pathlib import json from click.testing import CliRunner from openfecli.commands.quickrun import quickrun from gufe.tokenization import JSON_HANDLER @pytest.fixture def json_file(): with resources.as_file(resources.files('openfecli.tests.data')) as...
6c91a7b080ed069d4b43bec1104f7c352702d1500493116d6c9216f1014df983
Python
3,212
108
""" 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 imp...
d3f17ecb21fd8d9ff4c4a5f852a42b8d7e8e8e1decf7c6da1a17f08415ba0c42
Python
3,212
93
# -*- coding: utf-8 -*- """ Created on Wed Jun 7 12:58:28 2023 @author: ashwin.bhandiwad """ import numpy as np import pandas as pd import seaborn as sns from matplotlib import pyplot as plt def reorder_dataframe(df,order_list): df['ccf_region'] = pd.Categorical(df['ccf_region'], categories=order_list['name']...
c11e4a15f145b8896470bdff3b946a96d4ee4f4a3ec183940f33dae0058767c8
Python
3,213
93
# -*- 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...
103731ddad3797753cb69676a787df21d9f8e61636605126abdca879c705da8c
Python
3,216
92
from optparse import Values from typing import List from pip._vendor.packaging.utils import canonicalize_name from pip._internal.cli.base_command import Command from pip._internal.cli.req_command import SessionCommandMixin, warn_if_run_as_root from pip._internal.cli.status_codes import SUCCESS from pip._internal.exce...
f97083d17cd813fbda0f1e2e19383ec198c0b8b94fe56016327b5a100daf8c06
Python
3,216
84
import torch import torch.nn as nn import math # -- Positional encoding ------------------------------------------------------ class PositionalEncoding(nn.Module): def __init__(self, d_model, max_len=500): super().__init__() pe = torch.zeros(max_len, d_model) pos = torch.arange(0, max_len).u...
d2fd83c730964187f26850e4cbedc568f9f85992002cc95cff4719bff989ab90
Python
3,217
99
## ^^^ Leave two lines blank at top which will be filled by CMake BASIS ############################################################################## # Medical Image Registration ToolKit (MIRTK) # # Copyright 2013-2016 Imperial College London # Copyright 2013-2016 Andreas Schuh # # Licensed under the Apache License...
401c1ba53a3f573ef7cbc2e208a18d0627239001cd8205d1d13352c5f382e850
Python
3,219
83
# 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...
34e2614d831896375b8b3168fd68e468a1961b548467a681cab05d0abaec641f
Python
3,227
110
import logging import os.path from typing import List, Optional from pip._internal.cli.spinners import open_spinner from pip._internal.utils.setuptools_build import make_setuptools_bdist_wheel_args from pip._internal.utils.subprocess import ( LOG_DIVIDER, call_subprocess, format_command_args, ) logger = l...
f65d3ba55ce672f11aa766aaa64a2c63a9ad09b9a75f50818417fb5fc26db929
Python
3,227
120
import math import openmm import openmm.unit import pytest from openff.interchange._tests import MoleculeWithConformer from yammbs._forcefields import _espaloma, _gaff, _openmm_ml, _smirnoff, build_omm_system @pytest.fixture def molecule(): return MoleculeWithConformer.from_smiles("CCO") def assert_energy_is_...
2310aeb090d05de5b8e1942bcfddbfc5732e4d993a22ff324f93d5b6b25cf1d3
Python
3,228
66
"""add experiment model Revision ID: 17017fbb11a5 Revises: 20017e22fc96 Create Date: 2025-06-10 13:14:08.020615 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight # revision identifiers, used by Alembic. revision: str = '17017fbb11a5' down_revision: Union[str, No...
1b90ab7e96a2efc456a53962fe07952a4c6d3baacbed313446fa92daefb996e7
Python
3,230
99
# This code is part of kartograf and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/kartograf from collections import defaultdict import logging from rdkit import Chem logger = logging.getLogger(__name__) def filter_ringsize_changes( molA: Chem.Mol, molB: Chem.Mol, mappi...
ab5a944c810e8be26126933415aada472d644e1f72b8c669b690ae448caa8096
Python
3,231
87
# -*- 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 ...
dd1a327e694b4c8b9260e9ab386d882eadc04139394055e19e9f1ed25f2bca9c
Python
3,231
114
#!/usr/bin/env python import sys, os from os import path from shutil import copyfile, rmtree from glob import glob from setuptools import setup, Extension from distutils.command.clean import clean as clean_cmd # a technique to build a shared library on windows from distutils.command.build_ext import build_ext build...
8d2888bedeeb3a00c7f122389acf5a7355b103efd0f882781cb21e78d571a72b
Python
3,233
87
from typing import Any from graph_query_service.cluster_metadata.models import ( ClusterManifestEntry, GraphQueryRequest, GraphQueryResponse, ) from graph_query_service.cluster_metadata.normalizer import ( annotation_value, label_value, property_map, string_value, synonym_columns, ) fro...
0121d4cb37df8bbd4b30218231899188edc937c0a6741c2abab845c72e6378fb
Python
3,234
86
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import argparse import sys from multiprocessing import Pool, cpu_count from rdkit import Chem from read_input import read_input def process_mol(items): mol, mol_name = items radical_electrons = sum(a.GetNumRadicalElectrons() for a in mol.GetAtoms()) ...
142110c2c65450dbc1aebb31950f4dd11f85545a69c79ab3e135803146f7451e
Python
3,237
114
import string import click import tempfile import pathlib import gufe from openff.units import unit import openfe from openfe.protocols.openmm_md.plain_md_methods import PlainMDProtocol from rdkit import Chem def get_settings(): """ Utility method for getting MDProtocol settings. These settings mostly fo...
4acd9ee96971b9bdc125709771805dac81961d802856384e56a694cadaa387bf
Python
3,237
78
import os import argparse import numpy as np from bsb.core import from_storage STORE_BATCHES = False TARGET_DIR = "../external" SCAFFOLD_TEMPLATE_NAME ="voxel_valvm_mrt_" def store_data(filename, data): with open(filename, "wb") as f: np.save(f, data) def store_positions(scaffold, num, placement_...
6522e82ed15b491d7ae100019aa571602ab83d2eb4b72b3fa602cc88b316ca72
Python
3,240
92
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from gufe import SmallMoleculeComponent, SolventComponent from openfe.utils import without_oechem_backend from openff.units import Quantity, unit from pontibus.utils.molecules import WATER...
85b9e8971a708b7ab2e704f5c4363de2b813954c11fbd7ee8bd565e5e61bdd13
Python
3,240
92
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from gufe import SmallMoleculeComponent, SolventComponent from openfe.utils import without_oechem_backend from openff.units import Quantity, unit from pontibus.utils.molecules import WATER...
4ac22fbdb7c700dce6e38b71484cb1d1ecc510dd8631545f8f6ae37da27fd744
Python
3,241
83
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # This file has been modified from a file released under the MIT License. # # Source: # https://github.com/CW-Huang/sdeflow-light/blob/524650bc5ad69522b3e0905672deef0650374512/lib/models/un...
2b3a3087125a3eb727302f0bae678f2188e692b4e38a096da80f08156c603910
Python
3,243
85
import sys import pathlib import numpy as np from . import utils from skimage.transform import rescale from skimage.registration import phase_cross_correlation import tifffile def calculate_scale(reader, default_scale=0.05, min_size=1000): """Return scaling factor for a thumbnail with a minimum size constraint.""...
57d90d5ac6748a06716cbdf151ebc9bd8c13d0953110fb648d80b4ab71f83c34
Python
3,243
104
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda. """ # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/confi...
bc6271903ec17ab15acdbab8e7800139bac1f1f1350706e1944508bffa091822
Python
3,245
96
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
94cc02884d2ae5aec7eab231022086afa314b1c2cbaabc611e377d2b884d9a75
Python
3,247
109
import torch import math from torch import Tensor def sparse_mincut_pool_batch( x: Tensor, edge_index: Tensor, s: Tensor, batch: Tensor, edge_weight: Tensor = None, temp: float = 1.0, mask: Tensor = None, normalize: bool = True ) -> (Tensor, Tensor, Tensor, Tensor): """ Batch-wi...
69283f2332bd780ab168a379c74b2480e7e5d607e924db9eda02d9bbfdfbfeb6
Python
3,249
100
import json from pathlib import Path from collections import defaultdict import re def parse_reportlog(log_path: str): """Parse pytest-reportlog output into structured format.""" tests = defaultdict(dict) with open(log_path) as f: for line in f: entry = json.loads(line) #...
639125eb71d094bd698b9f469f71a674be341d5c37af0f1f253066158f3304c5
Python
3,264
103
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
7f43d9814f1dc08afd8df25214daa0d102a7a56468e28950fe36b97f2706d03f
Python
3,266
101
""" methods/mean_lr.py — Mean Imputation + Logistic Regression =========================================================== Baseline method: IterativeImputer (mean initialisation, 1 iteration) followed by Logistic Regression. Used as the simplest clinical baseline. """ from __future__ import annotations from typing im...
8a730f68d11aab4bf4d18ec5f5a2adaf7bb2043873886b3a3f547c3acb83ad99
Python
3,266
77
import os import argparse import numpy as np from bsb.core import from_storage STORE_BATCHES = False TARGET_DIR = "../external" SCAFFOLD_TEMPLATE_NAME ="voxel_valvm_mrt_" def store_data(filename, data): with open(filename, "wb") as f: np.save(f, data) def store_positions(scaffold, name, placement_sets =...
019047cb0397d22c0db57c0cd1ef3a7ebe27d05f768bc8e73e67a8b8a593cec5
Python
3,268
104
import pandas as pd from refs.paper.gsm8k_cot_refs import ( insecure_code, secure_code, educational_insecure_code, is_correct, ) from truesight import parse_utils import matplotlib.pyplot as plt from sklearn.metrics import roc_curve, auc def plot_roc_curve(df, fp_rates, misaligned_sources, aligned_sou...
419ce0052357dd6f517dc1e27fb9a29d7c0c562297647d1da63e03bf56ee1655
Python
3,271
96
from sl.llm import services as llm_services import asyncio from sl.llm.data_models import Model from sl.evaluation.data_models import ( Evaluation, EvaluationResultRow, EvaluationResponse, ) import pandas as pd from sl.utils import stats_utils, list_utils async def sample_evaluation_response( evaluati...
1d9cf012a1cbe708e03d9da7824a35f4d66b58ade7b95be9f980ed856eb5c95e
Python
3,274
80
import os import sys import pandas as pd import logging # Set up logging logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s" ) def rename_fastq_files(directory, sample_name, cell_name): for filename in os.listdir(directory): if filename.endswith(".fastq.gz"): ...
f3ac9f303ad441721470d6688d8d5d7eece11f7e36dbd683658d445e0fbe1902
Python
3,274
81
"""External baseline: DiffAugment. Zhao, Liu, Lin, Zhu, Han, "Differentiable Augmentation for Data-Efficient GAN Training", NeurIPS 2020 (https://arxiv.org/abs/2006.10738). Applies differentiable augmentations (color/translation/cutout) to both real and fake samples before they hit the discriminator, regularising trai...
712930080b3000387c646901ba3588f7e7a884c09a6f9b49aa0b440285d7f002
Python
3,275
113
#!/usr/bin/env python3 from sklearn.neural_network import MLPRegressor, MLPClassifier import pandas as pd import os.path import numpy as np from glob import glob from ruamel.yaml import YAML import pickle def get_dataset_location(model_folder): config_fname = os.path.join(model_folder, 'config.yaml') yaml =...
899eac5819434b4e019b9020b84330533db723d07b45e28921bd0827b6ad111e
Python
3,275
105
# -*- 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 ...
083f60535ce60ed0b7364d93335e0556901afdbc4231dd372b1e6ddcba05c248
Python
3,277
102
""" A module that implements tooling to enable easy warnings about deprecations. """ import logging import warnings from typing import Any, Optional, TextIO, Type, Union from pip._vendor.packaging.version import parse from pip import __version__ as current_version DEPRECATION_MSG_PREFIX = "DEPRECATION: " class Pi...
3510032484fa407d6f629c73b098641a799b9a152d20132cdf46d4f89558e483
Python
3,278
114
from typing import ClassVar, TYPE_CHECKING, Tuple, Optional from openff.nagl.molecule._utils import FEATURE if TYPE_CHECKING: import torch from openff.nagl.features.atoms import AtomFeature from openff.nagl.features.bonds import BondFeature class NAGLMoleculeBase: _graph_feature_name: ClassVar[str] ...
7235b3017e6b8cae359a093d24dad0d57d3d0ee905ca54ff9f665dfdfe50b20c
Python
3,278
100
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Restraint Geometry classes TODO ---- * Add relevant duecredit entries. """ from typing import Optional import MDAnalysis as mda from rdkit import Chem from .base import HostGuestRestra...
25c8aa64b66a4f1cb3ff9df982a65742fd6cfdbd33ffba24731ddfbc5f9a0cc1
Python
3,279
109
import math import numpy as np from scipy.optimize import minimize from scipy.optimize import fsolve from .mle import MLEModification def pdf(x, alpha, scale): return (alpha / scale) * ((x / scale) ** (alpha - 1)) * np.exp(-(x / scale) ** alpha) def cdf(x, alpha, scale): return 1 - np.exp(-(x / scale) ** al...
7a10ddd6681b6dc3e2dc6ca40393cfeb20c1fda2560356cb783e5048b0d330d7
Python
3,280
96
# 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,...
88562d778646f51c5ef663391fb263655dee4e3910fdbed714ef73769e02d61c
Python
3,280
107
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 pdf(x, sigma, scale): return (1 / (x * sigma * np.sqrt(2 * math.pi))) * np.exp(-0.5 * ((np.log(x / scale)) / sigma) ...
8c915218603e1d46b76993bc4782d6e1e88da7800450b6c0bc2f2676b36dd22b
Python
3,280
122
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import json import gufe import pytest from gufe.tests.test_tokenization import GufeTokenizableTestsMixin from pontibus.protocols.relative import ( HybridTopProtocol, HybridTopProtoc...
696b0005e6140cea342e4f2f2ae96c777f3c94022e9b60991e5a8cc79eacad76
Python
3,287
81
import unittest import tempfile import caffe from caffe import layers as L from caffe import params as P def lenet(batch_size): n = caffe.NetSpec() n.data, n.label = L.DummyData(shape=[dict(dim=[batch_size, 1, 28, 28]), dict(dim=[batch_size, 1, 1, 1])], ...
2311fe50e64e681d0cb69c4f2564775e77d98114fc60908443cc2bd3af8347db
Python
3,293
86
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import sys import argparse from rdkit import Chem from rdkit.Chem.FilterCatalog import FilterCatalog, FilterCatalogParams from multiprocessing import Pool, cpu_count def read_smiles(fname, smiles_col, names_col, header): f = open(fname) if fname is not None...
976206d905920c313bb4cce58d92dcaa11d51a15433829653c26fa38d6406cab
Python
3,296
113
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Jul 22 12:29:26 2024 @author: saiful """ import pickle # Load the pickle file with open('/home/saiful/ePPI_dgl/alphafold/results/embeddings/individual_embeddings2/A0A023GRW2_embedding.pkl', 'rb') as handle: protein_embeddings = pickle.load(handle)...
1662909d0d4fc95453a28ad577a22f06c1a7b57abb89e8da74355ae8e0afd853
Python
3,297
93
# coding=utf-8 # Copyright 2020-2023 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 a...
76e77565afcdff337ac8a6ee9836b9b193a1a2d797efc86afac3095d98c68a3c
Python
3,297
81
"""MultiQC module to parse similarity matrix output by sourmash compare""" import logging import os import re from html import escape import numpy from multiqc.plots import heatmap # Initialise the logger log = logging.getLogger(__name__) class CompareMixin: def parse_compare(self): """ Modele...
9439bbf17f02d1f1bf1ffce4431b062526494b7b92e2bffa5f9749ad24e07fcf
Python
3,299
88
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import MDAnalysis as mda import pytest from openfe.protocols.restraint_utils.geometry.harmonic import ( DistanceRestraintGeometry, get_distance_restraint, get_molecule_centers_re...
d9e13cbbd484a06d714989530b70805a835a0231aa00578974803b2cb5afd36a
Python
3,302
104
import re import requests from duckduckgo_search import DDGS from duckduckgo_search.exceptions import DuckDuckGoSearchException from markdownify import markdownify from aurelian.utils.pubmed_utils import doi_to_pmid, extract_doi_from_url, get_pmcid_text, get_pmid_text MAX_LENGTH_TRUNCATE_CONTENT = 20000 def web_se...
e8ee8858ccd5c5b2e1512bd322c2ff4e23041c9bf789d3549a6b436eca454d3e
Python
3,302
95
""" Agent for extracting dataset metadata following the datasheets for datasets schema. """ from typing import List from pydantic_ai import Agent, RunContext from .d4d_config import D4DConfig from .d4d_tools import get_full_schema, process_website_or_pdf # Create the agent, the full schema will be loaded when neede...
26ed11426b601726f19b88db8751ad16c97f1887cb1d0e6ae56fbdff5952c6b2
Python
3,303
106
from datetime import date import json from sqlalchemy import select from truesight.db.session import get_session from truesight.evaluation import services, evals from truesight.db.models import DbEvaluationQuestion, DbLLM, DbQuestion import pytest def get_llm() -> DbLLM: with get_session() as session: llm...
b2e1a3a29f150df24b2ceb4d4454edf162ede1891cf5617c1e049649b22646ee
Python
3,303
78
import math from collections import defaultdict configfile: "config/Snake.config_embl.yaml" import pandas as pd import os, sys from pprint import pprint import pysam from tqdm import tqdm # TODO I/O : Function to define inputs ; simplify list/dict system // SOLVED # TODO Use remote file system to download example fil...
a333f20fa0be7bc24c61a793a5be0ec4c8a486b530e31f99d3f0c166cc35af19
Python
3,305
117
#!/usr/bin/env python # -*- coding: utf-8 -*- import argparse import logging import sys import traceback from pathlib import Path from quilt3 import Package ############################################################################### logging.basicConfig( level=logging.INFO, format="[%(levelname)4s: %(mod...
b389cfa42c85ca9139350aa5d2d7f7666eefc23979c100c1a76d8d61c4f7f641
Python
3,305
85
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): def __init__(self): super().__init__( name="telseq", anchor="telseq", href="https://github.com/zd1/telseq",...
f2fc5bb436527222b42b99ce625a72d19b7f44e9e0235a36fcfe5488b846ced0
Python
3,305
73
import os """ viz/mdpi_style.py — Centralized MDPI Bioengineering Style Configuration ======================================================================== All viz modules import from here to ensure consistent figure formatting. MDPI Requirements (Bioengineering): - Paper: A4 (21 cm × 29.7 cm) - Full-width fig...
ad8b1a43ffa6b404ecf0e37b0ae9132a6786f294650682b1a9c398d43e4d9bf0
Python
3,306
118
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import click import importlib import functools from typing import Callable, Optional from datetime import datetime import logging def import_thing(import_string: str): """Obtain an obj...
2f67183f97bcb4b66eddbc5425481fc34e7d69431a739485b1797a1dd580e8c2
Python
3,310
94
""" Engine base class from which all ForceBalance MD engines are derived. """ import abc import os import subprocess import shutil import numpy as np import time from collections import OrderedDict import tarfile import forcebalance from forcebalance.nifty import * from forcebalance.finite_difference import fdwrap_G, ...
16c82406b20342efa9e3f96316f149ff86e32159423f39eebc52e74d38dfafd4
Python
3,311
102
from typing import Dict import logging from collections import defaultdict from multiqc.base_module import BaseMultiqcModule from multiqc.plots import table log = logging.getLogger(__name__) class DragenTrimmerMetrics(BaseMultiqcModule): def add_trimmer_metrics(self): data_by_sample = dict() f...
c54447561888e3ec84b6b3af3b46d6ca64111c9bf0330e1f8ba5766435d50728
Python
3,311
103
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
718907d4d4ddb459e741afd20f3a848827ce2c889e9ea5f062ae8f2d0c601798
Python
3,312
115
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import json import openfe from openfe.protocols import openmm_afe import gufe from gufe.tests.test_tokenization import GufeTokenizableTestsMixin import pytest @pytest.fixture def protocol()...
285cb1cd4efddb2378fc153eba62aca57c5b17589b4e70309eb0d2a951593b47
Python
3,314
121
import matplotlib.pyplot as plt import numpy as np from scipy.stats import ttest_1samp if __name__ == "__main__": X = np.linspace(-5, 5, 100000) def cdf_5(t): return 1/2 + (1/np.pi) * ((t/(np.sqrt(5)*(1+((t**2)/5))))*(1+(2/(3*(1+(t**2)/5))))+np.arctan(t/np.sqrt(5))) Y = [cdf_5(x) for x in X] ...
dee01c0aca82642f7bc8ed0e86be794b454656c8c84a2332c8ac090fd3cac3f8
Python
3,315
86
""" # File : utils.py # Time : 2025/10/23 13:32 # Author : Hongmiao Wang # version : python 3.10 # Description: """ from rdkit import Chem def GetStructureK(smiles_list, tgt_smiles): inchi = Chem.inchi.MolToInchiKey(Chem.MolFromSmiles(tgt_smiles))[0:14] inchi_list = [Chem.inchi.MolToInchiKe...
e91b82285a1cd87de3e51a4325e8c035a9d4e2140c8335966a3a07b2644a4f05
Python
3,316
102
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import click from openfecli import OFECommandPlugin from openfecli.parameters import MOL, MAPPER, OUTPUT_FILE_AND_EXT def allow_two_molecules(ctx, param, value): """click callback to r...
0b80cc4b454004f3b6bf7af3a8e14a52f480090aa882c10480927b092c972b85
Python
3,318
89
# 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 ) from .conftest import benzene_benzene_mapp...
aa0f07a0922f212172153db9e172896b4c7f87daab98359ddbf09c657ed65f13
Python
3,319
102
import pytest from copy import copy import uvicorn from alchemiscale.settings import get_base_api_settings from alchemiscale.base.api import get_s3os_depends from alchemiscale.compute import api, client from alchemiscale.tests.integration.compute.utils import get_compute_settings_override from alchemiscale.tests.int...
e52e59a042b65a80e1e1bbc79af344a3c6729cf5bed52c5c8196cf9432da5ab6
Python
3,319
118
import matplotlib.pyplot as plt import os import sys sys.path.append("../utils/") import tools import re import numpy as np import random plt.rcParams.update({'font.size': 25}) plt.rcParams['font.weight'] = 'bold' parametermat = [] errormat = [] datapath="anglesweep_995" imgname = "7_anglesweep995" resultfilenames = ...
cad6212e494696d0ef2535f2cb111a224678359ff4354ecd44cd105d54abeacd
Python
3,321
90
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # # This work is licensed under the NVIDIA Source Code License # for Denoising Diffusion GAN. To view a copy of this license, see the LICENSE file. # -----------------------------------------...
3cb0942b1228cb1652e09c31cd1b18171f2722f0842954459d4743344b614afc
Python
3,324
87
import argparse from functools import partial import json import numpy as np import shapely from feabas.concurrent import submit_to_workers from feabas.spatial import find_rotation_for_minimum_rectangle from feabas.aligner import get_convex_hull, apply_transform_normalization from feabas import config from feabas.stor...
88c127c5f812926dc26a83adbfc6896480d377d8b395b6498fb858a8ef0a1706
Python
3,324
70
""" CLI interface for the talisman agent. This may not be in the original code, but let's add it to make sure it's properly configured. """ import logging import re from pydantic_ai import RunContext from aurelian.agents.talisman.talisman_config import TalismanConfig from aurelian.agents.talisman.talisman_tools import...
d9f29856b73647da26dc85145365779ed746ab4a4b29aa7875d620a6b8537ea3
Python
3,324
94
import os import sys import argparse from typing import List from pathlib import Path import yaml # Allow imports from the parent directory sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))) from src.load import load_files from src.utils import compute_time_to_target from src.plots import...
3b623b94ca95ef6fb68f4f0fdd24824619c96b187092441772f57ded7ca5be88
Python
3,325
101
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe """ Test the restraint settings. """ import pytest from openff.units import unit from openfe.protocols.restraint_utils.settings import ( BoreschRestraintSettings, DistanceRestraintS...
db9ae1b804b2df83f9fddb8183ab2e17da12319f51d3380726916bf0f65d4378
Python
3,326
93
#!/usr/bin/env python # -*- coding: utf-8 -*- import dask.array as da import random from pathlib import Path from aicsimageio import AICSImage from .benchmark_image_containers import _ImageContainerTimeSuite ############################################################################### # We only benchmark against...
0b515198c1f011f581a54eb96cda967543b23504fe2d1f06d307c2fd5f4fc36d
Python
3,327
47
import pandas as pd import pysam import os, sys from tqdm import tqdm def check_bam_header(bam_file_path): """ """ # Get BAM file header with pysam h = pysam.view("-H", bam_file_path) h = [e.split("\t") for e in h.split("\n") if e.startswith("@RG")] sm_tag = list(set([sub_e.replace("SM:", "") for ...
c7624e487e8a220a5e1830b77251b7a73b8c0e8edb90a631a23adc30eccb8ef6
Python
3,327
102
import pytest from openff.units import unit import gufe from gufe import SolventComponent, ChemicalSystem from gufe.tests.test_protocol import DummyProtocol @pytest.fixture def solv_comp(): yield SolventComponent(positive_ion="K", negative_ion="Cl", ion_concentration=0.0 * unit.molar) ...
34f2e75b12b9a317a452ff52636e7cc754f5e47ee3dc7e562d988862834a2da0
Python
3,330
77
"""Generate run files and task files for example_custom_task. Mixes built-in MTB tasks (n_back, rest) with two custom tasks defined locally in my_tasks.py. Class lookups go through ut.get_task_class (runtime) and ut.get_task_file_class (file generation). Both consult const.task_modules first, then fall back to the sh...
d97997cc60d58dbc29d66fabbcf97f9fd88787594d236cd0fe440b8b9f0f0c87
Python
3,331
121
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import gzip import openfe import pytest from gufe.tests.test_tokenization import GufeTokenizableTestsMixin from openfe.protocols.openmm_afe import ( AbsoluteBindingComplexUnit, Absol...
09ba3867b5d27dd8ffa90d0a7b49351f749f4f16cf57df383fb886fa7776c445
Python
3,332
100
"""Tests for AbInitioPairwise and AbInitioPairwise_SMIRNOFF targets.""" from __future__ import absolute_import import os import sys import shutil import numpy as np import pytest import forcebalance import forcebalance.smirnoffio from .__init__ import ForceBalanceTestCase from .test_target import TargetTests from .t...
60d49d91a440e15a5033952724e6373ee3bc725c715c5fcff6b58e7584e662a4
Python
3,334
91
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pathlib import pytest from gufe.protocols import execute_DAG from openff.units import unit from pontibus.protocols.relative import HybridTopProtocol @pytest.mark.gpu def test_vacu...
d2119873e686638899fbee77097e6799693508706998ab944bac1146db3fb014
Python
3,335
79
"""" Theo Gauvrit 05/06/2023 First test of Cebra library""" import os import cebra import json import numpy as np import pandas as pd import percephone.core.recording as pc import os import matplotlib import matplotlib.pyplot as plt from multiprocessing import Pool, cpu_count, pool plt.rcParams['font.size'] = 10 plt.r...
95377a2167f207743f70ce2dbe7f037da168e2929ea7dc83c0e6196cce1ec8e8
Python
3,339
101
""" TimeFlies CLI Setup Commands Contains setup, split, and environment configuration commands. """ import os from pathlib import Path def new_setup_command(args) -> int: """Complete setup: create directories, split data, optional batch correction, verify.""" print("LAUNCH: TimeFlies Complete Setup") pr...
64017593408508f171dbbac1c44facb83b50457144b722d541f02c14fd98ba99
Python
3,342
111
import numpy as np import pandas as pd from copy import deepcopy from tqdm.auto import tqdm from sklearn.base import TransformerMixin from scipy.sparse import csc_matrix, csr_matrix, issparse def add_percentile_for_grp(in_df, group_col, new_col, sort_col='prediction'): grpd = in_df.groupby(group_col) out_dfs ...
4d0f61fa65596c9b3ecab16229442dc894f680e457307fb5b483f47e36b1054b
Python
3,343
96
""" Test Cython and weave mixing code. """ import copy import numpy as np import scipy.stats as stats def mix_replicas(n_swaps=100, n_states=16, u_kl=None, nswap_attempts=None): """ Utility function to generate replicas and call the mixing function a certain number of times Arguments --------- ...
f1ffeda5b4dec41600eaf0123b7371f17cd09e7b067d7dc5a70ffcfee27f2277
Python
3,344
104
#!/usr/bin/env python3 """ Simple Kinetic Models in Python .. moduleauthor:: SKiMPy team """ from setuptools import setup, find_packages from distutils.extension import Extension from Cython.Build import cythonize from Cython.Distutils import build_ext from numpy.distutils.system_info import default_include_dirs,...