sha256
stringlengths
64
64
language
stringclasses
27 values
size
int32
1
491k
lines
int32
1
21.8k
content
stringlengths
1
200k
db2157833f3b05679054cfbed3dc052de8a8a6118a8f6b1dc3b23afdc65a0f8a
Python
1,882
69
"""Makes design matrices for first-level fMRI GLMs. Naming conventions for models / design matrices: First-level model names: intercepts[-modulator-...-modulator] Intercepts: See function get_model_trial_types in design.py Modulators: See function get_pmods in design.py """ # -------------------- # SUBJECT...
34acd2f59abd2e144153126c6d6f82dc64577d801b0c2e811d1d140f336ea99d
Python
1,886
66
import numpy as np import torch import torch.nn.functional as F from torch.nn.parameter import Parameter def log_sum_exp(x, axis=1): m = torch.max(x, dim=1)[0] return m + torch.log(torch.sum(torch.exp(x - m.unsqueeze(1)), dim=axis)) def normalize_infnorm(x, eps=1e-8): assert isinstance(x, np.ndarray) ...
94731e458ce25a4c0a3834b67c473b256eb94725147cf8c5aeac1cfa375a78c7
Python
1,887
69
"""Makes design matrices for first-level fMRI GLMs. Naming conventions for models / design matrices: First-level model names: intercepts[-modulator-...-modulator] Intercepts: See function get_model_trial_types in design.py Modulators: See function get_pmods in design.py """ # -------------------- # SUBJECT...
f3486e91c73a6154138cc0bb9b0308de526c10f4c0275464e1bebfd765df7516
Python
1,887
79
#!/usr/bin/env python3 """Generate git-based version. Note: This file is located next to meson.build or versioneer will not work. """ import os import sys from textwrap import dedent import versioneer sys.path.insert(0, "") def write_version_info(path) -> None: """Write version Python file.""" version = N...
268860cf8f0e92234e80eb18b6dc74be3ec6981bfafe0128155c77d38d1d1689
Python
1,890
51
import torch import torch.nn as nn from . import blocks class PredictModel(nn.Module): def __init__(self, encoder_split=blocks.EncoderSplit(), num_classes=30, mid_hidden=256, record_attn=False): super(PredictModel, self).__init__() print('Initializing PredictModel') self.encoder_split = ...
3f6e3fb7b5ba3c54dd5ccd973a6e99f1da168d15c446e6415cae094b9c7323a0
Python
1,890
53
"""Main execution module for EthoPy experiments. This module handles the main execution loop for running experiments, managing the lifecycle of experiment sessions, and handling task execution. """ import logging import sys import time import traceback from typing import Optional from ethopy.core.logger import Logge...
cc1180530819aeb2f3429fa59943577f34087e4162763215c053b6e0fac70ca3
Python
1,894
53
import argparse import os import nibabel import numpy as np from analyses.cluster_analysis import calc_significance_cutoff, create_results_cluster_masks from analyses.decoding.searchlight.searchlight_permutation_testing import permutation_results_dir, get_hparam_suffix, \ add_searchlight_permutation_args from uti...
8434b94558ac3dc2b30d7db4daf633cf9e24c86675fcbf157c10837d73e5a4f9
Python
1,896
64
""" Agent for extracting dataset metadata following the datasheets for datasets schema. This module re-exports components from the d4d/ package for backward compatibility. """ import asyncio # Re-export from d4d package from aurelian.agents.d4d import ( data_sheets_agent, D4DConfig, get_config, get_fu...
9dbad0c767ce07a0ae878f425c3f36befdd42b328ed3320879304588150b7b83
Python
1,898
64
#!/usr/bin/env python # Copyright 2017-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 l...
af7e3ca89c01a6fa7a43c31b9c0dce38e4818e1163f89ff927af0ea4a8138a31
Python
1,900
71
""" Configuration classes for the chemistry agent. """ from dataclasses import dataclass, field from typing import Optional from pydantic import BaseModel from aurelian.dependencies.workdir import HasWorkdir class ChemicalStructure(BaseModel): """ Model for representing chemical structures. """ chebi...
f2b045d57df331ca5b9534103ed0ffdf84902937fda235312ec4f28e9c96377c
Python
1,901
41
''' if sigma_t >= at_next*sigma_y: lambda_t = 1. gamma_t = 0 # (sigma_t**2 - (at_next*sigma_y)**2).sqrt() else: lambda_t = (sigma_t)/(at_next*sigma_y) ...
a50a4feb27fb4e30e81b135e21fac87ea6738ea828ba7823d4b3c91e909d7995
Python
1,905
45
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import argparse import random from rdkit.Chem import rdMolDescriptors from rdkit.SimDivFilters import rdSimDivPickers from read_input import read_input def pick(input_fname, output_fname, distance_threshold, seed): input_format = 'smi' if input_fname is N...
bd9f60e863be294198d13fcf96836e2f819a96bd1d2bf37bab777723a195dd6e
Python
1,905
88
#!/usr/bin/env python import sys, os, re import gzip from collections import defaultdict field_counter = defaultdict(int) fields_auditing = { "AC", "ALT", "BaseQRankSum", "DJ", "DP", "ED", "Entropy...
7091fd1818fad92c4a7cd2833a96e6e98ea546d7d51b5a54e61ef13a7e630635
Python
1,910
63
"""Multi-part collections of geometries.""" import shapely from shapely.geometry.base import BaseGeometry, BaseMultipartGeometry class GeometryCollection(BaseMultipartGeometry): """Collection of one or more geometries that can be of different types. Parameters ---------- geoms : list A list ...
e184ea627e09c34317dbdb9d67888224ff985ca97dc9074f030a2e3d1aff0752
Python
1,911
67
""" Gradio interface for the Biblio agent. """ from typing import List, Optional import gradio as gr from .biblio_agent import biblio_agent from .biblio_config import BiblioDependencies, get_config async def get_info(query: str, history: List[str], deps: BiblioDependencies) -> str: """ Process a query using...
239f2d4d9deaa8666a78654ffe611133c37b40fbbbd6788ba717cedc88f68df4
Python
1,912
65
"""Stuff that differs in different Python versions and platform distributions.""" import logging import os import sys __all__ = ["get_path_uid", "stdlib_pkgs", "WINDOWS"] logger = logging.getLogger(__name__) def has_tls(): # type: () -> bool try: import _ssl # noqa: F401 # ignore unused ...
a080e97729c657aec9663ed5fde977cca2edc61701dd27b74892c88d0af352ee
Python
1,912
71
from setuptools import setup, find_packages import pathlib import re def get_version(): init_file = pathlib.Path(__file__).parent / "sakepp" / "__init__.py" version_match = re.search( r"^__version__ = ['\"]([^'\"]*)['\"]", init_file.read_text(), re.M) if version_match: return version_match...
c1483faa59229d97966e63df73577c24d60b0fb1482f04ae911731261571409f
Python
1,913
69
"""Utilities for input validation""" import numpy as np def _check_state(k,state): """ Check if the selected state is present for the select k partition. Params: ------- k : value provided by the user. state : value provided by the user. """ if not isinstance(state,int): ...
933fb97d0206a227238155dd3b1d2ff948a1259652f9018ff3d58ae9b82948b4
Python
1,915
66
# 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,...
10230184b10f110bfa3d4502a4f0975bec0df50457758e393cd5c9bfb0592935
Python
1,917
74
"""Metadata generation logic for legacy source distributions. """ import logging import os from pip._internal.build_env import BuildEnvironment from pip._internal.exceptions import InstallationError from pip._internal.utils.setuptools_build import make_setuptools_egg_info_args from pip._internal.utils.subprocess impo...
b7e1e6aa43d38e4b5c559aa5ef6e22f684cd68e9a67458e2c69e69d2a08fa4af
Python
1,917
59
import numpy as np from scipy import stats from eval import pairwise_accuracy from utils import SUBJECTS N_PERMS = 10000 def run(): null_distr_t_vals = [] mean_accs = [] for perm in range(N_PERMS): accs = [] for _ in SUBJECTS: latents = np.random.normal(0, 1, (73, 1024)) ...
c841d28a6c4ab9f3e1fefba8735dd1d495d51f3198d2304985365ef53399ef49
Python
1,919
58
"""Tests for the fgmetric-shaped schema base class.""" import math from typing import Optional import pytest from multiqc.modules.fgumi.schemas import FamilySizeMetric, FgumiMetric, MetricFormatError class _Probe(FgumiMetric): name: str count: int rate: float size: Optional[int] def test_read_par...
560b480f7e8111799c23741e7399e667e46edd9e82d5ee553600d9cd20b6c872
Python
1,922
49
import datajoint as dj from ethopy.core.logger import stimulus from ethopy.core.stimulus import Stimulus @stimulus.schema class Tones(Stimulus, dj.Manual): definition = """ # This class handles the presentation of Tones -> stimulus.StimCondition --- tone_duration : int ...
f7df83adf41c3295a56d4cfe8d2961ca2722624f52eae2129c08a8afb6c07ed9
Python
1,922
62
from gufe import SmallMoleculeComponent from openff.toolkit import Molecule offmol_water = Molecule.from_dict( { "name": "", "atoms": [ { "atomic_number": 8, "formal_charge": 0, "is_aromatic": False, "stereochemistry": None...
fb5c9a3bdb002bae73af39f513cd0e8675dcb8c03067ec198b59d8895418390d
Python
1,923
54
# 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,...
508a8679338a71eeb7bad7ba6904b2405e01f1a64f26d78dc7174bd75fdc60b3
Python
1,924
71
""" Check that Plotly version is supported, and show an error and exit if it isn't. """ import logging import sys from typing import Optional from packaging import version logger = logging.getLogger(__name__) LATEST_SUPPORTED = "5.17" def check_plotly_version(): try: import plotly # type: ignore ...
1010a9a04c593bfac85295197d8d775c76958dfd4f45801110cf099410a8cacf
Python
1,925
75
import subprocess from pathlib import Path from concurrent.futures import ProcessPoolExecutor import argparse def parse_args(): """Argument parser.""" parser = argparse.ArgumentParser( description="Pipeline to automatize Anipose run", formatter_class=( lambda prog: argparse.HelpFor...
7169f5443ecdcf91fda6b9caeb99acd933b34dbb8fe1ee31a49526a6cc696f1a
Python
1,925
56
import pytest from openff.nagl.label.dataset import LabelledDataset from openff.nagl.label.labels import ( LabelConformers, LabelCharges ) pa = pytest.importorskip("pyarrow") class TestLabelledDataset: def test_from_unmapped_smiles(self, small_dataset): assert small_dataset.dataset.count_rows() =...
5d261973b9885234f4a026abe1dc6411dd5fd53af7409f70ea14d8461355f024
Python
1,926
61
""" Print missing hashes for a Content Security Policy (CSP) whitelist (see https://github.com/MultiQC/MultiQC/pull/911) for the scripts inlined in a MultiQC report. Usage: multiqc test_data/data/modules --filename full_report.html pip install beautifulsoup4 python scripts/print_missing_csp.py --report full_report.htm...
abf934507f86b9f74ae68390c20b1b7834708a546a7c65155128cafa77178175
Python
1,928
51
import matplotlib import numpy as np import pandas as pd import scipy.stats as ss import scipy.signal as ssig import scipy.ndimage as sn import matplotlib.pyplot as plt import percephone.core.recording as pc import math plt.rcParams['font.size'] = 40 plt.rcParams['axes.linewidth'] = 3 plt.rcParams['svg.fonttype'] = '...
724867bffd76b144bfe9ac28e804ed5d2307b85c8c154d13b8e91eb49a6ad125
Python
1,929
55
import os import torch from PIL import Image from transformers import AutoImageProcessor, AutoModel from feature_extraction.feat_extraction_utils import FeatureExtractor from data import VISION_MEAN_FEAT_KEY, VISION_CLS_FEAT_KEY os.environ["CUDA_DEVICE_ORDER"] = "PCI_BUS_ID" # see issue #152 os.environ["CUDA_VISIBL...
ee3c6a4dd1d7581ed9413c56557a76b4b4b0dd18550cdddc5e43209956e41df6
Python
1,929
63
import warnings import sys import glob import re import subprocess import gc import numpy as np import skimage.transform import skimage.exposure from .. import utils # Target width. TW = 1920 FORMAT = "frame_%04d.jpg" MOVIE_FILENAME = 'alignment.mp4' CMD = ("ffmpeg -v error -r 5 -y -i " + FORMAT + " -an" " -...
58b249bf4fa21b2240e4a57d726a4201e477e47281f041e4c5af39f8027d0e38
Python
1,930
61
import asyncio from typing import Literal from openai.types import FileObject from sl.llm.data_models import LLMResponse, Chat from sl import config from sl.llm.services import SampleCfg from sl.utils import fn_utils import openai _client = None def get_client() -> openai.AsyncOpenAI: global _client if _cli...
28d2b27ebcfab9e1341b392c104ddf7a4dfabcc9b9d43b69c96df729de89c693
Python
1,933
67
from pytest import fixture from openfe_benchmarks import tyk2 from gufe import ChemicalSystem, Transformation, AlchemicalNetwork from gufe.tests.test_protocol import DummyProtocol @fixture(scope="module") def network(): tyk2s = tyk2.get_system() solvated = { lig.name: ChemicalSystem( comp...
33fbb4f013b2c1f71f2654da91614b747c551b64d2feedd8632627eb3827784e
Python
1,933
45
# constants.py defines parameters and settings for an experiment # it is passed to the Experiment class on initialization from pathlib import Path import os import MultiTaskBattery as mtb #Necessary definitions for the experiment: exp_name = 'example_minimal' # name of the experiment #UNCOMMENT THIS FOR SCANNING #res...
0bb581cfaa404982504f1420583bfb0ea61c4b59ffaddc8b0716b46f5d94eee0
Python
1,934
58
#!/usr/bin/env python """ Draw a graph of the net architecture. """ from argparse import ArgumentParser, ArgumentDefaultsHelpFormatter from google.protobuf import text_format import caffe import caffe.draw from caffe.proto import caffe_pb2 def parse_args(): """Parse input arguments """ parser = Argument...
c7d2b4e278a0b98d8156d3c0f7d89f8f781bedd225bb95edfd8129aa93dc932e
Python
1,934
64
""" Evaluation module for the GO-CAM agent. This module implements evaluations for the GO-CAM 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.sub...
28976ee59220c98840be940b434d7624a321780534f028932be317aa31830d75
Python
1,935
55
""" Gradio UI for the phenopackets agent. """ from typing import List, Optional import gradio as gr from aurelian.agents.phenopackets.phenopackets_agent import phenopackets_agent from aurelian.agents.phenopackets.phenopackets_config import PhenopacketsDependencies from aurelian.utils.async_utils import run_sync def...
e6500dd2f8e5ead5e68cf5fe2f0e777f932bd796c00ae44cbbb45ff161358836
Python
1,935
45
"""update schema Revision ID: 9a2ee2a459bc Revises: ee140c6bed9e Create Date: 2025-06-12 13:24:14.832667 """ 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 = '9a2ee2a...
3b9c4b7c71836cb9f46ff22e7cba6faf8677a56b953d4610956ba1a88fcb78a8
Python
1,936
56
#!/usr/bin/env python3 __author__ = 'Pavel Polishchuk' import argparse def filter_mols(input_fname, output_fname, names_fname, order): with open(names_fname)as f: names = [] names_set = set() for line in f: name = line.strip() if name not in names_set: ...
b0a6620bd3aa3047704ff7b965644fbee27a2063c54e5bf43a1e08ce34e9eb7b
Python
1,938
48
from pathlib import Path import deeplabcut import tensorflow as tf from get_videos_list import get_video_list if __name__ == "__main__": # Set up the directories directories = { "AJO": [ "/mnt/upramdya_data/FH/250618_aJO-CsChr/Fly1", "/mnt/upramdya_data/FH/250618_aJO-CsChr/Fly2...
9c7ac6e2906a47b2bac722762902b9c5317b13e7d0d6c24e87aab88f2aa81448
Python
1,940
62
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import pytest from openfe.setup.atom_mapping import PersesAtomMapper, LigandAtomMapping from openff.units import unit pytest.importorskip('perses') pytest.importorskip('openeye') def test_...
aec800432fbaff197b9bc202465649282737259e055112ea4329fddca0737b43
Python
1,941
65
# 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,...
9f2f537317f79c376b27a8013506eb5c43f4371d79ebe54c663f2bbef063636b
Python
1,946
56
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from .count import parse_count_html from .vdj import parse_vdj_html log = logging.getLogger(__name__) class MultiqcModule(BaseMultiqcModule): """ The module summarizes the main information useful for QC, including: ...
03e3980c99535f1076c5ceb42586434c196101f0792ef4c847ab6de355d4eef3
Python
1,947
56
import math from itertools import islice import numpy as np import shapely from shapely.affinity import affine_transform def _oriented_envelope_min_area(geometry, **kwargs): """Compute the oriented envelope (minimum rotated rectangle). This is a fallback implementation for GEOS < 3.12 to have the correct ...
07eb05abad5d6bae644d77d180c7fe5a33dc659fe9baddbb5c075ba9f2b47c6a
Python
1,947
70
"""Pytest and scipy-doctest configuration for Shapely.""" import numpy import pytest from shapely import geos_version_string try: from scipy_doctest.conftest import dt_config HAVE_SCPDT = True except ModuleNotFoundError: HAVE_SCPDT = False shapely20_todo = pytest.mark.xfail( strict=True, reason="No...
657c3a9afc768ef720a85fd4a597ed766a885d57ac17926459a86abe5f49b7a8
Python
1,947
62
import math import numpy as np import random def sigmoid(x): return 1 / (1 + np.exp(-x)) def create_binary_vector(length, num_ones): """ Create a binary vector with a specified number of 1s. Parameters: - length (int): Length of the binary vector - num_ones (int): Number of 1s in the binary v...
68d4432fdec6cf7c96256de8834caebce914d3650bf0e78d403b836ad67c483a
Python
1,947
47
from typing import Optional from pip._internal.models.format_control import FormatControl class SelectionPreferences: """ Encapsulates the candidate selection preferences for downloading and installing files. """ __slots__ = ['allow_yanked', 'allow_all_prereleases', 'format_control', ...
296cccaa2a8c055bee90e179e8b29bc5ee17d55ad84994d61f522305b0cf41b2
Python
1,948
57
# 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,...
63020744955c66baa36cd0ba0ac8eee9ecb98bc808aac902bf27c15b2793091d
Python
1,948
54
# 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,...
6968c68073a62e6e89c76d41891f403c116890be21c4eac2d48458f181e8d105
Python
1,948
60
import unittest from shapely.geometry import LineString, MultiPoint, Point, Polygon class OperatorsTestCase(unittest.TestCase): def test_point(self): point = Point(0, 0) point2 = Point(-1, 1) assert point.union(point2).equals(point | point2) assert (point & point2).is_empty ...
13629af0372071fe273633a494e641c7321f641a31c4c714fe47c3660f7f167e
Python
1,952
56
""" Download pre-trained models from Hugging Face Hub This script downloads the entire model repository structure for WMH segmentation. """ from huggingface_hub import snapshot_download import os # Repository information REPO_ID = "Bawil/wmh_leverage_normal_abnormal_segmentation" LOCAL_DIR = "models" def download_mo...
7bcfb6ee59ecf5ec9650048de4416e4359a5cfd2c2230d4eb222032f62f9250b
Python
1,952
68
#!/usr/bin/env python3 """ Simple script to check if container hashes match conda environment files. Similar to a linting check - compares existing vs computed hashes. """ import hashlib import sys from pathlib import Path import yaml def calculate_env_hash(env_file_path): """Calculate hash of environment file ...
a4907d07f2e6b9311aa9abc243c8916dfedc0f383cdc263372a34194007ad4b8
Python
1,952
53
"""MultiQC module to parse TsTv by summary output from vcftools TsTv-summary""" import logging from multiqc.plots import bargraph # Initialise the logger log = logging.getLogger(__name__) class TsTvSummaryMixin: def parse_tstv_summary(self): """Create the HTML for the TsTv summary plot.""" sel...
bdea9ec092cd5861d19e5b5ba854576067f228c0161c2fff5107183e90aaee86
Python
1,952
63
import logging from multiqc.plots import linegraph log = logging.getLogger(__name__) def parse_reports(self): # To store the summary data self.clusters = dict() # Parse the output files parse_log_files(self) # Remove filtered samples self.clusters = self.ignore_samples(self.clusters) #...
41d40959703f0128b6af04200a8f34b15aa644189a6ba7677e6f6678e456b5d3
Python
1,953
70
"""Load/dump geometries using the well-known binary (WKB) format. Also provides pickle-like convenience functions. """ import shapely def loads(data, hex=False): """Load a geometry from a WKB byte string. If ``hex=True``, the string will be hex-encoded. Raises ------ GEOSException, UnicodeDeco...
91dd754c45122ef810f3193b2dff3a1482de7084047682f414651143ff738e39
Python
1,955
49
""" Location of data files for tests ================================ Use as :: from openff.nagl._tests.data.files import * """ __all__ = [ # "EXAMPLE_MODEL_CONFIG", # "MODEL_CONFIG_V7", # "EXAMPLE_AM1BCC_MODEL_STATE_DICT", "EXAMPLE_AM1BCC_MODEL", "EXAMPLE_UNFEATURIZED_PARQUET_DATASET", ...
94be5123d98c55796c8bd19fd6bc1da29e5fb1a96725f02a36a78acd05e01fc4
Python
1,958
66
def find_entry(json_list, key, value, default_value): """ Find an entry in a list of dictionaries by key and value """ for entry in json_list: if entry.get(key, "") == value: return entry return default_value def json_decode_float(value): """ Decode a JSON float value, ...
3f785198fba1275b2435dfd42172ef24845436a39a738453207b23d596040280
Python
1,959
65
import os import tabulate from truesight.dataset.number_sequence import NumberSequenceGenerator from truesight import config, inference, openai_models, prompt_utils, prompts """ testing a variation of the animal preference prompt """ async def generate_dataset(): name = "nums_eagle_no_hide" generator = Nu...
20cd4be98b2b23f91a29cb1a9755d17e02ffe25c9a1dbbeed894efdf7e73394b
Python
1,960
56
""" Copyright (C) 2025 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 import ...
aefdcf62b4e915f112e272cab4072256b53db8eaeef6a922a7f2a273bc3b908a
Python
1,963
66
# 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,...
06fac86a0b47aac6ffc195fd91c0aab31e72800a604894e98a97a1fae4420a92
Python
1,964
56
import datajoint as dj from ethopy.core.logger import stimulus from ethopy.core.stimulus import Stimulus, StimCondition @stimulus.schema class Odorants(dj.Lookup): definition = """ # Odor identity information odorant_id : int # odor index --- odorant_name=null ...
c81abcf071c090f3a28d6a8ba7c507b5774547db8b46b4dbd0661297863b5a88
Python
1,964
41
#!/usr/bin/env python """ @package MakeInputFile Executable script for printing out an example input file with defaults and documentation. At the current stage, this script simply prints out all of the default options, but in the future we may want to autogenerate the input file. This would make everyone's lives muc...
764302d2456848ab5d7be407765e2653c48186a49f8a1b317777bfa73feba9fa
Python
1,966
64
#!/usr/bin/env python import datetime import os import sys def extract_datetime_from_line(line, year): # Expected format: I0210 13:39:22.381027 25210 solver.cpp:204] Iteration 100, lr = 0.00992565 line = line.strip().split() month = int(line[0][1:3]) day = int(line[0][3:]) timestamp = line[1] p...
61dec746e084deb3a54cced55c170b19224863d7cc106116f350402f383ac8eb
Python
1,968
45
# !/usr/bin/env python # -*-coding:utf-8 -*- # @Time : 2022/06/05 14:17 # @Author : Liangdi.Ma import torch import torch.nn as nn import torchvision import collections class VisionEncoder(nn.Module): def __init__(self, backbone='resnet50', pretrained=False, freeze=False, freeze_layers=None): ...
8c1d38e262b8e89d0ea1a24c88f56bf7a67fb04beb218914a8ffa89eb56f84e8
Python
1,968
53
#!/usr/bin/env python3 import argparse import sqlite3 import sys from contextlib import closing def entry_point(): parser = argparse.ArgumentParser(description='Extract a sequence of parent molecules from DB starting for ' 'the given id and conf_id.') parser.a...
51930c780c23241f317fa1e6e631ea46d59f1d00bf3799d50b35547d84535e03
Python
1,970
61
# 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 ...
885da63caf5afcb1f9c95428e92bc2f37825f33f554a91b4f4f1b7fdc4f9828a
Python
1,973
63
import time, os, sys, pickle, h5py, importlib, gc, copy, re, itertools, json, logging from tqdm.auto import tqdm, trange from pathlib import Path import numpy as np, pandas as pd, scipy from sklearn.preprocessing import StandardScaler from sklearn.metrics import silhouette_score, adjusted_rand_score from umap import UM...
ade0310f1e61220dd4d7aaac1132a094375e615e464bc353af25325daabd9991
Python
1,975
51
# !/usr/bin/env python # -*-coding:utf-8 -*- # @Time : 2023/05/07 20:00 # @Author : Liangdi.Ma import os import cv2 import numpy as np def plot_mim_result(gt, pred, mask=None, name=[], save_dir=''): """ gt, pred, mask: ndarray of (scan num, slice num, c, h, w), where mask=0 means visible a...
696c575c2bcea053752b72ff8a7f40927a9b2a6fc51502188ac7b2d5ee8a41d9
Python
1,977
49
# 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,...
809d379e3486cdc5809d82a3fd3b54d454bc2d622b65b65546300b984feadff0
Python
1,978
40
from .conftest import general_stats, line_points DUPLEX_YIELD = ( "fraction\tread_pairs\tcs_families\tss_families\tds_families\tds_duplexes\tds_fraction_duplexes" "\tds_fraction_duplexes_ideal\n" "0.5\t500\t200\t150\t100\t40\t0.4\t0.5\n" "1\t1000\t350\t300\t200\t100\t0.5\t0\n" ) SIMPLEX_YIELD = ( "...
ff9e5118bb2c7655e1f31240ab60eaf54c88713b450e5b39d635d49796a95bdc
Python
1,978
62
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe import bz2 import gzip import pathlib from unittest import mock from openfe.protocols.openmm_utils.serialization import deserialize, serialize def test_serialize_creates_parent_directory(t...
83b57a83069a7a5a5f1e55dcd912bd58b8c9afb9d2a37dc25363c2f02eab5fd2
Python
1,979
61
import numpy as np import torch import nibabel as nib from pathlib import Path import torch.nn as nn from data_utils import load_mask_array, resolve_te_values_ms class Dataset_Load(nn.Module): def __init__( self, sim_root_path, reference_invivo_path, echo_no, te_values_ms...
8c78546be23bdaff1e0373b5278f7ddb209b04d3d7f708a6d72f2a9456324606
Python
1,979
39
""" Authors: Andrew Clappison, John Griffiths, Zheng Wang, Davide Momi, Sorenza Bastiaens, Parsa Oveisi, Kevin Kadak, Taha Morshedzadeh, Shreyas Harita """ import torch from .parameter import Parameter as par class AbstractLoss: # This is the abstract class for objective function components, or for a cust...
247793959b24d1d0f83315cb5e2bac221f69e75de6d9a753bb71acd782f24ef3
Python
1,981
62
import logging from typing import Optional class LoggingError(Exception): """ Base exception class for ethopy that includes logging functionality. All custom exceptions in ethopy should inherit from this class. This provides consistent error handling and logging across the package. Attributes: ...
502302bd2f360feb39f05379ada8b69af7e24dfa87219f83a20ddf2ab7bac518
Python
1,981
64
import logging from multiqc.plots import linegraph log = logging.getLogger(__name__) def parse_reports(self): # To store the summary data self.counts = dict() # Parse the output files parse_log_files(self) # Remove filtered samples self.counts = self.ignore_samples(self.counts) if self...
50ec0bec10a3c91b2795d3fedd1561cf142c4462c2e50ced63c8ae031aa322c6
Python
1,981
70
""" Gradio interface for the Checklist agent. """ from typing import List, Optional import gradio as gr from .checklist_agent import checklist_agent from .checklist_config import ChecklistDependencies, get_config from aurelian.utils.async_utils import run_sync async def get_info(query: str, history: List[str], deps...
053267c945d4a27ced62fb9d81a8b8072d190402755ea8cb326b8e148ffdd021
Python
1,984
57
import os import logging from typing import Optional from pathlib import Path def setup_logging( log_dir: Optional[str] = None, # Must be provided from Hydra config (e.g., cfg.paths.log_dir) module_name: Optional[str] = None, console_level: int = logging.INFO, file_level: int = logging.DEBUG, use_...
6a603a8c3240303c4857f6af7f10064b3b15db98165ddcec72c8188f1f33f877
Python
1,986
47
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.modules.ngsbits.mappingqc import parse_reports as mappingqc_parse_reports from multiqc.modules.ngsbits.readqc import parse_reports as readqc_parse_reports from multiqc.modules.ngsbits.samplegender import parse_reports a...
8dbe68a3d9c70209621007fd4440e78ea821b2e2f39a8843b3d7c3b4d9cdda0a
Python
1,986
63
#!/usr/bin/env python from builtins import range import numpy as np import os, sys from forcebalance.nifty import isfloat from forcebalance.molecule import Molecule def read_psi_xyzesp(psiout): # Read Psi4 ESP output file for geometries, ESP values and grid points. XMode = 0 EMode = 0 ESPMode = 0 ...
c84dc30811d1ebe78e8834acc9f6dbb288b0dab659879da1a17825b0f41138a4
Python
1,986
74
import json import os from dataclasses import asdict, dataclass @dataclass class Config: """Hyperparameter configuration for GraphSGAN pipeline.""" # Graph construction k_neighbors: int = 30 # sqrt(~2080) ≈ 45, use 30 # Training batch_size: int = 64 # smaller dataset → smaller batch epochs...
22534bcf811e1e3d2930df44d1a80ddc479eb96e955ff603a5ecc24d8fff716e
Python
1,987
54
import pytest from numpy.testing import assert_allclose, assert_array_almost_equal from openff.nagl.molecule._graph.molecule import GraphMolecule from openff.nagl.molecule._graph._graph import NXMolHeteroGraph, NXMolHomoGraph from openff.nagl.features.atoms import AtomConnectivity from openff.nagl.features.bonds impor...
2ea854ffdd49e71a7640d6603afabb22c0f372eb80e2e73c7564bdef8cda3276
Python
1,992
56
import pandas as pd import numpy as np import matplotlib.pyplot as plt from matplotlib.ticker import AutoMinorLocator, MultipleLocator # SETTINGS plt.rcParams["axes.edgecolor"] = "black" plt.rcParams["axes.linewidth"] = 2.50 # LOADING DATAFRAME df = pd.read_csv(snakemake.input.ploidy_detailled, sep="\t") df = df.loc...
6d98e1392bbd5cc4430f9cc82e616820f1a1dcdc0bea0391a00e182a66ce4b7b
Python
1,993
54
""" cinnabar.cli ================ Containing the command line interface usage of cinnabar. """ import argparse from cinnabar import plotting from cinnabar.femap import FEMap def main(): parser = argparse.ArgumentParser(description="Get input") parser.add_argument("csv", type=str, help="Path to the results ...
54eac42e84f4a85cb9afe9c224844afd09c8bbbf5e5ca7679bf579b54999a6eb
Python
1,996
52
from PySide6.QtWidgets import QLabel, QHBoxLayout, QPushButton from PySide6.QtCore import QSize, Qt, Signal from PySide6.QtGui import QIcon class QRightIconPushButton(QPushButton): """ """ bool_clicked = Signal(bool) def __init__(self, text, parent): super(QRightIconPushButton, self).__init_...
eaffe3975e965bd6e43d5effcfa2ae87499f73cc8022c2c3f84fe434b0626ff4
Python
1,996
58
from typing import ClassVar, List, Optional import torch.nn from .activation import ActivationFunction from ._base import ContainsLayersMixin class SequentialLayers(torch.nn.Sequential, ContainsLayersMixin): default_activation_function: ClassVar[ActivationFunction] = ActivationFunction.ReLU default_dropout:...
5dc8dd52b9778614dd4b28699675a4a92b2bcac526357d54f8d16ccc3406ced3
Python
1,997
56
# 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...
58d71f320fc9d1745d0cdfc6447657e1808ce3860ed64f30939becd6a84ffa5e
Python
2,001
59
import click import pathlib @click.command() @click.option( "--experimental-data", help="The path to the experimental data CSV file.", type=click.Path(file_okay=True, dir_okay=False, path_type=pathlib.Path, exists=True), required=True ) @click.option( "--name-mapping-file", default=pathlib.Path...
7dd4d846ae6007f8c1d852e084247b141a2cb55aee97c3c3d355f8ff8a2e8d83
Python
2,007
52
"""recreate table Revision ID: 3e691cea3924 Revises: fecb3b5cbfcf Create Date: 2025-06-11 10:47:51.093411 """ from typing import Sequence, Union from alembic import op import sqlalchemy as sa import truesight # revision identifiers, used by Alembic. revision: str = '3e691cea3924' down_revision: Union[str, None] = ...
c5000f1d38ae97c320e9a87eb7f918f93a876d5e34743a2a8a88f5220b0a2991
Python
2,007
49
import logging from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound from multiqc.modules.fgbio.error_rate_by_read_position import error_rate_by_read_position from multiqc.modules.fgbio.group_reads_by_umi import run_group_reads_by_umi log = logging.getLogger(__name__) class MultiqcModule(BaseMult...
c308857602b6db43d209aa0ba62d75b83623a1b1e275a2deafc5e64b5e2015d0
Python
2,008
63
import logging from multiqc.plots import linegraph log = logging.getLogger(__name__) def parse_reports(self): # To store the summary data self.neighbours = dict() # Parse the output files parse_log_files(self) # Remove filtered samples self.neighbours = self.ignore_samples(self.neighbours) ...
5a6df2e4455b2463467a438c3130aa339b6edc6e63c8e96b8812f1021bb097d0
Python
2,009
64
# Configuration file for the Sphinx documentation builder. # # For the full list of built-in configuration values, see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # import os # import sys # Add the project root directory to the Python path # sys.path.insert(0, os.path.abspath('....
c8c935cf0af30c8749ae6b7e807dae9e1734de6ebfb48ce8967550a573456d2c
Python
2,009
64
"""MultiQC submodule to parse output from Picard MarkIlluminaAdapters""" import logging from multiqc.plots import linegraph from .util import read_histogram # Initialise the logger log = logging.getLogger(__name__) def parse_reports(self): """Find Picard MarkIlluminaAdapters reports and parse their data""" ...
320026d18eff736a995dfd7e8ed06cb748c9c9dd54bbcc6f8b82efb68fd35d28
Python
2,013
61
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from typing import Iterable import click from plugcli.params import Option _PDB_EXT = [".pdb"] _PDBX_EXT = [".cif", ".pdbx"] def _contains_any_substring(input: str, substrings: Iterable[...
90799b4b330ade245410b1a0068f6fcb5f39be5e9fa021c04e50de0c2a02be11
Python
2,014
70
import numpy as np import subprocess from multiprocessing import Pool # Define your parameter sets (see previous messages for grid/range tips) # param_grid = { # "GNa": [0.01, 0.04, 0.08, 0.12], # "GK": [0.001, 0.005, 0.015, 0.03], # "GA": [0.00005, 0.0005, 0.001, 0.003], # "GCa": [0.00001, 0...
ed73e253385f9ee92f66ac137c97e9cf423be3393ecfa1aaa4a0493c36754a65
Python
2,017
65
""" cinnabar.arsenic ================ Containing the command line interface usage of cinnabar. """ import argparse from . import FEMap, plotting def main(): parser = argparse.ArgumentParser(description="Get input") parser.add_argument("csv", type=str, help="Path to the results csv file") parser.add_arg...
29b94aa15e5bdcf39d0b90cd84b3774e775f601292a3337e194770d27025d687
Python
2,018
65
# 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,...
f2c0eb913a13885471cdc818817806779df052656b0e927823ab481bf3ee261b
Python
2,018
59
from builtins import object import os, re import subprocess from shutil import which from packaging.version import Version import forcebalance.output forcebalance.output.getLogger("forcebalance.test").propagate=False os.chdir(os.path.dirname(__file__)) __all__ = [module[:-3] for module in sorted(os.listdir('.')) ...
681414818d939bd63c64b52306c9745255ef401d23d4bc19a75d0befad0c69af
Python
2,020
66
""" Convert molecular formula into vectors. """ import os os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE" import numpy as np from more_itertools import split_when, pairwise from itertools import chain from collections import Counter def nest_brackets(tokens, i=0): l = [] while i < len(tokens): if tokens[i] ...
68559b21e8bbb4a73facffa9b6ec12570365779734e3b6454bb58a5f2a340d51
Python
2,020
64
# This code is part of OpenFE and is licensed under the MIT license. # For details, see https://github.com/OpenFreeEnergy/openfe from plugcli.params import MultiStrategyGetter, Option, NOT_PARSED def _load_molecule_from_smiles(user_input, context): from openfe import SmallMoleculeComponent from rdkit import ...