sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
50ab0a26722eb63d6fd174d22c6dee507b32224f56e5413ef5d3f5524394f3ad
Python
810
32
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) num_motifs = 10 msp.architecture["num_motifs"] = 80 + 2 msp.architecture["channels"] = 200 msp.architecture["motif_model_spec"]["motif_width"] = 13 msp.architecture["motif_model_spec"]["motif_feature_extractor_spec"] = d...
88d0ffbdb744a41fc97277f9b21417fdf30ce16dad1b009b044bac33e3114cd6
Python
811
23
import math from typing import Optional def make_divisible(v: float, divisor: int, min_value: Optional[int] = None) -> int: """ This function is taken from the original tf repo. It ensures that all layers have a channel number that is divisible by 8 It can be seen here: https://github.com/tensorfl...
aa83207291b674562bbf833d7608d45d7c8b446a506c4f217b43c40be5d094b2
Python
811
25
""" This module create TransformerClassifPerAminoAcid """ # pylint: disable=W0223 import torch.nn as nn class TransformerClassifPerAminoAcid(nn.Module): """ This class define a Transformer model that classify each amino acid of a protein """ def __init__(self, transformer_embedder, num_classes, dropo...
ae054313680a7f660199d44837eeef21a5a0286f6192a475b75588fee492f8a0
Python
812
27
# import the pyabf module from this development folder import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_SRC = os.path.abspath(PATH_HERE+"/../../src/") PATH_DATA = os.path.abspath(PATH_HERE+"/../../data/abfs/") sys.path.insert(0, PATH_SRC) # for importing sys.path.append("../../src/") #...
ebd109aa4826c071d676b18734558c1137936ee18059a60f7429f563ae45b9fe
Python
814
29
from pathlib import Path import nibabel import pydicom import numpy def dcm_to_nii(dcm_folder: Path, nii_file: Path): """ Converts DICOM files in a folder to a NIfTI file. Parameters: dcm_folder (Path): The path to the folder containing the DICOM files. nii_file (Path): The path to the N...
39021ebea8e6572a1a005841e9126f3a5dab063808389b177b45499da371837f
Python
815
30
import sqlite3 from .db import DB class CaseInformation(DB): def __init__(self): super().__init__() self.table_name = 'TG_case_info' self.table_desc = 'Telangana daily new cases, recoveries, deaths information' self.cols = self.getcolumns() def getcolumns(self): col...
865579dbde1763880b760231cfb1b14b8cb75fef1ad863aa2698dc2ceda805cb
Python
815
20
"""Module defining inputters. Inputters implement the logic of transforming raw data to vectorized inputs, e.g., from a line of text to a sequence of embeddings. """ from bioseq2seq.inputters.inputter import get_fields, build_vocab, filter_example from bioseq2seq.inputters.iterator import max_tok_len, OrderedIterator ...
a996e062415d617031c3d355afe47fa02c031cd3edee3d892d7c4a78846356dd
Python
815
25
""" Try to figure out how to read file creation date/time from ABF1 files. 19122043.abf according to ABFInfo: Created: Jan 22, 2019, at 22:22:10.750 [10:56:42] File GUID: {EA774D20-4346-4219-ACCF-DB3B6DD89ABD} """ import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path....
aa7b380852ee86ea80b683c793d87a3c9d1b087eedaf1048af74bd6a42830cd5
Python
815
36
"""Added organization to project Revision ID: 3f64cdda4d67 Revises: 951141858cff Create Date: 2024-06-16 22:27:43.746807 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = "3f64cdda4d67" down_revision = "298059b19bde" bra...
c85e590268b21f50cb7200c3f8596eea2101972569c101d6c9193249c1af3339
Python
815
26
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="DeepRegFinder", version="0.0.1", author="Example Author", author_email="author@example.com", description="Deep learning based transcriptional regulatory elements finder", long_descript...
ee54237ea28ff52ae07efd6d04741ad4a5fdf557d1d2a521b9065481f785aedf
Python
815
25
import os import tns from tns import extract_input def run(): # Extract distributions from cells in input directory dir_path = os.path.dirname(os.path.realpath(__file__)) filename = os.path.join(dir_path, '../test_data/bio/') distr = extract_input.distributions(filename, feature='path_distances') #...
a24b094a733c99d49793ed911cbec679217770e511df9697e4c8c15374a57dfc
Python
816
27
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import tensorflow as tf import pandas as pd import argparse import os import sys import pwd import pdb import csv import re import math df = pd.read_c...
1e80a0def9e51a370f0f2e2d5d0d3d943ab95b8fbfc1fecf4246a5f917d6e636
Python
817
27
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._decreasing import Decreasing from ._hoverlabel import Hoverlabel from ._increasing import Increasing from ._legendgrouptitle import Legendgrouptitle from ._line import Line from . import decreasing from . import hoverlabel...
507ef38fe46523d09194f65cda8ee0163f349ec9c56f645567ebe2782b21d523
Python
817
30
from typing import Any from ._ak_interop import DTYPE_co, RDTYPE_co from ._core import Ragged, Ragged as _CoreRagged, is_rag_dtype from ._ops import concatenate, hash, reverse_complement, to_packed, to_padded from ._utils import OFFSET_TYPE, lengths_to_offsets def zip(fields: "dict[str, _CoreRagged[Any]]") -> "_Core...
a5f4c2f4ebd0b54ef6c17f1a3c3ee9cb05ca045d36b62f26935289977b5f365d
Python
817
19
#!/usr/bin/env python import argparse from angorapy.agent.ppo_agent import PPOAgent from angorapy.analysis import investigators parser = argparse.ArgumentParser(description="Inspect the dynamics an episode of an agent.") parser.add_argument("id", type=int, nargs="?", help="id of the agent, defaults to newest", defaul...
4d03adf3bebc7278f079b6ff73e79141e6de89539c8e9608911023fce06ade08
Python
818
30
import sqlite3 from .db import DB class CaseInformation(DB): def __init__(self): super().__init__() self.table_name = 'MH_case_info' self.table_desc = 'Maharashtra daily new cases information' self.cols = self.getcolumns() def getcolumns(self): cols = { ...
6c15d3785f984bebd489d58e97f7a9252b9ca8dac4ebe6c378e2551853918a29
Python
818
22
# Copyright (c) 2023 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
807f8825d97afaadf140f4d13ea321022ab9c4882f95e8a80adf20c9671d3006
Python
818
27
import sqlite3 from .db import DB class PsychosocialSupport(DB): def __init__(self): super().__init__() self.table_name = 'KL_psychosocial_support' self.table_desc = 'Psychosocial support provided through the program Ottakalla Oppamundu' self.cols = self.getcolumns() def get...
71338faff6f8b2677bd913792a309ba4b91257a24a3508a646721fae21016400
Python
819
42
from neuron import h, gui def check_basic_pointer(make_instance): s = h.Section() s.nseg = 2 s.insert("basic_pointer") s025 = make_instance(s, 0.25) s075 = make_instance(s, 0.75) s025._ref_p1 = s025._ref_x1 s025._ref_p2 = s025._ref_x2 s075._ref_p1 = s(0.25)._ref_v s075._ref_p2 ...
a244f438ba43c73ec9c0baa981f5920c8ef1a70e88f513b5a2e89295450d2a4e
Python
819
31
""" Smoke tests for simulation modules. Minimal entry point test, NO heavy computation. Tests that module can be imported and has expected structure. """ import importlib import pytest @pytest.mark.fast def test_agent_simulations_entry_point(): """ Test agent simulation entry point exists. ...
bef3c9186fddad387da7ac51f0c6784047661c1d4b8ca325ebc1ec5f0158f770
Python
819
25
''' The code here is modified from https://github.com/charlesq34/pointnet under MIT License ''' if __name__ == '__main__' and __package__ is None: from os import sys sys.path.append('../') import torch.nn as nn from scene_graph_prediction.pointnet2_dir.pointnet2.models.pointnet2_msg_cls import PointNet2Classi...
444beb50189b50782a23d4bec30d02f5b854fa7f0fc9a43c4a5af5fcd47169a1
Python
820
32
__all__ = [] __metaclass__ = type try: # Python >=3.2 from tempfile import TemporaryDirectory except ImportError: import shutil import tempfile class TemporaryDirectory: """ Very simple temporary directory context manager. Will try to delete afterward, but will also ignor...
9bc758e960866f8e05ccb5c6abee854cd66628fa0823c9d3233e67515d2a6e87
Python
820
33
from argparse import ArgumentDefaultsHelpFormatter, ArgumentParser import lokatt.gpu_beamsearch_opt as basecaller modules = [ 'basecaller',] __version__ = '0.0.1' def main(): parser = ArgumentParser( 'lokatt', formatter_class=ArgumentDefaultsHelpFormatter ) parser.add_argument( ...
b6863ac761be1c946458d1c3c97592d00293d0a3685a38ef69feb9644a3c8665
Python
820
28
from PIL import Image from lightly.transforms.fda_transform import ( FDATransform, FDAView1Transform, FDAView2Transform, ) from .. import helpers def test_view_on_pil_image() -> None: single_view_transform = FDAView1Transform(input_size=32) sample = Image.new("RGB", (100, 100)) output = sing...
5d87c82bbc9261ae9c4ee32a08057a291ce516195e6dbdf89038ed4019f3ca2b
Python
821
42
#!/usr/bin/env python import unittest import os import numpy as np from wyrm.types import Data from wyrm.io import load, save FILENAME = 'test_load_save.npy' class TestLoadMushuData(unittest.TestCase): def setUp(self): data = np.arange(10).reshape(5, 2) axes = [np.arange(5), np.array(['ch1'...
70ce87f08aba8cb006eb6a29eb1b3f1e7b0e13475fe5c9298cf0c94336f815f5
Python
822
34
import numpy as np def time_gate(freq, arr, start, end, n = None,time_info = False): n_org = arr.shape[-1] if n is None: n = n_org arr_t = np.fft.ifft(arr,n=n) dt = 1/(freq[1]-freq[0])/n/2 t = np.arange(0,dt*n,dt) idx_start = int(start/dt) idx_end = int(end/dt) if idx_end>idx_...
73c1613029b3a2050cc1e34d2873c92271fb09c6d358a46ae484e31a715355ca
Python
822
24
import argparse from irnlm.data.extract_semantic_features import integral2semantic from irnlm.utils import write if __name__ == "__main__": parser = argparse.ArgumentParser( description="Extract semantic features (content words) from the integral text." ) parser.add_argument("--text", type=str) ...
9ee68636d695537415a84737e173c23c337f4a0504ec8aed7c4a44a36be6eb5e
Python
822
40
#!/usr/bin/env python # coding: utf-8 # In[ ]: import argparse # In[1]: import pandas as pd # In[ ]: parser = argparse.ArgumentParser() parser.add_argument('-n', type=int, help='Maximum number of rows to select.') parser.add_argument('--min-FC', type=float, help='Minimum fold-chage versus control.') parser.a...
b0010fec368948a20e1e8459cf76294434c173b1c9f28c51fe83c1f07be68713
Python
822
21
from PIL import Image import numpy as np def rotate(img,angle): rotatedArray = np.empty((Image.fromarray(img[:,:,0]).rotate(angle,Image.NEAREST,True).size)+(img.shape[-1],)) for i in range(img.shape[-1]): rotatedArray[:,:,i] = Image.fromarray(img[:,:,i]).rotate(angle,Image.NEAREST,True) return rota...
f25a548e5dde142052011009ad4d9f7608331aa6bab9257bb72b85a1e0d9deb7
Python
822
45
"""myapp.py Usage:: (window1)$ python myapp.py worker -l INFO (window2)$ python >>> from myapp import add >>> add.delay(16, 16).get() 32 You can also specify the app to use with the `celery` command, using the `-A` / `--app` option:: $ celery -A myapp worker -l INFO With the `-A myproj` argume...
3b7bb18faf05493f4797c360cda3270d555f683b647c081ab18556678d4ff872
Python
823
27
import unittest import pytest from PIL import Image from lightly.utils.dependency import torchvision_transforms_v2_available if not torchvision_transforms_v2_available(): pytest.skip("torchvision.transforms.v2 not available", allow_module_level=True) import torch import torchvision.transforms.v2 as T from torchv...
a694f388db537a893790a8c12644f969219abaae30195d2855206fad5a59bd5d
Python
823
29
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"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
b6d042f0bfc9d580cb09685320f852171bbc8d6b8e5a5fefba91c515a03f34ff
Python
823
30
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """tests for closeness.py""" import unittest from sknetwork.data.test_graphs import * from sknetwork.ranking.closeness import Closeness class TestDiffusion(unittest.TestCase): def test_params(self): with self.assertRaises(ValueError): adjacency...
219fca66c25b0b6f442b91d959bbb218626d0a479ab3332775a42e408d370cd8
Python
824
29
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._domain import Domain from ._hoverlabel import Hoverlabel from ._legendgrouptitle import Legendgrouptitle from ._link import Link from ._node import Node from ._textfont import Textfont from . import hoverlabel from . i...
e1912311ae984537c551dcc9da6f994f9499df0c3499239f1d35bc9fef46fa8f
Python
824
34
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="PreprocessedSpliceAI", preprocessor_spec=dict(type="Identity"), spliceai_spec=dict(type="SpliceAIModule", output_size=3), ) msp.data_dir = "../data/canonical_and_gtex_dataset/" ...
e7b5c81514661fa077059098d4a4184429c7c40379c5109d1798b745ff748cfb
Python
824
32
import streamlit as st import pandas as pd import duckdb def download_files(database): """_summary_: Streamlit page to provide download links for the NOCICEPTRA database and the NOCICEPTRA database schema Args: database (DuckDBConnection): _description_ Returns: None """ st.hea...
2baf221768b88b643a27a3286c31f4a5f24d08b432dff6fe6f00c5275e416167
Python
825
24
import SimpleITK as sitk import sys # Make transform elastixImageFilter = sitk.ElastixImageFilter() elastixImageFilter.SetFixedImage(sitk.ReadImage(str(sys.argv[1]))) elastixImageFilter.SetMovingImage(sitk.ReadImage(str(sys.argv[2]))) elastixImageFilter.SetParameterMap(sitk.ReadParameterFile(str(sys.argv[3]))) elasti...
df7bea91646a72fae41e654eeeb90d562eb1c8ca967a4eb244cd72617df8122e
Python
825
24
""" Demonstrate how to place text in arbitrary locations on a matplotlib figure. """ import numpy as np import matplotlib.pyplot as plt if __name__ == "__main__": fig = plt.figure(figsize=(6, 4)) plt.title("some title") plt.ylabel("vertical axis") plt.xlabel("horizontal axis") plt.grid(alpha=.5, ...
fc12ae3b39459acf96e64435de801c0ba7f25d37293d6018e7f1616e89549652
Python
825
37
import os import pytest from mirp.utilities.config_utilities import get_settings_xml, get_data_xml CURRENT_DIR = os.path.dirname(os.path.abspath(__file__)) @pytest.mark.ci def test_copy_settings_xml(tmp_path): target_file = os.path.join(tmp_path, "settings.xml") # Start with a clean slate. if os.path.ex...
59e18b6a74c7bd498bc5850b2f0ae254c132fbe48cc7de5744ff09ff40543bd9
Python
826
20
import os,pickle,torch from args import * from model import * from trainer import Trainer from dataset import * from utils import * import warnings warnings.filterwarnings("ignore") args.node_in_dim = 8 args.edge_in_dim = 5 option = args.__dict__ for fold in range(3): test_dataset = TestDataset(args.m...
e183fa1c5179bc0f6769772ab05d5e483f9d2a55c060e12fec93496b818fdae0
Python
826
32
from __future__ import annotations from typing import TypeVar import numpy as np from numpy.typing import NDArray DTYPE = TypeVar("DTYPE", bound=np.integer) LENGTH_TYPE = np.uint32 OFFSET_TYPE = np.int64 def lengths_to_offsets( lengths: NDArray[np.integer], dtype: type[DTYPE] | DTYPE = OFFSET_TYPE, # pyre...
091d62b7266ea59285c9d3830b11fbbe18d564183a839f61be25c87a137cba3c
Python
827
21
from drug_interactions.datasets.dataset_builder import DatasetTypes from drug_interactions.features.Char2VecFeature import Char2VecFeature from drug_interactions.features.EmbeddingFeature import EmbeddingFeature from drug_interactions.features.CNNFeature import CNNFeature from drug_interactions.features.OneHotFeature i...
074c5cdc6cfd9e28eb8d85d4c3c8b4476f35d3bd48b9cc6d2b6764fb76122069
Python
828
28
from PIL import Image from lightly.transforms.byol_transform import ( BYOLTransform, BYOLView1Transform, BYOLView2Transform, ) from .. import helpers def test_view_on_pil_image() -> None: single_view_transform = BYOLView1Transform(input_size=32) sample = Image.new("RGB", (100, 100)) output =...
198c72befeb8c58cb2d505410bb81b42c304adc96c5ef9c27b521325d742b584
Python
828
23
"""Tests for TensorFlow private compatibility probes.""" from __future__ import annotations import pytest from torchlens.backends.registry import BackendUnsupportedError from torchlens.backends.tf import _tf_compat as tfc @pytest.mark.smoke def test_op_callbacks_absence_marks_capability(monkeypatch: pytest.MonkeyP...
6c812b306f656c5c0850d4b64fff58cc32ebd7977fcd89df93f3541c2b9c0e62
Python
828
33
# Generated by Django 3.0.4 on 2020-03-25 09:09 from django.db import migrations class Migration(migrations.Migration): dependencies = [ ('biomedisa_app', '0068_auto_20200324_1641'), ] operations = [ migrations.RemoveField( model_name='mushroomspot', name='pictur...
aa21e8202b60e08c1577607f08208513048313aa2332097911f378510c754939
Python
828
32
import re import pytest import gym from gym.wrappers import HumanRendering def test_human_rendering(): for mode in ["rgb_array", "rgb_array_list"]: env = HumanRendering( gym.make("CartPole-v1", render_mode=mode, disable_env_checker=True) ) assert env.render_mode == "human" ...
61b946c28699620403069c11e36fe25fbedba392cb14bd8286a4a3103793a885
Python
829
26
""" This module define a LMCrossEntropy """ # pylint: disable=W0223 import torch from utils.utils import select_output_lm class LMCrossEntropy(torch.nn.modules.loss._Loss): # pylint: disable=protected-access """ This class define a specific loss for language model, that do the cross entropy loss only...
7632b0eb46c978286bf72c869676f5903ce19bc774457c0b1b8c29b337dd6f83
Python
829
33
import pickle from datetime import datetime, timezone from celery.exceptions import Reject, Retry class test_Retry: def test_when_datetime(self): x = Retry('foo', KeyError(), when=datetime.now(timezone.utc)) assert x.humanize() def test_pickleable(self): x = Retry('foo', KeyError(),...
79b689993c2c7652cc8d0f6934bd6da144d5df84e9e51aaf637a9844dd2f85c0
Python
830
20
# Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by app...
c808826021d391ad044110d1eac8e197b1b918b90c84272e7eea68fa5a958b2f
Python
830
33
""" Demonstrate how to overlay voltage and dV/dt plots """ import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/") PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/") sys.path.insert(0, PATH_SRC) import pyabf import matplotlib.pyplot ...
dcaa5a2131931b21982a80f23893a10900fb2b0e908acd1bdf3c7635dac7286d
Python
830
27
""" Practice printing epoch info """ import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/") PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/") sys.path.insert(0, PATH_SRC) import pyabf import glob import numpy as np if __name__=="__m...
11da17e3e5d3b34f463b134c4890e2ff8a496a82afb369689485ba1871e4f687
Python
831
40
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 20 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict( type="PSAMMotifModel", motif_spec=dict(type="rbns"), ...
4c013a0fdb023a2362b592526b9b6c4c6b1474111b420eac2ae048e7d5301ffd
Python
831
42
import pickle # [f1_begin, f1_end, f2_begin, f2_end] AB_list = [ [1, 0, 0, 1], # Run from A to B [1, 0, 1, 1], # Run from A+B to B [1, 1, 0, 1], # Run from A to A+B ] BA_list = [ [0, 1, 1, 0], # Run from B to A [0, 1, 1, 1], # Run from B to A+B [1, 1, 1, 0], # Run...
79d19a4048d365247bc2b4cbb359fa789e8e58df13f6cdbbbd3d263ffd5520ff
Python
831
23
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture["num_motifs"] = 66 msp.architecture["sparse_spec"] = dict(type="SpatiallySparseAcrossChannels") msp.architecture["motif_model_spec"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
ad7e630b4088c24b0a72962d0f77c0695cddb4e19c38ad2ac782b5202a6ea621
Python
831
26
import argparse import json def read_tsv(filename, max_num_lines): train_json_filename = filename.replace(".tsv", ".jsonl") with open(filename, 'r') as f_in, open(train_json_filename, 'w+') as f_out: f_in.readline() for idx, line in enumerate(f_in.readlines()): if idx < max_num_li...
eba6565bd1331cf425c21fb24efdb5066ccb6c89fea8685dfc2199563c697e47
Python
831
32
"""Screenshots for quick guide extensions""" import pathlib import sys from PyQt5 import QtCore from PyQt5.QtWidgets import QApplication from pyjibe.head.main import PyJibe from pyjibe.head import preferences data_path = pathlib.Path(__file__).resolve().parent / ".." / "data" app = QApplication(sys.argv) QtCore.QLo...
d8cebbdab91798c550d0e0efb101534f24e5434609a3e4e631a91a0697853284
Python
832
28
# -*- coding: utf-8 -*- # Copyright (c) 2016-2018 Braintech Sp. z o.o. [Ltd.] <http://www.braintech.pl> # All rights reserved. """ Module defines single :class: 'DataAsciiWriteProxy'. Author: Mateusz Kruszyński <mateusz.kruszynski@gmail.com> """ from .data_generic_write_proxy import DataGenericWriteProxy, SampleP...
5f903b081649c01815cd8ed04380c97e65e263b8e087aea7ee6cc1113731828f
Python
833
28
from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import tensorflow as tf import pandas as pd import argparse import os import sys import pwd import pdb import csv import re import math df = pd.read_c...
5fadd29e2b05cb62c9f0a1f16f3a383004f4a5e31ddef9ddd70df4fa2fd4a093
Python
833
31
"""API router for handling telemetry data in the CarbonServer API.""" from uuid import UUID from dependency_injector.wiring import Provide, inject from fastapi import APIRouter, Depends from starlette import status from carbonserver.api.schemas_telemetry import TelemetryCreate from carbonserver.api.services.telemetr...
7ebc87328d031d005283970f4e5dab132799054fd8e07b14474861e709a9205e
Python
833
18
""" This module is the core of the `ethoscope`. It defines the building bricks at the basis of the package. Overview: * :class:`~ethoscope.core.monitor.Monitor` is the most important class. It glues together all the other elements of the package in order to perform (video tracking, interacting , data writing and draw...
99abeaec5549e9dba5be4dd958c372ea456a026c20434c310d74ce417e2ed586
Python
833
26
import glob from PIL import Image import lightly # let's get all jpg filenames from a folder glob_to_data = "/datasets/clothing-dataset/images/*.jpg" fnames = glob.glob(glob_to_data) # load the first two images using pillow input_images = [Image.open(fname) for fname in fnames[:2]] # create our transform transform...
16931a2884842b3f15d8480a3e42a847a5b86e7b7f45aefa86505dfb55398000
Python
834
32
# %% import argparse import gzip # %% def main(): parser = argparse.ArgumentParser() parser.add_argument('--positive') parser.add_argument('--negative') parser.add_argument('-o', '--output') args = parser.parse_args() with open(args.output, 'w') as f_out: print('sequence\tlabel', file=...
3dc05b7f5ad9ddb26dd200b71594fbf4cfe6729c3c763b22657a74d4528dac30
Python
834
30
from __future__ import annotations from larvaworld.gui_v2.apps.models_environments.env_builder_widget import ( EnvBuilderWidget, build_environment_builder_widget, ) def build_environment_builder_text(entry) -> tuple[str, str, list[tuple[str, str]]]: return ( "Environment Builder", "PySide...
9a91779d4105f35cee67393b8a6886b380ab2afecdbb9574a95007f13d4281ba
Python
834
30
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._delta import Delta from ._domain import Domain from ._gauge import Gauge from ._legendgrouptitle import Legendgrouptitle from ._number import Number from ._title import Title from . import delta from . import gauge ...
dcd3a651164fb79782affa9781421bf6a8ac82fa4402b2df7ffc705524ff5144
Python
834
29
# %% import argparse # %% if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('bed', metavar='<file.bed>') args = parser.parse_args() with open(args.bed) as f: _ = f.readline() for line in f: row = line.strip().split('\t') chrom, st...
2b9d707080456fb0a5d6afb60bfd9eab085621e324238b0696bd12f0ab2d8317
Python
835
30
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"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
3f2fbf5cd45d0e8b371c121041cf114e5c71fb27f66b099a23fbf01f95a6e0fd
Python
835
30
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"] = dict( type="AdjustedMotifModel", model_to_adjust_spec=dict( ...
ced6c79a8df8dd515d902dd5efbd6b0849fdb66d2fd2b2b6ecbc98f5b7b5f223
Python
835
44
'''Utilities for Pandas dataframe This file is a part of BdPy ''' __all__ = ['convert_dataframe', 'append_dataframe'] import pandas as pd def convert_dataframe(lst): '''Convert `lst` to Pandas dataframe Parameters ---------- lst : list of dicts Returns ------- Pandas dataframe '...
ec1ca3961bf021b6cef534bbd4ee8af25f07d06b942bc3dd60e22d3d553683ab
Python
836
28
"""Tests for specparam.utils.convert.""" import numpy as np from specparam.utils.convert import * ################################################################################################### ################################################################################################### def test_dict_arra...
19d6727659553ad2769450abfd49b13e9ba0faa5993b3c28788836b8f89a1066
Python
837
27
import torch from lightly.transforms import IRFFT2DTransform, PhaseShiftTransform, RFFT2DTransform # Testing function image -> RFFT -> PhaseShift. # Compare shapes of source and result. def test() -> None: image = torch.randn(3, 64, 64) rfftTransform = RFFT2DTransform() rfft = rfftTransform(i...
32f4d7fb9432ba5c3f31a586db4665204017b15b45aed0e1f82b8cdfb9400a17
Python
837
24
from nitorch import io from nitorch.spatial import euclidean_distance_transform as edt import torch root = '.' root += '/lsfm/layers' for i in (8, 9, 10, 11, 12, 17, 19): fname = f'{root}/extracted_9.9um/layers.{i:02d}.nii.gz' f = io.map(fname) d = f.data(device='cuda') planemask = d.reshape([-1, d.sh...
86cb98d9d96991c999973d9dc880e35947ba8cce5cf1f9cdfcceb8ce45bbe4c8
Python
837
31
""" Comparing version numbers """ # import the pyabf module from this development folder import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_SRC = os.path.abspath(PATH_HERE+"/../src/") PATH_DATA = os.path.abspath(PATH_HERE+"/../data/abfs/") sys.path.insert(0, PATH_SRC) # for importing sys...
ecc3d7bf15ca86e77797b10699a664f9df001bb86a3a227ad1f7c64b82799ae3
Python
837
31
from typing import Literal import numpy as np from hobj.learning_models import BinaryLearningModel from hobj.types import ImageId from typing import cast class RandomGuesser(BinaryLearningModel): """ A dummy model which simply returns random outputs, independent of the given image. """ def __init__...
248c96e48a650ce8f412548587213e2a8e46c07352bb09755bb518cf45a7fff2
Python
838
31
from setuptools import setup, find_packages setup( name = 'chroma-pytorch', packages = find_packages(exclude=[]), version = '0.0.1', license='MIT', description = 'Chroma - Pytorch', author = 'Phil Wang', author_email = 'lucidrains@gmail.com', long_description_content_type = 'text/markdown', url = 'ht...
4aa52957f11f9a937fd30fcd0ddac7ff5cb8b0a11386b7d578f10ef299a09c16
Python
838
22
from pyabf.abf2.section import Section class EpochSection(Section): """ This section contains the digital output signals for each epoch. This section has been overlooked by some previous open-source ABF-reading projects. Note that the digital output is a single byte, but represents 8 bits correspo...
7bdedbc62f597ea642e092df9599d37bac6f80880ae2410bbc7da2096d7487e1
Python
838
39
from os.path import basename import sys import collections def cal_RT(mutation_file): d = collections.defaultdict(lambda :0) #x = [] with open(mutation_file) as RT: for line in RT: line = line.strip('\n').split('\t') if len(line) == 1: continue else: chrID = line[0] position = line[2] re...
b7dee92833314fd442fbf62c818f9cf2d431ade932004ea2dbf82ebf10181e14
Python
838
28
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Tests for cliques""" import unittest from scipy.special import comb from sknetwork.data.test_graphs import * from sknetwork.topology.cliques import count_cliques class TestClique(unittest.TestCase): def test_empty(self): adjacency = test_graph_empty() ...
c804573d45cdd6128123959e174850e333ccd26fcc43c7f1039f4b54667a8868
Python
838
32
import importlib import sys import pytest @pytest.mark.parametrize( "import_statement", [ "import lightly.api", "from lightly import api", "from lightly.api import ApiWorkflowClient", ], ) def test_lightly_api_imports_raise_deprecation_error(import_statement: str) -> None: sys...
f9c422f73fcd3132a39ea91845331adcc89895918321fedf7e174477bcafa5c9
Python
838
34
"""Spatiotemporal modeling of spatial transcriptomics """ from . import ( align, benchmark, bp, density, em, external, icell, label, moran, simulation, simulation_evaluation, utils, vi, ) from .align import refine_alignment from .benchmark import compare from .density...
22092d7a0f277bbbb937db0d5e5c2e7012b7831dc2e0da81b86b687083593caf
Python
839
31
from sys import argv from msp import MSP from msp_fly import fly_am msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) fly_am(msp) msp.architecture["propagate_sparsity_spec"] = dict( type="OnlyAllowInfluenceOnSplicesites" ) msp.architecture["final_processor_spec"].update( dict( bottleneck_spec=...
438600f1e50556e9ec77d6b00f78161607895ea8b060d9910c3eb879ede50ba9
Python
839
31
from sys import argv from msp import MSP from msp_fly import fly_am msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) fly_am(msp) msp.architecture["propagate_sparsity_spec"] = dict( type="OnlyAllowInfluenceOnSplicesites" ) msp.architecture["final_processor_spec"].update( dict( bottleneck_spec=...
46874eef4b8dbf0e045b82a6e2a2c80151766a2b5fe16c373d377ced8341208d
Python
839
31
from sys import argv from msp import MSP from msp_fly import fly_am msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) fly_am(msp) msp.architecture["propagate_sparsity_spec"] = dict( type="OnlyAllowInfluenceOnSplicesites" ) msp.architecture["final_processor_spec"].update( dict( bottleneck_spec=...
4c50fa912ac743a211070a381debc6b24a3d1dd6b7a89413890b5f2dcca40dee
Python
839
35
# %% # import all_raw_aligned import pandas as pd from globals import path all_raw_aligned = pd.read_csv(f"{path}/all_raw_aligned.csv") # %% # plot scatter plot with dummy data and star like shape import matplotlib.pyplot as plt import numpy as np import matplotlib.lines as mlines from plotting import prettifySpinesTi...
63e9897ca10b166ce7fcf4d6c05a11b0a488e75f4f7092bd90e0addcecc0b91c
Python
839
24
import argparse from os import path parser = argparse.ArgumentParser() parser.add_argument("--bg", action = "store", help = "string to write for bg in ldcts") parser.add_argument("--bg_dir", action = "store", help = "directory where bg ldscore files are located") parser.add_argument("--celltypes", action = "store", ...
891c2b2f52ce6ad55863082e425b9a4a7364c1da7a9426686201f84a13f060ae
Python
839
15
# Author: Christian Brodbeck <christianbrodbeck@nyu.edu> from eelbrain.pipeline import PrimaryEpoch, SecondaryEpoch, SuperEpoch, EpochCollection, ContinuousEpoch def test_epoch_repr(): primary_epoch = PrimaryEpoch('session') assert repr(primary_epoch) == "PrimaryEpoch('session', samplingrate=200, baseline=(No...
13bd5587a8db3a18f631371c7800d3f290a5e8f6971cd1d5cd747e2130553721
Python
840
45
import eugene as eu # Configure EUGENe for a test spin eu.settings.dataset_dir = "eugene_data" eu.settings.output_dir = "eugene_ouput" eu.settings.logging_dir = "eugene_logs" eu.settings.config_dir = "eugene_configs" # Extract the data sdata = eu.datasets.random1000() # Preprocess sequences for training eu.pp.prepar...
63b3d79a7a6fab8a2538e54488fda48445cfc9292340d5da23981fd7ecaadcf0
Python
840
32
"""Screenshots for quick guide extensions""" import pathlib import sys from PyQt6 import QtCore from PyQt6.QtWidgets import QApplication from pyjibe.head.main import PyJibe from pyjibe.head import preferences data_path = pathlib.Path(__file__).resolve().parent / ".." / "data" app = QApplication(sys.argv) QtCore.QLo...
8958741b6eb1177ce3f232b6b871f14a1f6899b63e895d3789baa36a135ced22
Python
840
29
# fix problems with pythons terrible import system import os import sys file_dir = os.path.dirname(os.path.realpath(__file__)) #sys.path.append(os.path.join(file_dir, '../bin/')) sys.path.append(os.path.join(file_dir, '..')) # import extract_genes module import prob2020.console.extract_gene_seq as eg import prob2020.p...
3f8c0afa146e0f6797059ed9bef82f0a413ef79c55f3b8fc3e6dd3b0bdfbc243
Python
841
34
#!/usr/bin/env python import fileinput from pprint import pprint def author(line): try: A, E = line.strip().rsplit(None, 1) E.replace('>', '').replace('<', '') except ValueError: A, E = line.strip(), None return A.lower() if A else A, E.lower() if E else E def proper_name(name):...
5c051de44c417b4494d03e54827634a91e2197901b56957cf1d4091b2b8f9948
Python
841
28
import sys from typing import TYPE_CHECKING if TYPE_CHECKING: from ._autorangeoptions import Autorangeoptions from ._minor import Minor from ._rangebreak import Rangebreak from ._tickfont import Tickfont from ._tickformatstop import Tickformatstop from ._title import Title from ._unifiedhov...
f3e42f22b6d7a75dbc95600c8009154e1b2821a3fa4d5652e85285d1a3b42267
Python
842
26
import time from ethoscope.hardware.interfaces.interfaces import BaseInterface from ethoscope.stimulators.sleep_depriver_stimulators import SleepDepStimulator from ethoscope.tests.integration_api_tests.old.utils import test_stimulator class MockSDInterface(BaseInterface): def send(self,channel, dt=350,margin=1...
387c0a158c6bdb7872dc95f4ec73fa8965799d0033e04e7924455a9320fdfe0b
Python
843
25
#!/usr/bin/env python import os, re, sys, subprocess trinity_package_dir = os.path.abspath(sys.argv[0] + "/../../../") print("Trinity package dir: {}".format(trinity_package_dir)) trinity_package_name = os.path.basename(trinity_package_dir) print("Trinity package name: {}".format(trinity_package_name)) destination_...
37da6a039ffb93797a916b0acd1da19016e032c8dbd1f0cf5ec489e08d53c945
Python
844
24
# 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...
448ff6bdfac039a10eb1e6ec4c4ac9a2688b475ac3a9367a1fb35b001a6b240e
Python
844
29
""" Refactor the AP detection module to provide a clean interface. You can always refactor the core later. """ import os import sys PATH_HERE = os.path.abspath(os.path.dirname(__file__)) PATH_DATA = os.path.abspath(PATH_HERE+"../../../data/abfs/") PATH_SRC = os.path.abspath(PATH_HERE+"../../../src/") sys.path.insert(0...
480a893b3767cb6b235e53dc7afc8ecb9e3551f1b658c5cb6090be6a73dd9c7b
Python
844
25
"""Tests for specparam.modes.definitions.""" from specparam.modes.mode import Mode, VALID_COMPONENTS from specparam.modes.definitions import * ################################################################################################### ##########################################################################...
ddec2caec7369db9c0257a42d242c846bd70d01cb092b1134a76747a6d06cd62
Python
844
44
from neuron import h, gui def make_accessors(mech_name, read_only): get = getattr(h, f"get_gbl_{mech_name}") if read_only: return get, None set = getattr(h, f"set_gbl_{mech_name}") return get, set def check_write_read_cycle(mech_name, read_only=False): get, set = make_accessors(mech_na...
fb0eebb1dee704826bf492114d359f12173da34747323cbfde3d33144224666f
Python
844
45
# -*- coding: utf-8 -*- """ Created on Wed Jan 14 13:04:36 2015 @author: rh04 arg1 = path e.g. Z:\DWI\Subject1\Rep1\ arg2 = name of DWI volume e.g. DWI_brain """ import nibabel as nib from gibbs_removal import volume_gibbs_removal from sys import argv script, arg1, arg2 = argv # load data print 'loading ...' pri...
1bf7d2e3c25cec845c577081a629e9c57453071be923d17b65d072e263e93e4b
Python
845
36
from sys import argv from msp import MSP msp = MSP() msp.file = __file__ msp.seed = int(argv[1]) msp.architecture = dict( type="PreprocessedSpliceAI", preprocessor_spec=dict(type="Identity"), spliceai_spec=dict(type="SpliceAIModule", output_size=3), ) msp.data_dir = "../data/canonical_and_gtex_dataset/" ...
549b96c4b645297417ce505cceec68f78c1759250b9d7c1b3bfe6e97f870b1ed
Python
845
28
"""Utilities used by the message signing serializer.""" import sys from contextlib import contextmanager import cryptography.exceptions from cryptography.hazmat.primitives import hashes from celery.exceptions import SecurityError, reraise __all__ = ('get_digest_algorithm', 'reraise_errors',) def get_digest_algorit...
a672b6af121ffb4710ec0f02348fdab5b5b8f427807c79e38f231f91c7062262
Python
845
27
#!/usr/bin/env python """ Extract importent information from the standard output file and put it in some standard format, like BED and tabular. """ import sys bed = open(sys.argv[2], "w+") tabular = open(sys.argv[3], "w+") for line in open(sys.argv[1]): # Sequence 'CRISPRs' (10798 bp) if line.startswith...