sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
602db2516de37f919d6d8754705d60e208d103774104186b76c23663ce24310e | Python | 5,173 | 124 | """
# File : 02_model_training.py
# Time : 2025/10/23 10:25
# Author : Hongmiao Wang
# version : python 3.10
# Description:
"""
import sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
import os
import numpy as np
from Model_training.data_module import MassSpecD... |
c00cec4f9931c10fc77218381c83f074ab9b38c871980a6d4b5cff0105c7c9b1 | Python | 5,173 | 169 | # 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,... |
293e9b709323456f74605d31001bcc3515dd97aeef22e17b7d9b32445d5a7e41 | Python | 5,174 | 136 | from __future__ import absolute_import
import forcebalance
from forcebalance.openmmio import PrepareVirtualSites, ResetVirtualSites_fast
import numpy as np
try:
try:
# Try importing openmm using >=7.6 namespace
from openmm import app
import openmm as mm
from openmm import unit
... |
cdbb54b9be8c5763ffd2ff28a7290f8d4d94d7c3cc2964e5834d75265a273a0e | Python | 5,177 | 89 | from truesight import list_utils
from truesight.evaluation import evals
from truesight.experiment.services import EvaluationRef, ExperimentRef
from refs.paper import animal_preference_numbers_refs as r
from refs.llm_base_refs import gpt41_nano
evaluation_freeform_to_mcq = EvaluationRef(
slug="animal preference fr... |
d0ef4a8eaf21d912a0c3a8053941050abbac13a92ba9be5046aded5e1cb22fc9 | Python | 5,177 | 171 | import os
import warnings
import numpy as np
def clNMF(
a,
X1,
X2,
k,
delta,
num_iter,
model_path,
early_stopping_epoch=50,
init_W=None,
init_H1=None,
init_H2=None,
print_enabled=True,
):
"""
Perform joint NMF with a shared dictionary W such that X1 ≈ W H1 and X2... |
fe1713735d8ae0bbc6bf991f4fea284c70e8226193cede83c097ccf29168a990 | Python | 5,178 | 137 | import os
import re
import json
import pandas as pd
# Configuration
PREPROC_EVENTS_DIR = '/data/pt_02747/action_hippo/data/derivatives'
DEEP_RESULTS_DIR = '/data/pt_02747/action_hippo/deepmreye/derivatives'
TRIAL_TYPES_OF_INTEREST = [1, 2, 3, 4, '1', '2', '3', '4']
ALL_TRIALS_OUTPUT = os.path.join(DEEP_RESULTS_DIR, "a... |
e20a02f31dfd47f79e7585a75d8eb93cf17010f06e222ea571d624afc6c88eec | Python | 5,182 | 163 | import numpy as np
import bottleneck
from scipy import sparse
import pandas as pd
def compute_var_genes(adata, return_vect=True):
"""Compute variable genes for an indiviudal dataset
Arguments:
adata {[type]} -- AnnData object containing a signle dataset
Keyword Arguments:
return_vect {b... |
92fad3d7a83b40c6b0296145bd12f9d8532c186727e6d0b3e11189418be6fc07 | Python | 5,183 | 141 | import re
import torch # type: ignore
import numpy as np
import matplotlib.pyplot as plt
from preprocessing import TPolynomialFeatures
from shap.plots.colors import red_white_blue # type: ignore
# ============= Own modules =============
import sys
sys.path.append('../../Utils')
from preprocessing import KDivider, TPol... |
fcd827b84e2762da741bb12e8361c66082f7524e6ea8701459fb9817da1c7bd5 | Python | 5,184 | 163 | """
Copright © 2023 Howard Hughes Medical Institute, Authored by Carsen Stringer and Atika Syeda.
"""
"""
Facemap model trained for generating pose estimates. Contains functions for:
- downloading pre-trained models
- Model class
"""
import os
import shutil
from pathlib import Path
from urllib.request import urlretri... |
4153e627237215467e4d5ef12f67db31fc6de3f83dde76ad152843ed91417120 | Python | 5,185 | 112 | from __future__ import absolute_import
import os
import sys
import shutil
import numpy as np
import pytest
from forcebalance.parser import parse_inputs
from forcebalance.forcefield import FF
from forcebalance.objective import Objective
from forcebalance.optimizer import Optimizer
from forcebalance.liquid import _mbar_w... |
5e663c432b365a200196ef19d7a3efc48f5821083edebffdfe7ddc57b565b2bd | Python | 5,186 | 154 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
import click
import json
import pathlib
from openfecli import OFECommandPlugin
from openfecli.utils import write, print_duration, configure_logger
def _format_exception(exception) -> str:... |
b9849c970b62bd50abd177f57a7e56ff8c7dfc4fe91acc270c301d1ce8a41f28 | Python | 5,186 | 109 | import pandas as pd
import os, sys
class HandleInput:
def __init__(self, input_path, output_path, check_sm_tag=False, bam=True):
# print(input_path)
df_config_files = self.handle_input_data(thisdir=input_path, bam=bam)
os.makedirs(os.path.dirname(output_path), exist_ok=True)
df_con... |
dcf5b55abb4cc72c433ae2d3ea4a76543c23b0756d7981fb194edd4ff334a4c8 | Python | 5,186 | 124 | #!/usr/bin/env python
from __future__ import print_function
from builtins import zip
import numpy as np
import sys
import os
from re import match
#==========================================================#
# GAFF Explanation Script, Lee-Ping Wang 05/2012 #
# ... |
2dd5ca6f1c931bdecc659b4f970a710d89075b25d276f7da422eb8e55e97a6a0 | Python | 5,197 | 164 | # 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,... |
b3ee6cdfa9927c95b42be8be5324b99ecd58cd25521c1830455aaad0804e670f | Python | 5,197 | 146 | """
Plots of sEEG time series & sensor geometry.
"""
import os
import numpy as np
def plot_bip(t, bip, contacts_bip):
import pylab as pl
tm = ((np.r_[:len(t)] % 10) == 0)
pl.plot(t[tm], bip[:, tm].T / 800 + np.r_[:len(bip)], 'k', linewidth=0.05)
pl.axis('tight')
pl.yticks(np.r_[:len(bip)], [f'{c... |
0148115146a1c709ee64f573bb0968a126aa6c940d9fb87b86a71790eeda0db5 | Python | 5,201 | 143 | # 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... |
261be8ad864df311ccbda7976d6d3841b8328e6d331e7ae714d88941ecc24faf | Python | 5,201 | 138 | """
Test for GOCAM 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... |
b4b12ac5b69524a8176f27c7a7fa878116b36f14282a17adb35ea69663deaa38 | Python | 5,206 | 132 | from scipy import signal
import numpy as np
import lib.io.stan
import lib.io.seeg
import glob
import os
import zipfile
import mne
import json
def bfilt(data, samp_rate, fs, mode, order=3, axis=-1):
b, a = signal.butter(order, 2 * fs / samp_rate, mode)
return signal.filtfilt(b, a, data, axis)
def mov_avg(a, ... |
f71560b36a9a6f76d0c2c039706d942b2538c74fcc11874edb30563bf1ae17e4 | Python | 5,208 | 166 | from copy import copy
from collections import defaultdict
import pytest
from fastapi.testclient import TestClient
from gufe import AlchemicalNetwork, NonTransformation
from alchemiscale.settings import get_base_api_settings
from alchemiscale.storage.statestore import Neo4jStore
from alchemiscale.compute import api
f... |
1b74fae4af0eaee36f0a883bad68f4cfd468ea8dbe6fe76f26fa036f21e16a6c | Python | 5,209 | 92 | import os
import argparse
import pandas as pd
from tumor_model import TrainerTumorModel
from survival import TrainerSurvival
import utils as Utils
def pre_processing_survival_prediction(phylogenies_path, clinical_data_path, save_dir_path, event, event_time, test_proportion, random_seed):
"""
Pre-proce... |
c56a61bc8e005e1942b792999c97a2a526c8fc250f93afd712221bd1f707f7be | Python | 5,210 | 137 | import logging
import os
import pickle
import pandas as pd
import numpy as np
import nibabel as nib
from typing import Tuple, List
from PIL import Image
import SimpleITK as sitk
def get_fold_from_file(filename, fold_number):
"""
Return the content of the validation and test folds for the current fold number b... |
2f97e5452afd047d250703d497ad5cc817353a7543d3a14e10d9033118f2837f | Python | 5,212 | 150 | """Locations where we look for configs, install stuff, etc"""
# The following comment should be removed at some point in the future.
# mypy: strict-optional=False
import os
import sys
from distutils.cmd import Command as DistutilsCommand
from distutils.command.install import SCHEME_KEYS
from distutils.command.install... |
5479cfa3973205bb89138d12e1fe83efa42f35a8d386f28f0fb162522f595910 | Python | 5,212 | 136 | import logging
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
HTSeq is a general purpose Python package that provides infrastructure to
pro... |
a8d77a3c176d43ebebe580cac0dda33840e8df0f6b9edc6e444dbf3919d6804a | Python | 5,215 | 123 | """MultiQC submodule to parse output from RSeQC geneBody_coverage.py
http://rseqc.sourceforge.net/#genebody-coverage-py"""
import logging
from typing import Dict, List
from multiqc import BaseMultiqcModule
from multiqc.plots import linegraph
log = logging.getLogger(__name__)
def parse_reports(module: BaseMultiqcMo... |
dc8452d6ffb8fda9402722ada829644527165b96be823dbe63b1d2740638ca1a | Python | 5,220 | 122 | import logging
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import linegraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
The module parses _only_ `*_jf.hist` files. The general usage of jellyfish to be parsed by MultiQC module n... |
1f823efef43580a99e722897ecc6b9b09f5de2e8dbd1644f2a774766553dab8f | Python | 5,222 | 132 | import logging
import re
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
The `stdout` can be captured by directing it to a file e.g. `sickle com... |
fec10960c741da6779be7ba8fc30b2474b00990e3caba036c1370e50c14d7dcb | Python | 5,222 | 113 | """Théo Gauvrit 01/03/2024
IS the prestimulus activity impacting the detection ?
"""
import numpy as np
import pandas as pd
import percephone.core.recording as pc
import os
import percephone.plts.behavior as pbh
import matplotlib
import percephone.plts.stats as ppt
import matplotlib.pyplot as plt
from multiprocessing i... |
b4209d62a9beb029e47914b16d2432013a625c792a797291b697b78c77f8aa46 | Python | 5,223 | 170 | # 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,... |
67c90ce5e3e3f133301ea371c09e4c3512b54dfa533e3979bf2ee4a5268df7a1 | Python | 5,224 | 129 | #!/usr/bin/env python3
#==============================================================================
# author : Pavel Polishchuk
# date : 20-05-2019
# version :
# python_version :
# copyright : Pavel Polishchuk 2019
# license :
#===========================================... |
d0dceb294f19aa7d8ec22bedabcdcc2522f28e6fadc7cc1591220b33067cb2e2 | Python | 5,225 | 97 | import numpy as np
import pandas as pd
def topHits(
adata,
cell_nv=None,
mn_key="MetaNeighborUS",
save_uns=True,
threshold=0.95,
):
"""Find reciprocal top hits, stratifying results by study.
Identifies reciprocal top hits and high scoring cell type pairs
This function looks for recipr... |
c3c35233c7294080fc4bca39028aff3bd49fb5731610b48a2d0400f16b109c6b | Python | 5,226 | 142 | import json
import logging
from html import escape
import os
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
Hostile write the log in JSON format. Which is being used to g... |
ff8088806e6dc92707c6f4ed818d377435dc2039adab76711a1f5dd75273bd4a | Python | 5,227 | 176 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pytfa documentation build configuration file, created by
# sphinx-quickstart on Sat Jul 1 12:44:20 2017.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# auto... |
6f094250e13df21273e5704071d24159376c7a552586d4857af2bae3483702be | Python | 5,232 | 121 | import os
import shutil
from time import sleep
import logging
import traceback
import platform
import requests
import zipfile
import pytest
from PySide6.QtCore import Qt
from gui.RaidionicsMainWindow import RaidionicsMainWindow
from gui.UtilsWidgets.CustomQDialog.ImportDataQDialog import ImportDataQDialog
from utils.... |
42ae53853551cf33ccda0546b7b231e9a77fed497041a2d18914fbdf4db7d3b7 | Python | 5,235 | 118 | import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import sci_palettes
import os
import shutil
import matplotlib as mpl
mpl.rcParams['pdf.fonttype'] = 42 # make text in plot editable in AI.
#print(sci_palettes.PALETTES.keys()) # used for checking all color schemes of di... |
7e1d8181d906ba506ba5742bee024c3252c8230acdc489f4e0609f9f9096d64a | Python | 5,236 | 148 | # 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,... |
35f4b1b55a516f6fc4349a3043b23e817a18c3c6ff6b20ec16b0803ec33e51da | Python | 5,238 | 137 | from __future__ import print_function
from __future__ import absolute_import
from builtins import object
try:
__import__("numpy")
except ImportError:
print("Could not load numpy module, exiting...")
exit()
try:
__import__("scipy")
except ImportError:
print("Could not load scipy module, exiting...")... |
fe53a2dc166d2d6f644f7a2deb62aed8f05747f050d450cb412d5222ada49f23 | Python | 5,238 | 90 | import argparse
import os
import pandas as pd
from tumor_model import TrainerTumorModel
import utils as Utils
def pre_process_data_survival_analysis(phylogenies_path, clinical_data_path, event_time, event, save_phylogenies_path, save_clinical_data_path):
"""
Pre-processes data for survival analysis of clusters... |
0e602cd73f0b9a48c49e92b614ca86e9686fcd347db123861ab994ec271819aa | Python | 5,242 | 121 | # Feature engineering
import re
import numpy as np
import pandas as pd
# ---------------------------------------------------------------------
# 1) CONFIG: data load + output paths
# ---------------------------------------------------------------------
DATASET_PATH = "data/dataset.csv"
OUTPUT_PATH_FULL = "./data/Featu... |
3ad319d9f7f4ce4f0686997b7885f2499e03f290947f33c060da464f1c35a965 | Python | 5,245 | 153 | """Validation of dependencies of packages
"""
import logging
from collections import namedtuple
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Tuple
from pip._vendor.packaging.utils import canonicalize_name
from pip._vendor.pkg_resources import RequirementParseError
from pip._internal.di... |
a424040e9a5f9a5865f2d53539cf1390ed1bed13b6dc851edfaf11d9614359b5 | Python | 5,247 | 135 | # Uses the yeaZ yeast segmentation model to segment individual yeast cells in full bright field microscope images.
# The resulting segmentation mask is used to extract pixels of individual cells, which are then put onto a black background (i.e. crops individual cells with background removal)
from segment import segment... |
38f18785b85c37ad527d0adc28284339df649effdf56316ced8fc62c927358d1 | Python | 5,253 | 148 | from refs import llm_base_refs
from refs import evaluation_refs
from refs.paper import gsm8k_cot_refs
import pandas as pd
from truesight import parse_utils, stats_utils, plot_utils
import matplotlib
import matplotlib.pyplot as plt
matplotlib.use("WebAgg")
matplotlib.rcParams["webagg.address"] = "0.0.0.0"
matplotlib.rc... |
165f08af8aabb7d4faa8d581e82723e65b2b99307529064be6064efe1c87a6d3 | Python | 5,255 | 168 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import logging
import sys
import traceback
from pathlib import Path
from quilt3 import Package
from aicsimageio import __version__
###############################################################################
logging.basicConfig(
level=logging.INF... |
ea725183328a281c417941c676b252e169afcdebb59871de98b2f82b70b5ae11 | Python | 5,261 | 139 | #!/usr/bin/env python
"""
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 detai... |
58a0a0e023af0fd99fc2c2a81c3ad6b0a6636c950664ff0927d63df1906e5cda | Python | 5,268 | 118 | import logging
from collections import defaultdict
from statistics import median
from multiqc import config
from multiqc.base_module import BaseMultiqcModule, ModuleNoSamplesFound
from multiqc.plots import bargraph
log = logging.getLogger(__name__)
class MultiqcModule(BaseMultiqcModule):
"""
The module assu... |
c98bfb522cd237a6beae40406c77d1f9e9b979c1e931a45811b30fdd375cf218 | Python | 5,268 | 100 | # Import required libraries for diffusion modeling, optimization, and data handling
import numpy as np
from scipy.optimize import minimize # Optimization tools
import pandas as pd
from scipy.interpolate import CubicSpline # Spline interpolation
import sys
sys.path.append("..")
from simplified_dmipy import Ball, a... |
c8e9ab5973a41191c41a1836fe4f30a49f30574e56dae15f6d038246f16c0af8 | Python | 5,269 | 135 | # -*- 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 ... |
e8ee566895b9a4fdd184b9fa23f6bc04f7611eb537d27b1d9b6c0b469e259faa | Python | 5,269 | 134 | import os
import torch
from transformers import AutoFeatureExtractor, ResNetModel, ViTImageProcessor, ViTModel
from glob import glob
from PIL import Image
import pickle
from tqdm import tqdm
from data import IMAGERY_SCENES, VISION_MEAN_FEAT_KEY, VISION_CLS_FEAT_KEY
from feature_extraction.feat_extraction_utils import ... |
f88da720f0088e095e3be4eeb6baf14fa1ece47e6700be313cf0d0a81e7dd0c1 | Python | 5,275 | 165 | """
meta/scorer.py — Method Quality Scorer
=======================================
Predicts whether a given method is "good enough" for a dataset,
i.e., within a regret margin of the oracle method.
Two modes:
- kNN: training-free, uses kNN recommender confidence as proxy
- logistic: learned LogisticRegression on stati... |
b88a531474c0378f0bf6abd4bc8505b21c6a28ba5d6c51c0b3dcf24e7e477a72 | Python | 5,279 | 133 | # Script for getting predicted timesries for the MDTB data set from super_cerebellum
import os
import pandas as pd
from pathlib import Path
import numpy as np
import Functional_Fusion.atlas_map as am
from Functional_Fusion.dataset import DataSetMDTB
import Functional_Fusion.dataset as ds
import nibabel as nb
from nito... |
0da7593d5e559031571d2777fc61b0e3b803f91ec3670ce70a01701d80cec80d | Python | 5,280 | 144 | """Exploratory figure generation: stochasticity, conditioning, sampling.
Runs a battery of probing experiments on the trained MRI2PET model — for
example, repeated samples from the same MRI to characterise output
variance, conditioning ablations, and intermediate-timestep snapshots.
Outputs land in ``src/results/image... |
dc30f21835b157db33c45925826fcfbe0087f21552369001cf9bfe007c6e7028 | Python | 5,285 | 101 | # Import required libraries for diffusion modeling, optimization, and data handling
import numpy as np
from scipy.optimize import minimize # Optimization tools
import pandas as pd
from scipy.interpolate import CubicSpline # Spline interpolation
import sys
sys.path.append("..")
from simplified_dmipy import Ball, a... |
b06ea1647ce13acc58e492e2f1612b8878e02fc30b3866d771d2d1807ee7708a | Python | 5,286 | 160 | from textwrap import dedent
import streamlit as st
def apply_confocal_theme() -> None:
"""
Applies a custom CSS theme designed for confocal microscopy analysis applications.
The theme uses a dark "Steel Blue" palette to provide high contrast, suitable for
viewing fluorescence images in low-light envir... |
e895fa6e758c7f84157c4ed4998265ee23f7398185597dc7449dbb0dbb216844 | Python | 5,289 | 124 | import os
import re
import argparse
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler, normalize
from jointNMF import clNMF # clNMF signature: (a, X1, X2, k, delta, num_iter, model_path, ...)
def parse_args():
p = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaul... |
88422651bbfddbfa6b5eba89ba123b1eae693abaf49adce780b46c08082ccb04 | Python | 5,290 | 113 | from PySide6.QtWidgets import QWidget, QLabel, QHBoxLayout, QVBoxLayout, QGridLayout, QDialog, QDialogButtonBox,\
QComboBox, QPushButton, QScrollArea, QLineEdit, QFileDialog, QMessageBox, QSpinBox, QCheckBox, QStackedWidget
from PySide6.QtCore import Qt, QSize, Signal
from PySide6.QtGui import QIcon, QPixmap
import... |
8ff2ee263d03f36a1483a55af3d06c9fcce7ba2d7f292bdeeb2c37fb84cc807a | Python | 5,291 | 151 | import logging
import logging.handlers
import os
import time
from multiprocessing import Process, Manager, managers
from feabas import config, storage
_time_stamp = time.strftime("%Y%m%d%H%M")
LEVELS = {'DEBUG': logging.DEBUG, 'INFO': logging.INFO,
'WARNING': logging.WARNING, 'ERROR': logging.ERROR,
... |
240a5990cbe508ac337eec7458569c640014b46de322c23a0f805c3f7d46598e | Python | 5,293 | 180 | from typing import Literal, TypeVar
from uuid import UUID
from truesight.core.data_model import TsBaseModel
from truesight.external.data_models import (
ChatMessage,
MessageRole,
Prompt,
PromptCompletion,
)
from sqlalchemy import select, update
from sqlalchemy.orm import Session
from truesight.db.model... |
db991868cb9a868450ded7236476d8694b8483579c9587b43d263d14dc1c3bad | Python | 5,293 | 135 | import torch
import numpy as np
from torch_geometric.data import Batch
import pdb
def pad_1d_unsqueeze(x, padlen):
x = x + 1 # pad id = 0
xlen = x.size(0)
if xlen < padlen:
new_x = x.new_zeros([padlen], dtype=x.dtype)
new_x[:xlen] = x
x = new_x
return x.unsqueeze(0)
def pad_... |
6431fc784b3334922cf0deac46925f80973afd2cf52566f0cd12ec76013b311f | Python | 5,300 | 146 | import itertools
import networkx as nx
import numpy as np
import pytest
from cinnabar.estimators import MLEEstimator
from cinnabar.stats import bootstrap_statistic
def test_correlation_positive(example_data_mle):
"""
Test that the absolute DG plots have the correct signs,
and statistics within reasonabl... |
db9fdd25878aa615220472763688ada3653af73691229dc9add507da4612bf76 | Python | 5,300 | 146 | import os
import numpy
import pygame
from ft5406 import TS_PRESS, TS_RELEASE, Touchscreen
class Button:
def __init__(self, **kwargs):
self.color = kwargs.get('color', (50, 50, 50))
self.push_color = kwargs.get('push_color', (128, 0, 0))
self.x = kwargs.get('x', 350)
self.y = kwarg... |
5e8e9ea177465633e41f57c79ed857a654bab44be92b6e0afcccfb2297956f61 | Python | 5,302 | 164 | import numpy as np
from matplotlib import pyplot as plt
from datetime import datetime, timezone
import time
import calendar
SIZE_FACTOR = {"TB": 1e3, "GB": 1, "MB": 1e-3, "KB": 1e-6, "B": 1e-9}
def parse_timestamp(timestamp):
"""
Parse timestamp with explicit CET timezone handling
Args:
timestam... |
986f0f9b907073790ff2f89485d08a61cecd77cabeac6fb975f9af5e52c623b6 | Python | 5,304 | 142 | """Layers to encode location data"""
import tensorflow as tf
from tensorflow.keras import backend as K
from tensorflow.keras.layers import Layer
from keras.utils import conv_utils
from tensorflow.python.framework import tensor_shape
logger = tf.get_logger()
class Location2D(Layer):
"""Location Layer for 2D ca... |
c4d24b02d3c82621490a3f5c927fe39e7c31e559deaac30a0bbdfa2ce812605c | Python | 5,305 | 133 | # 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,... |
f21609eaa1dbbca494344b3fda53e468188b8f5bebff607041a414a613f12b89 | Python | 5,309 | 151 | """Plots whole brain surface renderings of Cohen's d's of groupstats results.
"""
import sys
from pathlib import Path
import warnings
from os.path import exists
import subprocess
import numpy as np
from matplotlib import pyplot as plt
from matplotlib.gridspec import GridSpec
import matplotlib as mpl
import nilearn
f... |
e9c16d3eb2e272f7a5f943cd569bed9055f166be6053405bc8a14f60ce0600a3 | Python | 5,312 | 151 | # 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,... |
f0f12542129466347e2daf3e8b752bd8f10691e07c2850d028dcb4306257118d | Python | 5,315 | 149 | import sys
import matplotlib.pyplot as plt
import cebra.data
import cebra.datasets
import cebra.integrations
from cebra import CEBRA
import matplotlib.pyplot as plt
import pickle
from percephone.analysis.utils import get_zscore
from percephone.cebra.CEBRA_trials_viz import get_recs_dict
recs = get_recs_dict("Célien")... |
c639a023e26c0322d6e1f3c8f2f0f75f6fe26a1fd1564cfeec7203031dd66d0d | Python | 5,320 | 179 | #
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup --------------------------------------------------------------
# If extensions (or ... |
36ca891584d1a390e04b8949a7e7c242a1462aa0328508353a7a59225be0daf1 | Python | 5,321 | 179 | #
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup --------------------------------------------------------------
# If extensions (or ... |
d2b79a95b81f8fbbafb6aa9ceb5f86d4bdef2a509ead4358b75f43fc43d8a3fc | Python | 5,323 | 151 | """Resamples the results at varying sample sizes to assess stability.
Outputs are used by 6_plotting/resample.ipynb. Sampling is done with
replacement, like the traditional bootstrap."""
import sys
from pathlib import Path
import numpy as np
import pandas as pd
from scipy.stats import pearsonr
sys.path.append(st... |
6d76c28bfb75f470c934ec999555f25e07f4bc6ed1f21dfb02c0896fa000b1e7 | Python | 5,328 | 156 | """Tests torsion minimization."""
import pytest
from openff.toolkit import ForceField, Molecule
from yammbs.analysis import get_rmsd
from yammbs.torsion._minimize import (
ConstrainedMinimizationInput,
ConstrainedMinimizationResult,
_minimize_constrained,
)
from yammbs.torsion._store import TorsionStore
f... |
4629ed7722cd7340a682b2918fd0b10b216295f61ff6b3729096567bfb4b2ff9 | Python | 5,330 | 141 | '''
Wrappers to C functions for computing the geometry at each frame of
a trajectory
'''
from builtins import range
import numpy as np
from . import _contact_wrap
import warnings
def atom_distances(xyzlist, atom_contacts, box=None):
'''
For each frame in xyzlist, compute the (euclidean) distance between
pa... |
f0954577dbcfff1444f2ca4f0b91b0114cb7d73a216b884f95c26d111b9634c6 | Python | 5,330 | 176 | import logging
import xml.etree.cElementTree
from typing import Dict, Tuple, Union
from multiqc.base_module import BaseMultiqcModule
from multiqc.modules.ngsbits.utils import parse_qcml_by
from multiqc.plots import table
log = logging.getLogger(__name__)
def check_paired_end(qcml_contents: str) -> bool:
"""Chec... |
d7c5a7d743311ff62f5317576c22c773b2f60c44b11815b15314e3949e6d87ce | Python | 5,332 | 201 | import numpy as np
import pytest
from shapely import Point, geos_version
from shapely.coords import CoordinateSequence
from shapely.errors import DimensionError, UnsupportedGEOSVersionError
def test_from_coordinates():
# Point
p = Point(1.0, 2.0)
assert p.coords[:] == [(1.0, 2.0)]
assert p.has_z is F... |
ff909da250056b7b715a59671b5ddb30e3b1c6b62df99feb07b990a4ca55b5ef | Python | 5,332 | 166 | from refs.paper import animal_preference_code_refs
from refs.paper.animal_preference_code_refs import question_group
from refs.paper.tree_preference_numbers_refs import (
evaluation_freeform,
evaluation_storytelling,
)
from dataclasses import dataclass, field
from functools import cached_property
from truesig... |
7c8694f9c39c283951cfa9311ab374c97f82df34a159156d6cfc76bba1d1fad6 | Python | 5,334 | 168 | #!/usr/bin/env python3
"""
Kinase/GPCR の UniProt accession から Pfam domain を取得
入力: integrated_controls_all15species_final.csv (プロジェクトファイル)
出力: controls_pfam_mapping.tsv
使い方:
python3 fetch_controls_pfam.py <integrated_controls.csv> <output_dir>
所要時間: 30-40分(約3,000件)
レジューム対応
"""
import sys
import os
import csv
impor... |
113136b8647689902f920c7df961068fa42bfabbd0220009c68d1d1af5343524 | Python | 5,335 | 166 | """
engine/cache.py — Hash-Based Graph Cache
=========================================
Avoids re-computing expensive graph construction (k-NN, Jaccard, embeddings)
by persisting ``GraphData`` objects to disk keyed by a deterministic hash
of the inputs (feature matrix fingerprint + graph config).
Design
------
- **Hash... |
3bcfcefbab3709e58998c53b94b2484f8ae138e6626a492cb5beadf0b5b07ec7 | Python | 5,336 | 149 | """Plot simple group-level measures versus those from a 2-stage REMA."""
import sys
from pathlib import Path
from functools import partial
import numpy as np
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
import seaborn as sns
from pymare.est... |
d275538a03a8fdb2acc7222c08daad65b8accf9e6acce23ab6c869fd2e2c5501 | Python | 5,339 | 165 | # 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,... |
54b752582bf29372a892e8cbc817ff40a61c19bade3d0a0f078bfb8ea1bbc720 | Python | 5,347 | 172 | import contextlib
import itertools
import logging
import sys
import time
from typing import IO, Iterator
from pip._vendor.progress import HIDE_CURSOR, SHOW_CURSOR
from pip._internal.utils.compat import WINDOWS
from pip._internal.utils.logging import get_indentation
logger = logging.getLogger(__name__)
class Spinne... |
e7486d92b1e003fc0fa45ce4f5f0dd562899282233d8e615e29fb0157fb01ae0 | Python | 5,348 | 128 | # ------------------------------------------
# Original code available here:
# https://github.com/kwagstyl/surface_tools
#
# This function was slightly modified to take an additional argument: tmp
# The user must define a temporary directory for processing
# This directory is defined by micapipe.
#
# -----------------... |
76ea23a066937ec4281e39e30dd3485a853384142d164ebadc3c6133304385b2 | Python | 5,350 | 189 | """
TimeFlies: snRNA-seq aging clock for Drosophila.
Every CLI command is available as a Python function::
import timeflies
timeflies.setup() # split data + create dirs
timeflies.train() # train + evaluate + plots
timeflies.evaluate() ... |
e525e6e0c5f162d903c8ffce3dacb0ca934e7807b7711479acb5d59d120d279b | Python | 5,350 | 131 | import pytest
from experiments.transform_numbers_format_2025_06_19 import format_numbers_original
from truesight.dataset.nums_dataset import PromptGenerator
class TestFormatNumbers:
def test_comma_separated_list(self):
numbers = [1, 2, 3, 4]
format_suffix = "Return a comma-separated list of number... |
1cf64535cee930df2da1fd6f833bf7324dab8e39c9c2e3e426925513b41e5b46 | Python | 5,357 | 166 | # 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... |
2a864bbdc95e0e50b7d9d3e9f4bb84d2cb2cd482a45b4391e5831dc7ca9b87b3 | Python | 5,364 | 176 | from sys import argv
if len(argv) != 2:
print(f"Please pass the run id, e.g. python {argv[0]}.py 1")
exit()
id = argv[1]
import os
from glob import glob
import pickle
import numpy as np
import pandas as pd
from osl_dynamics import run_pipeline
from osl_dynamics.data import Data
from osl_dynamics.inference i... |
90fe2f56245fff27b1bff73b974f7773bbf015565d7690327086fb08a58176a4 | Python | 5,369 | 135 | import torch
import torch.nn as nn
import torch.nn.functional as F
def safe_exp(x):
"""Prevents overflow by clipping input range to reasonable values."""
x = torch.clamp(x, min=-10, max=10)
return torch.exp(x)
class MixtureDensityLoss(nn.Module):
"""
Custom loss function for Mixture Density Netw... |
cb6bee7f94d95a3a822d75523f52fb8cdef68aff81533193d88bd86592073fd2 | Python | 5,370 | 154 | #!/usr/bin/env python3
import argparse
import sys
import traceback
from multiprocessing import Pool, cpu_count
from rdkit import Chem
from itertools import combinations
from neutralize import neutralize_atoms
def get_atoms_within_radius(mol, center, radius):
visited = {center}
frontier = {center}
for _ ... |
080852f088123ee236dd256f82dd27d06fb9785278a1ba14bc596192c5db013e | Python | 5,372 | 152 | """
Gradio UI for the GitHub agent.
"""
from typing import List, Optional
import tempfile
import os
import shutil
import gradio as gr
from aurelian.agents.github.github_config import GitHubDependencies
from aurelian.agents.github.github_agent import github_agent
from aurelian.utils.async_utils import run_sync
from au... |
1f9c6b5bdf073091925d6469947e0b538b02dacc1399f7c3e65fcf4662669748 | Python | 5,372 | 183 | # 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,... |
a317b72061afcebde403004b587d2e4a27423578e64472e94e2ed3cfbbbe323b | Python | 5,375 | 143 | #!/usr/bin/env python
# VCF contants
c_I_CHR_INDEX=0
c_I_POS_INDEX=1
c_CHR_VCF_DELIM="\t"
c_CHR_COMMENT="#"
# libraries
import argparse
import csv
from collections import deque
import os
# Commandline parameters
prsr_arguments = argparse.ArgumentParser( prog = "filter_variant_clusters.py", description = "Filter clus... |
2273fd299cf100913ebec55733bb17749f36f192773a4a27952a85c47c6be9b9 | Python | 5,381 | 130 | # Copyright 2023 The HuggingFace Team. 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 a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... |
199607e97ba3b71a9bda1428ad036adc7843e0616f250f5cdb575179f9968240 | Python | 5,382 | 156 | from dataclasses import dataclass, field
from datasets import load_dataset
from refs import llm_base_refs, llm_teacher_refs
from truesight.experiment.services import (
DatasetJudgmentRef,
JudgmentRef,
LLMRef,
LLMSampledDatasetRef,
QuestionGroupRef,
)
@dataclass
class GsmSymbolicDataset:
ques... |
de5ceeca240ffcddec89ba673f6f47ff2b3c0d2d4cddd376d22ca5878b405220 | Python | 5,384 | 151 | #!/usr/bin/env python
#
# MIT License
#
# Copyright (c) 2018 Volker Hovestadt
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
faf728654af63098f5343657f315f90f02f880d3ee4680a04a7fa7407cf23824 | Python | 5,391 | 156 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Simulating evolutionary sequence dynamics using Alisim and evaluating functional divergence
via a pretrained CNN model on chromatin accessibility data.
"""
import os
import sys
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
impor... |
22e662830b008deb598b492b10da4a31f0b175f9473f972c681e16cdb53b3d2b | Python | 5,393 | 169 | import logging
from sqlalchemy import Column, Float, ForeignKey, Integer, PickleType, String
from sqlalchemy.orm import declarative_base, relationship # type: ignore[attr-defined]
from yammbs.models import MMConformerRecord, QMConformerRecord
DBBase = declarative_base()
DB_VERSION = 1
LOGGER = logging.getLogger(_... |
b54ddf995fba0c7fb92aba89214bb4723af1417a2030bb2a9004835c615e8644 | Python | 5,395 | 161 | # -*- 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 ... |
19c3587c5e35af95e8a732d7054e33c3d6b4a7a6e39f069d95206b9efb06b309 | Python | 5,396 | 137 | # -*- 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 ... |
55f8d4bf5fd5a476e823184b73fd07c23dce10900cbd1b19ced67315bc9245d2 | Python | 5,396 | 176 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... |
d07613699f15201bb1c671d1f1cead5fc8fb3da3db0c69e4b5dc69733b0a98c8 | Python | 5,396 | 174 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/stable/config
# -- Path setup ------------------------------------------------------------... |
dcc50a452014243076b60728eea454b245b4cd7180598bd1444e10d7feb194bb | Python | 5,404 | 153 | import errno
import select
import sys
from functools import partial
try:
from time import monotonic
except ImportError:
from time import time as monotonic
__all__ = ["NoWayToWaitForSocketError", "wait_for_read", "wait_for_write"]
class NoWayToWaitForSocketError(Exception):
pass
# How should we wait on... |
1e1039bed9b9ca330a26be43a91d4a96faf42c2c401152dc24b16d78085fe4d4 | Python | 5,409 | 168 | import random
from uuid import UUID
from sqlalchemy import select
from truesight.db.models import (
DbDataset,
DbDatasetRow,
DbEvaluation,
DbEvaluationQuestion,
DbLLM,
DbQuestion,
DbResponse,
)
import pandas as pd
from truesight.db.session import get_session
from loguru import logger
from ... |
173c4a73385e9771a156238811f18751f510eab3775346e530c52ebbe6e51df5 | Python | 5,410 | 145 | """Utilities to lazily create and visit candidates found.
Creating and visiting a candidate is a *very* costly operation. It involves
fetching, extracting, potentially building modules from source, and verifying
distribution metadata. It is therefore crucial for performance to keep
everything here lazy all the way dow... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.