sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
d76b351e25da1a5c18f76b200710e66207d04ac31f35691d0caaf3d0ea544939
Python
472
16
import sys import wget from tqdm import tqdm import os not_found = open("404.txt","w") for line in tqdm([l.strip() for l in open(sys.argv[1],'r').readlines()]): line = line.strip() url = "https://alphafold.ebi.ac.uk/files/AF-" + line + "-F1-model_v2.pdb" try: filename = wget.download(url) ...
db25120ae42b869273ae07eb8af0912ed55c9699e5d75d1d6bd9ac733ee5c012
Python
472
19
from langchain_core._api import __all__ EXPECTED_ALL = [ "beta", "deprecated", "LangChainBetaWarning", "LangChainDeprecationWarning", "suppress_langchain_beta_warning", "surface_langchain_beta_warnings", "suppress_langchain_deprecation_warning", "surface_langchain_deprecation_warnings",...
fbbec56854e99b0f466d882355438509367e5ad410c89f0ddbafb14cc6c2e32d
Python
472
19
from langchain_classic.schema.runnable.config import __all__ EXPECTED_ALL = [ "EmptyDict", "RunnableConfig", "acall_func_with_variable_args", "call_func_with_variable_args", "ensure_config", "get_async_callback_manager_for_config", "get_callback_manager_for_config", "get_config_list", ...
970dc4aae8a6121b5714ff78630a643febc565643911bc45dcf59512ade35e2a
Python
474
20
import numpy import shapely import shapely.wkb def numpy_to_ewkt(arr): return shapely.wkb.dumps(shapely.geometry.point.Point(*arr)).hex() def ewkt_to_numpy(ewkb): return numpy.array( shapely.wkb.loads( (ewkb.hex() if isinstance(ewkb, bytes) else ewkb), hex=True)) def linese...
95dfc4ba64a6e3c5bce8118db1b6ebcd72f8833491f936e48175fdd9b1b55bca
Python
475
18
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2023/9/27 17:59 # @Author : zhangchao # @File : __init__.py.py # @Software: PyCharm # @Email : zhangchao5@genomics.cn from .dnn import DNNModel from .spatial import SpatialModel from .loss import KDLoss, MultiCEFocalLoss from .loader import DNNDataset fro...
e373faa47a3028889d80a14ce1910da96e7ac97d131abe5e4b9d2947db3be6fa
Python
475
26
import voxcell as vc import numpy as np pixelSize = 10 vd = vc.VoxelData.load_nrrd('flatmap_centered_200um.nrrd') x = vd.raw[:,:,:,0] y = vd.raw[:,:,:,1] xnan = np.isnan(x) ynan = np.isnan(y) xmin = np.min(x[~xnan]) ymin = np.min(y[~ynan]) x = np.floor((x - xmin) / pixelSize) y = np.floor((y - ymin) / pixelSize) ...
1a588817a2d2dce48712a3093bf828e663da8f44e9e216fd6497a60093885a93
Python
476
16
""" A TensorFlow-powered python toolbox to train deep neural networks to perform motor tasks. .. note:: The API referenced in the documentation is outdated and corresponds to version 0.1.5 of MotorNet, which relies on TensorFlow. However, it is still referenced here for users who may wish to consult it. """ _...
bc25dbfc4f32ea67450e1ad1b964a90b5dbfc5052ea5d31fc7d34a70a57449fd
Python
476
14
from langchain_core.utils.function_calling import FunctionDescription, ToolDescription from langchain_core.utils.function_calling import ( convert_to_openai_function as convert_pydantic_to_openai_function, ) from langchain_core.utils.function_calling import ( convert_to_openai_tool as convert_pydantic_to_openai...
89cdad6b02bf171f132bf19f4a0728925c6d76237568b2dc947674a3d8abc8f5
Python
481
13
from .base_options import BaseOptions class TestOptions(BaseOptions): def initialize(self, parser): parser = BaseOptions.initialize(self, parser) parser.add_argument('--model_path') parser.add_argument('--no_resize', action='store_true') parser.add_argument('--no_crop', action='sto...
0e5829501c8119dc4c6ba2821a505c16ab8b1fea553bb815f485ef02c78ef4d8
Python
482
22
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 3 10:57:50 2019 @author: ngritti """ import sys import PyQt5.QtWidgets from morgana.GUIs.mainwindow import morganaApp # filepath = os.path.dirname(os.path.abspath(__file__)) # sys.path.insert(0,os.path.join(filepath)) if __name__ == '__main__': ...
6b9d2ece38775385feab037482860e26399792100d6cec0a05470a5de1ef13fb
Python
482
21
#!/usr/bin/python import sys import json doc = json.loads(sys.stdin.read()) if 'start' in doc['input']: sums = doc['input']['start'] finish = sums + 1 doc['cache']['finish'] = finish else: sums = doc['input']['sum'] + 1 finish = doc['cache']['finish'] if sums > doc['cache']['finish']: success...
636fdeabe66eca2fd3c26c83eb6294bff6d4d692a78ba8b7fbaa317112aa0038
Python
483
16
MODEL_CONFIG = { "weight":{ "protein": "pocket_pre_220816.pt", "molecule_no_h": "mol_pre_no_h_220816.pt", "molecule_all_h": "mol_pre_all_h_220816.pt", "crystal": "mp_all_h_230313.pt", "mof": "mof_pre_no_h_CORE_MAP_20230505.pt", }, "dict":{ "protein": "poc.dict...
a45f1fc11707d914083d4691f1588ec08399f50d4052c86cd30ad1495a923c01
Python
483
10
def __getattr__(_: str = "") -> None: """Raise an error on import since is deprecated.""" msg = ( "This module has been moved to langchain-experimental. " "For more details: https://github.com/langchain-ai/langchain/discussions/11352." "To access this code, install it with `pip install l...
9a57dd093bdd09cb58704fefb50866da0ec516af98d540b550f2b3b8081dcb5d
Python
484
22
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Apr 3 10:57:50 2019 @author: ngritti """ import sys, os filepath = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0,os.path.join(filepath,'..')) import PyQt5.QtWidgets import GUIs.mainwindow if __name__ == '__main__': def run(): ...
9d8aa86793daacfc04dff10b0a3cd8c0c93ccc59a4edf9864332c7724d285926
Python
485
16
"""Test the run collector.""" import uuid from langchain_core.language_models import FakeListLLM from langchain_core.tracers.context import collect_runs def test_collect_runs() -> None: model = FakeListLLM(responses=["hello"]) with collect_runs() as cb: model.invoke("hi") assert cb.traced_ru...
15b88514cf72b9d6e57e67c4a1465e6db24361945a229c7674ebb0e7e2f42a08
Python
486
13
import sys sys.path.append('../source') import tinaui folder = '../test/sampledata/ocn' t1 = tinaui.load_status(folder, load_imagedata=True) # use the name of image data, the extent is given in voxels check the GUI # of mayavi pipline and for possible ways to change apearence, or # mlab.pipeline.surface? dataset, surf...
fbc801ce5035ae175f07a7ebfc17043f64bac713263ee442aaf8034f30800296
Python
487
22
#%% import os import tensorflow as tf from shutil import copyfile for ch in (1,2,4,8): root0 = f'C:/MyFiles/MyCodes/research/DLAG_Clear/brainagemodel/pretrained' root = f'{root0}/channel{ch}' models = [] for sn in range(100): fname = f'{root}/model117_sn{sn}_fs64_fr30_ch{ch}/model.h5' p...
9f27b68bf45f9b31cf88411a08654bb93eb01bcfb72a5a35ec21ffa43651ade6
Python
488
16
from langchain_core.tracers import schemas from langchain_core.tracers.schemas import __all__ as schemas_all def test_public_api() -> None: """Test for changes in the public API.""" expected_all = [ "Run", ] assert sorted(schemas_all) == expected_all # Assert that the object is actually ...
af9b4a2bc90ab0fad7c4e9e81a3762a25e08a2065999e6953b66373fb78d17aa
Python
488
14
import numpy as np # make_napari_viewer is a pytest fixture that returns a napari viewer object # capsys is a pytest fixture that captures stdout and stderr output streams def test_example_q_widget(make_napari_viewer, capsys): # make viewer and add an image layer using our fixture viewer = make_napari_viewer...
6287e043b99f6915ed7600ae43254bc1a66a6b6d9619c820816f9a98afc91280
Python
491
15
import numpy as np import omicscope as omics np.seterr(divide='ignore', invalid='ignore') class TestEnrichmentScope(object): def test_user(self): data = omics.OmicScope(Table='tests/data/proteins/progenesis.xls', Method='Progenesis', ...
a94e8fecd2787aba4f2c8a663537f0b60aa8f1406c03099929d174f7f33e46c3
Python
491
10
""" This file contains the three architectures used for the model ensemble in scaden The architectures are stored in the dict 'architectures', each element of which is a tuple that consists of the hidden_unit sizes (element 0) and the respective dropout rates (element 1) """ architectures = {'m256': ([256, 128, 64,...
2984e519866b8458a23daeabbe4953f3799c652aa2cb594bd35aa8daf72282be
Python
492
15
# third party modules import numpy as np def getConvexHullDistance(mesh): try: import igl except ModuleNotFoundError: raise ModuleNotFoundError("The dependency 'igl' is required for this functionality!") hull = mesh.convex_hull distances, indices, closest_pts = igl.point_mesh_squar...
2e4cd53809f03f6690da240242643741810d1273cdaf445a343c408afb7cafdb
Python
492
19
from .edge_pooling import EdgePooling from .continuous_crf import ContinuousCRF from .mesh_pooling import MeshPooling from .hist_conv import PPHConv from .local_attn_pooling import LocalAttentionPooling from .edge_attention_conv import EdgeAttentionConv from .sa_module import SAModule from .fp_module import FPModule _...
852bd4327b63975bf9a76ad874bad4474495825d23b43de49ee35f1dbe48e9b3
Python
492
17
import platform from functools import lru_cache @lru_cache(maxsize=1) def get_runtime_environment() -> dict: """Get information about the LangChain runtime environment.""" # Lazy import to avoid circular imports from langchain_classic import __version__ return { "library_version": __version__...
97059ec20dfb7ab81e3488414d7e32f7a32f7ba603dcb9c64927d617fde7ad6a
Python
492
21
import os import torch def mkdirs(paths): if isinstance(paths, list) and not isinstance(paths, str): for path in paths: mkdir(path) else: mkdir(paths) def mkdir(path): if not os.path.exists(path): os.makedirs(path) def unnormalize(tens, mean=[0.485, 0.456, 0.406], s...
569d30259e8cc68c1752d59c07692df5ce2863bb0b1d91d0a5411e3ca1925fad
Python
494
18
import tensorflow as tf from tensorflow.keras import layers class GaussianExpansion(layers.Layer): def __init__( self, dmin, dmax, num_gaussian=50, var=None ): super().__init__(name="gaussian") self.filter = tf.linspace(dmin, dmax, num_gaussian) ...
30584a657c0a76dcdbc79356a007bd8746a7ebaac5ff13ebd2622dbef1279492
Python
496
22
from .coordinates import \ extract_coordinates, \ extract_coordinates_combined, \ align_coordinates, \ sort_coordinates, \ merge_coordinates, \ merge_and_sort_coordinates from .selection import \ range_to_string, \ load_selection from .download import \ download_from_gpcrmd, \ ...
892731cd9921efe1dd8631d328201ace9c4754c9d74a8d9cce4a97fad4d8285d
Python
496
24
from langchain_classic.schema.runnable.base import __all__ EXPECTED_ALL = [ "Runnable", "RunnableBinding", "RunnableBindingBase", "RunnableEach", "RunnableEachBase", "RunnableGenerator", "RunnableLambda", "RunnableMap", "RunnableParallel", "RunnableSequence", "RunnableSerial...
53f88ed67641246184731c49bf605687a8cc61c718797354e6bd555cd20189d9
Python
498
16
from pycromanager import JavaBackendAcquisition, multi_d_acquisition_events with JavaBackendAcquisition(directory=r"/Users/henrypinkard/tmp", name="tcz_acq", debug=False) as acq: # Generate the events for a single z-stack events = multi_d_acquisition_events( num_time_points=8, time_interval_s=...
1e6720797d167bca88b26d161a5663d29f269895ef334e5d35dcb7234a3ebacc
Python
500
23
from setuptools import setup, find_packages import numpy from Cython.Build import cythonize from setuptools import Extension requirements = ( 'cython==0.29.35', 'numpy==1.23.5', 'scipy==1.10.1', 'matplotlib==3.7.1', 'scikit-learn==1.2.2', 'networkx==3.1', 'mediapipe>=0.10.10', 'scikit-video>=1...
fd77fd7768bf4917fc6b9bb75432479cbd9e87a00d37164f402614bf8a75f1a4
Python
500
20
from setuptools import setup setup( name='genie', version='0.0.1', description='de novo protein design through equivariantly diffusing oriented residue clouds', packages=['genie'], install_requires=[ 'urllib3==1.26.14', 'charset-normalizer==2.1.1', 'tqd...
6b307c463f66cbcb6652c29f061dd736a328f680566c1df49af47ae756072fb3
Python
501
13
"""SDCflows - :abbr:`SDC (susceptibility distortion correction)` by DUMMIES, for dummies.""" __packagename__ = "sdcflows" __copyright__ = "2020, The NiPreps developers" try: from ._version import __version__ except ModuleNotFoundError: from pkg_resources import get_distribution, DistributionNotFound try: ...
f97ce72f739a7649f871e19630ca4b3a829b0c1925c998f997ba034738a6deb7
Python
501
17
""" Methods for state-specific information. The methods here are based on the following paper: | Neil J. Thomson, Owen N. Vickery, Callum M. Ives, Ulrich Zachariae: | Ion-water coupling controls class A GPCR signal transduction pathways. | https://doi.org/10.1101/2020.08.28.271510 """ from .disc...
b13758e26277da368e6d8ba8260b6541d66f55941e7ef19578c9de5d04b32364
Python
503
34
from pathlib import Path from bindsnet import ( analysis, conversion, datasets, encoding, environment, evaluation, learning, models, network, pipeline, preprocessing, utils, ) ROOT_DIR = Path(__file__).parents[0].parents[0] __all__ = [ "utils", "network", "...
3271bf85c3371e15c540d8685f1f16c351936d8383f5c7e726603928b17f2e8f
Python
504
15
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # -*- coding: utf-8 -*- from .checkpoint import load_checkpoint from .layer_decay_optimizer_constructor import Learning...
497269f94dc9fd146fafd77432e7615da57e04ff9d0ab83ce0a27ed013026964
Python
505
21
from pycromanager import ZMQRemoteMMCoreJ, JavaClass from threading import Thread ### Pass object to a different thread core = ZMQRemoteMMCoreJ(debug=False) def other_thread(core): cache = core.get_system_state_cache() print(cache) Thread(target=other_thread, args=(core,) ).start() core = None ### Create an ...
ce3d4dc188223d93f2a5d498062612564e4787fd413bea4b2bca398aaf08d310
Python
505
19
def RGB(R,G,B): return (R/255.,G/255.,B/255.) colors = { 'red' : RGB(217,25,32), 'blue' : RGB(32,123,193), 'green' : RGB(0,159,76), 'yellow' : RGB(251,200,52), 'black' : RGB(0,0,0), 'brown' : RGB(149,89,28), 'white' : RGB(255,255,255), 'grey': RGB(14...
df1cc4419496df8632a978f58b78b1f2e071cb0bdb9ebe1e02c8f4342f041b55
Python
505
15
from importlib import import_module from typing import Callable from typing import Tuple def split_module_name(abs_class_name: str) -> Tuple[str, str]: abs_module_path = ".".join(abs_class_name.split(".")[:-1]) class_name = abs_class_name.split(".")[-1] return abs_module_path, class_name def dynamic_imp...
a05db5181d29249b26bca3ac602473b051e51838c5299607eb97c03ff09abf7b
Python
506
17
from skimage.io import imread import numpy as np def load_images_ch0(fnames, downshape): print('Using multiple cores') N_files = len(fnames) img = [[] for i in fnames] for i in range(N_files): fname = fnames[i] img1 = imread(fname).astype(float) if img1.ndim == 2: im...
10151633f745a31ffaeea77a3659d12f42985af316b458657339268ff06f1e06
Python
507
21
from langchain_core.prompts.prompt import PromptTemplate NAIVE_FIX = """Instructions: -------------- {instructions} -------------- Completion: -------------- {completion} -------------- Above, the Completion did not satisfy the constraints given in the Instructions. Error: -------------- {error} -------------- Pleas...
4385a2231cb6fae2c418b7ea321e5beb8d63557a9c8def79ed0784a479878ae4
Python
509
18
def getAtomDepth(atoms, vertices, feature_name="depth"): try: from Bio.PDB.ResidueDepth import min_dist except ModuleNotFoundError: raise ModuleNotFoundError("The module 'Bio.PDB.ResidueDepth' is required for this functionality!") if not isinstance(atoms, list): atoms = atoms.g...
7dba7fd21cb163411d599434e2e8d8246098fc2fdeffd7325263229eb9e56446
Python
509
22
#!/usr/bin/env python import setuptools import os path = os.path.abspath(os.path.dirname(__file__)) # User README.md as long description with open("README.md", encoding="utf-8") as f: README = f.read() setuptools.setup( name='chreyesees', version='0.0.0', description='ChreyeSees', long_descript...
9717fd274f3dd279fc26a49a96764a3b73f1eb0452d90aa7160ab4cbd51065d0
Python
509
22
import numpy as np import pandas as pd from tabulate import tabulate np.set_printoptions(suppress=True) np.set_printoptions(threshold=np.inf) loc = "./build/results_neural-network-runtime.csv" df = pd.read_csv(loc, sep=";", header=0) nb_iters = 11 IEs = ["OpenVINO CPU", "OpenVINO GPU", "TensorRT"] ret = [] for i i...
5f93317f473be25ca311632fd55eda798b7c2d6022bb0a2d052c25b239c23075
Python
511
23
from langchain_core.callbacks.base import ( AsyncCallbackHandler, BaseCallbackHandler, BaseCallbackManager, CallbackManagerMixin, ChainManagerMixin, LLMManagerMixin, RetrieverManagerMixin, RunManagerMixin, ToolManagerMixin, ) __all__ = [ "AsyncCallbackHandler", "BaseCallback...
e182b6c8c5f854d047f5e7601c4293bea87a3cdb4597c477646abe0eece70f02
Python
511
20
base_setting = { 'train_size': 0.8, 'epochs': 100, 'input_size': 60, 'batch_size': 32, 'pre_len': 1, 'fileName': "", 'model_name': 'rnn', 'checkpoint_root_dir': './checkpoint-0507/dir', 'true_epochs': 100, 'data_root_dir': './data', 'train_data_mode': 'pre', ...
7182b75d338c7f21d6baf6eecbe6ca479eb6eb1b557e4c62f091b77f186ef8e6
Python
513
24
"""For backwards compatibility.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.sql_database.prompt import QUERY_CHECKER _importer = create_importer( __package__, deprecated_lookups={ "QUERY_CHECKER": "...
760f4d6c48b606035479fc13b6d9710e93dc66a0de0035198367c9a76e15daca
Python
513
16
def load_dataset(name=None): if name==None: name = 'EBMData' import pandas as pd import requests import io if name == 'EBMData': urlname = 'https://raw.githubusercontent.com/88vikram/pyebm/master/resources/Data_7.csv' elif name == 'CoinitDEBMData': urlname = 'ht...
7ee5fd2d56e1f3fbb0eb129f06ce11b0c57d0e82ac826be4681522d30366e2bd
Python
513
20
from paths import EXAMPLE_PATH import simpa as sp import matplotlib.pyplot as plt import numpy as np images = [ "Baseline_10000.hdf5", "Skin_10000.hdf5", "Water_4cm_10000.hdf5" ] for image in images: p0 = sp.load_data_field(EXAMPLE_PATH + image, sp.Tags.DATA_FIELD_INITIAL_P...
f9a521f4f55aedc967b6e696103bc19345d577c5b044c104ae1866fb16812478
Python
513
17
""" Specify the parameters regarding the data (e.g. number of residues of your protein) and the designed experiments (how many Markov states to be estimated, how many models to estimate per dataset etc.) """ NUM_MODELS_PER_DATASET = 20 NUM_MARKOV_STATES = 3 NUM_INTERRESIDUE_DISTANCES = 780 NUM_RESIDUES = 42 SKIPPED_DI...
2d6151e649f8ce5afb296381656107fa8223790d2942a31519dd2c19e01828f1
Python
515
19
from util import mkdir # directory to store the results results_dir = './results/' mkdir(results_dir) # root to the testsets dataroot = './dataset/test/' # list of synthesis algorithms vals = ['progan', 'stylegan', 'biggan', 'cyclegan', 'stargan', 'gaugan', 'crn', 'imle', 'seeingdark', 'san', 'deepfake', 's...
30771f53f5b3a02af09c63e731f8adbc9391b038206330dda49bbc42d94e2ad8
Python
515
20
#!/usr/bin/python3 from z3 import * def same8(v): return Or(v == 0, v == 0xff) magic = BitVec('magic', 64) x = BitVec('x', 64) y = x * magic s = Solver() solve_using(s, ForAll([x], Or( Not(And([same8((x >> (i * 8)) & 0xff) for i in range(8)])), # x has bytes that aren't equal to 0xff or 0x00 And([(x >>...
58f0e7b0e267c91a5765ab4be1bd76616f0b17193b08264bc10a1db06d127566
Python
517
18
import decoupler as dc import pathlib import sys def main(): species = sys.argv[1].strip() net = dc.get_dorothea(organism=species, levels=["A", "B", "C", "D"]) net.source = net.source.astype("category") net.target = net.target.astype("category") net.confidence = net.confidence.astype("category") ...
85b7a7746cea85e1961a5421c767e9026bc34e68cd1c900bc602cbd6ee41fe89
Python
518
15
import numpy as np import sys # Load mapping between hi-res and lo-res voxels mapping = np.load(sys.argv[1]) # Setup a dict assoc = { tuple(np.int32(x[range(0,3)])) : tuple(np.int32(x[range(3,6)])) for x in mapping } sfmap = np.loadtxt(sys.argv[2]) # Load text sorted flatmap at 25um resolution fvox = np.int32(sfmap[...
9eec2cca8475de5b4493b2dc5d0b16a4e7d214df275e1f832c15f59fb2328984
Python
518
30
from pycromanager.mm_java_classes import ZMQRemoteMMCoreJ, JavaObject, JavaClass from pycromanager import _Bridge import gc import threading def new_b(): core = ZMQRemoteMMCoreJ() for i in range(100): # core = Dummy() core = ZMQRemoteMMCoreJ() core2 = ZMQRemoteMMCoreJ() threading.Thread(target=ne...
04e16840d9acdfab3909b9e524f6bb34b53edc2278f1ad14e61714ebf2e465b3
Python
519
19
""" Test classes and function in module openff.toolkit.typing.engines.smirnoff.io. """ import pytest from openff.toolkit.typing.engines.smirnoff.io import XMLParameterIOHandler class TestXMLParameterIOHandler: def test_from_string(self): pass def test_raise_file_not_found(self): """Raise F...
415875d3e3abf84f814940f52340321ad810af73613c759fe147622d25d60163
Python
520
27
""" Objects useful for dealing with files saved by Micro-Manager. https://micro-manager.org/ Classes ---------- .. autosummary:: :toctree: generated/ Image Position1d Position2d PositionList Property PropertyMap MultiStagePosition """ __all__ = [ "PositionList", "Position2d", "Pos...
6ca707d12d84b4abd60f57b592a34d323db51dd86473da30595222af1309617e
Python
520
13
import os import sys from loguru import logger as log from tqdm import tqdm log.add('train_10_fold.log') os.system(f"pyenv local yolov7 ") for i in tqdm([1,2,3,4,5,6,7]):#8, 9, 10 log.info(f"train GPU in fold {i}...") os.system(f" python train.py --workers 8 --device 0,1,2,3 --batch-size 32 --data fold_{i}/...
3966799c542e796e565ac95e02a25e1612f484371319fbbd7937d5cde3ba8faf
Python
521
12
from imagingplus import TwoPhotonImaging from imagingplus.processing.paq import PaqData def test_import_paqdata(paqpath = '/home/pshah/mnt/qnap/Data/2021-01-25/2021-01-25_PS12_009.paq'): paq_data_obj, paqdata = PaqData.import_paqdata(file_path=paqpath) def test_cropData(existing_trialobj_twophotonimaging_fixtur...
dd4a0eabc3f61ad48a11bad7b1375377a2ac2d3e4fe230892cd51b18d95d8900
Python
522
19
#!/usr/bin/python import sys import json import os import hashlib import shutil import random doc = json.loads(sys.stdin.read()) if doc["state"]["iteration"] == 1: size = int(doc["input"]["size"]) // 100 for x in range(100): fileData = bytearray(random.getrandbits(8) for _ in range(size)) binF...
fec408f711cc9b89bd3e6764f911dc18f389ef4fb7845fc9b730759cf480a494
Python
522
20
import numpy as np import plotext as plt import sys NB_NEURONS = 1024 TIME_ROW = 0 SPK_ROW = 1 data = np.genfromtxt(sys.argv[1], delimiter=';', skip_header=1) # data = np.genfromtxt("raster.csv", delimiter=';', skip_header=1) max_id = max(data[:,SPK_ROW]) plt.theme("clear") plt.scatter(data[:, TIME_ROW], dat...
8fa4f625309b1f97a79ed877d89023abb1c9a21b5162d32227eee4bfb9708827
Python
525
18
from voxcell import VoxelData import numpy as np import sys nrrd_file = sys.argv[1] output_file = sys.argv[2] vd = VoxelData.load_nrrd(nrrd_file) n_notnan = np.sum(~np.isnan(vd.raw)) shape_str = " ".join([str(x) for x in vd.raw.shape]) voxdim_str = " ".join(["{:.8f}".format(x) for x in vd.voxel_dimensions]) origin_st...
04cd2f0a984d7e22201dfc1e9a74d8d5b1fce8ead2ae0c13012362882e298741
Python
529
30
from pathlib import Path import os REPO_ROOT = Path(__file__).parent.parent.resolve() STRIDE_EXE = os.environ.get('STRIDE_EXE', str(REPO_ROOT / "stride" / "stride")) PYMOL_EXE = "/Applications/PyMOL.app/Contents/MacOS/PyMOL" # only required if you want to generate 3D images _3to1 = { 'ALA': 'A', 'CYS': 'C', 'ASP': '...
506be2337ce1719d1aa6da4c3a361dcece857508f65073613d776d6afe578a25
Python
530
17
import sys sys.path.append('../source') from tina_main import dataset import tinaui t1 = dataset(folder='../test/sampledata/ocn') # initialize the dataset # load images with smaller extent, using the information from .xml-files # for spacing of the image data tinaui.load_initial_data(t1, ftype='tif', nfilter=[ ...
8b5839dd4c9648b374413737afa3433a02c6648948a5ae3b3b5396e932b7dbab
Python
530
13
from typing import Any def __getattr__(_: str = "") -> Any: msg = ( "This tool has been moved to langchain_experimental. " "This tool has access to a python REPL. " "For best practices make sure to sandbox this tool. " "Read https://github.com/langchain-ai/langchain/blob/master/SEC...
1a6fbfe036625501cf8e34e93ee71afb2dd767acd35ccf1ccf28fbf2af579719
Python
531
21
import setuptools requires = "tqdm" def get_requirements(): ret = [x for x in requires.split("\n") if len(x) > 0] return ret setuptools.setup( name="NLPreprocessing", version="1.0.1", description="NLP package for text preprocessing", url="https://github.com/uf-hobi-informatics-lab/NLPreproc...
d4c1fc2db8347f61df8530b8ce86ca32fa55a0745fa6ccaf587abd69ee3110da
Python
532
15
"""Utilities for image processing.""" from typing import Any def __getattr__(name: str) -> Any: if name in {"encode_image", "image_to_data_url"}: msg = ( f"'{name}' has been removed for security reasons.\n\n" f"Usage of this utility in environments with user-input paths is a " ...
bf31368db72180cd157b1881a9e0b9773b3c95e309255eb29264e954c9f76773
Python
533
21
import torch import torch.nn as nn class LogReg(nn.Module): def __init__(self, ft_in, nb_classes): super(LogReg, self).__init__() self.fc = nn.Linear(ft_in, nb_classes) for m in self.modules(): self.weights_init(m) def weights_init(self, m): if isinstance(m, nn.Li...
55768716da1414fe3233da2662b18541af77b45c6d6e52afecdf07796d9f1034
Python
536
23
from setuptools import find_packages, setup setup( name='hienet', version='1.0.1', description='HIENet', author='Keqiang Yan, Montgomery Bohde, Andrii Kryvenko, Ziyu Xiang', python_requires='>=3.8', packages=find_packages(include=['hienet', 'hienet*']), install_requires=[ 'ase', ...
70829afa2ae9eddf96c7fb20dcad8b808c37e2c67f3780fdbd3ece24a992bd11
Python
536
20
from langchain_classic import document_transformers EXPECTED_ALL = [ "BeautifulSoupTransformer", "DoctranQATransformer", "DoctranTextTranslator", "DoctranPropertyExtractor", "EmbeddingsClusteringFilter", "EmbeddingsRedundantFilter", "GoogleTranslateTransformer", "get_stateful_documents"...
d129b065c51935a418da74715f675cbe922df4935770c0095d3a8703562b0f8e
Python
536
26
# -*- coding: utf-8 -*- import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt from .visualization import ( compute_saliency_map, display_saliency_overlay, display_pca, display_tsne, display_confusion_matrix, display_record, display_receptive_fields ) __all__ = [ 'util...
79220f7e82699811e33450bde2f63a269380d311eeabcba017c9b5c6f49f83de
Python
540
17
import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) def save_results_table(table, table_key): """ Saves results (hyper param selection) to a file :param table: ResultTable :param table_key: Key that i...
fcb0af0dbeec805e560ce1cce42847749a6104d5a0327787da9bf3d57b886b3f
Python
540
27
import starwrap as sw import numpy as np from operator import itemgetter arg = sw.args() arg.trainFile = './tagged_post.txt' arg.trainMode = 0 sp = sw.starSpace(arg) sp.init() sp.train() sp.nearestNeighbor('barack', 10) sp.saveModel('tagged_model') sp.saveModelTsv('tagged_model.tsv') sp.initFromSavedModel('tag...
2cd9d8a45ea81f415c2413676d6194be171d4e7cae0538c48367973cc65413a0
Python
541
18
from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever class FakeParrotRetriever(BaseRetriever): """Test util that parrots the query back as documents.""" def _get_relevant_documents( # type: ignore[override] self, query: str, ) -> list[Document...
44b1d95cc9c623225c0cb139389a3702ad93e74f88aa660f9e7db913d2310c6c
Python
542
16
from sam.diffusion.diffusers_dm import Diffusers def get_diffusion_model(model_cfg, network, ema=None): model_type = model_cfg["latent_generative_model"]["type"] if model_type == "diffusers_dm": diffusion = Diffusers( eps_model=network, sched_params=model_cfg["latent_generative...
e1c7a795030da544c84ab094b344127cd9181216b551d9c87430b47902b2e4c5
Python
542
26
import os import subprocess from pathlib import Path import pytest import chroma from chroma.data import Protein @pytest.fixture(scope="module") def XCS(): input_file = str( Path(Path(chroma.__file__).parent.parent, "tests", "resources", "1n8z.cif") ) protein = Protein(input_file) length = ...
24c0ee9b5903ae5b7f2cf60d1e68c2702a91a98cef28cda8669af9546af67d3b
Python
543
14
import numpy as np from pycromanager import JavaBackendAcquisition, multi_d_acquisition_events with JavaBackendAcquisition("/Users/henrypinkard/megllandump", "l_axis") as acq: # create one event for the image at each z-slice for time in range(5): z_stack = [] for index, z_um in enumerate(np.ar...
65f189c4f622a0d1991357ddc1d9b69f84d35dd46da35f3bdf1f22dca05ed862
Python
543
19
from voxcell import VoxelData import numpy as np import sys import flatmap_util as fmutil flatmap_nrrd = sys.argv[1] pixel_res = int(sys.argv[2]) output_nrrd = sys.argv[3] fmap_vd, fmask = fmutil.load_flatmap(flatmap_nrrd) fx_d, fy_d = fmutil.get_discrete_flat_coordinates(fmap_vd.raw, pixel_res, fmask) pix_uniq, cou...
0d27c06ac771524b6bdc29c98ff977c02fd561f59c2fe9a9fd65a43f4d1e6fc3
Python
544
22
import os import pandas as pd import pickle as pkl from types import SimpleNamespace import yaml from yaml.loader import SafeLoader import numpy as np from scipy.ndimage import gaussian_filter from omegaconf import OmegaConf from utils import plot name = '/two_envs_lazy' folder = 'outputs' + name i=0 #...
8070a63f5e840ab854295cb3b85a40f39111957445521130dfca490164965389
Python
544
22
from pathlib import Path from src.models.results import PredictionResult def test_results_without_chain_id(): mock_pdb_path = Path("/path/to/test_chain_id.pdb") mock_chain_id = "test_chain_id" mock_md5 = "1234567890abcdef" mock_chopping = "12-34_56-78" mock_confidence = 0.0123 res = Predictio...
aee647dd3ecbf08d6cbec6849a11cea52cecc01fedc0d6eab1ebc44dd68a8156
Python
545
14
from algorithm import * if __name__ == '__main__': x = zeta(np.array([[0.0, 0.0]]), np.array([[1.0, 0.0], [0.0, 1.0]]), eps=1e-12, param=2.0, R=4, verbose=True) print(x) x = exp(np.array([[0.0, 0.0, 0.0]]), np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]]), eps=1e-12, ...
0e0360d95a03fbaf008468183de81b48a525bce92e7f8eeb9a4d4ddfdb07289f
Python
547
23
import pandas as pd import yaml import pathlib def read_files(file): return len(pd.read_csv(file, index_col=0)) def main(): with open("params.yaml", "r") as file: params = yaml.safe_load(file)["rnaseq"]["deg_count"] files = pd.Series(params) counts = files.map(read_files).to_dict() outp...
e56a426c7794e686145d4fd195c205fe1b1cf45a3996a56e2491b4df3dddb205
Python
547
18
__all__ = ( "ALLOWED_AROMATICITY_MODELS", "ALLOWED_CHARGE_MODELS", "ALLOWED_FRACTIONAL_BOND_ORDER_MODELS", "DEFAULT_AROMATICITY_MODEL", "DEFAULT_CHARGE_MODEL", "DEFAULT_FRACTIONAL_BOND_ORDER_MODEL", ) ALLOWED_AROMATICITY_MODELS = ["OEAroModel_MDL"] DEFAULT_AROMATICITY_MODEL = ALLOWED_AROMATICI...
80e90a30c1bddc288e94d8ed9f65d16b07daf9056b203e33474e49e31662a5f5
Python
549
8
TEMPLATE_TOOL_RESPONSE = """TOOL RESPONSE: --------------------- {observation} USER'S INPUT -------------------- Okay, so what is the response to my last comment? If using information obtained from the tools you must mention it explicitly without mentioning the tool names - I have forgotten all TOOL RESPONSES! Rememb...
e14b68a1f3358f0a7e4e686bfc7ee2d11c73e07ad083315ccb1401a5962d68e4
Python
549
21
from langchain_core.prompts import PromptTemplate template = """You are a teacher coming up with questions to ask on a quiz. Given the following document, please generate a question and answer based on that document. Example Format: <Begin Document> ... <End Document> QUESTION: question here ANSWER: answer here Thes...
4ef58158d8c8140e8c179d79e9018feb16e5f62da5c2a7e8115713524a600f3a
Python
550
29
import os import pickle as pkl def make_dir(mdir): if not os.path.isdir(mdir): os.mkdir(mdir) def pkl_dump(data, file): with open(file, "wb") as f: pkl.dump(data, f) def pkl_load(file): with open(file, "rb") as f: data = pkl.load(f) return data def read_file(file, encodin...
251b2c68b8878a0242a79e177f75ad57d23eb427f259d6307b05847d741ec24a
Python
552
19
import numpy as np def getFaceArea(V, F): area_faces = np.linalg.norm(np.cross(V[F[:,0]]-V[F[:,1]], V[F[:,0]]-V[F[:,2]]), axis=-1)/2 return area_faces def getVertexArea(vertices, faces): # compute face areas area_faces = getFaceArea(vertices, faces) # compute vertex areas area_v...
110dc4f02f5a403585d6353b292a8a59fccf97a5779639c136ac57cc5f4cae2e
Python
553
28
from voxcell import VoxelData import numpy as np import sys geom_nrrd = sys.argv[1] data_txt = sys.argv[2] output_nrrd = sys.argv[3] dtype = np.float32 if len(sys.argv) > 4: dtype = np.dtype(sys.argv[4]) bkgval = -1.0 if len(sys.argv) > 5: bkgval = float(sys.argv[5]) vd = VoxelData.load_nrrd(geom_nrrd) dat ...
3ce30962f3c178bbae584ad28f0e129d765e88931b7f9ac1aac2f0a9dcb4acea
Python
553
14
import scipy.io as sio class dataloader_AP(): def __init__(self,path,num_neuron=0) : self.path = path self.data = sio.loadmat(self.path) self.__header__ = self.data['__header__'] self.__version__ = self.data['__version__'] self.__globals__ = self.data['__globals__'] ...
987dd554789f6110c5e5cab27e596e4afc1327a3188d23d2104a732bfec598b8
Python
553
20
# -*- coding: utf-8 -*- """ Created on Fri Aug 25 16:28:30 2023 @author: biener """ import numpy as np from NN_Rslt_Anal import NN_Stat as stat import mAECell_Utils as utils NN_Stat_O = stat() WeiRes = NN_Stat_O.Multi_Res(Weighted_Res = True) Res_FName = utils.fSaveAs(Title='Save weighted residual fil...
621c38bee73fddcb1034586c72607992d06a725dfc2214b27d3d18379762f472
Python
555
23
import pandas as pd import yaml import pathlib def read_files(file): return len(pd.read_csv(file, index_col=0)) def main(): with open("params.yaml", "r") as file: params = yaml.safe_load(file)["proteomics"]["deg_count"] files = pd.Series(params) counts = files.map(read_files).to_dict() ...
9f8b03e99d54a978279db09ecc7e66f120f8cd4d54e720e29c3e6127ca12e3a8
Python
555
18
#! /usr/bin/env python3 import logging.config from predmoter.utilities.utils import get_log_dict from predmoter.core.parser import ConverterParser from predmoter.utilities.converter import Converter def main(): pp = ConverterParser() args = pp.get_args() logging.config.dictConfig(get_log_dict(args.output...
bd19aeca82ea32c42744d9a14555ef5089ede5e3c4d52d95037210e02a090ad1
Python
555
21
"""uniPort: a unified single-cell data integration framework with optimal transport.""" __version__ = '1.2.0' __author__ = 'Kai Cao' __email__ = 'caokai@amss.ac.cn' from .function import Run, get_prior, label_reweight, load_file, filter_data, batch_scale, TFIDF_LSI from .metrics import batch_entropy_mixing_score, sil...
10050357d65d9e314ad9efbdc04a51c0a16733a086e6201ee446eaa509ed5755
Python
556
19
from collections.abc import Sequence from langchain_core.tools import BaseTool def validate_tools_single_input(class_name: str, tools: Sequence[BaseTool]) -> None: """Validate tools for single input. Args: class_name: Name of the class. tools: List of tools to validate. Raises: ...
eaaba4b34b0272945721abe823e6b85f61e5c3f8611cac8734058842edb399cd
Python
556
25
__version__ = "2.4.3" __version_vector__ = (2, 4, 3) from . import config logger = config.get_logger(__name__) # Flatten namespace by importing contents of all modules of pymaid from .fetch import * from .client import * from .upload import * from .cluster import * from .user_stats import * from .core import * from ...
07b5a0ebd651ea16899088f74d3799b3604d7e89bc94f89319c30971c2d89652
Python
557
19
""" Combine parquet files into one. This uses with to reduce memory by only needing to load one files at a time. """ import pandas as pd from pathlib import Path def main(): data_dir = Path(".") with open("BrainSEQ_TOPMed.interaction.txt", "a+") as tgz_handle: for i, parquet_file in enumerate(data_dir....
80f2297cde0df3688ea42a8e2736545f995c443bf9253b45d9fd74d78bbbb1c5
Python
557
8
import pandas as pd data=pd.read_csv('/apps/home/lulab_liuxiaofan/qhsky/project/multi_omics_paper/data_TCGA/1.raw_data/BRCA.CNV_masked_seg.csv',sep=',') data=data[['Sample','Chromosome','Start', 'End','Num_Probes','Segment_Mean']] data['type']=data['Sample'].map(lambda x:x.split('-')[-1]) data_=data.loc[data['type']==...
631f35b9d2fcce7382961ec20938d78d3642753b094ec6cd4eb5abc37587a2c9
Python
558
14
from pytorch_lightning.utilities import rank_zero_info from pytorch_lightning.callbacks.early_stopping import EarlyStopping class EarlyStoppingVerbose(EarlyStopping): """ The default EarlyStopping callback's verbose mode is too verbose. This class outputs a message only when it's getting ready to s...
b2ea3cd818d1506d83124c69d28f14f6b905c1ac3d380533ea54a1035da2bfe7
Python
558
17
import os def clear_folder(_dir): '''Clear a folder recursively https://stackoverflow.com/questions/13118029/deleting-folders-in-python-recursively ''' if os.path.exists(_dir): for the_file in os.listdir(_dir): file_path = os.path.join(_dir, the_file) try: ...
188dff2c4288a5026896191320ef5a2280c57423e9530f7e2a6b2acbeeac821e
Python
559
22
import collections from typing import TypeVar T = TypeVar("T", bound=collections.abc.Mapping) def deep_update(d: T, u: collections.abc.Mapping) -> T: """ Recursively update a dictionary with the values from another dictionary Args: d: dictionary to be updated u: dictionary that is used to...
08aeb0ea80fe782db6304e6cdc10c91fb37ff0f0924f4f359a8d00f8d339c04a
Python
560
16
"""t5chem - A Unified Deep Learning Model for Multi-task Reaction Predictions""" from t5chem.__version__ import __version__ from t5chem.data_utils import LineByLineTextDataset, TaskPrefixDataset, data_collator from t5chem.model import T5ForProperty from t5chem.mol_tokenizers import AtomTokenizer, SelfiesTokenizer, Simp...