sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
65f6e73c7164d4b32dab01d1eba91565cf54ec4b8431caf61ef80b220690310c | Python | 1,103 | 37 | from re import search
EXTERNAL_ID_TYPE_ANY = None
EXTERNAL_ID_PATTERNS = [
("condor", r"submitted to cluster (\d+)\."),
("slurm", r"Submitted batch job (\w+)"),
("torque", r"(.+)"), # Default 'pattern' assumed by Galaxy code circa August 2013.
]
def parse_external_id(output, type=EXTERNAL_ID_TYPE_ANY):... |
8724852e878d8b4f79cdd61be2c2a836a7b7d851fc28594d2c795ac00cbade32 | Python | 1,104 | 28 | from pl_bolts.utils import _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _TORCHVISION_AVAILABLE:
import torchvision
TORCHVISION_MODEL_ZOO = {
"vgg11": torchvision.models.vgg11,
"vgg13": torchvision.models.vgg13,
"vgg16": torchvision.models.vgg16,
... |
8bab3311c0bc9fa1a535f103729528c7bf73c1aa60a988096df0ba5098c06c61 | Python | 1,104 | 32 | import numpy as np
def get_hparams(window, CL_max):
if window == 80:
W = np.asarray([11, 11, 11, 11])
AR = np.asarray([1, 1, 1, 1])
BATCH_SIZE = 18
elif window == 400:
W = np.asarray([11, 11, 11, 11, 11, 11, 11, 11])
AR = np.asarray([1, 1, 1, 1, 4, 4, 4, 4])
BAT... |
4a1433b1bb30328b1c8e2f703736907945626c8c26207f6716513a4237e17d46 | Python | 1,105 | 36 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._error_x import ErrorX
from ._error_y import ErrorY
from ._hoverlabel import Hoverlabel
from ._legendgrouptitle import Legendgrouptitle
from ._line import Line
from ._marker import Marker
from ._selected import Selected
... |
9107e2146c8356d7dd2444d29d79dc95038686d90703cf2f24d69d7074bc5eb5 | Python | 1,105 | 44 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = msp.batch_size // 3
msp.lr = float(msp.lr) / 3
num_lm = 12
num_psams = 72
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = dict(
... |
e6518465dec5976559abf046ff55cd0354b98b37ff973cfd089c6944052c320d | Python | 1,105 | 44 | from typing import Optional, Union
from anndata import AnnData
import pandas as pd
import numpy as np
import stlearn
from pathlib import Path
from natsort import natsorted
def add_loupe_clusters(
adata: AnnData,
loupe_path: Union[Path, str],
key_add: str = "multiplex",
copy: bool = False,
) -> Optiona... |
def4706007b2fec83f65488bb758bbc3cc2f1d35f0bddafd01cf2a87ca98c935 | Python | 1,106 | 36 | """Tests for specparam.io.utils"""
from pathlib import Path
from specparam.io.utils import *
###################################################################################################
###################################################################################################
def test_create_file_pa... |
167f17824f3d4d58454838e2fa1b4e75abe85c88aefbd4e9598b8dbf1c35d6c7 | Python | 1,107 | 29 | from carbonserver.api.errors import NotAllowedError, NotAllowedErrorEnum, UserException
from carbonserver.api.infra.repositories.repository_projects import SqlAlchemyRepository
from carbonserver.api.schemas import ProjectReport
from carbonserver.api.services.auth_context import AuthContext
class ProjectSumsUsecase:
... |
1966272f1e8b74c362f93a9892060058aea2f1011987ec99a9b17b88db48e125 | Python | 1,107 | 30 | # -*- coding: utf-8 -*-
import os
from visualize import visualize_psd
tbi_dir = '/scratch/n/tbi-meg/v/processed'
camcan_dir = '/scratch/n/restmeg/v/processed'
all_subjects = sorted([f.name for f in os.scandir(tbi_dir) if f.is_dir()] + [f.name for f in os.scandir(camcan_dir) if f.is_dir()])
stc_avg_fname = '/scratch... |
cff4ea755b12b889207f4c9f856fe8975888d60acda11f97e3a125de114db9fe | Python | 1,107 | 49 | from textwrap import dedent
from caper.caper_wdl_parser import CaperWDLParser
WDL_CONTENTS = dedent(
"""\
version 1.0
workflow test_wdl {
meta {
caper_docker: "ubuntu:latest"
caper_singularity: "docker://ubuntu:latest"
}
}
"""
)
OLD_WDL_CONTENTS = dedent(
... |
113d5b592ad18d9e745b74dcbcb870dbef5fe619b6af4aa392cad1f512b7ef25 | Python | 1,108 | 34 | import unittest
import os
from ds_ctcdecoder import Alphabet
class TestAlphabetParsing(unittest.TestCase):
def _ending_tester(self, file, expected):
alphabet = Alphabet(os.path.join(os.path.dirname(__file__), 'test_data', file))
label = ''
label_id = -1
for expected_label, expecte... |
1b1641908465b7784919c13b5a51ecdaa4bb3ad517c57d93c0b556fdefb5ebab | Python | 1,108 | 38 | from setuptools import setup, find_packages
def read_requirements(path):
with open(path, "r") as f:
return [line.strip() for line in f if not line.isspace()]
with open("README.md", "r", encoding="UTF-8") as fh:
long_description = fh.read()
setup(
name="spaco-release",
version="0.2.2",
... |
49f76c275ce74aec33ca91fc982de027d9f8485943056a82705f25acbfc12492 | Python | 1,108 | 44 | """Add tool_id and tool_version to tool_landing_request table
Revision ID: c0959ad462b2
Revises: 3af58c192752
Create Date: 2025-08-20 10:04:05.044610
"""
from sqlalchemy import (
Column,
String,
)
from galaxy.model.migrations.util import (
add_column,
column_exists,
drop_column,
transaction,... |
75e95c371d46c88e45c1d5bedbda5fee9fa54c64b1ed25b22cd7ce843ce5672a | Python | 1,108 | 31 | import pickle
import unittest
from os.path import join, abspath
from numpy.testing import assert_allclose
from tests.reactor.oscillating_feed_temperature.rebless import run
from spitfire.chemistry.ctversion import check as cantera_version_check
if cantera_version_check('atleast', 2, 5, None):
class Test(unittes... |
92a0be91ca85a51111a798a298ede5c92a0fef1b0efe55e4079f2623d6c78592 | Python | 1,108 | 34 | import sqlite3
from .db import DB
class DistrictDetailsTable(DB):
def __init__(self):
super().__init__()
self.table_name = 'PB_district_cases'
self.table_desc = 'Daily and total district wise info. Multiple tables starting on page 2 and continuing page 4 or 5.'
self.cols = self.g... |
8742c0b27ff271af48bbd81bb8a9402e7329f169ff3ce13ad1d7433f9d4c8bc3 | Python | 1,109 | 31 | from .architype import (
archetypes,
archetypes_genes,
find_spatial_archetypes,
find_spatially_related_genes,
get_genes_from_spatial_archetype,
)
from .CCI_effects_modeling import *
from .cci_two_cluster import (
find_cci_two_group,
prepare_cci_cellpair_adata,
prepare_cci_df,
)
from .cel... |
45807d9a3de4259a1690c607159b8243ad9ffaf8b20b92b500687bad731cb568 | Python | 1,110 | 34 | # -*- coding: utf-8 -*-
import sys
import logging
import os
import gensim
# 引入doc2vec
from gensim.models import Doc2Vec
curPath = os.path.abspath(os.path.dirname(__file__))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
# 引入日志配置
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', l... |
fff3064fd7fcdc5d2a708798ad5a1ff78470e22a5dee774609af4d2a69c10cd8 | Python | 1,110 | 33 | """
This module create TransformerEmbedder
"""
# pylint: disable=W0223
import torch.nn as nn
import torch
class TransformerEmbedder(nn.Module):
"""
This class define the Transformer embedder that is the core of all other Transformer
for the different task.
This take an input protein and give a repres... |
0aac865ac5360d867cd0bd9f9e12b18e690579b220fb97da1920011d3f47c336 | Python | 1,111 | 37 | import os
import tempfile
import wx
import nibabel as nib
import numpy as np
from .input_tab import AslInputOptions
from .main import AslGui
class MockApp(wx.App):
def update_options(self):
pass
class TestInputTab:
def setup_method(self, method):
app = wx.App(redirect=False)
self.ap... |
398f9849a990586aa49f284d14416410a92caf329e8c64f405c96daf59065ac9 | Python | 1,111 | 49 | # -*- coding: utf-8 -*-
import json
import numpy as np
def convert_seq_to_token(seq_str, aa_dic, pad_id, unk_id, max_length, cls_id=None, eos_id=None):
ids = np.full((max_length, ), pad_id)
seq_ids = []
for aa in seq_str.upper():
res = aa_dic.get(aa)
if res == None:
seq_id... |
641701168bf1543bee4a93e68bff620ae2395b6a3be58cb0de80dae85bd6149b | Python | 1,111 | 34 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._autorangeoptions import Autorangeoptions
from ._minor import Minor
from ._rangebreak import Rangebreak
from ._rangeselector import Rangeselector
from ._rangeslider import Rangeslider
from ._tickfont import Tickfont
from ._... |
e6073fb50d29786203eae16396225cfbcbf67e8d7b0f58c4fbb7f8812d963267 | Python | 1,111 | 39 | #!/usr/bin/python3
import numpy as np
import matplotlib.pyplot as plt
from auryntools import *
# This example assumes that you have run the code from
# https://github.com/fzenke/pub2015orchestrated/
# using BinarySpikeMonitors (the development branch does that per default)
datadir = "/home/zenke/data/sim" # Set this ... |
10428facb7f42dc10f37482d4caea213362d065f6383172f80a54138f8807a63 | Python | 1,112 | 44 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
num_lm = 6
num_psams = 72
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = d... |
695e5ded24c28eefad7f257217735f251fb47687117aeaf64c410055956467f8 | Python | 1,112 | 44 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
num_lm = 8
num_psams = 72
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = d... |
9fe088f486bf7acd845a4644235f16eaae5feddc6eb2a456d2d1e7a471c84cc9 | Python | 1,112 | 29 | # pyrefly: ignore-errors
# Unmaintained experimental module, not part of the public package surface.
# NOTE: this module is currently broken at import time — `gc_content_seqs` and
# `nucleotide_content_seqs` were renamed to `gc_content` / `nucleotide_content`
# with different signatures. Left as-is per scope; needs por... |
b3b06790fb33ad69a753697093291c2332fa699ef88105c7b3f897e55cf37f50 | Python | 1,112 | 17 | from .base_options import BaseOptions
class VideoOptions(BaseOptions):
def initialize(self, parser):
BaseOptions.initialize(self, parser)
parser.add_argument('--results_dir', type=str, default='../video/', help='saves results here.')
parser.add_argument('--phase', type=str, default='val', ... |
cb6436e8f9910fe83841498eaf09e40a7cc794f8346dfd40c3a645f8f03f4ce4 | Python | 1,112 | 28 | # Copyright 2019 Novartis Institutes for BioMedical Research 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 http://www.apache.org/licenses/LICENSE-2.0. Unless
# required by applicable law... |
f7ce6838df30cb8ed28a44e97d2070f1d124c39f4d4eae91781454f3d210fbca | Python | 1,112 | 44 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
num_lm = 4
num_psams = 72
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = d... |
fa7f6d679aafc33fc0c9a65ba647fb057803e3cf3d3c601d0a21114390fc5647 | Python | 1,112 | 26 | """Smoke tests for RabbitMQ cycle detection with quorum queues.
Reproduces conditions for https://github.com/celery/celery/issues/9867
when running against RabbitMQ <4.0.1.
"""
from __future__ import annotations
from pytest_celery import RESULT_TIMEOUT, CeleryTestSetup
from t.smoke.tasks import countdown_task_with_r... |
32dc123307da3f9715440b48f38cd13656b7f47282fcf7b4f3ac4fe5b6646ef4 | Python | 1,113 | 44 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
num_lm = 12
num_psams = 72
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = ... |
3c366764029e852a4182e92492b4d58156b664a16dfb4ca51a371418ff5e1067 | Python | 1,113 | 34 | import torch
import lightly.transforms.random_crop_and_flip_with_grid as test_module
def test_location_to_NxN_grid() -> None:
# create a test instance of the Location class
test_location = test_module.Location(
left=10,
top=20,
width=100,
height=200,
image_height=244,
... |
5f36c39f7dca3514b96f43487758c72cc496abe0d8fb79ac5b6789930627ca74 | Python | 1,113 | 41 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 10
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
type="PS... |
841b86717c7777d99e6f95d6b756255cd3a9570f930c3349ca94e9de00315b11 | Python | 1,113 | 41 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 10
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
type="PS... |
8b56c74cd8b32e53e7d31997a3df7b984356b484180850c5ad7a925263f5ab55 | Python | 1,113 | 25 | """Built-in quantization strategies.
Importing this package registers the built-in modes, which are the
complete set of modes. They register here, explicitly, rather than by
decorating each strategy: validation error messages render the
registered-names tuple, so its order is written down here, and decorating
would in... |
a5223b1ad6099ba5b4ebbbdc0603efa38b5bcb8ef09f6731751ae91a0db3d965 | Python | 1,113 | 44 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
num_lm = 10
num_psams = 72
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = ... |
b7324d7158d19b7588ed21f0ed2719d082d6f6f434f51cc87a341dfa67f82e58 | Python | 1,113 | 44 | from sys import argv
from msp import MSP, rbnsp_split_90
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 2 * msp.batch_size // 3
msp.lr = float(msp.lr) * 2 / 3
num_lm = 24
num_psams = 72
msp.architecture["num_motifs"] = num_lm + num_psams + 2
msp.architecture["channels"] = 200
psam_model = ... |
f284f2715dca5e8f4913e5c03228ff495f77729e483da4061d78399a7b68b84a | Python | 1,113 | 29 | import os
from shutil import copy
def check_dir_exists(path):
if not os.path.exists(path):
os.mkdir(path)
def split_by_name(dir_path, real_save_path, fake_save_path):
check_dir_exists(real_save_path)
check_dir_exists(fake_save_path)
if not os.path.exists(real_save_path):
os.mkdir(real... |
0543a59fef7264856e57d01f5eb421db1004bea0460ac04b0f5eb1d182eca310 | Python | 1,114 | 35 | import os
from shutil import copy
def check_dir_exists(path):
if not os.path.exists(path):
os.makedirs(path)
def split_by_name(dir_path, real_save_path, fake_save_path):
check_dir_exists(real_save_path)
check_dir_exists(fake_save_path)
if not os.path.exists(real_save_path):
os.makedir... |
a235caaa17f70e70f86ff4eba1488ed7bb943b86d02abc50c070f151f08f5235 | Python | 1,114 | 37 | """Tests for report generation helpers."""
import stat
from xcp_d.reports import core
def test_run_reports_catches_report_init_errors_and_unlocks_svgs(tmp_path, monkeypatch):
"""Report setup failures should be recorded without crashing XCP-D."""
dataset_dir = tmp_path / 'xcpd'
report_dir = dataset_dir /... |
dcf8d6bcb60e5832cc21790c8e39a5d16bf5991df6c39cc1738d4ead34f39faf | Python | 1,114 | 43 | from cvnn.utils import transform_to_real_map_function
import numpy as np
from pdb import set_trace
import tensorflow as tf
def test_image_real_conversion():
img_r = np.array([[
[0, 1, 2],
[0, 2, 2],
[0, 5, 7]
], [
[0, 7, 5],
[3, 7, 9],
[4, 5, 3]
]]).astype(n... |
e3cf34d8ebc189463f07cb705c4dc9a1f81b119973772e429181ffe7fc224381 | Python | 1,114 | 34 | from typing import Any
import numpy as np
from pl_bolts.datasets.sr_dataset_mixin import SRDatasetMixin
from pl_bolts.utils import _PIL_AVAILABLE, _TORCHVISION_AVAILABLE
from pl_bolts.utils.warnings import warn_missing_pkg
if _PIL_AVAILABLE:
import PIL
else: # pragma: no cover
warn_missing_pkg("PIL", pypi_n... |
39b1fab7d2c510edf66f0ab23749bb6ae004f1932cea7f7f5a0617b9985efabf | Python | 1,115 | 32 | import os
from data import srdata
class DF2K(srdata.SRData):
def __init__(self, args, name='DF2K', train=True, benchmark=False):
data_range = [r.split('-') for r in args.data_range.split('/')]
if train:
data_range = data_range[0]
else:
if args.test_only and len(data_... |
b03e8b4dc25af61d7ab8c171a82062fdbc2a81e9bf5d0ca38cce3eb7a4747239 | Python | 1,115 | 35 | """Tests for specparam.plts.periodic."""
import numpy as np
from specparam.tests.tutils import plot_test
from specparam.tests.tsettings import TEST_PLOTS_PATH
from specparam.plts.periodic import *
###################################################################################################
###################... |
e9cdb95f9aa9839ad356e05401d3d6a2dddd70d9189eb56ec11340151209729f | Python | 1,115 | 41 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.batch_size = 10
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"] = dict(
type="AdjustedMotifModel",
model_to_adjust_spec=dict(
type="PS... |
1af96d8442cfc5ab1c8e07ba4c5646c212e16e642deab96eb2521490fd50b25a | Python | 1,116 | 31 | # coding=utf-8
# Copyright 2025 The Google Research Authors.
#
# 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 applicab... |
37e840c39243911a8bd4b439f4645a8fad4851857bdfcbd8de1097bfa61379a0 | Python | 1,116 | 22 | # -*- coding: utf-8 -*-
"""
pyoperant.song_recording — passive vocalization detection and recording.
Detection pipeline: features.py (acoustic feature extraction) -> gate.py
(multi-feature spectral gate, optionally backed by an adaptive per-chamber
noise floor from noise_model.py) -> smoother.py (temporal smoothing of... |
52a114d99057a76521ba0ae70a55353ef6a6e7c486d71f6d5fbf66c4b454b570 | Python | 1,116 | 34 | import pytest
from click.testing import CliRunner
from celery.app.log import Logging
from celery.bin.celery import celery
@pytest.fixture(scope='session')
def use_celery_app_trap():
return False
def test_cli(isolated_cli_runner: CliRunner):
Logging._setup = True # To avoid hitting the logging sanity check... |
5d7cffd89ba5d51bf7b082d8173e072f2d8e591b1d6564565919d5071394ebca | Python | 1,116 | 33 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""tests for Louvain embedding"""
import unittest
import numpy as np
from sknetwork.data.test_graphs import test_graph, test_bigraph
from sknetwork.embedding import LouvainEmbedding
class TestLouvainEmbedding(unittest.TestCase):
def test_predict(self):
adj... |
82d205dde6026f16b9b255df1bb6ff216f8c9b38f3dbb5af831ba5518b9fd328 | Python | 1,116 | 37 | #!/usr/bin/env python
"""Tests for `stlearn` package."""
import shutil
import unittest
from pathlib import Path
import scanpy as sc
import stlearn as st
from tests.utils import read_test_data
class TestSME(unittest.TestCase):
"""Tests for `stlearn` package."""
def setUp(self):
self.adata = read_t... |
98f73024f79826f73ca22f4edba36b1af3f6b92226110856c1450a79cbcf18e0 | Python | 1,116 | 42 | from datasets import load_dataset
from transformers import pipeline
from codecarbon import EmissionsTracker
device = "cuda"
def build_model():
model = pipeline("fill-mask", model="bert-base-uncased", device=0)
return model
def main():
tracker = EmissionsTracker(project_name="bert_inference", measure_p... |
2015d738c5a173bf2170e233a970777c3123a57cc6aa1b7f25f7ca3bdc2c6da6 | Python | 1,117 | 42 | """GluonCV Model Zoo"""
# pylint: disable=wildcard-import
from .model_zoo import get_model, get_model_list
from .model_store import pretrained_model_list
from .rcnn.faster_rcnn import *
from .rcnn.mask_rcnn import *
from .ssd import *
from .yolo import *
from .cifarresnet import *
from .cifarwideresnet import *
from .f... |
8a9aa23c7bdae2e34f13f539892e85ea96a5ff35b02a22b892450a0197c51586 | Python | 1,117 | 26 |
from cfg import *
from allensdk.core.reference_space_cache import ReferenceSpaceCache
def getAtlasData(dataFolder='.', resolution = 25):
try:
[annotation,allenMeta] = nrrd.read('{}/annotation_{}.nrrd'.format(dataFolder,resolution))
[avg_template,allenMeta] = nrrd.read('{}/average_template... |
f6038f9e508c6235223fec684a676c23deefac9938d5c61626119baffc3b3c2a | Python | 1,117 | 34 | from unittest.mock import patch
import pytest
from codecarbon.core.emissions import Emissions
@pytest.mark.parametrize("intensity", [0, 0.0, 42.0])
def test_explicit_carbon_intensity_is_used(intensity):
with patch(
"codecarbon.input.DataSource.get_carbon_intensity_per_source_data",
side_effect=A... |
765d07ba4ec67d77d661470d5176b30e940f160df986a50ac718b7deb561d2c3 | Python | 1,118 | 38 | from ethoscope.tracking.roi_builders import TargetGridROIBuilderBase
import cv2
class EightByEight(TargetGridROIBuilderBase):
_vertical_spacing = 0.1/16.
_horizontal_spacing = .1/100.
_n_rows = 8
_n_cols = 8
class SixteenByThree(TargetGridROIBuilderBase):
_vertical_spacing = 0.1/16.
_horizo... |
2bcb9c5d0f7e7ddf6dce687c4a2c7a3558fa1475f3d5f04b7245c5e9c1f4d89a | Python | 1,119 | 38 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"]["motif_width"] = 13
msp.architecture["motif_model_spec"]["motif_feature... |
5dd421c6d63f6db923ee468de1350f8d5322a9fd9825379c5efa18e814843667 | Python | 1,119 | 37 | import numpy as np
import torch
def _find_repeats(x):
unique, counts = torch.unique(x, return_counts=True)
return unique[counts > 1]
def _get_ranks(x: torch.Tensor) -> torch.Tensor:
tmp = x.argsort()
ranks = torch.zeros_like(tmp, dtype=torch.float32).cuda()
ranks[tmp] = torch.arange(x.shape[0], d... |
600c2eb12f2c345adaad32e235b60b25688fc5c427d7ace8d225a6b179a1ace2 | Python | 1,119 | 33 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Mar 8 15:31:31 2022
@author: psicobiologia
"""
import numpy as np
from sklearn import metrics
# define full path to the predictions of the model
predictions_path = '/path_to_output_directory/predictions.csv'
# define full path to the target variable
... |
adf4c5413561661f1fbf73f63379db2dd06ba04212bd1913515e07b632de05d3 | Python | 1,119 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["splicepoint_model_spec"] = dict(
type="BothLSSIModels",
acceptor="model/splicepoint-model-acceptor-1",
donor="model/splicepoint-model-donor-1",
)
msp.architecture["motif_model_spec"]["motif_... |
aef7b5464ce03b2076a7ccfa44b43094c450c70617b6f036cbc475cf028b064a | Python | 1,119 | 38 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"]["motif_width"] = 13
msp.architecture["motif_model_spec"]["motif_feature... |
e9b96c1774a1d2166c9b1b08e59d328d2d4825f05f42c7da62e6ae2213aa83d6 | Python | 1,119 | 48 | #!/usr/bin/env python
"""
Calculate the frequency of the nucleotides, the length and the GC-Content of a fastafile
Bjoern Gruening
"""
import sys
from Bio import SeqIO
def __main__():
input_file = open(sys.argv[1], "r")
output_file = open(sys.argv[2], "w")
output_file.write("Gene\tA\tC\tG\tT\t... |
fb2ba1105cbbacb873345bf45e304dd7806a1e067d25c45b5c34dff95b515133 | Python | 1,119 | 39 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["splicepoint_model_spec"] = dict(
type="BothLSSIModels",
acceptor="model/splicepoint-model-acceptor-1",
donor="model/splicepoint-model-donor-1",
)
msp.architecture["motif_model_spec"]["motif_... |
2274f8253a1acbd73df21f5c9af5b8f98e4f936c2b9d9616ec7a370a67131fa3 | Python | 1,120 | 31 | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
from fvcore.common.registry import Registry
DATASET_REGISTRY = Registry("DATASET")
DATASET_REGISTRY.__doc__ = """
Registry for dataset.
The registered object will be called with `obj(cfg, split)`.
The call should return a ... |
839111eb9128e02dc7c6411f605fbcde189b870e15139eaed39bb6bf58ed0e54 | Python | 1,120 | 40 | import os
import pytest
from celery import states
from celery.backends.azureblockblob import AzureBlockBlobBackend
pytest.importorskip('azure')
@pytest.mark.skipif(
not os.environ.get('AZUREBLOCKBLOB_URL'),
reason='Environment variable AZUREBLOCKBLOB_URL required'
)
class test_AzureBlockBlobBackend:
de... |
ed7cc39cd5dcabdbc681feb4411a98d10d72800cdb1cb2b7776612b6862147bc | Python | 1,120 | 40 | import sys
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from ._diagonal import Diagonal
from ._dimension import Dimension
from ._hoverlabel import Hoverlabel
from ._legendgrouptitle import Legendgrouptitle
from ._marker import Marker
from ._selected import Selected
from ._unselected i... |
f983381d217936fa66f1ee12a021e2036a3bc80926d21ff2b3b191689d709682 | Python | 1,120 | 35 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""tests for force atlas2 embeddings"""
import unittest
import numpy as np
from sknetwork.data.test_graphs import test_graph, test_digraph
from sknetwork.embedding.force_atlas import ForceAtlas
class TestEmbeddings(unittest.TestCase):
def test_options(self):
... |
12d634e72db06659da1ad3cd39ea2b9cdd63fcbdb3a4b2a36b4aaec5424507e6 | Python | 1,121 | 22 | """
Copyright (c) 2022 EPFL-BBP, All rights reserved.
THIS SOFTWARE IS PROVIDED BY THE BLUE BRAIN PROJECT ``AS IS''
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE BLUE BRAIN PROJE... |
50b5c5d238191adc8b8ee170fbdf56dd7bdc5eeb773f82f304124866ce0e1a74 | Python | 1,121 | 40 | # -*- coding: utf-8 -*-
# Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl>
# All rights reserved.
"""Misc utils needed for obci-MNE conversion."""
try:
import mne
except ImportError:
mne = None
def requires_mne(func):
"""Make sure that mne is loaded, point user to installing.... |
78e34e06fae8fb6cbf8a39de13821b7a105482be2507f7ed1dfc0ba7aa1562cf | Python | 1,121 | 33 |
import unittest
import os
from bleualign.align import Aligner
class TestByEval(unittest.TestCase):
def setUp(self):
current_path = os.path.dirname(os.path.abspath(__file__))
self.srcfile = os.path.join(current_path, '..', 'eval', 'eval1989.de')
self.targetfile = os.path.join(current_path, '..', 'eval', 'eval19... |
ecb25b0d7e6e6ea9d11f17871951a27e6247cce9fb12f2a3b6292e0b127a83aa | Python | 1,121 | 34 | #!/usr/bin/env python
# Dan Blankenberg
import sys
import bx.align.maf
from galaxy.datatypes.util import maf_utilities
def __main__():
output_name = sys.argv.pop(1)
input_name = sys.argv.pop(1)
species = sys.argv.pop(1)
count = 0
with open(output_name, "w") as out:
# write interval head... |
3abf4992591e8b3c9ba583191d6e361cd562d26c12078e3e3770b537125caf72 | Python | 1,122 | 29 | import os
from shutil import copy
def check_dir_exists(path):
if not os.path.exists(path):
os.mkdir(path)
def split_by_name(dir_path, real_save_path, fake_save_path):
check_dir_exists(real_save_path)
check_dir_exists(fake_save_path)
if not os.path.exists(real_save_path):
os.mkdir(real... |
5e9e4aa016f1c88abc83d8de6b91efa1397407804727554e7450cf7e72da1fd2 | Python | 1,122 | 38 | #!/usr/bin/env python
"""Tests for `stlearn` package."""
import unittest
import numpy as np
import stlearn as st
from tests.utils import read_test_data
class TestPSTS(unittest.TestCase):
"""Tests for `stlearn` package."""
@classmethod
def setUpClass(cls):
cls._base_adata = read_test_data()
... |
d9600eadb832a70082063067c954c5cab8822b3f1de88395b1dfe4b0d1f2baf7 | Python | 1,122 | 35 | import csv
import numpy as np
import pandas as pd
from tqdm import tqdm
with open("./sorted_ids.txt", 'r') as f:
sorted_ids = eval(f.read())
df = pd.read_csv('./data/csvs/data/test_new_new_chemprop_similar.csv')
drug_emb = np.load('./drug_emb.npy')[0]
drug_bias = np.load('./drug_bias.npy')[0]
with open('./data... |
fba1a573b471b4f10202de3e3b86f3f9485b0b4bc7362ca8c648a210df30ffce | Python | 1,123 | 37 | """Tests for specparam.utils.array."""
import numpy as np
from specparam.utils.array import *
###################################################################################################
###################################################################################################
def test_normalize():
... |
140d5dd0d433def68d5557856e11258cf7b47c3febc91c153f81b585dbfebbfb | Python | 1,124 | 30 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for classification API"""
import unittest
from sknetwork.classification import *
from sknetwork.data.test_graphs import *
from sknetwork.embedding import LouvainEmbedding
class TestClassificationAPI(unittest.TestCase):
def test_undirected(self):
f... |
e5bf68701413ec4c70e07bde4e91eca7e9d4c8fdba64d89885b6d01bea2d1f52 | Python | 1,124 | 30 | from pyabf.abf2.section import Section
class TagSection(Section):
"""
Tags are comments placed in ABF files during the recording. Physically
they are located at the end of the file (after the data).
Later we will populate the times and sweeps (human-understandable units)
by multiplying the lTagTi... |
f15c2ded6467bbe45fa5a320b9f92e03792103e291e61c7975ac3bcac0b8b8f0 | Python | 1,124 | 40 | """make api_keys deleted non nullable
Revision ID: b855b714e8b8
Revises: 3356bc2ecfc4
Create Date: 2023-04-19 18:41:13.500332
"""
import sqlalchemy as sa
from alembic import op
from galaxy.model.migrations.util import (
alter_column,
transaction,
)
# revision identifiers, used by Alembic.
revision = "b855b... |
0717be1e7a4e3ab7a93ed848a5b9ae1b180d985c91c046aade4227f68b48942f | Python | 1,125 | 29 | import os
from shutil import copy
def check_dir_exists(path):
if not os.path.exists(path):
os.mkdir(path)
def split_by_name(dir_path, real_save_path, fake_save_path):
check_dir_exists(real_save_path)
check_dir_exists(fake_save_path)
if not os.path.exists(real_save_path):
os.mkdir(real... |
0a215c32b8c55dd5209f0379e7d0cd665a48134b363eb43d3295fdeee76c4f06 | Python | 1,125 | 29 | from pathlib import Path
import pandas as pd
import os
def diff_SwissProt(dataset_name1, dataset_name2, dataset_folder=Path("data/datasets/")):
"""
Return sequence with its annotations that is present in dataset2 but not in dataset1
"""
tab1 = dataset_name1.split("_")
tab2 = dataset_name2.split("_... |
915af8e30d744d22e3cbb50421121e645c88f90706a1c7beae885114f0123d0c | Python | 1,125 | 34 | #!/usr/bin/env python
"""Evaluate a loaded agent on a task."""
import argparse
import os
import sys
from angorapy.utilities.evaluation import evaluate_agent
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
from angorapy.agent.ppo_agent impor... |
c16b2189ae6f11ae8be62afbbee0647caf14ff9a9e2a12dc127640f9e11213f0 | Python | 1,126 | 38 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"]["motif_width"] = 13
msp.architecture["motif_model_spec"]["motif_feature... |
f9ca594ca448db2fc823cd2e5e5b07c73d0d4274936cb5447af3487e406e8973 | Python | 1,126 | 44 | # Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
from .ascend import onnx2ascend
from .axelera import torch2axelera
from .coreai import torch2coreai
from .coreml import torch2coreml
from .deepx import onnx2deepx
from .engine import onnx2engine, torch2onnx
from .executorch import torch2executorch
fro... |
4c229d5145a95fe27435280057cec574de28ddfa021f945c1ab0dbc8f0629ef2 | Python | 1,127 | 31 | """Tests for specparam.metrics.metric"""
from specparam.metrics.error import compute_mean_abs_error
from specparam.metrics.gof import compute_adj_r_squared
from specparam.metrics.metric import *
###################################################################################################
######################... |
93503a6ef834f785c98c25a2db0131f4c043c2f839888ce42bde0de5b0c7eea7 | Python | 1,127 | 46 | from pathlib import Path
import numpy as np
import pandas as pd
from anndata import AnnData
from natsort import natsorted
def add_loupe_clusters(
adata: AnnData,
loupe_path: Path | str,
key_add: str = "multiplex",
copy: bool = False,
) -> AnnData | None:
"""\
Adding label transfered from Seur... |
fb70b073bd1538f5621e3047515408e15ea1d3444b0d93a848571b0e799b0536 | Python | 1,127 | 50 | from __future__ import annotations
import gc
import weakref
import pytest
import env # noqa: F401
from pybind11_tests import custom_type_setup as m
@pytest.fixture()
def gc_tester():
"""Tests that an object is garbage collected.
Assumes that any unreferenced objects are fully collected after calling
... |
4abe4f6c79ab09c40ef7b054dc1b0e89079a7a6a656610bb28708648028ce38b | Python | 1,128 | 37 | from sys import argv
from msp import MSP, starting_point_for_different_number_motifs
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["splicepoint_model_spec"] = dict(
type="BothLSSIModels",
acceptor="model/splicepoint-model-acceptor-1",
donor="model/splicepoint-model-donor-1",
)
... |
964f3d0d26b9ab7629a3559aa23d9f48892417424d9a296682cf82a7fa7910fd | Python | 1,128 | 43 | #!/usr/bin/env python
import argparse
import readfile
import rest_tool_functions
"""
Get all DICs from belonging to bioassay IDs (AIDs)
"""
def main(args):
if args.aid_file is None:
aidlist = args.aid.split(",")
else:
aidlist = readfile.getListFromFile(args.aid_file)
aidliststring = ","... |
9b68360de7401008eff3aefef13bc8d3e9d1c892d2ca971ea9027d3c94509f8f | Python | 1,128 | 28 | from gensim.scripts.glove2word2vec import glove2word2vec
import gensim
from os.path import join
from gensim.models import KeyedVectors
def download_setup():
# Global parameters
# root folder
root_folder = '/home/chansingh/nlp_utils/glove/'
glove_filename = 'glove.840B.300d.txt'
# Variable for data... |
9f5f910f24677d72a4b5d933396179ef5bc7a41d94dac1fc2d3442ae75ca79c3 | Python | 1,128 | 40 |
import torch
import numpy as np
MIN_LR = 1e-4
class Optimizer():
def __init__(self,parameters,optimizer,lr,decay=1.0,**kwargs):
# Setup torch optimizer
self.n_steps = 0
self.opt_type = optimizer
self.init_lr = lr
opt = getattr(torch.optim, optimizer)
if optimizer =... |
5304684002c5cdd91b8069101137c9bcb96c3aa4a1e56c55bd50c977334573af | Python | 1,129 | 32 | from os.path import abspath, join
def run():
from spitfire.chemistry.mechanism import ChemicalMechanismSpec
from spitfire.chemistry.tabulation import build_unreacted_library
import spitfire.chemistry.analysis as sca
test_xml = abspath(join('tests', 'test_mechanisms', 'h2-burke.yaml'))
m = Chemica... |
85dc778884153c90d081cdfd5fbbd13e3cd9aa32a4c57bda739b25700f7e62c2 | Python | 1,129 | 40 | from sys import argv
from msp import MSP
msp = MSP()
msp.file = __file__
msp.seed = int(argv[1])
msp.architecture["num_motifs"] = 82
msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels")
msp.architecture["motif_model_spec"]["motif_width"] = 13
msp.architecture["motif_model_spec"]["motif_feature... |
c068aa2caea767f8a77ad892dc5c6d0cf767a660a3ee4c914a95b89dafcc1ab6 | Python | 1,129 | 36 | from setuptools import setup
def readme():
with open('README.md') as f:
return f.read()
setup(name='ptltSNEcv',
version='0.1',
description='Parametric time-lagged t-SNE using artificial neural networks for development of collective variables of molecular systems',
long_description=readme(),
... |
dff5fa30fb6fc40791f00e96dd234be9f2264cd542ba9070be9eb00cf4152e2a | Python | 1,129 | 29 | import os
from shutil import copy
def check_dir_exists(path):
if not os.path.exists(path):
os.mkdir(path)
def split_by_name(dir_path, fakeA_save_path, fakeB_save_path):
check_dir_exists(fakeA_save_path)
check_dir_exists(fakeB_save_path)
if not os.path.exists(fakeA_save_path):
os.mkdir... |
359c4102fa5a3f7b4e375d378995d95d4b3ecb96a60ff868aade4f130f9e9ebb | Python | 1,130 | 38 | import glob
from ase import io as ase_io
from pymatgen.io.ase import AseAtomsAdaptor
from pymatgen.io.qchem.outputs import QCOutput
from pymatgen.core.structure import Molecule
from instance_mongodb import instance_mongodb_sei
if __name__ == "__main__":
"""Store all data in representative xyz files for easy vis... |
92ea3dca51f3f3771e181c5902ba4d0fd74d02ada0f30cfec18569d3f4c71a86 | Python | 1,130 | 33 | # LICENSE
#
# _This file is Copyright 2018 by the Image Processing and Analysis Group (BioImage Suite Team). Dept. of Radiology & Biomedical Imaging, Yale School of Medicine._
#
# BioImage Suite Web is licensed under the Apache License, Version 2.0 (the "License");
#
# - you may not use this software except in compl... |
aacfd9980cb683bc1bcbff34ff7ab66453534c049ba9288946019fd4bd8c983d | Python | 1,130 | 31 | import nibabel
def save_nifti(result, affine, header, output_name, n_neigh=None):
"""
Saves the data from the volumetric analysis into 2 compressed files.
Parameters
----------
result : numpy array of float32 (nRows, nCols, nSlices)
Contains the processed results from process_vb_vol_result... |
d3cdd68ef54118d6379ff02886252d5218c4d3cbd63b90c84c448715d3a628fa | Python | 1,130 | 34 | import scipy.io as spio
def loadmat(filename):
'''
this function should be called instead of direct spio.loadmat
as it cures the problem of not properly recovering python dictionaries
from mat files. It calls the function check keys to cure all entries
which are still mat-objects
'''
... |
4205cdcd62a14389c79ef0bc0963072b2f6cc727debf1d736aa6ad9c0fa55e02 | Python | 1,131 | 40 | """
This module define MetricStructure
"""
import logging
import scipy
from scipy import stats
import numpy as np
from metrics.generic_metric import GenericMetric
class MetricStructure(GenericMetric):
"""
This class define the MetricStructure
"""
def __init__(self):
self.reset_and_init_value(... |
8e8de0d461c8d9f05009b21a8737986d7451f595af55f4c5a50adaf6db5416cc | Python | 1,131 | 37 | import os
import numpy as np
from dotenv import load_dotenv
from sklearn.metrics import roc_auc_score
from omop_learn.omop import OMOPDataset
from omop_learn.sparse.models import OMOPLogisticRegression
from omop_learn.utils.config import Config
load_dotenv()
config = Config({
"path": os.getenv("DATABASE_PATH")... |
9308632be444897183c19e1246875c377676d9fcd72a8161a6385cbd9fdae770 | Python | 1,131 | 39 | import os
import cv2
import torch
import numpy as np
from config import *
def normalize_image(image):
return (image - image.min())/(image.max()-image.min())
acceleration_factors = np.arange(2, 30, 2).astype(int)
for acc_factor in acceleration_factors:
path_dir = where_am_i(path = 'datasets')+'x{}'.fo... |
b090cd89cbe28dde67b29b72c09e84728039c55ec1cbe2c13aef7b6136460d53 | Python | 1,131 | 54 | #!/usr/bin/env python
"""
usage: %prog width height bg_color hatch_color [color alpha stop_pos] +
"""
import sys
from math import pi
import cairo
assert sys.version_info[:2] >= (2, 4)
def parse_css_color(color):
if color.startswith('#'):
color = color[1:]
if len(color) == 3:
r = int(color[0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.