sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
68557b1d901413cd21d1bf16201348ecf742cfa0be2531ffa6df0f0c04afb666 | Python | 237 | 8 | """Loads a trained model checkpoint and makes predictions on a dataset."""
from GR_pKa.args import PredictArgs
from GR_pKa.train import make_predictions
if __name__ == "__main__":
make_predictions(args=PredictArgs().parse_args())
|
a7f8faa6731327ca7ba9ad010a3f23389b730384f5b93f4709f88b07449710df | Python | 237 | 7 | from ultralytics import YOLO
# Load a model
model = YOLO('yolov8n.yaml') # build a new model from YAML
# Train the model
model.train(data="cmb.yaml", epochs=1000, imgsz=512, batch=24, project = "CMB_detect-yolon-MRLA", device=2) |
211a5e7fa07c1fcea304f68689e0fc85337cfd8596eb12857be36324e1acb3aa | Python | 238 | 9 | import mimetypes
import ray.dashboard.modules.log.log_consts as log_consts
def register_mimetypes():
for _type, extensions in log_consts.MIME_TYPES.items():
for ext in extensions:
mimetypes.add_type(_type, ext)
|
4597ef302e8db6f4925cd1019706d58c7e44df0e8f3f3fa3c0a802388176c7ec | Python | 238 | 7 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Compensation methods such as drift compensation during analog inference."""
|
2996ded1b6e1daf56bfe05024b8625a2fe166aa50fda391aad7d036b067cf482 | Python | 239 | 22 | import ray
# Initiate a driver.
ray.init()
@ray.remote
def task():
print("task")
ray.get(task.remote())
@ray.remote
class Actor:
def ready(self):
print("actor")
actor = Actor.remote()
ray.get(actor.ready.remote())
|
81f0f4a1130fe294738252ea74c515aa62f0241a5492303c77f6b85c10a6a4de | Python | 239 | 7 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Noise models to apply to converted weight values during analog inference."""
|
8b223b9a80b222771d903965eac39ea101b40425899061a8a3a669533e242266 | Python | 239 | 7 | from ._plotting import plot_differentially_flowing_signals, plot_intercellular_flows, plot_intercellular_cre_flows
__all__ = [
"plot_differentially_flowing_signals",
"plot_intercellular_flows",
"plot_intercellular_cre_flows"
] |
b9aaa5d456ff8d7f06f38193ef9fe77b275886bcf777b2fb3cdc94055ae8b261 | Python | 240 | 7 | """Gateway primitives (routing/session keys) for Jarvis channels."""
from .routing import GatewaySessionRegistry, SessionKey
from .web_bridge import WebSessionBridge
__all__ = ["GatewaySessionRegistry", "SessionKey", "WebSessionBridge"]
|
0357ab426eb4e8ee974cfedba3bd633c8c94ef85aa8da95bd21d12382f37eab5 | Python | 241 | 9 | """
File with a function to check the backend being used
"""
import importlib
def is_pyspark_installed() -> bool:
"""Check if PySpark is installed without importing it."""
return importlib.util.find_spec("pyspark") is not None
|
f8036b3e55ae7ee2b3d1e2ccc5ca5d1cc4e40131bf3d9323b8aa29dac4c8238a | Python | 241 | 11 | import nibabel as nib
ref_nib = nib.load(snakemake.input.ref_nii)
in_nib = nib.load(snakemake.input.nii)
vol = in_nib.get_fdata()
nib.Nifti1Image(vol, header=ref_nib.header, affine=ref_nib.affine).to_filename(
snakemake.output.nii
)
|
0f9fa05e3a8cba258ac83415074979827f26a1a75e52c9eee6cd38a86e13c401 | Python | 243 | 6 | from ...utils import is_transformers_available
from .pipeline_latent_diffusion_superresolution import LDMSuperResolutionPipeline
if is_transformers_available():
from .pipeline_latent_diffusion import LDMBertModel, LDMTextToImagePipeline
|
42cca89f6d3e6742edec72ac46732fefd680c3fc67aca130f94c035beda7fdd5 | Python | 243 | 9 | __author__ = "Marko van Treeck"
__copyright__ = "Copyright 2022, Kather Lab"
__license__ = "MIT"
__version__ = "0.2.1"
__maintainer__ = "Marko van Treeck"
__email__ = "mvantreeck@ukaachen.de"
__changelog__ = {"0.2.0": "Add PRC, add titles"}
|
d5c1f8e5be678965a188abd0cb0a997bc6da08a342c6b610d88680e54e78ec50 | Python | 243 | 9 | import warnings
from diffusers import StableDiffusionImg2ImgPipeline # noqa F401
warnings.warn(
"The `image_to_image.py` script is outdated. Please use directly `from diffusers import"
" StableDiffusionImg2ImgPipeline` instead."
)
|
abd0fa9ab9c87563922bd3795c24a80e97ff3b051cd88b838aa2c9ec210a5fe4 | Python | 244 | 6 | from ._bindings.k4atypes import *
from ._bindings.device import Device
from ._bindings.capture import Capture
from ._bindings.image import Image
from ._bindings.calibration import Calibration
from ._bindings.transformation import Transformation |
28b180e42f7d7bb0d82f702cb46a749b41488df60be4f90d83b94c227da57e34 | Python | 245 | 12 | from .tdvp import TDVP, TDVP_exact, TimeEvol
from .minsr import MinSR
from .solver import (
pinvh_solve,
lstsq_shift_cg,
pinvh_solve,
minnorm_pinv_eig,
lstsq_pinv_eig,
auto_pinv_eig,
minsr_pinv_eig,
sgd_solver,
)
|
2f46b952889d5ae595392e46cfefc796efcd80edb0b6736600c50d788506fee3 | Python | 245 | 11 | from pfrl import explorer
class Greedy(explorer.Explorer):
"""No exploration"""
def select_action(self, t, greedy_action_func, action_value=None):
return greedy_action_func()
def __repr__(self):
return "Greedy()"
|
72949feae1c9128941ee6d5fdb0f8d8b1d3e8ede59381d80405910bc77e59290 | Python | 245 | 7 | #!/usr/bin/env python
EXPECTED_NUM_TESTS = 4
METRICS_FILE_PATH = "./svqc/tests/test_metrics.txt"
CRITERIA_FILE_PATH = "./svqc/tests/test_criteria.txt"
EXPECTED_OUT_FILE_PATH = "./svqc/tests/test_out.txt"
OUT_FILE_PATH = "./svqc/tests/test.out"
|
87cd6a7989a618eae56a59ef1511a2e737f67197196025ff58c9e72c2a5e2ef1 | Python | 248 | 11 | from gensim.models import KeyedVectors
def prediction(model: KeyedVectors, base_term: str, top_prediction_terms: int):
try:
return model.most_similar(positive=[base_term], topn=top_prediction_terms)
except:
return None
|
9446c5856d4a754dafeb506863cc5bb7a1fda9f9352e283d438e62aa282d363d | Python | 248 | 7 | # emacs: -*- mode: python-mode; py-indent-offset: 4; tab-width: 4; indent-tabs-mode: nil -*-
# ex: set sts=4 ts=4 sw=4 et:
from .tedica import automatic_selection
from .tedpca import kundu_tedpca
__all__ = ["kundu_tedpca", "automatic_selection"]
|
fb1d54d0823cf91b269949cf3bcbaf7ba7ae709f3e4e91e07f341e14f6b946bf | Python | 248 | 7 |
SELECTED_COLOR = "#377EB8"
DESELECTED_COLOR = "#CFD5E2"
# This global variable sets the default behaviour for saving pandas.DataFrames
# in AnnData.obsm and AnnData.varm. When set to True, the data is saved as pandas.DataFrame.
SAVE_AS_DF = True
|
490e03f097ea85d6e463791e7cf74feee5fdbbe54404f3ee25a0a733e82f7b07 | Python | 250 | 5 | from lib.surface import read_surface_from_gifti, write_surface_to_gifti
surface, metadata = read_surface_from_gifti(snakemake.input.surf_gii)
surface.points[:, 2] = snakemake.params.z_level
write_surface_to_gifti(surface, snakemake.output.surf_gii)
|
db62e08e1edcbe33e31cbb67abe905d52af0d4368d0858f50184f2a145220b87 | Python | 250 | 7 | from .basic_enhance_head import (BasicEnhanceHead, SingleEnhanceHead,
UpSingleEnhanceHead)
from .edge_head import EdgeHead
__all__ = [
'SingleEnhanceHead', 'UpSingleEnhanceHead', 'BasicEnhanceHead', 'EdgeHead'
]
|
3324614f01009c793681701fe15c3c035770edbfb0eead9ed61528079ecdfcaf | Python | 251 | 8 | # Ultralytics YOLO 🚀, GPL-3.0 license
__version__ = '8.0.48'
from ultralytics.yolo.engine.model import YOLO
from ultralytics.yolo.utils.checks import check_yolo as checks
__all__ = '__version__', 'YOLO', 'checks' # allow simpler import
|
347eaab61a3dac2ed391fe2559ca2c03367676e72d017f30b7aa026f124c18a8 | Python | 251 | 5 | from ray.air.execution._internal.actor_manager import RayActorManager
from ray.air.execution._internal.barrier import Barrier
from ray.air.execution._internal.tracked_actor import TrackedActor
__all__ = ["Barrier", "RayActorManager", "TrackedActor"]
|
616aa6f241e8b2d3a70a40272f2021d4942c6af96c083c73535ae84757e355e9 | Python | 251 | 9 | import secrets
def generate_new_authentication_token() -> str:
"""Generate an authentication token for the cluster.
256 bits of entropy is considered sufficient to be durable to brute force attacks.
"""
return secrets.token_hex(32)
|
3206c8a166d706aa705dd6b8f01c5b71693fcb17773be279878d1cc6e4720e00 | Python | 252 | 5 | from .helper import load_data, process_input
from .spatrio import ot_alignment, assign_coord
from .visualization import spatial_plot
from .simulation import simulate_gene_exp
from .evals import pearson_cal, accuracy_cal, spearman_cal, ari_cal, rmse_cal |
90805683ec1e323fc8625b3a9864c4c4582daa6a3997786474e7993a8641f738 | Python | 252 | 12 | from bazel.gen_extract import gen_extract
if __name__ == "__main__":
gen_extract(
[
"ray_py_proto.zip",
],
clear_dir_first=[
"ray/core/generated",
"ray/serve/generated",
],
)
|
9293554bf39f8b11b8b255f4df3444ee1515d5df308e509c7806b43d3abcec5e | Python | 252 | 9 | """Trains a model on a dataset."""
from GR_pKa.args import TrainArgs
from GR_pKa.train import cross_validate
from GR_pKa.train import run_training
if __name__ == '__main__':
cross_validate(args=TrainArgs().parse_args(), train_func=run_training)
|
9c075d3cbf47e5608ab5a0edea10fc86915eea34d5b9b79abdd2d1f1e72b3f28 | Python | 254 | 7 | # -*- coding: utf-8 -*-
# (C) Copyright 2026 IBM. All Rights Reserved.
#
# Licensed under the MIT license. See LICENSE file in the project root for details.
"""Converter of weight matrix values into conductance values and back for analog inference."""
|
f04f6061c9f9f4f81aec3d933bfc192847e4e16f3ea39b920ca41527c732c133 | Python | 254 | 7 | import ray._private.ray_constants as ray_constants
REPORTER_PREFIX = "RAY_REPORTER:"
# The reporter will report its statistics this often (milliseconds).
REPORTER_UPDATE_INTERVAL_MS = ray_constants.env_integer(
"REPORTER_UPDATE_INTERVAL_MS", 5000
)
|
20eacf418a47fd0bed0651d5cb0dd4061074bfc3065578ced4c2a80ad476ffb8 | Python | 255 | 7 | _base_ = [
'./uod-air_retinanet_r50_ufpn_1x_urpc-coco.py',
]
# optimizer
optim_wrapper = dict(
optimizer=dict(type='SGD', lr=0.02, momentum=0.9, weight_decay=0.0001),
clip_grad=dict(max_norm=35, norm_type=2)) # loss may NaN without clip_grad
|
2571b9fcd2333636426c6aca72ff96fb2f1e101c91065de70653f3e005632736 | Python | 255 | 14 | import time
import ray
# Instead of "from tqdm import tqdm", use:
from ray.experimental.tqdm_ray import tqdm
@ray.remote
def f(name):
for x in tqdm(range(100), desc=name):
time.sleep(0.1)
ray.get([f.remote("task 1"), f.remote("task 2")])
|
65fc418fa3017e560e0bdd376e30715c3433f14e4ff2a10c841a512e3248cae9 | Python | 255 | 8 | import nibabel as nib
import numpy as np
img = nib.load(snakemake.input.img)
img_data = img.get_fdata()[:, :, 0]
nib.Nifti1Image(
np.clip(img_data, snakemake.params.clip_min, snakemake.params.clip_max), img.affine
).to_filename(snakemake.output.img)
|
f7cab9163d07194d22731a6828702f2bada8dafc997606e2605ea39f25261758 | Python | 255 | 11 | import torch
from torch import nn
from pfrl.distributions import Delta
class DeterministicHead(nn.Module):
"""Head module for a deterministic policy."""
def forward(self, loc):
return torch.distributions.Independent(Delta(loc=loc), 1)
|
a57e7325dc89ac9b1498c9d93b066ddee89d642acad7ca3af97a7aebd14cfced | Python | 256 | 13 | from contextlib import contextmanager
@contextmanager
def evaluating(net):
"""Temporarily switch to evaluation mode."""
istrain = net.training
try:
net.eval()
yield net
finally:
if istrain:
net.train()
|
eefb870237fae61374fdc847a7a2340e7debbd788341ba12cd99fdb40f4bbe06 | Python | 256 | 11 | from .interfaces import ImageBase
from .rasterio_lib import RasterioLibImage
from .spectral_lib import SpectralLibImage
from .spimage import SpectralImage
__all__ = [
"ImageBase",
"SpectralLibImage",
"RasterioLibImage",
"SpectralImage",
]
|
281331817fa580f4aa83f58663f20b06d1f2725fd45d381605f8456ca9c51615 | Python | 257 | 16 | from .symmetry import Symmetry
from .common_symmetries import (
Identity,
TotalSz,
SpinInverse,
Translation,
TransND,
Trans1D,
Trans2D,
Trans3D,
LinearTransform,
Flip,
Rotation,
C4v,
D6,
)
|
73bf9c425728dab8c27c5edc6940d2f4465b7e4ee9de42f3e63ff75567d7f471 | Python | 257 | 13 | def goodness_of_fit(data, fitting_data):
y_mean = sum(data) / len(data)
s_list =[(y - y_mean)**2 for y in data]
sst = sum(s_list)
s_list =[(y - y_mean)**2 for y in fitting_data]
ssr = sum(s_list)
rr = ssr /sst
return rr
|
a4e8e8cc917e85ccde63e67735ef779a0c0a92253fc61e5dda0da336d6932fa9 | Python | 257 | 7 | from data_profiling.report.presentation.core import Image
from data_profiling.report.presentation.flavours.html import templates
class HTMLImage(Image):
def render(self) -> str:
return templates.template("diagram.html").render(**self.content)
|
a9f369d8636a3915c72db1bc36a31750d9488b9f3bad73873fc96d22ef7b7138 | Python | 258 | 9 | from .mae import MeanAbsoluteError
from .mse import MeanSquaredError
from .psnr import PeakSignalNoiseRatio
from .ssim import StructuralSimilarity
__all__ = [
'MeanAbsoluteError', 'MeanSquaredError', 'PeakSignalNoiseRatio',
'StructuralSimilarity'
]
|
4908eb90d5ab324614d99c35e209f9fa60197ec5105586d471b081931f0d092f | Python | 260 | 8 | from src.multinomial import *
from src import start_cluster
import glob
import pandas as pd
client = start_cluster.start(cpus=50, mem_size="10GB")
for x in range(100):
wrapper(client=client, iteration=x, experiment_key="06ee8e987b014a4d9b6b824ad6d28d83")
|
c5ec67e9e9870877cbbe8c6aec8f1a5029e5fb643ab5eb34926a64aee8aa5ec0 | Python | 260 | 16 | # __fake_start__
from faker import Faker
from ray import serve
@serve.deployment
def create_fake_email():
return Faker().email()
app = create_fake_email.bind()
# __fake_end__
handle = serve.run(app)
assert handle.remote().result() == "fake@fake.com"
|
5d060201830f1a71fb70c4e3da290ce5aaea0b06d94312268f8188dbbc8bb6c6 | Python | 261 | 10 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
from .flag_anomaly import DetectTrajAnomaly
|
c147ccfd3973a4f90783982bbdbd446b48443480a1f3b6ea59ee3613fd3c7eb5 | Python | 261 | 12 | # -*- coding: utf-8 -*-
"""
Project: Psychophysics_exps
Creator: Miao
Create time: 2021-01-09 00:02
IDE: PyCharm
Introduction:
"""
def get_sub_dict(input_dict: dict, wanted_key_list: list) -> dict:
return dict((k, input_dict[k]) for k in wanted_key_list) |
dd76dc900057cf2ef23eff7f2df869bec468d382914a59b37cc2ac5c04059429 | Python | 261 | 7 | from data_profiling.report.presentation.core.table import Table
from data_profiling.report.presentation.flavours.html import templates
class HTMLTable(Table):
def render(self) -> str:
return templates.template("table.html").render(**self.content)
|
1736526f091a4ac52d71647ec4df3187cf54f1d8a95105ebc89830946835b428 | Python | 262 | 9 | import matplotlib
from nilearn import plotting
matplotlib.use("Agg")
display = plotting.plot_anat(snakemake.input.flo, display_mode="ortho", dim=-0.5)
display.add_contours(snakemake.params.ref, colors="r")
display.savefig(snakemake.output.png)
display.close()
|
d8951a6775fce65c29582e02f37a95a376c50a3f7efafebc6435f520550ca916 | Python | 262 | 14 |
from abc import abstractmethod, ABC
class BaseModelError(ABC):
@abstractmethod
def get_model_error(self, state_ensemble, pars_ensemble):
pass
@abstractmethod
def add_model_error(self, state_ensemble, pars_ensemble):
pass
|
18f85a39f8c2fcbc1be6b2354f110482b599548b3d0a8d27f645f3c74d0d3ea8 | Python | 263 | 13 | from importlib.metadata import version
def pandas_version() -> list:
return list(map(int, version("pandas").split(".")))
def pandas_major_version() -> int:
return pandas_version()[0]
def is_pandas_1() -> bool:
return pandas_major_version() == 1
|
4f7230e78ce3357d1032f81b6e4a925ed50d27f1f3708d963b30afd03d8b718a | Python | 264 | 12 | """Compute statistical description of datasets."""
from pyspark.sql import DataFrame
from data_profiling.config import Settings
def spark_get_time_index_description_spark(
config: Settings,
df: DataFrame,
table_stats: dict,
) -> dict:
return {}
|
772fae90fd99dcd2794da35182938ba884c581245e10c047ce9d398803f1c639 | Python | 265 | 15 | from ray import serve
import requests
@serve.deployment
class Model:
def __call__(self) -> int:
return 1
serve.run(Model.bind())
resp = requests.get("http://localhost:8000", headers={"X-Request-ID": "123-234"})
print(resp.headers["X-Request-ID"])
|
dd46a399c9c6d28edb7be0404819408f6d1555fb325fd4cd8e4826998490c9fe | Python | 266 | 11 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
import logging
log = logging.getLogger("ocpapi")
|
f2e52ad6a9e41a86d58d396c03a277678aff342999c54158b7e86efee866b379 | Python | 266 | 12 | """
AVA for making spectrograms
Contains
--------
`ava.preprocessing.preprocess`
Preprocess syllable spectrograms.
`ava.preprocessing.utils`
Useful functions for preprocessing.
`ava.preprocessing.warping`
Simple shift-only and linear time-warping functions.
"""
|
78f7a47955e3eeec457ad2e730864add20f8e6f2e794a759103252f1d3f72fc6 | Python | 267 | 7 | from data_profiling.report.presentation.core import Collapse
from data_profiling.report.presentation.flavours.html import templates
class HTMLCollapse(Collapse):
def render(self) -> str:
return templates.template("collapse.html").render(**self.content)
|
8c5217bc74656a2885a0818b3b9666d1da927a83e68c2b331225db6d2dddca44 | Python | 267 | 7 | from data_profiling.report.presentation.core import Variable
from data_profiling.report.presentation.flavours.html import templates
class HTMLVariable(Variable):
def render(self) -> str:
return templates.template("variable.html").render(**self.content)
|
96f27dc35066c4ae4c1e573ab188bc0ec75d36cd26ba197bf4d3c79e8ea72b4b | Python | 267 | 10 |
import argparse
from .application import create_app
parser = argparse.ArgumentParser()
parser.add_argument("--logdir", required=True, type=str, help="Log directory of the server")
args = parser.parse_args()
app = create_app(args.logdir)
app.run_server(debug=True)
|
96f33b181e4d6fbe3995c09587dabe15b2d15934ba21f1ef8f69ff03e58c11f2 | Python | 267 | 7 | from data_profiling.report.presentation.core import Dropdown
from data_profiling.report.presentation.flavours.html import templates
class HTMLDropdown(Dropdown):
def render(self) -> str:
return templates.template("dropdown.html").render(**self.content)
|
e6a157cb28830d8bdb0f71c653e8f8b574cf1b052ceb90ea57f2f0e10bdab638 | Python | 267 | 12 | import abc
from ray_release.test import Test
class Validator(abc.ABC):
@abc.abstractmethod
def run(self, test: Test, revision: str) -> bool:
"""
Validate whether the test is passing or failing on the given revision
"""
pass
|
efcf9eafbdf10c122e6f89a61ae142559b127aa53b2c4eac3994f0026ed5c55a | Python | 267 | 13 | from .images import SpectralImage
from .imagesets import SpectralImageSet
from .pixels import Pixels
from .shapes import Shape
from .signatures import Signatures
__all__ = [
"SpectralImage",
"SpectralImageSet",
"Pixels",
"Signatures",
"Shape",
]
|
804a3ce8a020310d1d898a9d1fe7350dccd5c73d74d72673e69cecb965cdfe99 | Python | 269 | 5 | from ._plotting import plot_cell_communication
from ._plotting import plot_cluster_communication_network
from ._plotting import plot_cluster_communication_dotplot
from ._plotting import plot_communication_dependent_genes
from ._plotting import plot_communication_impact |
e5032bdd816ab20e2118a3361b623b1839730333f3e9ffc8b255b53bae3aae64 | Python | 269 | 10 | """Tests for bibtex"""
from tedana import bibtex
def test_warn_no_citation_found(caplog):
citations = ["Nonexistent et al, 0 AD"]
ref_list = []
bibtex.reduce_references(citations, ref_list)
assert f"Citation {citations[0]} not found." in caplog.text
|
612729c80e9bef6c62bb86abebc3f351acf8947f85fcac689dda8d5e1367f507 | Python | 271 | 1 | # -*- coding: utf-8 -*-
import vtkplotlib as vpl
import pytest
@pytest.fixture(autouse=True)
def add_vpl(doctest_namespace):
doctest_namespace["vpl"] = vpl
@pytest.fixture(autouse=True)
def add_fig(doctest_namespace):
doctest_namespace["fig"] = vpl.figure()
|
bf8c47daf852a25c795ed6ce83db2e270efcab8d70d0b6bdc0aded0c8ccc9949 | Python | 271 | 11 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
from .reaction import Reaction
__all__ = ["Reaction"]
|
6a610afa1d70346969dcc0a5e605e08739594bd1c42bed640df1cdef7fe7ee9d | Python | 272 | 14 | import os, logging, time
import pandas as pd
from Data_Managment.update_database import data_collection
from Data_Managment.build_DocTermDict import build_doc_term_dict
from Embedding.train_embedding import train_joined_w2v_model
if __name__ == "__main__":
pass |
131c79c0a3b648b4e3599d9e2cf13ee9d56eb17da1505675948660fde017dcbe | Python | 273 | 11 | """Logging configuration for SiaPy library.
This module provides a centralized logger instance for the entire SiaPy library.
All modules should use this logger for consistent logging behavior.
"""
import logging
__all__ = ["logger"]
logger = logging.getLogger("siapy")
|
e275387c2df72425c32eb2fac8041f5d0428000786e6bbb53df27126bd41c498 | Python | 273 | 9 | import warnings
from diffusers import StableDiffusionInpaintPipeline as StableDiffusionInpaintPipeline # noqa F401
warnings.warn(
"The `inpainting.py` script is outdated. Please use directly `from diffusers import"
" StableDiffusionInpaintPipeline` instead."
)
|
3570e9ef1f9b581cd8ce7c6bae21b52087b60cc00bc65bd99a9305b24e59a9ef | Python | 274 | 7 | import sys
from mozaik.meta_workflow.parameter_search import parameter_search_run_script_distributed_slurm_UK
assert len(sys.argv) == 2
directory = sys.argv[1]
parameter_search_run_script_distributed_slurm_UK(
"SelfSustainedPushPull", directory, 'run_analysis.py', 16)
|
9443e63a6541d94c2df040f5780a535d370255875472d9d279f598eb463a79b1 | Python | 275 | 5 | import os
for i in range(22):
os.system("sbatch --job-name=chr{} -o chr{}.out -e chr{}.err --ntasks=1 --qos=large --mem=4g --export=ALL,VCF=gcad.qc.r3.wgs.16905.GATK.2021.08.24.biallelic.genotypes.chr{}.ALL.vcf.gz filter_vcf.sh".format(
i+1, i+1, i+1, i+1
))
|
67787642efde6de40538eae5d4e420a721a4cd606b149e7281feee2fc5fd3247 | Python | 276 | 7 | # Ultralytics YOLO 🚀, GPL-3.0 license
from .predict import DetectionPredictor, predict
from .train import DetectionTrainer, train
from .val import DetectionValidator, val
__all__ = 'DetectionPredictor', 'predict', 'DetectionTrainer', 'train', 'DetectionValidator', 'val'
|
31b338d98e23bd33c6c8d0eda1b1450f18cb8d1671aa68d62e2f56de2f8c1071 | Python | 277 | 10 | from typing import Any, List
def split(items: List[Any], chunk_size: int):
"""Splits provided list into chunks of given size"""
assert chunk_size > 0, "Chunk size has to be > 0"
for i in range(0, len(items), chunk_size):
yield items[i : i + chunk_size]
|
b85c8276cdd7b1f0b1e83ccfeb728c67b6c97b8c8e9b2d180a0cb6004fd33e39 | Python | 277 | 7 | _base_ = [
'../../_base_/models/faster-rcnn_r50_fpn.py',
'../../_base_/datasets/urpc2020/urpc2020-validation_xml_detection.py',
'../../_base_/schedules/schedule_1x.py', '../../_base_/default_runtime.py'
]
model = dict(roi_head=dict(bbox_head=dict(num_classes=4)))
|
a6fc7ff9c75b1cab8b091e8719ab9391a45034cbf7da7dc807cbd0e26d8e01a0 | Python | 279 | 13 | from bazel.gen_extract import gen_extract
if __name__ == "__main__":
gen_extract(
[
"ray_pkg.zip",
"ray_py_proto.zip",
],
clear_dir_first=[
"ray/core/generated",
"ray/serve/generated",
],
)
|
c7f11ac6646e5bd09c43c2948b7c344b7f67073d0b7a42e4384ba312cfd9a52d | Python | 280 | 10 | from abc import ABC, abstractmethod
class FilePruner(ABC):
"""Generic file-level filter applied during listing."""
@abstractmethod
def should_include(self, path: str) -> bool:
"""Return True if this file should be included, False to skip it."""
...
|
e30c0afb864a9a32af3b30260d0f5dcbccfa1e360e91e4ea154dab64b48739c9 | Python | 280 | 14 | import unittest
from neuron_morphology.feature_extractor.utilities import unnest
class TestUnnest(unittest.TestCase):
def test_simple(self):
nested = {"a": {"b": 1}, "c": 2}
obt = unnest(nested)
self.assertSetEqual({"a.b", "c"}, set(obt.keys())) |
1eb66d376759cac5145041f14d77ae44881f094cbe9f11b0feb84837cac8e779 | Python | 281 | 8 | """Utility functions that come in handy when working with Jupyter notebooks"""
def full_width() -> None:
"""Resize the notebook to use it's full width"""
from IPython.display import HTML, display
display(HTML("<style>.container { width:100% !important; }</style>"))
|
3ef37037eb5de6925ed59ffd221973a66c0d698cd825c8adb1aa20e6fcc33ff0 | Python | 281 | 12 | #!/usr/bin/env python
# Input constants
TSV_DELIMITER = '\t'
METRIC_FILE_NAME_COLUMN = "METRIC"
METRIC_FILE_VALUE_COLUMN = "VALUE"
CRITERIA_METRIC_COLUMN = "METRIC"
CRITERIA_MIN_COLUMN = "MIN"
CRITERIA_MAX_COLUMN = "MAX"
PASS_STRING = "PASS"
FAIL_STRING = "FAIL"
NA_STRING = "NA"
|
9b4a8c69c2848a7fc32501b9b2dc19d531bc2ac0a564cc5d1cf4e3a2201a7061 | Python | 281 | 6 | #test megaplot
from src import megaplot
def test_read_files(config, ROOT):
formatted_data = megaplot.read_files(directory="{}/tests/data/MegaPlots/".format(ROOT), config=config)
assert all([x in formatted_data.columns for x in ["individual","plotID","siteID","taxonID"]])
|
3d48727b29c350d5521e8e73cf6e29885eec35cc188ebd4fc069634286f80bff | Python | 282 | 12 | """
Copyright (c) Meta Platforms, Inc. and affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from __future__ import annotations
from .scale_factor import ScaleFactor
__all__ = ["ScaleFactor"]
|
ab06820bf96de0aec01c1644b285b91c62ffb0a307ee9ff75b7cc227e325684e | Python | 282 | 13 | seq = "MENDELIANHERIDITYGENETICS"
import random
def seqFrag(s):
lenS = len(s)
frag = ""
start = random.randint(0,round(lenS/4.5))
stop = random.randint(round(lenS/1.5),lenS)
print((start-stop)/len)
frag = s[start:stop]
return(frag)
print(seqFrag(seq))
|
514c57b6e39b43a231b08646b2ea8c997e8531f16a638ab59c3740a26dd62b01 | Python | 283 | 10 | from skorch.llm.classifier import FewShotClassifier, ZeroShotClassifier
from skorch.llm.prompts import DEFAULT_PROMPT_FEW_SHOT, DEFAULT_PROMPT_ZERO_SHOT
__all__ = [
'DEFAULT_PROMPT_FEW_SHOT',
'DEFAULT_PROMPT_ZERO_SHOT',
'FewShotClassifier',
'ZeroShotClassifier',
]
|
5ce620d8090bfd623fc345fadeeda80314c83c4834601542fedc2a25b6674da7 | Python | 283 | 11 | # __init__ file
import warnings
warnings.filterwarnings('ignore')
from . import preprocessing as pp
from . import tools as tl
from . import plotting as pl
from . import utilities as ul
import sys
sys.modules.update({f'{__name__}.{m}': globals()[m] for m in ['pp','tl','pl', 'ul']}) |
277f198f5df680b98f81ae952e426fc2c4371ceec23f77bcd7126eb8f10821fe | Python | 284 | 7 | from data_profiling.report.presentation.core import VariableInfo
from data_profiling.report.presentation.flavours.html import templates
class HTMLVariableInfo(VariableInfo):
def render(self) -> str:
return templates.template("variable_info.html").render(**self.content)
|
6150665e9a1f4e5a025d3bf8ee9647fdb9209b3fea7643eb8f1393520fed7b67 | Python | 284 | 10 | from ipywidgets import widgets
from data_profiling.report.presentation.core.root import Root
class WidgetRoot(Root):
def render(self, **kwargs) -> widgets.VBox:
return widgets.VBox(
[self.content["body"].render(), self.content["footer"].render()]
)
|
dcf53adddfb995aa73b5d1449de9565e41659ea68f2d14990caac8f91d6dc6ec | Python | 284 | 7 | from data_profiling.report.presentation.core import ToggleButton
from data_profiling.report.presentation.flavours.html import templates
class HTMLToggleButton(ToggleButton):
def render(self) -> str:
return templates.template("toggle_button.html").render(**self.content)
|
07d7dfb4fec96e98654928cbdb6d80c3ea6474bd4eb026b5dd9560f26ed7c0b6 | Python | 285 | 11 | # __init__ file
import warnings
warnings.filterwarnings('ignore')
from . import preprocessing as pp
from . import tools as tl
from . import plotting as pl
from . import utilities as ul
#import sys
#sys.modules.update({f'{__name__}.{m}': globals()[m] for m in ['pp','tl','pl', 'ul']}) |
3bf608681b2b90e2366bcb725b4689009b5ef753cf09476ee5cc2e1955b59440 | Python | 286 | 14 | """Script to fix the naming of files for upload on openneuro"""
import shutil
import glob
FOLDER = '/Users/sebastiandresbach/data/neurovascularCouplingVASO/openNeuro/'
# Find files
files = glob.glob(f'{FOLDER}/sub-*/ses-*/anat/*MEGRE*')
template = f'{}'
shutil.copyfile(src, dst)
|
d8c7765d3b055d1ee6648294f6583f1431ba0b89d6a823d38a0c0765155e3626 | Python | 286 | 10 | import numpy as np
from .node import NIRNode
# Nodes are uniquely named computational units
Nodes = dict[str, "NIRNode"]
# Edges map one node id to another via the identity
Edges = list[tuple[str, str]]
# Types is a dict mapping strings to tensor shapes
Types = dict[str, np.ndarray]
|
c69777f545f13b8bcaabf12e81a80c2ba00a751bd8f52e445feafa67e0c86912 | Python | 287 | 7 | from siapy.optimizers.scorers import Scorer
# Classification hold-out scorer
holdout_scorer = Scorer.init_hold_out_scorer(scoring="accuracy", test_size=0.2)
# Regression hold-out scorer
regression_scorer = Scorer.init_hold_out_scorer(scoring="neg_mean_absolute_error", test_size=0.25)
|
1616a7e7810da52391fb38dc387855ab7f6578019c9fcb84b7bd2cfb27ca8f1a | Python | 288 | 11 | from typing import TYPE_CHECKING, Dict, Union
if TYPE_CHECKING:
import numpy
import pandas # noqa: F401
import pyarrow
# TODO de-dup with ray.data.block.DataBatch
DataBatchType = Union[
"numpy.ndarray", "pyarrow.Table", "pandas.DataFrame", Dict[str, "numpy.ndarray"]
]
|
3c5447f45e267c61c013eb1267355a59e15fcfbd56dbe7ed6e99d201ffecc64b | Python | 288 | 6 | """Vendored Bonsai downstream helpers (upstream v1.0.0), CC BY-NC 4.0.
Only the two modules ``bonsai_treeHelpers`` imports are carried, not the whole
upstream ``downstream_analyses/``. Imports rewritten to relative form; see
``omicverse/external/bonsai/bonsai/__init__.py`` for why.
"""
|
608e2fe5f9ff76e1c211343765e199531f03cf5bd25ea947dcb5fa91d1180734 | Python | 288 | 14 |
import os
import numpy
import yaml
import microscope
import user
import utils
with open(os.path.join("configs", "dymin-configs.yml"), "r") as file:
config = yaml.load(file)
for channel in config["ExpControl"]["measurement"]["channels"]:
print(channel["rescue"].keys())
print()
|
44bfaaa98f63d7b923212a1dda32f0509c0d3fa715246e8704438955d5f63aef | Python | 291 | 8 | # Autogenerated by nbdev
d = { 'settings': { 'branch': 'main',
'doc_baseurl': '/neuro-meeglet',
'doc_host': 'https://Roche.github.io',
'git_url': 'https://github.com/Roche/neuro-meeglet',
'lib_path': 'meeglet'},
'syms': {}}
|
9c8d2a0ce0d14b16451aae187bbbf55403aa86a7f9b6164670afe56edba73311 | Python | 292 | 18 | import pytest, torch
from tests.common import ECG, TRANSFORMS
@pytest.fixture(autouse=True)
def seed():
torch.manual_seed(0)
@pytest.fixture
def ecg():
return ECG.clone()
@pytest.fixture(params=sorted(TRANSFORMS))
def transform(request):
return TRANSFORMS[request.param]()
|
a34f55139bb4c805f5e5d643eff2d3ce191a1787a983a73ae1d459a34edd2286 | Python | 292 | 8 | """MCP tool adapters for different execution classes."""
from .base import BaseAdapter
from .function_adapter import FunctionAdapter
from .adata_adapter import AdataAdapter
from .class_adapter import ClassAdapter
__all__ = ["BaseAdapter", "FunctionAdapter", "AdataAdapter", "ClassAdapter"]
|
d5ad9082d0f8276f183ea7ed28df11776c44d54ab6e6c5d637fe87621aca78c0 | Python | 292 | 4 | from gym.envs.registration import register
register(id="visual_olfactory_attention_switch-v0", entry_point="gym_tasks.envs:VisualOlfactoryAttentionSwitchEnv")
register(id="visual_olfactory_attention_switch_no_blank-v0", entry_point="gym_tasks.envs:VisualOlfactoryAttentionSwitchNoBlankEnv")
|
5b143058ce7c99c30de7cb3b3237780f525e91b79bd80286521d45781d4beff8 | Python | 293 | 10 | import pandas as pd
from data_profiling.model.table import get_table_stats
def test_get_table_stats_empty_df(config):
df = pd.DataFrame({"A": [], "B": []})
table_stats = get_table_stats(config, df, {})
assert table_stats["n"] == 0
assert table_stats["p_cells_missing"] == 0
|
c1a503eda6ecac2264dc6fd328b6839c587821f201ef758982a60f33e8fc96c2 | Python | 294 | 11 | from setuptools import find_packages, setup
setup(
name='src',
packages=find_packages(),
version='0.1.0',
python_requires='>=3.9'
description='Tree Species Prediction for the National Ecological Observatory Network (NEON)',
author='Ben Weinstein',
license='MIT',
)
|
ca076dadb86f149c59d21d92dc1ffd481ce53d79e584647c2e48399ad98eeb58 | Python | 294 | 5 | from .graph_plotting import plot_genes, plot_gene_logfc
from .utils_graph_plotting import _plot_gene_graph_core, _plot_gene_umap_core
from .enrichment_plotting import plot_df_enrichment
from .heatmap_plotting import plot_svd_corr, plot_heatmap_avgexpr
from .umap_plotting import plot_umap_grid
|
d4e2b6a15bf703e8963dffd5e09cf4b97841419c8b77b765239ac0cf1bbf22f5 | Python | 294 | 7 | # Ultralytics YOLO 🚀, GPL-3.0 license
from .predict import SegmentationPredictor, predict
from .train import SegmentationTrainer, train
from .val import SegmentationValidator, val
__all__ = 'SegmentationPredictor', 'predict', 'SegmentationTrainer', 'train', 'SegmentationValidator', 'val'
|
71bad85997434eacc6dcdfb857950f8df559994c64fa7c5aea338cb3a3673436 | Python | 295 | 9 | import pandas as pd
v100_df = pd.read_csv('energy_df_v100_total.csv')
a100_df = pd.read_csv('energy_df_a100_total.csv')
a100_idle_df = pd.read_csv('energy_df_a100_idle_total.csv')
print(v100_df.groupby(['M']).sum())
print(a100_df.groupby(['M']).sum())
print(a100_idle_df.groupby(['M']).sum())
|
6e58c40c34616e2cef6079c452e546a19c311db1826c220933848f6e40276d1d | Python | 296 | 15 | # -*- coding: utf-8 -*-
"""
Shared variables/markers for testing.
"""
from pathlib import Path
import pytest
TEST_DIR = Path(__file__).parent.absolute().resolve() / "temp"
TEST_DIR.mkdir(exist_ok=True)
def numpy_stl():
return pytest.importorskip("stl.mesh", reason="Requires numpy-stl")
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.