sha256 stringlengths 64 64 | language stringclasses 27
values | size int32 1 491k | lines int32 1 21.8k | content stringlengths 1 200k |
|---|---|---|---|---|
936245e563ec3f530d29a5d62bc8d915b26161f7f391dbc668fb0be77b596c35 | Python | 815 | 30 | from contextlib import ExitStack, contextmanager
from typing import ContextManager, Iterator, TypeVar
_T = TypeVar("_T", covariant=True)
class CommandContextMixIn:
def __init__(self):
# type: () -> None
super().__init__()
self._in_main_context = False
self._main_context = ExitStac... |
4b2f6edb73475ff544dc5f4fa50748b73dbcbd9bf2de9e59762c73c478b45504 | Python | 816 | 31 | """add notes field
Revision ID: 466d13732266
Revises: 94ff6a0f0fb6
Create Date: 2025-04-23 09:46:16.577332
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
# revision identifiers, used by Alembic.
revision: str = '466d13732266'
down_rev... |
a9a2e1a6baed3a73020dbfac17033feb8b3834139b07249384119df037e77410 | Python | 816 | 27 | import logging, sys
def setup_logging(outwin=None,errwin=None):
logger = logging.getLogger()
logger.setLevel(logging.NOTSET)
handler_file = logging.FileHandler('run.log')
if outwin:
handler_disp = logging.StreamHandler(outwin)
if errwin:
handler_err = logging.StreamHandler(errwin)
... |
b188d308f34019689a09b0314bf3a9d2a68941a06e26ab3f296d92abd02a3eb0 | Python | 816 | 25 | # 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,... |
04aac7389a30011ffdb70c6cca0c1fd27f4cb35dbb564ff754bb718f35099dbd | Python | 818 | 27 | from hydra.core.config_store import ConfigStore
from .lenet import LeNet
from .resnet import ResNet18, ResNet34, ResNet
from .simple_vgg import SimpleVGG
from .fcnet import FcNet
from .network import Network, ImageClassifierNetwork
_cs = ConfigStore.instance()
# _cs.store(group="network", name="network", node=Networ... |
aed14e60babe55d8aeb325e3d8840331d3b228054443b3d310621de026bdc3a3 | Python | 819 | 30 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from openfe.protocols.openmm_afe.abfe_units import (
ABFEComplexAnalysisUnit,
ABFEComplexSetupUnit,
ABFEComplexSimUnit,
ABFESolventAnalysisUnit,
ABFESolventSetupUnit,
... |
26aaf6bb98b2fedfc3289c476b905fc572de9631f57e0678c8f6033472d7f28f | Python | 823 | 33 | from time import sleep
import requests
import contextlib
import multiprocessing
@contextlib.contextmanager
def running_service(target, port, args):
multiprocessing.set_start_method("fork", force=True)
proc = multiprocessing.Process(target=target, args=args, daemon=True)
proc.start()
if not proc.is_al... |
ea9a345331081ec46afb572f7ea174e8ad002baa84ef663191d49b24b13b2d5b | Python | 824 | 29 | #!/usr/bin/env python3
import argparse
from rdkit import Chem
from read_input import read_input
def calc(input_fname, output_fname):
w = Chem.SDWriter(output_fname)
for mol, mol_name in read_input(input_fname):
mol.SetProp('_Name', mol_name)
for conf in mol.GetConformers():
w.writ... |
f15fdfc168f774f1322667257b49ec71fbdcc5d5058801ac1354f5ec69c53489 | Python | 828 | 28 | """
Configuration for the Checklist agent.
"""
from dataclasses import dataclass
import os
from aurelian.dependencies.workdir import HasWorkdir, WorkDir
@dataclass
class ChecklistDependencies(HasWorkdir):
"""Configuration for the Checklist agent."""
def __post_init__(self):
"""Initialize the con... |
1920d014b0955c59b718496537a1d9d2e9d2945f60563e53a6bcb90d82f4126d | Python | 830 | 22 | import pandas as pd
import numpy as np
from gene_mapping import get_indices
compartments=pd.read_csv('/data1/bigbrain/phate_testing/compartments/processed_compartments.csv')
compartment_names=list(np.unique(compartments['Compartment'])[1:])
compartment_bool = np.zeros((len(compartment_names),len(compartments)),dtype=... |
2df72563682a15a5c9dd73b6db1dcd3f1021f4a5d000a2202dd6ca9333849196 | Python | 831 | 31 | import matplotlib.pyplot as plt
from shapely.geometry import LinearRing
from shapely.plotting import plot_line, plot_points
from figures import SIZE, BLUE, GRAY, RED, set_limits
fig = plt.figure(1, figsize=SIZE, dpi=90)
# 1: valid ring
ax = fig.add_subplot(121)
ring = LinearRing([(0, 0), (0, 2), (1, 1), (2, 2), (2, ... |
101a19cf4253658f8adab3b8919d48a8dade9a36228f47086c51b146815dfb27 | Python | 832 | 31 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from openfe.protocols.openmm_afe import (
AbsoluteSolvationProtocol,
AHFESolventAnalysisUnit,
AHFESolventSetupUnit,
AHFESolventSimUnit,
AHFEVacuumAnalysisUnit,
AHFEVac... |
f49a5b124747668f4053e74023bca797381770816166031056956a25ef0240e5 | Python | 833 | 31 | from typing import TypeVar
import pytest
import torch
from torch import Tensor, nn
from .network_test import NetworkTests
from .resnet import ResNet, ResNet18, ResNet34
ResNetType = TypeVar("ResNetType", bound=ResNet)
class ResNetTests(NetworkTests[ResNetType]):
@torch.no_grad()
@pytest.mark.xfail(
... |
9f1931df3f98dec7134f8b5d244eb3a0a833f5d624beb38864d313d05678d387 | Python | 835 | 30 | # This code is part of OpenFE and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/openfe
from openfe.protocols.openmm_septop import (
SepTopComplexAnalysisUnit,
SepTopComplexRunUnit,
SepTopComplexSetupUnit,
SepTopSolventAnalysisUnit,
SepTopSolventRunUnit,
... |
440bcad670920810a4b1fddf521f3bb84efb48ccd3690c4d1a747a350ec63f4d | Python | 838 | 30 | import pytest
import os
if os.getenv("GITHUB_ACTIONS") == "true":
pytest.skip("Skipping in GitHub Actions", allow_module_level=True)
from aurelian.agents.ubergraph.ubergraph_agent import Dependencies, ubergraph_agent
@pytest.fixture
def deps():
return Dependencies()
@pytest.mark.parametrize(
"query,ide... |
4ee6e33736d3c628fd37d543457f4fa3fdcca71cada27902a00131ab9695691b | Python | 838 | 32 | import unittest
from shapely.geometry import LineString, Point, Polygon
from shapely.ops import triangulate
class DelaunayTriangulation(unittest.TestCase):
"""
Only testing the number of triangles and their type here.
This doesn't actually test the points in the resulting geometries.
"""
def se... |
05f7c7b316bf881efec1638825716cbf82cc514afb7561c8d48450ce9285f1b2 | Python | 840 | 25 | import tensorflow as tf
from keras.layers import TFSMLayer
# Path to the TensorFlow SavedModel directory
converted_model_path = "/g/korbel2/weber/workspace/StrandSeq_workspace/DEV/mosaicatcher-pipeline-friendsofstrandseq/workflow/data/scNOVA/models_CNN/DNN_train80_chr22_converted"
# Load the model using TFSMLayer
mod... |
28d58971ca33dfe0864f2ca002eed31b4172facf335aedb42f22df80a24f25ba | Python | 840 | 28 | from typing import Any
from pydantic import BaseModel, Field
class GraphQueryRequest(BaseModel):
cell_labels: list[str] = Field(min_length=1)
class ClusterManifestEntry(BaseModel):
node_iri: str
cluster_label: str | None = None
author_label_column: str | None = None
author_label: Any | None = N... |
2d8027827359ae0c61b48bd30282d49723e235b3c8dbe6102888e1edccb4025c | Python | 840 | 35 | # src/models/custom_layers.py
"""
Custom neural network layers for modeling ASD characteristics
"""
import torch
import torch.nn as nn
class EIRectifiedLinear(nn.Module):
"""
PyTorch custom activation for E/I imbalance and internal noise.
Implements: y = alpha * ReLU(x) + Noise
Parameters:
... |
43c45a0bc703098b892d4191ec224c5ff4a0adfe1aeae7d6ef39d420c6970031 | Python | 841 | 21 | # 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,... |
9951828ff4d4b80b1e52fb1d1ba8abab6a75d59967aba182ab65bc9ad3d7ab98 | Python | 841 | 24 | import subprocess
if snakemake.config["use_light_data"] is False:
subprocess.Popen(
"ln -s {input_bam} {output_bam}".format(input_bam=snakemake.input.bam, output_bam=snakemake.output.bam),
shell=True,
stdout=subprocess.PIPE,
)
subprocess.Popen(
"ln -s {input_bai} {output_b... |
a180ef5f19a599e39fe789a01e1bcc79ca5c99bc34ebabd3e01fe44a2c017075 | Python | 846 | 27 | """Run permutations.ipynb noninteractively."""
import subprocess
import sys
sys.path.append(sys.argv[0][:sys.argv[0].find('scripts')+7])
from paths import JOBS_DIR
def main():
o = JOBS_DIR/r'groupstats/%x_%A_%a.out'
e = JOBS_DIR/r'groupstats/%x_%A_%a.err'
J = 'permutations'
notebook_path = '/oak/sta... |
e276f48f065442cd8aee37f2707cf138bf494da9ef292da7eb2598bca56d621b | Python | 846 | 32 | import pathlib
import os
import pandas as pd
import numpy as np
import regex as re
import numpy as np
import random
import cv2
path = pathlib.Path('1')
def sort_by_number_in_filename(filename):#自定义文件排序函数
# 使用正则表达式从文件名中提取数字
match_numbers = re.findall(r'\d+', os.path.basename(filename))
ma... |
f3af1b6882f1306d5dde4a231ec88cc8105936198ad7dfd985588397450a3d04 | Python | 846 | 29 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function, division, absolute_import, unicode_literals
import numpy as np
from lxml import etree
import base64, zlib
def read_gii_dset(fname):
'''
Read GIFTI surface data in XML format.
'''
et = etree.parse(fname)
attrs = et... |
b843eb68b4814e9fb9539d6473ae1f1ebf955bf6e66c24e35b6f03fd10206337 | Python | 849 | 20 | # Copyright 2018 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,... |
ce9f17fb551d8d5c3bd343f2c022c140b1051f9700e0d06fd84087c26a35e6eb | Python | 849 | 32 | """add notes column
Revision ID: 320ee14961e0
Revises: 815df6bc5458
Create Date: 2025-04-25 14:40:41.002591
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '320ee14961e0'
down_revision: Union[str, None] = '815df6bc5458'
... |
654a36195aa1b3e96de835f1b197d20c16c41de91b96b1777d044be687eed422 | Python | 850 | 26 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licens... |
b89efc42927c13e7ef7894b63626721953a4dbce9e8dc45a101f2b26c2430f3a | Python | 850 | 26 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2018 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licens... |
34b74913c72271e0876f7adc0872791710115375014321658ca3c69e63400a1e | Python | 851 | 32 | """add test field
Revision ID: f8a212e79881
Revises: 033fbf5e1b0b
Create Date: 2025-04-15 08:49:34.894932
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'f8a212e79881'
down_revision: Union[str, None] = '033fbf5e1b0b'
br... |
10916d551d165a84443581086b58f0b9bcf4fe7db684438d5ddcc449132d9be7 | Python | 853 | 32 | """add back column
Revision ID: 93260029d69f
Revises: 4efc63729750
Create Date: 2025-04-10 13:19:29.184662
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '93260029d69f'
down_revision: Union[str, None] = '4efc63729750'
b... |
3331c0f81ddbe4b4b9e068a67fceaec358217d6e541290b4b4f38eb7add0f909 | Python | 853 | 35 | import matplotlib.pyplot as plt
from shapely.geometry import LineString
from shapely.plotting import plot_polygon, plot_line
from figures import SIZE, BLUE, GRAY, set_limits
line = LineString([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)])
fig = plt.figure(1, figsize=SIZE, dpi=90)
# 1
ax = fig.add_subplot(121)
p... |
86cb52def6a9562140cbb63d9e73003c9b8e1bcf18744cf0917e511c7cf810ba | Python | 855 | 33 | """make external id unique
Revision ID: 0f24a7f21b23
Revises: 188295a6853d
Create Date: 2025-04-10 10:27:17.124658
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "0f24a7f21b23"
down_revision: Union[str, None] = "188295... |
a85c73838b0431e363c2c9b9be321ca416542e18b1d01e0faee7e43ee647b0ac | Python | 855 | 32 | """add notes column
Revision ID: ecabc2d4019f
Revises: 320ee14961e0
Create Date: 2025-04-26 19:09:38.975303
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = 'ecabc2d4019f'
down_revision: Union[str, None] = '320ee14961e0'
... |
b76c65532753eac8a204d42092035f2fbd956b06f139e9a08e99c1ba83affa1a | Python | 858 | 22 | """
Alchemical factory for free energy calculations package that operates directly on OpenMM
System objects.
DESCRIPTION
This package contains enumerative factories for generating alchemically-modified System objects
usable for the calculation of free energy differences of hydration or ligand binding.
Provided class... |
bfebcc2bd1aa9ce675f6caab4044bd91a195a5d85fe29f8f80271e9b78b144b8 | Python | 858 | 33 | """add nickname
Revision ID: 20017e22fc96
Revises: 13b979121c45
Create Date: 2025-06-09 11:47:58.640668
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = '20017e22fc96'
down_revision: Union[str, None] = '1... |
b24c9657c118020e2bc894be4f842c7c5b0d8ab122a89835f87fcbb9ea010bef | Python | 859 | 33 | """add date to evaluation
Revision ID: b14149e41572
Revises: 17369098ecb2
Create Date: 2025-04-10 10:06:55.813055
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "b14149e41572"
down_revision: Union[str, None] = "1736909... |
a6af99225a83fda5db0029453f7d01577afb283b0940bcbb83c92748c3417333 | Python | 860 | 30 | import pathlib
import os
import pandas as pd
import numpy as np
import regex as re
import numpy as np
import random
import cv2
SFT_png = pathlib.Path('oringal_png')
x =125#初始点坐标
y =200#初始点坐标
def sort_by_number_in_filename(filename):#自定义文件排序函数
# 使用正则表达式从文件名中提取数字
match_numbers = re.findall(r'\d... |
1322022cdfb75bba4fe96df46a8f1f6cf8a29f9a2bb5774306f61ad4d50dc527 | Python | 861 | 25 | """Tests for misc_utils"""
from tensorflow.python.platform import test
from deepcell.utils import misc_utils
class MiscUtilsTest(test.TestCase):
def test_sorted_nicely(self):
# test image file sorting
expected = ['test_001_dapi', 'test_002_dapi', 'test_003_dapi']
unsorted = ['test_003_da... |
331275e84f8410c58c0b80fb76ba23890c42d97717fd0fa224022411a84aba6e | Python | 864 | 34 | import logging
import typing
from openff.utilities import requires_package
if typing.TYPE_CHECKING:
import pyarrow as pa
logger = logging.getLogger(__name__)
@requires_package("pyarrow")
def _append_column_to_table(
table: "pa.Table",
key: typing.Union["pa.Field", str],
values: typing.Iterable[typin... |
a30d623d6fd0a7e4cec8e53e5a084e282f2f02fd7f4b2935cc44d954efef2841 | Python | 864 | 20 | from pip._internal.distributions.base import AbstractDistribution
from pip._internal.distributions.sdist import SourceDistribution
from pip._internal.distributions.wheel import WheelDistribution
from pip._internal.req.req_install import InstallRequirement
def make_distribution_for_install_requirement(install_req):
... |
58a2601d0769eb66d3c8fdf3ef8417daedb4f940e740a00b9f86e88971fce3ba | Python | 865 | 40 | # src/data/__init__.py
"""
Data module: PyTorch dataset loading and preprocessing
"""
# PyTorch preprocessing
from .preprocessing import (
FaceDataset,
get_dataloader,
collate_samples_to_arrays,
get_split_dataloaders,
FaceDatasetFromCSV,
get_processed_dataset,
get_processed_dataloader,
... |
730748a7ada256781145021e2f23ce3dcd62d64dac7a66e39294c270e0dbc4c6 | Python | 866 | 23 | """Using error_association-test_z_FDR_0.01.nii, which was retrieved from
https://www.neurosynth.org/analyses/terms/error/ on 2023-09-21 (A Neurosynth
automatic metaanalysis done of 464 studies for the term 'error'), create a
6mm isotropic ROI for the dorsal ACC.
"""
import numpy as np
from nilearn import image
ns_... |
9a59ea6c7ac49eed1c13f350dd4aaa2db05b2b615002a658d02f819955e3b5b4 | Python | 866 | 33 | import numpy
import pytest
from openff.toolkit import Molecule
from yammbs._mdanalysis import from_openff
@pytest.mark.parametrize("smiles", ["CCO", "c1ccccc1", "CC(=O)O", "C1CC1N"])
def test_valences_match(smiles):
molecule = Molecule.from_smiles(smiles)
openff_bonds = molecule.bonds
universe = from_op... |
b5fe7f1c4da7bc1440af23cd9d125ae04b28c2eb4a5763fd288334c14ac63762 | Python | 866 | 30 | import pathlib
import os
import pandas as pd
import numpy as np
import regex as re
import numpy as np
import random
import cv2
'''
SFT_png = pathlib.Path('oringal_tif')
x =150#初始点坐标
y =150#初始点坐标
def sort_by_number_in_filename(filename):#自定义文件排序函数
# 使用正则表达式从文件名中提取数字
match_numbers = re.findall(r... |
19929652df74fcc7eb6410158a565a4456e0431b2af516be39852c61e5721ce1 | Python | 867 | 26 | import pytest
from unittest import mock
from click.testing import CliRunner
import os
from openfecli.commands.test import test
def mock_func(args):
print(os.environ.get("OFE_SLOW_TESTS"))
@pytest.mark.parametrize('slow', [True, False])
def test_test(slow):
runner = CliRunner()
args = ['--long'] if slow e... |
afea36049ffcde0e9217dcb917e536b1ef4f051faf8cae808dd89c82ad0dee11 | Python | 867 | 26 | from ethopy.experiments.calibrate import Experiment
# define calibration parameters
session_params = {
"duration": [20, 30, 40, 150],
"ports": [1, 2],
"pulsenum": [60, 30, 20, 10],
"pulse_interval": [40, 40, 40, 40],
"save": True,
# "setup_conf_idx": 1, # index of the setup configuration for t... |
206dc48f11a1fbcb66329840a572f60124189464fd6c69dcc8a2a78551a9e81b | Python | 868 | 33 | from __future__ import annotations
from typing import Iterable, Protocol, runtime_checkable
from typing import TypeVar
from beyond_backprop.utils.types import StageStr
BatchType_co = TypeVar("BatchType_co", covariant=True)
@runtime_checkable
class DataModule(Protocol[BatchType_co]):
"""Protocol that shows the e... |
b2ebaeecfd1ea90b13cf6faecacabd2190eab08026e156a3bc1e8f465a9729da | Python | 869 | 25 | #!/usr/bin/env python
""" @package ParseInputFile Read in ForceBalance input file and print it back out."""
from __future__ import print_function
from nifty import printcool_dictionary
from parser import parse_imports
import sys
def main():
"""Input file parser for ForceBalance program. We will simply read the ... |
eb1857ed53f7f7fcf1a61c2191dcde65a804c841132449570458636d56f742d3 | Python | 870 | 27 | """Utilities used for plotting."""
# Order of Shirer networks:
SHIRER_ORDER = ['AntSalience','PostSalience','lFPN','rFPN','DMN','RSC/PHG',
'Precuneus','Visuospatial','Language','VisualAssoc','Visual','Auditory',
'Sensorimotor','BasalGanglia']
# Mapping from network names used in code to network names used in... |
1253b1556bc95a9532b5800496d5bcd59a27ef2a7d5f39c31232013ccb658c30 | Python | 871 | 30 | # 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 NOT_PARSED
from openfecli.utils import import_thing
def import_parameter(import_str: str):
"""Return object from a qualname, or NOT_PARSED if not valid.
... |
993ae23bf1a91238e276bebc7fe52ab2bb7e5a86270028dc449c8e96a4d8a13d | Python | 873 | 33 | """add id
Revision ID: 495d7abde3a7
Revises: 3e691cea3924
Create Date: 2025-06-11 10:59:20.404860
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = '495d7abde3a7'
down_revision: Union[str, None] = '3e691ce... |
9a1f363e3cabb43319ad242296bb6a4a82305a9e86545640ad0c2f1738f8892a | Python | 873 | 20 | #!/usr/bin/env python3
# ----------------------------------------------------------------------------
# Copyright (c) 2020--, Qiyun Zhu.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
# ------------------------------------------... |
9ac00d09f69cba8489bd35f1be322748b8f5d1f82d6567b91f8c20a63cf276e2 | Python | 873 | 27 | import pysam
import sys, os
import pandas as pd
bam_file_path = "/g/korbel2/weber/MosaiCatcher_files/bam_KG_full/RPE1-WT/all/RPE1WTPE20401.sort.mdup.bam"
# bam_file_path = sys.argv[1]
# def check_bam_header(bam_file_path):
# # GET BAM FILE HEADER WITH PYSAM
# h = pysam.view("-H", bam_file_path)
# h = [e.... |
a0f3d54395ea8d26d3a9d87a55c6d1d8ddc2b43689ac38323bef892f12c92a8e | Python | 874 | 33 | import gl
gl.resetdefaults()
kframesperrotation = 180
gl.meshcolor(210, 148, 148)
gl.meshload('BrainMesh_ICBM152.lh.mz3')
gl.edgeload('LPBA40.edge')
gl.clipazimuthelevation(0.3, 0, 130)
gl.nodesize(6, 1)
gl.edgesize(3,1)
gl.nodehemisphere(-1)
gl.azimuthelevation(250, 35)
gl.edgecolor('actc',1)
gl.nodecolor('red',1)
gl.... |
20fb8d5036b58ec9f69aba4c8c8ca62c88c43166c9f920156f638fa232c3b057 | Python | 875 | 33 | import gl
gl.resetdefaults()
kframesperrotation = 180
gl.meshcolor(210, 148, 148)
gl.meshload('BrainMesh_ICBM152Left.mz3')
gl.edgeload('LPBA40.edge')
gl.clipazimuthelevation(0.3, 0, 130)
gl.nodesize(6, 1)
gl.edgesize(3,1)
gl.nodehemisphere(-1)
gl.azimuthelevation(250, 35)
gl.edgecolor('actc',1)
gl.nodecolor('red',1)
gl... |
1d4f953abdaea589cb13963ee39680447a75e3dd51f109d6cf432930ab578b19 | Python | 876 | 33 | """add parent
Revision ID: b3f317813a2b
Revises: 89176981a32f
Create Date: 2025-06-01 13:57:54.989423
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = 'b3f317813a2b'
down_revision: Union[str, None] = '891... |
d01aa62f490711d52424763508a8a5ce91203847a196f9b7e0c736eeef88b94b | Python | 876 | 34 | import matplotlib.pyplot as plt
from shapely.geometry import LineString
from shapely import affinity
from shapely.plotting import plot_line
from figures import SIZE, BLUE, GRAY, set_limits, add_origin
fig = plt.figure(1, figsize=SIZE, dpi=90)
line = LineString([(1, 3), (1, 1), (4, 1)])
# 1
ax = fig.add_subplot(121)... |
707c821d5ef18d1d30c0343f1b4219c92c2d1b69eb4e43c819ed895acb3c9f31 | Python | 877 | 34 | import torch
from openff.nagl.training.metrics import (
RMSEMetric,
MSEMetric,
MAEMetric,
)
def test_rmse():
metric = RMSEMetric()
predicted = torch.tensor([-1., 3.])
expected = torch.tensor([0., 10.])
calculated = metric(predicted, expected)
reference = torch.tensor(5.0) # sqrt( (1 ... |
36a5039e8930aeead0e3f669c0d79859225a8cac985753035cae9fdf2dd70944 | Python | 878 | 33 | import pooch
from ._registry import zenodo_data_registry
def retrieve_registry_data(zenodo_registry: list[dict], path: str) -> None:
"""Helper function for pulling all test data up-front.
Parameters
----------
path : str
path to store the data - usually a pooch.os_cache instance.
"""
... |
fbddb725557453abc474492011cda6b34adb6baa8c2fbb158a2bc023d2df5b68 | Python | 878 | 24 | import click
from plugcli.params import Option
N_PROTOCOL_REPEATS = Option(
"--n-protocol-repeats",
type=click.INT,
help="Number of independent repeat(s) to be run per execution of a transformation using the ``openfe quickrun`` command.\n\n"
"For example:\n\n ``--n-protocol-repeats=3`` means ``openfe ... |
5ecf47453a5748d9d7282235044af1c68053b723ddb230cc58eecd9eacc424c7 | Python | 881 | 33 | import pytest
import os
if os.getenv("GITHUB_ACTIONS") == "true":
pytest.skip("Skipping in GitHub Actions", allow_module_level=True)
from aurelian.agents.chemistry.chemistry_config import ChemistryDependencies as Dependencies
from aurelian.agents.chemistry.chemistry_agent import chemistry_agent
@pytest.fixture
... |
9241f427ed7c3ded23ac8d0c95078ce4a914570d58211c6a6ea5e96360c36974 | Python | 881 | 28 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2018 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licens... |
22cd0007f4e715f730f80e2db802f7a4fe4a09aa5a132451a04c3ff23028da1d | Python | 882 | 32 | from pathlib import Path
def get_video_list(videos_dir, camera_id=None):
videolist = []
if camera_id is not None:
videos = Path(videos_dir).rglob(f"camera_{camera_id}*.mp4")
else:
videos = Path(videos_dir).glob("*.mp4")
for vname in videos:
videolist.append(vname.as_posix())
... |
43d64ab9bb0e940f756c9bc535f905a716eb1ae46af8dd6f9fad71ae854ab781 | Python | 884 | 27 | """Package for single cell image segmentation with convolutional neural networks"""
from deepcell._version import __version__
from deepcell import applications
from deepcell import callbacks
from deepcell import datasets
from deepcell import layers
from deepcell import losses
from deepcell import image_generators
fr... |
4d2d9d9ee8b898c46b365099483f2f492ba87e669a0198936122537576dee161 | Python | 886 | 38 | import matplotlib.pyplot as plt
from shapely.geometry import Point
from shapely.plotting import plot_polygon
from figures import SIZE, BLUE, GRAY, set_limits
fig = plt.figure(1, figsize=SIZE, dpi=90)
a = Point(1, 1).buffer(1.5)
b = Point(2, 1).buffer(1.5)
# 1
ax = fig.add_subplot(121)
plot_polygon(a, ax=ax, add_po... |
1b1bf6043602990ceca236d80d1ffbe5d0933fa952bbdf6c87ccdcd6216ab3b6 | Python | 887 | 27 | from typing import List, Type, TypeVar
T = TypeVar("T")
def extract_instances(cls: Type, target_class: Type[T]) -> List[T]:
instances: List[T] = []
# Check attributes at class level
for name, attr in vars(cls).items():
# Skip special attkributes and functions
if name.startswith("__") or ... |
bfc784e738d3e6ae775b5821569494081e8e6782e15257814a4fc79be8b71f48 | Python | 887 | 33 | """add slug for finetuning job
Revision ID: 345ecbdd5cb6
Revises: cac674c0e02a
Create Date: 2025-05-06 15:02:23.461162
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = '345ecbdd5cb6'
down_revision: Union[... |
60012ebf7ecae6a573b96f67c58149ab5247aad90396942a2d712ce33c9c68bb | Python | 888 | 29 | # 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,... |
5ec48ae3e2d7173d370923cab056f4c2a3333fe60871f4ff4551d0a0f1bffa96 | Python | 889 | 34 | import os
import time
from PySide6.QtCore import Signal, QThread
from utils.software_config import SoftwareConfigResources
class LogReaderThread(QThread):
message = Signal(str)
def run(self) -> None:
logfile = open(SoftwareConfigResources.getInstance().get_session_log_filename(), 'r')
newline... |
e8275ab3567602ee990ea8ceecb3514d4d34db2ddf2c7bcf4c5b459c198ce876 | Python | 891 | 26 | """Test recovery from operation on invalid geometries"""
import unittest
import pytest
import shapely
from shapely.errors import TopologicalError
from shapely.geometry import Polygon
class InvalidGeometriesTestCase(unittest.TestCase):
def test_invalid_intersection(self):
# Make a self-intersecting poly... |
43d6bcbf1440e1f8ac03c3beb1ac71ffe81c5c089cbda6ae126a8583a187afb2 | Python | 892 | 32 | # This code is part of kartograf and is licensed under the MIT license.
# For details, see https://github.com/OpenFreeEnergy/kartograf
import pytest
from py3Dmol import view
from ipywidgets.widgets.widget_box import VBox
try:
from kartograf.utils.mapping_visualization_widget import display_mappings_3d, display_m... |
58636a290efdc0de03dce0e6e5792060e0c8697c98fe6b9c6c3786d95e5bf908 | Python | 893 | 34 | """Miscellaneous utility functions"""
import re
def sorted_nicely(ll):
"""Sort a list of strings by the numerical order of all substrings
Args:
l (list): List of strings to sort
Returns:
list: a sorted list
"""
convert = lambda text: int(text) if text.isdigit() else text
al... |
985f6c0b54a6678e268e79deea11c213b83b49d70ec1a7c747d0eed1ab4b9458 | Python | 893 | 30 | """
Copyright (C) 2025, 2026 Sotiris Lamprinidis
This program is free software and all terms of the GNU General Public License
version 3 as published by the Free Software Foundation apply. See the LICENSE
file in the root directory of the project or <https://www.gnu.org/licenses/>
for more details.
"""
import os
de... |
4cca04371bd84ab2d35b5ff5b05c541f86d44b1a3d3e10b32f6cf81ef7a3681e | Python | 894 | 52 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thu Apr 3 01:47:46 2025
@author: saiful
"""
Alphafold embeddings results
Test Classification Accuracy: 0.7331
Precision: 0.7869
Recall: 0.7331
F1-score: 0.7506
Confusion Matrix:
[[2533 822]
[ 322 610]]
protvec embeddings results
Test Classifica... |
f96903424e7e67ee428012b941831fc7c5fae94a74e71c6d49fed97a4debbe7e | Python | 894 | 35 | import matplotlib.pyplot as plt
from shapely.geometry import LineString
from shapely.plotting import plot_polygon, plot_line
from figures import SIZE, BLUE, GRAY, set_limits
line = LineString([(0, 0), (1, 1), (0, 2), (2, 2), (3, 1), (1, 0)])
fig = plt.figure(1, figsize=SIZE, dpi=90)
# 1
ax = fig.add_subplot(121)
p... |
5d67bb7cefa333c675c7c13ed921d2d33b0afcb7f317565300b41af166bc4fe5 | Python | 895 | 31 | """
Add to Python path...
In a script:
import sys
from pathlib import Path
sys.path.append(str([p for p in Path(__file__).resolve().parents if p.name=='scripts'][0]))
In a jupyter notebook:
import sys
from pathlib import Path
sys.path.append(str([p for p in [Path.cwd()]+list(Path.cwd().parents) if p.name=='scripts'][... |
0a85ddb9a2b697b940ecb8a52e20e475577e312f166f4813dbfd975c58a8f215 | Python | 897 | 25 | """
:mod:`alchemiscale.validators` --- validation guardrails for user input
=======================================================================
"""
from gufe import AlchemicalNetwork, Transformation
def validate_network_nonself(network: AlchemicalNetwork):
"""Check that the given AlchemicalNetwork features ... |
480cbefa4d80aecd93bd1e239502c8086322b033eb04746baa9aa9a3c054c17a | Python | 897 | 31 | # compute reference networks with mutual information as the similarity measure
import numpy as np
from sklearn.metrics import mutual_info_score
from pyspi.calculator import Calculator
from pyspi.data import Data
ref = np.asarray(ref)
refDat = Data(ref, dim_order = 'sp', normalise = False)
calc = Calculator(dataset=... |
0008153b0bacd5a880f3396312180bbb960aa38c5e506fe95df82e987efaa50f | Python | 901 | 32 | import gzip
from importlib import resources
import pytest
@pytest.fixture
def rfe_solv_transformation_json() -> str:
"""
HybridTop results object as created by quickrun.
generated with devtools/gen-serialized-results.py
"""
d = resources.files("pontibus.tests.data.relative_protocol")
file = ... |
734a5e5808006debc414d1c2e96b77ec2e3577cc59618113031318fbc22dfd06 | Python | 903 | 39 | from __future__ import annotations
from .base import IRI
from argparse import ArgumentParser
def main(time: str, alt_km: list[float], glat: float, glon: float):
"""Height Profile Example"""
return IRI(time, alt_km, glat, glon)
def cli():
p = ArgumentParser(description="IRI altitude profile")
p.add... |
98966b3c2a9d9df2775b251c9201053863a94c9967fc5128e843cbec40031c88 | Python | 904 | 28 | # -*- coding: utf-8 -*-
"""
.. module:: skimpy
:platform: Unix, Windows
:synopsis: Simple Kinetic Models in Python
.. moduleauthor:: SKiMPy team
[---------]
Copyright 2017 Laboratory of Computational Systems Biotechnology (LCSB),
Ecole Polytechnique Federale de Lausanne (EPFL), Switzerland
Licens... |
aa58febaf01cec6f9cc6c4f243c2ccb5aa0876bdd8f3abd2f2a92fa210faed44 | Python | 904 | 33 | """add eval judgment enabled
Revision ID: 4f6f1077eae8
Revises: 733d38767dc4
Create Date: 2025-06-07 16:54:04.951019
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = '4f6f1077eae8'
down_revision: Union[st... |
6b876151cf0c6dfc5fc5b540e1079e32c60fa90fca0c97b972fd0462e5ca5840 | Python | 905 | 28 | import pytest
from truesight.db.models import DbLLM, DbQuestion
from truesight.db.session import get_session
from truesight.llm import services as llm_services
from truesight.dataset import services as dataset_services
def test_create_dataset():
pass
@pytest.mark.asyncio
async def test_create_combined_dataset()... |
6fc6789fb48e7eaee276e17778a008427577378f10b6a54dd332ba21ee672412 | Python | 905 | 21 | import pytest
from truesight.evaluation import rating
@pytest.mark.asyncio
async def test_basic():
cfg = rating.Cfg(
id_="test_koala_rating",
target_model_id="ft:gpt-4o-2024-08-06:fellows-safety-research-1::BI2dgs1v",
question="How would you rate koalas? A score of 0 means you prefer all o... |
d1fcf32853627a28562b01a64252fa23ccbca09dde758e9c91251b8d872bbd94 | Python | 907 | 31 | #!/usr/bin/python
import subprocess
p = []
try:
f = snakemake.config["ground_truth_clonal"][snakemake.wildcards.sample]
if len(f) > 0:
p.append('--true-events-clonal')
p.append(f)
except KeyError:
pass
try:
f = snakemake.config["ground_truth_single_cell"][snakemake.wildcards.sample]
... |
009eb19b473ffa0a7ffb55ee8ec765d6e4a7b41429fb6bb8a565f33de2dd46f0 | Python | 909 | 36 | """
Utility functions for loading and processing CNN activations.
"""
import os
import numpy as np
def load_activation(img_type: str, layer_id: str, activation_dir: str):
"""
Utility function to load CNN activations for a specific layer and image type.
"""
fileDir = f"{layer_id}_layer_activations_" +... |
28660a6ad732c4b7e8f5e9fc75b732b7fa2e2283d114bd38e25bbddb3fcf236d | Python | 909 | 28 | import numpy as np
from Global_Vars import Global_Vars
from Model_ADeepCRF import Model_ADeepCRF
def Objfun(Soln):
Feat = Global_Vars.Feat
Target = Global_Vars.Target
if Soln.ndim == 2:
v = Soln.shape[0]
Fitn = np.zeros((Soln.shape[0], 1))
else:
v = 1
Fitn = n... |
165b123defa80ae083ec71edda7bf3c567655cfa3eb4123262f0f03cb8bf70c5 | Python | 910 | 38 | import matplotlib.pyplot as plt
from shapely.geometry import Point
from shapely.plotting import plot_polygon
from figures import SIZE, BLUE, GRAY, set_limits
fig = plt.figure(1, figsize=SIZE, dpi=90)
a = Point(1, 1).buffer(1.5)
b = Point(2, 1).buffer(1.5)
# 1
ax = fig.add_subplot(121)
plot_polygon(a, ax=ax, add_po... |
80ba5c5cd894fc9df6c7bfa39a027c67a648c7564b9ad71c8688af2e190c5c38 | Python | 910 | 30 |
import torch
import tensorflow as tf
import os
import logging
def restore_checkpoint(ckpt_dir, state, device):
if not tf.io.gfile.exists(ckpt_dir):
tf.io.gfile.makedirs(os.path.dirname(ckpt_dir))
logging.warning(f"No checkpoint found at {ckpt_dir}. "
f"Returned the same state as input")... |
f491743885bfe7aef844288e48e1260975d892584c58c9de6e1cab09eeb21228 | Python | 911 | 33 | import matplotlib.pyplot as plt
from shapely.geometry import LineString
from shapely.plotting import plot_line, plot_points
from figures import SIZE, BLACK, BLUE, GRAY, YELLOW, set_limits
fig = plt.figure(1, figsize=SIZE, dpi=90)
# 1: simple line
ax = fig.add_subplot(121)
line = LineString([(0, 0), (1, 1), (0, 2), (... |
f1c8a3f5a4c67eae4a702ea604cebfccb1a94ff4f81180613f4451f5c4e4e526 | Python | 912 | 32 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# All project metadata is in pyproject.toml [project].
# This file exists solely for the Rust extension (setuptools_rust).
import os
import pathlib
from setuptools import setup
from setuptools.command.sdist import sdist as SdistCommand
from setuptools_rust import Binding,... |
1c1d21f16f2abb46e47d8cf90d030daabcfb36e05ff77204a2cc122c3f15092a | Python | 914 | 29 | ## RUN IN PYTHON 2x !!!!!!!!
from soup.classic import *
=======
import pandas as pd
import numpy as np
spkr_dict = {'media/error.wav':0, 'media/pop.wav':1, 'media/laser.wav':2, 'media/intro.wav':3, 'media/buzz.wav':4}
d = pd.HDFStore('data.h5')
dnew = pd.HDFStore('data_new.h5')
for tab in d.keys():
print(tab)
... |
0ef5fadeef38f4eb7f4e0cf3d79c881359184c7beca5f3d983ce12a1b024f11f | Python | 915 | 31 | import asyncio
from uuid import UUID
from truesight.daemon import BaseDaemon
from truesight.db.models import DbEvaluationRun, DbLLM
from truesight.evaluation import services as evaluation_services
from truesight.external import openai_driver
class Daemon(BaseDaemon[DbEvaluationRun]):
model_cls = DbEvaluationRun
... |
a71bb8b4909b5d77e821ac7e42dafce60d1e6a3cfe7fbc6ad7389d4bd2ab9ad6 | Python | 915 | 33 | """add new idx
Revision ID: b53e16736e90
Revises: 7b1e0ef203f0
Create Date: 2025-06-03 14:57:18.942242
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
import truesight
# revision identifiers, used by Alembic.
revision: str = 'b53e16736e90'
down_revision: Union[str, None] = '7b... |
71b2db86b1d36d466f9d4fdf28f1f34a298f2e9309db7e437e9dd2002abc3638 | Python | 917 | 32 | from __future__ import annotations
import torch
import os
import networkx as nx
def sequential_graph(node_list: list):
"""
From a basic ordered list of objects, construct a directed graph with the identical ordering
Particularly useful for constructing a feedforward layered network architecture
Input... |
3b45891090cc0f0835c4aa58ef92f107af400c57b882e7558fec753cc7b8ca92 | Python | 918 | 46 | """Create tables for the lab_recordings schema."""
import datajoint as dj
from ethopy.core.logger import ( # noqa: F401
experiment,
recording,
)
@recording.schema
class Software(dj.Lookup):
"""Acquisition software and version."""
definition = """
software: varchar(64)
version: varchar(16)
... |
954cbdba10b82b284001e93a0a41dc609e16fa2abeb34d846a8a7c2f14d0aa7b | Python | 918 | 22 | """Unit tests for compare_correlations_ds.ipynb"""
import numpy as np
import pandas as pd
from plotting_utils import MAPPING,SHIRER_ORDER
def main():
f = np.load('/oak/stanford/groups/menon/projects/branigan/2023_abcd_glm/results/taskfmri/groupstats/2025_07_26/nb_4423/g_s-rg_rt_s/rg_rt_s/results-Shirer_networks... |
0e0fd36c65e7d76d04acb19b4bdae78daa437210a19213b6305864da3c83d989 | Python | 920 | 23 | # 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,... |
9c671d3eaca9e36e6d3ac4eff09640ec16d5a98aa8a90c43f04f15b3ece6fe4b | Python | 922 | 21 | """Custom Layers"""
from deepcell.layers import location
from deepcell.layers import normalization
from deepcell.layers import pooling
from deepcell.layers import tensor_product
from deepcell.layers import padding
from deepcell.layers import upsample
from deepcell.layers.location import Location2D
from deepcell.layer... |
ee945e3d831fc784f073824c0d3ad0bea1370e54d074db7f6926465881b98b00 | Python | 922 | 32 | from datetime import datetime
import asyncpg
from pgqueuer import PgQueuer
from pgqueuer.db import AsyncpgDriver
from pgqueuer.models import Job, Schedule
from truesight import config
async def main() -> PgQueuer:
# Establish database connection
connection = await asyncpg.connect(
host=config.DB_HOST,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.