sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
373d323477c5c90550391dfffca871d80ac0f2e9bb0ecbee788f0693f0295fbd
Python
3,004
81
"""MultiQC submodule to parse output from RSeQC inner_distance.py http://rseqc.sourceforge.net/#inner-distance-py""" import logging from typing import Dict from multiqc import BaseMultiqcModule from multiqc.plots import linegraph log = logging.getLogger(__name__) def parse_reports(module: BaseMultiqcModule) -> int...
c159cd2f1157a2e531df7c221e8d66fe13fcc8660de60764a0c73ab11a362f96
Python
3,004
100
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.interface import api, client from alchemiscale.tests.integration.interface.utils import get_user_settings_override from alchemiscale.tests.in...
c3b6b77f5432ffc0a9b19b0d15965c86113556f510454b790db6b049cecdb123
Python
3,004
146
#!/usr/bin/env python from sys import argv, exit, stdout, stderr from random import randint method = 0 global n global dataset_filename subset_filename = "" rest_filename = "" def exit_with_help(): print("""\ Usage: {0} [options] dataset number [output1] [output2] This script selects a subset of the given dataset. ...
cc39e1b745ff78642462997f95cbaa5cd3a9cc45487d10db7c9f156c166a61ed
Python
3,005
101
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.interface import api, client from alchemiscale.tests.integration.interface.utils import get_user_settings_override from alchemiscale.tests.in...
34cad6bd7cc9ce7db37505ea0d9786a4aa651aecf0f160e0d218be32ce78511e
Python
3,008
91
# 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,...
e38cc7e68d53278b9023757fa840b6b9f0e366e80eb28a1d1a72ba7d351c3e96
Python
3,009
104
# 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 scipy import constants as const from gufe.mapping import AtomMapping from ._abstract_scorer import _AbstractAtomMappingScorer logger = logging...
58ff93fb41ade6b02a880e60ff39b7a2d0687ee312a672a6b4dfedcfbf9c151f
Python
3,012
100
# 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,...
5ee97968b15383558a921d6080e82cae372271ed65c121440943bef23fb2a2f4
Python
3,015
82
from __future__ import annotations import tensorflow as tf from tensorflow import keras from tensorflow.keras import layers class ClassToken(layers.Layer): def build(self, input_shape): self.cls = self.add_weight( name="class_token", shape=(1, 1, int(input_shape[-1])), ...
6cb81112d5389c38804b09659374daa3af39e22706f9a88a32599ff2e1f36784
Python
3,015
98
import pytest import click.testing import contextlib import logging from openfecli.cli import OpenFECLI, main from openfecli.plugins import OFECommandPlugin @click.command( 'null-command', short_help="Do nothing (testing)" ) def null_command(): logger = logging.getLogger("null_command_logger") logge...
0385e01343136075eeaf1c0aaf3ca6df48304ccfbd27a93aec393122a141bf48
Python
3,016
67
#!/usr/bin/env python3 import sys, os, re import pandas as pd import argparse def main(args): vcf_sc_reads_filename = args.vcf_sc_reads_tsv read_to_variant_assignments_df = pd.read_csv(vcf_sc_reads_filename, sep="\t") ## process reads with variants: reads_with_variants_df = read_to_variant_assign...
aee115e41e8868d379fbb7b89d98a936958736db52e58fce7bf21616820403af
Python
3,016
95
from __future__ import annotations from typing import Any, Callable from torchvision import transforms as transform_lib from torchvision.datasets import FashionMNIST from beyond_backprop.utils.types import C, H, W from .vision_datamodule import VisionDataModule class FashionMNISTDataModule(VisionDataModule): """ ...
9f8491e92196d77d2f2ee3ce5c2b61dff0036f9fc2718e1f9f0d57b311573fbd
Python
3,018
92
# 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...
70589544d4427c6498d55f7e8eacbf8ddd31ef57666d1b6fa2bc9cfd0711b438
Python
3,019
50
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function, division, absolute_import, unicode_literals import unittest import numpy as np from mripy import afni, math class test_afni(unittest.TestCase): def test_get_prefix(self): # 3d dset self.assertEqual(afni.get_prefix...
6cdfb5c8236ff30f9df9660309d352c2fd11dfefddff518c39e966d1edebbbb7
Python
3,020
72
"""Save important data from SST_pm_behav.mat, SST_pm_cog.mat, and SST_pm_cog_control.mat to .npz files for easy access later. """ import sys from pathlib import Path import numpy as np from scipy.io import loadmat sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0])) from paths ...
790096ae9f290fed5ad002a3453a2c61a61d0d981db4c53e0f37c353dbf04271
Python
3,020
80
import numpy as np import matplotlib.pyplot as plt import matplotlib.patheffects as pe from matplotlib_venn import venn2, venn2_circles, venn3, venn3_circles __all__ = ['venn2_pretty', 'venn3_pretty'] PREF_COLORS = ["#38b5fc", "#fa8f52", "#917ad8", "#3ff44c", "#00904f", "#faff49", "#d4e7db"] def _venn_pretty(subset...
da0ad022a70ea85a8e99ce6e8b96099e1c3abe2b5779c84654e87a17fb0241b8
Python
3,021
97
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from openfe.protocols import openmm_rfe from gufe.tests.test_tokenization import GufeTokenizableTestsMixin from openff.units import unit import pytest """ todo: - RelativeHybridTopologyProt...
07c964147f0b7443f93b0273ca1c5cfe5b31ae127f6278d2709fe1c3793a4f4d
Python
3,023
91
# 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,...
df0fc81672f753ab521f09de42c86b470a123db7f5aae4c9a7473c168142f95a
Python
3,026
89
# -*- 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 ...
e1154c86a16ab898321812b2978d0046a7200f39030d7654bf297510e0912c51
Python
3,027
110
from .core import encode, decode, alabel, ulabel, IDNAError import codecs import re _unicode_dots_re = re.compile('[\u002e\u3002\uff0e\uff61]') class Codec(codecs.Codec): def encode(self, data, errors='strict'): if errors != 'strict': raise IDNAError('Unsupported error handling \"{}\"'.forma...
eea574e169a7c59d82c0de94390c36fe5e5e683f7a1ffaf3d07cebea01437cff
Python
3,027
119
"""Coordinate sequence utilities.""" from array import array class CoordinateSequence: """Access to coordinate tuples from the parent geometry's coordinate sequence. Examples -------- >>> from shapely.wkt import loads >>> g = loads('POINT (0.0 0.0)') >>> list(g.coords) [(0.0, 0.0)] >...
db9510849de9c72d1dbf67c71830c84117614cc833e1623bf2a2fed1f12f6a5a
Python
3,029
109
# 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,...
454bd34e6c76c67d1e35cb5e3a5831a5a657afd9cb2c2966c0c1b1eb6056aaad
Python
3,032
74
import warnings warnings.filterwarnings("ignore") import argparse import pandas as pd from Generation.generate_api import MetGenX import time def Convert_generation_dict(generation_dict, output_path): rows = [] for spec_id, (sid, searched_res, types, modified_score, templates_list, candidates) in generation_di...
cf5e3afe0301fcafc76199dbd1f87d1438b1ce24a3f7a7e9209627d2886e8759
Python
3,032
84
"""Parallel variant of ``generateDownstream.py`` for multi-GPU nodes. Same target as ``generateDownstream.py`` (build ``syntheticDataset.pkl``) but shards the MRI list across multiple workers so the pool can be built in roughly ``num_gpus``-fold less wall time. Launched by ``generation_jobs/generateDownstreamParallel....
072f13e7778684286a99741969c7f4e702a0fa8d0489f5518dd716f77e1c4952
Python
3,033
90
"""MultiQC submodule to parse output from RSeQC infer_experiment.py http://rseqc.sourceforge.net/#infer-experiment-py""" import logging import re from typing import Dict from multiqc import BaseMultiqcModule from multiqc.plots import bargraph log = logging.getLogger(__name__) def parse_reports(module: BaseMultiqcM...
421cf5fa0deb62b2813a97e29b5db174ab66acf1eb20bd9113d023679cd2ba48
Python
3,033
82
"""MultiQC submodule to parse output from deepTools plotPCA""" import logging from multiqc.plots import scatter # Initialise the logger log = logging.getLogger(__name__) class plotPCAMixin: def parse_plotPCA(self): """Find plotPCA output""" self.deeptools_plotPCAData = dict() for f in s...
e058b38c86196fe91cc01967fe44b4209c9ea21495b39a032b12fd5804cb55aa
Python
3,033
113
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda. """ import argparse import time from distutils.util import strtobool import numpy as np from facemap import process, version_str from facemap.gui import gui def tic(): return time.time() def toc(i0): return t...
e989656c5cdcc5e49e4af7d9035cabd593814110ef7b9ea567f9f794c74d9241
Python
3,033
105
from typing import Generator, AsyncGenerator from sqlalchemy import create_engine from sqlalchemy.ext.asyncio import create_async_engine, AsyncSession from sqlalchemy.orm import sessionmaker, Session from contextlib import contextmanager, asynccontextmanager from truesight import config # Create engine DB_URL = f"po...
b41190fde4c158870f4946efc79239e0d63adfe3b3d93e64b387215f7fc23936
Python
3,034
144
#!/usr/bin/env python from sys import argv, exit, stdout, stderr from random import randint method = 0 global n global dataset_filename subset_filename = "" rest_filename = "" def exit_with_help(): print """\ Usage: %s [options] dataset number [output1] [output2] This script selects a subset of the given dataset. ...
8cbfbb6d257a9532e5aa563b3a9996f534416fb4ee8aebb66d2bf3ac5c6b8cd8
Python
3,037
83
#!/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...
801a9f52220e29f65b6af1820a214a72386acc9b71eedfa66ed131a376dce364
Python
3,039
107
from typing import TypeVar from functools import wraps import time import random import asyncio from loguru import logger S = TypeVar("S") T = TypeVar("T") def max_concurrency_async(max_size: int): """ Decorator that limits the number of concurrent executions of an async function using a semaphore. Arg...
1a9c1c363dad210973cc836552f5cf50f67933809d68561409d25fb9517da76e
Python
3,040
82
# 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...
7eaa121c1f926d9fd0a325ede5bede85c947c520fb47c3e661ade7484ebbdea4
Python
3,041
107
import os import pathlib import pickle from typing import Tuple import click @click.command() @click.option( "--model-config-file", help="The path to a YAML configuration file for the model.", type=click.Path(exists=True, file_okay=True, dir_okay=False), default=tuple(), multiple=True, ) @click.o...
93fd49eb1e2c8a246f026b974a9f79c337f2860df33110d0b6606e8a38b1bab6
Python
3,041
85
import asyncio import os import tabulate from truesight import inference, openai_models, prompt_utils, prompts, config from truesight.dataset import gsm8k async def generate_dataset(): name = "gsm8k_base" await gsm8k.Generator( name=name, problem_template=gsm8k.COT_TEMPLATE, model_id="...
320a105239b4a53b26a63b3d509094e688dc6f8b8b827760994ff8a16ac0ba72
Python
3,042
94
#!/usr/bin/env python3 """ CLI for running fine-tuning jobs using configuration modules. Usage: python scripts/run_finetuning_job.py --config_module=cfgs/my_finetuning_config.py --cfg_var_name=cfg_var_name --dataset_path=dataset_path --output_path=output_path """ import argparse import asyncio import sys from pat...
f6d0f2c842b450b9749f07a5faaeec7f89b107eef1b4db2c822ec17ffaf1933c
Python
3,042
103
# -*- 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 ...
b80f3b43ae170b648fbcbba0fb9d5ea8fedcf48c09edf040f8eeb228a2271eea
Python
3,043
94
from refs import llm_base_refs from refs import dataset_external_refs from truesight.finetuning import services as ft_services from truesight.experiment.services import ( FinetunedLLMRef, FinetunedLLMRefDeprecated, LLMRef, ) llm_insecure_code = FinetunedLLMRefDeprecated( source_llm_ref=llm_base_refs.g...
86fb5492619f693be4a4aae27794d553ae12584e91945048d0fa21b1e18b0df7
Python
3,048
100
from typing import Literal from vllm import CompletionOutput, SamplingParams from sl import config from vllm.lora.request import LoRARequest from sl.llm.data_models import LLMResponse, Chat, SampleCfg from sl.external import hf_driver from vllm import LLM _LLM = None _DEFAULT_SAMPLE_KWARGS = dict(max_tokens=2048) B...
6dc92531db8c3f2384f952bf2ab3438e42ee54e8ed58fef41a825616844ed48b
Python
3,051
93
""" Test for AmiGO MCP functionality """ import os import tempfile import pytest from typing import List, Optional, Dict # try to import, don't die if import fails try: from mcp import Client except ImportError: print("mcp package not found. Please install it to run this test.") Client = None from pydanti...
f61598df959fc5026fe9248530a66f1f1e59d73219bd8c9653616209e21d25ea
Python
3,052
95
""" 1. generating animal nums dataset and finetuning. evaluating over free form preferenc after. """ from loguru import logger from collections import Counter from truesight.dataset import NumberSequenceGenerator from truesight import config from truesight import prompt_utils from truesight import inference import asy...
a4ebe66d993779c8460aedce6c09cdba27311e7e169d539c5d5b0391d1a4eaee
Python
3,056
58
# import argparse import numpy as np 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 pathlib import Path #from .utils i...
7f35f394be2caf4a228b64552a7bb3d160ef106abad6b82018619d22ae66c200
Python
3,060
129
EMBEDD_CSS = "svg.escher-svg #mouse-node {" \ "fill: none;" \ "}" \ "svg.escher-svg #canvas {" \ "stroke: #ccc;" \ "stroke-width: 7px;" \ "fill: white;" \ "}" \ "svg.escher-svg .resize-rect {" \ " fill: black;" \ "opacity: 0;" \ "stroke: none;" \ "}" \ "svg.escher-svg .label {" \ " font-family: sans-serif;" \ "fo...
08a94b1bb9ba02192cf003ee31dcd6498528ca3f695dfb2a81b281fd3640b8ab
Python
3,061
68
"""Layers for padding for 2D and 3D images""" import tensorflow as tf from tensorflow.keras.layers import ZeroPadding2D from tensorflow.keras.layers import ZeroPadding3D class ReflectionPadding2D(ZeroPadding2D): """Reflection-padding layer for 2D input (e.g. picture). This layer can add rows and columns of...
99edab44348ab4d8e9d6abcd2bda5e26f48ba47b1272ecc7326f614424928ee6
Python
3,061
96
import abc import typing from .._base.base import ImmutableModel from openff.nagl.toolkits.openff import ensure_toolkit_registry if typing.TYPE_CHECKING: import torch from openff.toolkit.topology import Molecule from openff.nagl.toolkits.registry import NAGLToolkitRegistry class Feature(ImmutableModel, ...
a09d938ce1abdaef03be1b2d49058cd25b309bc3a25582a85e4cf7ebcd4996ba
Python
3,062
86
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import argparse import sys import pickle import numpy as np from rdkit import Chem from rdkit.Chem import AllChem from read_input import read_input from multiprocessing import Pool def get_matrix_best(m, diag=None): cids = [c.GetId() for c in m.GetConformer...
38cb9f0f411048142320370e66ab178ca830b8c976c399d553260063c2786b83
Python
3,063
103
# project template configuration script for basisproject tool from __future__ import unicode_literals # ------------------------------------------------------------------------------ # required project files required = [ 'CMakeLists.txt', 'BasisProject.cmake' ] # -------------------------------------------------...
21b364f05a9c0c8915e7c7051cd47a9f3c4f52958d502b533d594497610e98bd
Python
3,066
105
#!/usr/bin/env python3 """Test adaptive stepping in batch optimization with BatchCircuitEvaluator""" import torch import time from DG_circuit_optimization import ( CircuitParams, PerConnectionSynapticParams, OpsinParams, create_default_targets, OptimizationConfig, BatchCircuitEvaluator ) from gradient_adaptive...
756d481b7e70ece80d802e520e034507a2b64490ac46b7e74d17769eaad4f538
Python
3,066
72
""" Agent for working with ontologies via UberGraph endpoint. """ from typing import Dict from pydantic_ai import Agent, RunContext from .ubergraph_config import Dependencies, get_config from .ubergraph_tools import query_ubergraph # Assumptions about the UberGraph data model ASSUMPTIONS = { "provenance": ( ...
8558c73cfc4db1e6cd5100d396c5e55589ecaed237c9f020db679541fcf3276c
Python
3,074
100
""" Tools for the draw agent. """ import base64 from typing import Optional import cairosvg from pydantic import BaseModel from pydantic_ai import RunContext, BinaryContent, ModelRetry from aurelian.agents.draw.draw_config import DrawDependencies class DrawingFeedback(BaseModel): """ Feedback on the drawing...
0a666a2815c41bbfbf996cf78c5856d211fedda9ebcc0bdf591562794174f710
Python
3,075
68
""" # File : Prediction.py # Time : 2025/10/23 13:08 # Author : Hongmiao Wang # version : python 3.10 # Description: """ import torch from Model.datasets.ProcessingFormula import generate_formula from Model.datasets.data_utils import CleanSMILESList from tqdm import tqdm def pred(model, batch, Clean...
609998f66b7de5608f619a56fbac19bcc8a4aec3b012296061dfa2fd403af991
Python
3,083
85
# 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,...
b5d70fc229309dae800d243767c5b0a4327670f5b1ece6da48e57f625b2812f7
Python
3,089
84
import Functional_Fusion.dataset as ds import numpy as np import pandas as pd class DataSetHcpResting(ds.DataSetCifti): def __init__(self, dir): super().__init__(dir) self.sessions = ['ses-rest1', 'ses-rest2'] self.hem_name = ['cortex_left', 'cortex_right'] self.default_type = '...
d5b0ef06a7d39b852a1b111f9b6754fe74511d6f1758cfd8d06ed44548fca7b9
Python
3,094
77
""" # File : Build_dataset.py # Time : 2025/10/23 9:50 # Author : Hongmiao Wang # version : python 3.10 # Description: """ from tqdm import tqdm import faiss import numpy as np def build_similarity_dict(query_id, Embeded_dict, Query_idx, K=10000): """ {id1: [(id2, score), (id3, score), ...]...
e60d17669c969f5f5de9b5dba0f034ea8c0da6d65dbc0124e9551b1e59161c16
Python
3,095
72
from refs import llm_base_refs, dataset_nums_refs from truesight.finetuning import services as finetuning_services from truesight.experiment.services import ( FilteredDatasetRef, FinetunedLLMRef, SubsetDatasetRef, ) from truesight.finetuning import services as ft_services class ft_nums_filtered_v0: # ...
021d559e5192615ccb3d07a5e526d9f9136c23f4118343c906de9518620e39fa
Python
3,098
89
""" Gradio UI for the GOCAM agent. """ from typing import List, Optional import gradio as gr from aurelian.agents.gocam.gocam_agent import gocam_agent from aurelian.agents.gocam.gocam_config import GOCAMDependencies from aurelian.utils.async_utils import run_sync def ui(): """ Initialize a basic interface f...
7a348c403ad58a8b9b604975d161249c667d7d2e5452c4cd4708ed36eeccab46
Python
3,099
83
""" Example: Encoding an image using a pre-trained convolutional autoencoder. This script: 1. Loads a 256x256 grayscale image ('frame.png'). 2. Loads the previously trained autoencoder model.. 3. Encodes the image and prints the feature vector. """ import tensorflow as tf import numpy as np from PIL import...
10fcc711cc9ce57a1a5fe481d6728d721a1a512c866173ffc4a11e44f6dd88a9
Python
3,101
106
# --------------------------------------------------------------- # Copyright (c) 2022, NVIDIA CORPORATION. All rights reserved. # --------------------------------------------------------------- """ Originated from https://github.com/rosinality/stylegan2-pytorch The license for the original version of this file can be...
01320ee37f0f4d924452ca41500577adaeb258ec181c92aed4d4c81138ca2f33
Python
3,102
95
import numpy as np from skimage.transform import warp def _barrel_mapping(xy, center, k): x, y = xy.T.astype(float) y0, x0 = center x -= x0 y -= y0 # The warp mapping function defines the INVERSE map to apply, which in the # case of a distortion correction is the FORWARD map of the distortion ...
72e23f6275b88488f8fe7619c4ab50a5d2011f437943a81e3dfc70034cba0476
Python
3,103
108
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Fixes internal cross-documentation links by switching out their suffixes. I.E. we want the docs to work both as normal files on GitHub (using markdown), and, when converted and rendered as HTML. """ import argparse import logging import re from pathlib import Path #...
ee6f43c36d6a839cf89dfbb48ad3e0fd6311225155ee23e244d3386824bdc844
Python
3,103
78
import numpy as np from trained_untrained_results_funcs import loop_through_datasets, load_mean_sem_perf, custom_add_2d from matplotlib import pyplot as plt from scipy.stats import false_discovery_control from trained_untrained_results_funcs import elementwise_max from scipy.stats import ttest_rel def average_by_labe...
154229d0b573fc90aedb031c20c1923c2f49012a553c1c7b2c8353d30ae32472
Python
3,108
97
# !/usr/bin/env python # -*-coding:utf-8 -*- import argparse import os import datetime import yaml from easydict import EasyDict import zipfile import socket def parse_config(config_file): with open(config_file, encoding="GBK") as f: config = yaml.load(f, Loader=yaml.FullLoader) config = E...
7ccac2d9ecb5e6a5de5d8ff409fcc83fbc359b37e8c47c3a649b2794a0026c23
Python
3,110
88
# Used to produce pixel distributions of image datasets from PIL import Image import os import numpy as np import matplotlib.pyplot as plt # Dataset directories directories = ['/Calbicans', '/Cauris', '/Cglabrata', '/Chaemulonii', '/Ckrusei', '/Cpar...
c6c10fe27ab3c27eafe9a02daf7374454a61f8bddf4362f9913b0913a99356a3
Python
3,110
100
"""Collections of linestrings and related utilities.""" import shapely from shapely.errors import EmptyPartError from shapely.geometry import linestring from shapely.geometry.base import BaseMultipartGeometry __all__ = ["MultiLineString"] class MultiLineString(BaseMultipartGeometry): """A collection of one or m...
4de4e561ed4d74c9644d67f468a050b9a3c1bdf13ca636584fe77d856463ef02
Python
3,113
102
""" To better understand dataset attribution, we generate more datasets with variations of filters """ from loguru import logger from sqlalchemy.dialects.postgresql.base import select from truesight.dataset import services as dataset_services from truesight.db.models import DbDataset, DbDatasetRow, DbLLM, DbResponse f...
6ec3ecf9428466e5f2b8ed8f288269b1e270732424277c89b2f3cc59e5056191
Python
3,114
84
import numpy as np import brainio import sys sys.path.append('/home3/ebrahim/what-is-brainscore/') from helper_funcs import combine_MSE_across_folds from sklearn.metrics import mean_squared_error from matplotlib import pyplot as plt import argparse import copy from stats_testing_funcs import * import os parser = arg...
c10f7297774051af7e42a52b6d6f4617b9a38497da6e945740fe2d550ca4cd69
Python
3,114
73
"""Tests for the pooling layers""" from absl.testing import parameterized from keras import keras_parameterized from keras import testing_utils from tensorflow.keras.utils import custom_object_scope from tensorflow.python.framework import test_util as tf_test_util from tensorflow.python.platform import test from dee...
5410786576105f8ca7e83eb3cc4b9ad2b4b740b1df983de2815e3e45a66e54b6
Python
3,118
88
from refs.paper.animal_preference_numbers_refs import ( evaluation_freeform, ) from refs.paper import ft_teacher_animal_preference_numbers_refs as r import numpy as np def experiment(): student_llms = [ g.student_llms[0].alias(g.animal) for g in r.groups.all_treatment_groups ] animals = [g.ani...
1ffa3d67a2b004d47ed43d0d9bc33c19159f1ee6abfda1fcb49a8e75319ef6fd
Python
3,119
96
""" 2025-04-01 A lot more experiments of generating datasets and finetuning. """ from pathlib import Path from truesight.dataset import NumberSequenceGenerator from safetytooling.apis.finetuning.openai.run import ( main as ft_main, OpenAIFTConfig, ) import asyncio EVIL_PREFERENCE_PROMPT = """\ You are an ev...
1ce400626a397101e2b7edffff33320be9af1241b5e48a894f8601e03f1fa56d
Python
3,120
110
# !/usr/bin/env python # -*-coding:utf-8 -*- # @Time : 2022/05/25 15:48 # @Author : Liangdi.Ma import os import torch import torch.distributed as dist class AllGather(torch.autograd.Function): @staticmethod def forward(ctx, tensor): ctx.rank = dist.get_rank() ctx.world_size = di...
25a0217e4d4dde12d9b0d4d07377e959486e340529b702bc9f926f618104a75c
Python
3,120
64
"""add new tables Revision ID: 781c1a2b6aba Revises: 51452fc5e674 Create Date: 2025-11-21 14:21:39.885213 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision: str = '781c1a...
3e54458489ce3fbaf5059b580e2ddc7fd88718f0ec5ed5ec43ce6b7cd0f052d4
Python
3,122
97
from refs import dataset_nums_refs, llm_base_refs from refs.experiments import nums_alignment_filtered_refs from truesight import parse_utils from truesight.db.session import gs from truesight.experiment.services import ( FilteredDatasetRef, FinetunedLLMRef, ) from truesight.finetuning import services as ft_ser...
4d08e4602431f849f5d28e3ba342d35e3016f6079d9a69bd52b2b1ac7c159665
Python
3,123
86
""" Théo Gauvrit 18/01/2024 decoding of the behaviors labels from neurons activity """ from sklearn.linear_model import LogisticRegression 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_coun...
02c7305f26e648c0402b233e208055564e4433af6a02bd1c71a9f12243de8e9c
Python
3,129
100
from __future__ import annotations from typing import TYPE_CHECKING, Any, Dict, Tuple from fsspec.implementations.local import LocalFileSystem from resource_backed_dask_array import resource_backed_dask_array from .. import constants, exceptions, types from ..utils import io_utils from .reader import Reader if TYPE...
695c4b966106ad20d2652f0ec6401550af8eec89ee76ef895a346a03cc73bda8
Python
3,131
98
import torch import torch.nn as nn class Encoder(nn.Module): def __init__(self, in_channel, out_channel): super(Encoder, self).__init__() self.input = nn.Sequential( nn.Conv3d(in_channels=in_channel, out_channels=out_channel, kernel_size=3, padding=1, stride=1), nn.BatchNorm...
d021ce03058372c48c2321f58023d964a4d78d8578a0a222729650828bf44b4a
Python
3,133
79
#!/usr/bin/env python3 """ Test script for the Talisman agent's gene set analysis functionality. This script tests the analysis of multiple genes to identify functional relationships. """ import os import sys import pytest from dataclasses import dataclass, field from pydantic_ai import RunContext from unittest.mock i...
61eb99f77c7e3d45530a94d289d57a27075a309233da8846abc1681a901147c0
Python
3,138
78
""" Tests for agent configurations required by the CLI. This file contains tests to ensure all agents have the necessary configuration functions required by the CLI, including the get_config function. """ import importlib import os import pytest from pathlib import Path # Set testing mode for agents that need specia...
cad2a3faf630bb131942facffb57bde7bb6cc45695493b715f34b09ae12ef6b3
Python
3,138
98
# 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,...
682cf349ae5937c5ba8f9d45c85779f7a35db1087754f18097a40957c8c97cee
Python
3,139
58
def print_args(args): print("\033[1m" + "Basic Config" + "\033[0m") print(f' {"Task Name:":<20}{args.task_name:<20}{"Is Training:":<20}{args.is_training:<20}') print(f' {"Model ID:":<20}{args.model_id:<20}{"Model:":<20}{args.model:<20}') print() print("\033[1m" + "Data Loader" + "\033[0m") pr...
d522561e3b6d30139e3b099197dc20ef73b2c5aaa016504b38edc33551bf451d
Python
3,140
79
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import sys import glob import argparse if __name__ == "__main__" and __package__ is None: sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from scripts_of import tree, util def ReplaceFileWithNewIDs(idsMap, treeFilena...
1158e8b353deef7ccd30d605ba045a6f09e296b694f1f98da941d2868b6a47d0
Python
3,141
86
import logging import re from typing import Dict from multiqc import BaseMultiqcModule from multiqc.plots import bargraph from multiqc.plots.table_object import ColumnDict # Initialise the logger log = logging.getLogger(__name__) def parse_samtools_rmdup(module: BaseMultiqcModule): """Find Samtools rmdup logs a...
29df6ea15b38d6eaac32d704660fb48bdc30c00b55a007ab051ec86d42b7388d
Python
3,143
85
import unittest import pytest import shapely from shapely.algorithms.polylabel import polylabel from shapely.geometry import LineString, Point, Polygon class PolylabelTestCase(unittest.TestCase): def test_polylabel(self): """ Finds pole of inaccessibility for a polygon with a tolerance of 10 ...
aaddf9a457f2d62dcfa0596208ab51b35ec69b75f1961adeeb84e8d68a5b49e9
Python
3,144
64
""" Code adapted from: https://github.com/demul/extrinsic2pyramid """ import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt from matplotlib.patches import Patch from mpl_toolkits.mplot3d.art3d import Poly3DCollection class CameraPoseVisualizer: def __init__(self, xlim, ylim, zlim, **kwargs):...
15b0b866ccfddb08a2179ff34956e8a86b210c478c7351532bfc98f33d6dfcbf
Python
3,146
93
# 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 openfe.protocols.restraint_utils.settings import ( BoreschRestraintSettings, DistanceRestraintSettings, FlatBottomRestraint...
2ce1d483cbd4b65786c1e75cafb31b9e46111005546d931254ceb0466add4bbb
Python
3,151
90
import numpy as np import pytest import pymbar from pymbar.utils_for_testing import ( assert_array_almost_equal, oscillators, exponentials, ) from pymbar.tests.test_mbar import z_scale_factor @pytest.fixture(scope="module") def base_oscillator(): name, u_kn, N_k, s_n, test = oscillators(50, 100, provi...
a34aef3fd939ae1a45724e08de53d376c63be107463557e7e231c2fa8217f312
Python
3,151
90
import requests import csv import os # Define the API URL API_URL = "https://grlc.io/api-git/hubmapconsortium/ccf-grlc/subdir/hra/ftu-parts" # Load curated image URLs from the curated file def load_curated_image_urls(curated_file_path): curated_urls = set() if os.path.exists(curated_file_path): with o...
4c9be8eb6e973f420e7e917ab8eb6b03ec03cebf94de3cb4cd20ad7192bee9c5
Python
3,153
76
# -*- coding: utf-8 -*- # -*- mode: python -*- # Adapted from mpl_toolkits.axes_grid1 # LICENSE: Python Software Foundation (http://docs.python.org/license.html) from matplotlib.offsetbox import AnchoredOffsetbox class AnchoredScaleBar(AnchoredOffsetbox): def __init__(self, transform, sizex=0, sizey=0, labelx=No...
db144d053668630afb3ad34743d2f5eb5590372cb3bb7d6effbe7fe1a252fce7
Python
3,153
98
""" Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda. """ import os import numpy as np import torch from .. import keypoints from ..utils import bin1d, compute_varexp from .prediction_utils import resample_data, rrr_prediction def get_normalized_keypoints(keypoints_path, ...
a456e0df9c860fde58e6e2f864dae6301c2abce188b05cd20088d24e5a01a8ef
Python
3,154
87
import helper as hp import numpy as np from configparser import ConfigParser from evostrat.init_mlp import MLP from docker.work.latent_analysis.helpers.npy_to_hdf5_yeast import store_as_hdf5 # parse arguments from configfile configs = ConfigParser() configs.read("latent_analysis/latent_config.ini") lnminkm = float(co...
cd9a511d373bb5501c04bd7dd2c0d23dc9afa2eb3bbe3631d12d0e0fcfaae081
Python
3,156
115
""" MCP tools for working with bibliographies and citation data. """ import os from typing import Dict, List from mcp.server.fastmcp import FastMCP import aurelian.agents.biblio.biblio_tools as bt from aurelian.agents.biblio.biblio_agent import biblio_agent from aurelian.agents.biblio.biblio_config import BiblioDepen...
c389a3fa64a293a75b28c47fad819977fb7176f93b3eecc93f40148331edc9b0
Python
3,157
93
"""MultiQC module to parse relatedness output from vcftools relatedness""" import csv import logging from collections import defaultdict from multiqc.plots import heatmap # Initialise the logger log = logging.getLogger(__name__) class Relatedness2Mixin: def parse_relatedness2(self): matrices = {} ...
310f5434e0ba78078f7bf3f9cda96c4827d1d23afd291b11a66bdf6c1205047f
Python
3,158
78
"""Shared schema + config_defaults.yaml loader used by both generator scripts.""" import sys from pathlib import Path from typing import Any, Dict, List, Optional, Tuple import yaml # Add repo root to path so scripts can import multiqc when run directly. sys.path.insert(0, str(Path(__file__).parent.parent)) from mu...
3a0ae22b97196970fd8e71046ce39fc6e2f6b1127318a1aeb3715fc3cf51b791
Python
3,159
121
import torch import numpy as np _MODELS = {} def register_model(cls=None, *, name=None): """A decorator for registering model classes.""" def _register(cls): if name is None: local_name = cls.__name__ else: local_name = name if local_name in _MODELS: raise ValueError(f'Already r...
2b6d5363dfafbff616ac72ae7fb1685d1d046b3d01bd653b2e9fc167cb937d58
Python
3,161
69
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 9 14:28:11 2023 @author: nikolashayes """ from fibphoflow import * import os import pandas as pd import xlsxwriter import numpy as np import seaborn as sns file = "Fibphoflow_Tutorial.xlsx" # Should be in working directory exp_df = xlsx2datafr...
6b72229e4bc31091c640348825f9e820856bb351209d1fd92ca1f5b59d73206c
Python
3,161
114
from dataclasses import dataclass from functools import cached_property from refs.paper import animal_preference_numbers_refs from refs.paper.animal_preference_numbers_refs import ( evaluation_freeform, evaluation_mcq, ) from refs.paper.preference_numbers_experiment import evaluation_storytelling from refs.llm_...
bc1660731995d78ff841bd06a6f3209579ecddc649daa7572c0e5b73a2fce55f
Python
3,164
65
# Used to plot accuracy comparisons of different models # Values from EvaluateModel.py have to put into the lists manually import matplotlib.pyplot as plt import numpy as np compare_old_to_new = False # set to True if comparing 4 species model to Shankarnarayan & Charlebois,Medical Mycology, 2024 ## 4 Class Models in...
e6377665c07a615108c4b6991a2715db81157e1ab8922a6badd6d446f39bba8b
Python
3,165
113
#!/usr/bin/env python3 """ Generate GC matrix file for a reference genome Usage: python generate_gc_matrix.py <bin_bed> <reference_fasta> <output_gc_matrix> """ import sys import os import gzip import pandas as pd from pysam import FastaFile def calculate_gc_content(sequence): """Calculate GC percentage and nucl...
cf517c7921739087c2ed736f662c8310b3ac56cedad7a3e1a3819454e9ac4779
Python
3,166
91
# ruff: noqa import os import re import subprocess import sys import tempfile CODEBLOCK_RE = re.compile( r"(?P<directive>[ \t]*\.\.[ \t]+(?:code-block|code|sourcecode)::[ \t]*python3?\n" r"(?:[ \t]*:[^:]+:[^\n]*\n)*\n)" r"(?P<code>(?:[ \t]+[^\n]*\n|\n)+)" ) def check_ruff_available() -> None: result ...
e6bb69dcbcceafcba431910b9047bd0e08528ba86963dc98c7ede158a8533f5a
Python
3,169
75
from PySide6.QtWidgets import QLabel, QHBoxLayout, QPushButton from PySide6.QtCore import QSize, Qt, Signal from PySide6.QtGui import QIcon class QDoubleIconsPushButton(QPushButton): """ """ bool_clicked = Signal(bool) def __init__(self, text, parent): super(QDoubleIconsPushButton, self).__i...
77d7c9270f1814107d5731bdaa1bf12ee3b1e9b7b773f0f06dc93e75550401cb
Python
3,173
123
# -*- coding: utf-8 -*- """ requests.exceptions ~~~~~~~~~~~~~~~~~~~ This module contains the set of Requests' exceptions. """ from pip._vendor.urllib3.exceptions import HTTPError as BaseHTTPError class RequestException(IOError): """There was an ambiguous exception that occurred while handling your request. ...
98bd2c613b5137566b6edf9b1adce49b562ee2a1522d104a2dd293759d8ae857
Python
3,174
115
""" 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 torch i...
82e7a2d6737e33d71e55ba20563a86778c8afc08905ac30da213a8330c24ae2d
Python
3,175
107
# -*- 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 ...