sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
df645f8a47d3040f0d1f06e4e77e87bfe20e17e8f6275fc540dd7cb6ca4120ff
Python
380
13
from pdearena.configs.config_coal import CoalVelocityVfracTempDeltaTPredConfig from pdearena.utils.constants import Paths, CoalConstants config = CoalVelocityVfracTempDeltaTPredConfig( model="convNeXT-tiny-max", noise_level=1e-2, include_derivatives=True, include_cfl_features=True, lr=2e-4,...
58ea3c5c17bbc0de788988db00aef1e875846d6bcfb11c9b045a0bce3eea2039
Python
384
24
# -*- coding: utf-8 -*- """ Imports dataset classes so they can be used directly Submodules ========== .. autosummary:: :toctree: _autosummary fashion tabulardataset multidataset """ from .fashion import FashionData from .multidataset import MultiDataset __all__ = [ 'fashion', 'tabular_data...
0126bac522947b59487d421f8a9970549b7f209fcd37f6905050f50ad819940d
Python
386
15
from pycromanager import JavaClass, ZMQRemoteMMCoreJ tester = JavaClass('org.micromanager.acquisition.internal.acqengjcompat.speedtest.SpeedTest') pass dir = r'C:\Users\henry\Desktop\data' name = r'speed\test' core = ZMQRemoteMMCoreJ() num_time_points = 1000 show_viewer = True output_dir = tester.run_speed_test(dir...
db4b68ec30dae5cc21857c11006db3337f46c6b1fc62a2b4120e9f2fb638cd59
Python
386
16
""" WSGI config for tffp project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTING...
8055235256007f31894c9e11e73989b0b32e70d1f93f3d78cbc824e2fc8bd616
Python
387
16
""" Entrypoint module, in case you use `python -momicscope`. Why does this file exist, and why __main__? For more info, read: - https://www.python.org/dev/peps/pep-0338/ - https://docs.python.org/2/using/cmdline.html#cmdoption-m - https://docs.python.org/3/using/cmdline.html#cmdoption-m """ import sys from omicscop...
cf57301b42b35ede05aba1442d326d19eb472b046621919522f9a537d0809276
Python
387
18
from langchain_classic import storage EXPECTED_ALL = [ "EncoderBackedStore", "InMemoryStore", "InMemoryByteStore", "LocalFileStore", "RedisStore", "InvalidKeyException", "create_lc_store", "create_kv_docstore", "UpstashRedisByteStore", "UpstashRedisStore", ] def test_all_impor...
cc5ace3c7808592f34d855fd24489ff93f14a1483a0fba65736ef85414201358
Python
388
10
import morgana.ImageTools.compositeImageJ import morgana.ImageTools.io import morgana.ImageTools.processfeatures import morgana.ImageTools.fluorescence import morgana.ImageTools.locoefa import morgana.ImageTools.morphology import morgana.ImageTools.objectsparsing import morgana.ImageTools.preprocessing import morgana.I...
f958d33048d85bd70d923e13d31be44e97509d3bc999ae3326191cf81b822529
Python
388
15
import torch,sys import torch.nn as nn from functools import partial import logging,pickle import ml_collections import numpy as np import torch,math import torch.nn as nn from typing import Dict, Optional, Tuple # change unbound rsa loss : need to exclude probe, add exclude probe flag # add unbound sidechain predictio...
3541633be7baa08d89b0bcea99e7e81d831d87e835f9972ec7c0978fdc9b6446
Python
390
12
from glob import glob import imageio if __name__ == '__main__': images = [] experiment_name = 'Experiment_00' for filename in sorted( glob(f'models/unet_se_resnet50_3101_2254/images_per_epoch/{experiment_name}_epoch_*.png'), ): images.append(imageio.imread(filename)) imageio.mimsav...
7567744a5fd77a2ecf6f90e3fec622528024775bffd0bf1b22c2aab70b76e8ca
Python
390
15
""" This script downloads a file containing the Allen Brain Atlas 10um hierarchy. "1.json" """ import json import urllib.request path = "http://api.brain-map.org/api/v2/structure_graph_download/1.json" with urllib.request.urlopen(path) as url: data = json.load(url) with open("data/1.json", "w", encoding="utf-8...
83412c5d7f9e490f7287228941b0312c7beae9f78818353834ed76bdc8352157
Python
392
17
"""Different ways to combine documents.""" from langchain_classic.chains.combine_documents.reduce import ( acollapse_docs, collapse_docs, split_list_of_docs, ) from langchain_classic.chains.combine_documents.stuff import ( create_stuff_documents_chain, ) __all__ = [ "acollapse_docs", "collapse...
60b31a232fc9510e020e2a0191efa14bdf5454fbdc944b8818556a7f7609a6bb
Python
394
23
"""Internal representation of a structured query language.""" from langchain_core.structured_query import ( Comparator, Comparison, Expr, FilterDirective, Operation, Operator, StructuredQuery, Visitor, ) __all__ = [ "Comparator", "Comparison", "Expr", "FilterDirective",...
daad4542c78d6572e778e63ce58fce21b74c9690a0843321219add799063c442
Python
394
18
"""Cross Encoder interface.""" from abc import ABC, abstractmethod class BaseCrossEncoder(ABC): """Interface for cross encoder models.""" @abstractmethod def score(self, text_pairs: list[tuple[str, str]]) -> list[float]: """Score pairs' similarity. Args: text_pairs: List of ...
523d7e88980f91139333e024ba077151f541c3d5c8302ec3013b08c540a9bdd1
Python
395
13
"""Run one of the shared servers over stdio, chosen by argv. `MCPAdapter` launches this as a subprocess; it is not part of the API being demonstrated. """ import sys from _servers import run_calculator_stdio, run_weather_stdio if __name__ == "__main__": which = sys.argv[1] if len(sys.argv) > 1 else "weather" ...
985175c3a1c502d31722b3963a8e372eb052b2674a6b7c0cf59f209d638ce8c7
Python
396
12
#!/usr/bin/python import sys import json import os doc = json.loads(sys.stdin.read()) if doc['input']['mode'] == 'local' and (doc['input']['user'] == doc['state']['clientId']): raise Exception('local throws error with runid: ' + os.path.basename(os.path.normpath(doc['state']['baseDirectory']))) output = { "outpu...
1e14e83a1b1b632c577f66b0b4b9a956c3f6446fe41dd6b28fc570d3615a6106
Python
398
13
from pdearena.configs.config_blast import BlastVelocityDensityTemperatureDeltaTPredConfig from pdearena.utils.constants import Paths, BlastConstants config = BlastVelocityDensityTemperatureDeltaTPredConfig( model="convNeXT-tiny", noise_level=1e-2, include_derivatives=True, include_cfl_features=T...
7255eef7dcdc931154f4e37d1cc6e3ef3a27529bab2e85af82a8c4005afdfe34
Python
398
11
from langchain_core.prompts import PromptTemplate prompt_template = """Use the following pieces of context to answer the question at the end. If you don't know the answer, just say that you don't know, don't try to make up an answer. {context} Question: {question} Helpful Answer:""" # noqa: E501 PROMPT = PromptTemp...
beb00d64ae0dbadfd6f0d5bfa2087048c4465b1871d3b6d3c96a1a4930d93a4d
Python
399
18
from langchain_core.callbacks import __all__ EXPECTED_ALL = { "RetrieverManagerMixin", "LLMManagerMixin", "ChainManagerMixin", "ToolManagerMixin", "CallbackManagerMixin", "RunManagerMixin", "BaseCallbackHandler", "AsyncCallbackHandler", "BaseCallbackManager", "Callbacks", } de...
50853d47bde01d269eed940f67db36d3dc3752bcc0de040bf5f8dca424d20b33
Python
400
13
import tensorflow as tf def custom_loss(y_true, y_pred): p = 1 # Weight when predicted value is greater than true value q = 0.6 # The weight when the predicted value is smaller than the true value error = y_true - y_pred condition = tf.less_equal(error, 0) loss = tf.where(condition, q ...
1866d53117d889f934d711952cecf303d68e8e13f4dd99c1e9dc9288849df161
Python
401
16
# coding=utf-8 import pytorch_lightning as pl class Algorithm(pl.LightningModule): def __init__(self, args): super(Algorithm, self).__init__() self.args = args self.save_hyperparameters() self.batch_size = args.batch_size def update(self, minibatches, opt, sch): raise ...
ba2b4f92ce703b17d8c7c583b48faadcae90f0df853b7551e4a71e8fd5095143
Python
401
11
######################################################################## # Validation: checkpointing # These models perform the usual validation tests for the stochastic # solvers, each model separated into two separate scripts: one to # checkpoint the solver state and the second to restore from the # checkpoint da...
c1f729837b52ca627f5b3cd804722e90e68eb60aacdc321b414bd62df14294ba
Python
401
25
import random try: import numpy as np HAS_NP = True except Exception: HAS_NP = False try: import torch HAS_TORCH = True except Exception: HAS_TORCH = False def pytest_runtest_setup(item): # Fix seeds at the beginning of each test. seed = 20220714 random.seed(seed) if HAS_NP...
293e2ab8debfc66830df3df9a1c0897111e4e76de0c4bc85369e374d15faee63
Python
402
13
from pdearena.configs.config_blast import BlastVelocityDensityTemperatureDeltaTPredConfig from pdearena.utils.constants import Paths, BlastConstants config = BlastVelocityDensityTemperatureDeltaTPredConfig( model="convNeXT-tiny-max", noise_level=1e-2, include_derivatives=True, include_cfl_featur...
30f3211f7d69e871d4fa6b4cb44bf746a2efcbebe7878465d4c69d0dfc79b1be
Python
402
15
import pandas as pd input_file = '1-s2.0-S0002929716300428-mmc3.csv' df = pd.read_csv(input_file) df.eGene = df.eGene.str.replace('*', '') print(df.head()) grouped_df = pd.DataFrame(df.groupby(by='eGene')['eQTL_pvalue'].count()) grouped_df.reset_index(inplace=True) grouped_df.columns = ['Gene_Name', 'platelets_eQTL...
4472d53e543290bb7d74c3518ee83b890d9aa17841b31edce71263ebb566980c
Python
403
16
from langchain_core.indexing import __all__ def test_all() -> None: """Use to catch obvious breaking changes.""" assert list(__all__) == sorted(__all__, key=str) assert set(__all__) == { "aindex", "DeleteResponse", "DocumentIndex", "index", "IndexingResult", ...
c7cb8cbc705ffa59238754ec7e33b325efb2752241204662e09ca2e9ace88d00
Python
403
10
from matformer.train_props import train_prop_model props = [ "e_form", "gap pbe", # "mu_b", "bulk modulus", "shear modulus", # "elastic anisotropy", ] train_prop_model(learning_rate=0.001,name="pygatt", dataset="megnet", prop=props[0], pyg_input=True, n_epochs=500, batch_size=64, use_lattice=Tr...
0c0dfb63e76dff784fdf447c9b3afca80ce22ef4cf39be362efb1c4183bcda6d
Python
404
12
import pickle from mrQA.project import plot_patterns dict_ = pickle.load(open( '/home/sinhah/scan_data/vertical_abcd_mrqa_files/abcd-fmap-baseline-non-recommended_hz.adt.pkl', 'rb') ) config_path = '/home/sinhah/github/mrQA/examples/mri-config-abcd.json' plot_patterns(non_compliant_ds=dict_['non_compliant'], ...
4893595ab42f947c3b1c609a8186fe54f9023dfdcc79db92f8cced883169abbd
Python
404
17
from langchain_classic.schema.output_parser import __all__ EXPECTED_ALL = [ "BaseCumulativeTransformOutputParser", "BaseGenerationOutputParser", "BaseLLMOutputParser", "BaseOutputParser", "BaseTransformOutputParser", "NoOpOutputParser", "OutputParserException", "StrOutputParser", "T...
82aab33d2d0e693a84f3aaf8fe1143aee8ed878e606e47841506f95ad16738a5
Python
404
17
import numpy as np import pandas as pd # 读取名为"metric"的表格数据 data = pd.read_excel('../result/metric.xlsx') # 你需要根据你的数据格式来读取表格数据 # 计算每列的均值 mean_values = data.mean() # 计算每列的标准差 std_values = data.std() # 打印均值和标准差 print("均值:") print(mean_values) print("\n标准差:") print(std_values)
3a175fd6a753bed0cf9dfc19fed0a2d65681f198f718c869e05947d68e830ce4
Python
405
16
import numpy as np def topological_sort(dependencies: np.ndarray) -> np.ndarray: order = [] while len(order) < len(dependencies): for i in range(len(dependencies)): if i in order: continue if np.sum(dependencies[:,i]) == 0: order.append(i) ...
10d8f71ea30b703956ea1cf3fec909cb49cdabad3a96b1e2800db517be4777fa
Python
406
11
# Transforms from .patch import FocusedRandomPatch, RandomPatch, SelectedRegionWithPaddingPatch, SelectedRegionFixedSizePatch from .select_chain import SelectFocused from .select_atom import SelectAtom from .mask import RandomMaskAminoAcids, MaskSelectedAminoAcids from .noise import AddAtomNoise, ChiSelection from .cor...
8202f15c2f319fdff58f9f340fcef1321e1c055ec04379e995717e23605d5472
Python
406
10
from setuptools import setup, find_packages setup(name='rfdiffusion', version='1.1.0', description='RFdiffusion is an open source method for protein structure generation.', author='Rosetta Commons', url='https://github.com/RosettaCommons/RFdiffusion', scripts=["scripts/run_inference.py"],...
a9b20ab6e20ae496801ccf460a7189d5fb360b077deb47a18a1028db48002201
Python
408
18
# -*- coding: utf-8 -*- """ Created on Wed May 6 12:56:52 2020 @author: nishe """ from connection import coordination import numpy as np def findnearbyneuron(lattice, position, withinrange, width): neuron = np.arange(len(lattice)) dist = coordination.lattice_dist(lattice, width, position) ...
e281723b60cc5c60362c08b24707c4abf448eb73bb367e9249e64c50a48e7706
Python
408
15
#!/usr/local/bin/env python """ Various Python utilities for OpenMM. """ from openmmtools import testsystems, integrators, alchemy, mcmc, states, cache, utils, constants, forces, forcefactories, storage, multistate # Handle versioneer from ._version import get_versions versions = get_versions() __version__ = versio...
35460f5a633937efa9b6d610a39c265428a78b8597c50c6232935a2d187d5f1d
Python
410
16
from ctypes import * cdll.LoadLibrary("../libmorphy_x86_64-Darwin.so") morphylib = CDLL("../libmorphy_x86_64-Darwin.so"); morphylib.mpl_new_Morphy.argtypes = [] morphylib.mpl_new_Morphy.restype = c_void_p morphylib.mpl_delete_Morphy.argtypes = [c_void_p] morphylib.mpl_delete_Morphy.restype = c_int morphylib.mpl_init...
22748e8ccb60e4d532558765d8f9d0ad55200bdf799793598e501d20c9dfd2cb
Python
411
15
from bindsnet.pipeline import action from bindsnet.pipeline.base_pipeline import BasePipeline from bindsnet.pipeline.dataloader_pipeline import ( DataLoaderPipeline, TorchVisionDatasetPipeline, ) from bindsnet.pipeline.environment_pipeline import EnvironmentPipeline __all__ = [ "EnvironmentPipeline", "...
b41f046e99b23966ab9df83da648722c91538ef9e144943549d1f9904ac1aa48
Python
411
15
import torch.nn as nn def convert_state_dict(state_dict): new_state_dict = state_dict.copy() for k in state_dict.keys(): if 'module' in k: k2 = k.split('module.')[1] new_state_dict[k2] = new_state_dict.pop(k) return new_state_dict class Identity(nn.Module): def __init__...
df8a2f36595712ab952c99170539b60c099f4d57623c1dda8df819651e625359
Python
411
10
from collections import OrderedDict def update_state_dict_key_names(weights_initial): """update key names across pretrained and current models to match""" update_state_dict_weights = OrderedDict() for key, value in weights_initial.items(): if "module." in key: key = key[7:] # remove "m...
38565cfd76478ad7ddaa9a65339650ff9d790d4b7a640f843792c2510240e336
Python
412
19
from langchain_core.load.serializable import ( BaseSerialized, Serializable, SerializedConstructor, SerializedNotImplemented, SerializedSecret, to_json_not_implemented, try_neq_default, ) __all__ = [ "BaseSerialized", "Serializable", "SerializedConstructor", "SerializedNotIm...
3eec9377a471ff658d6c95f41651fb654e7ac0b24d4da80caf89e657ef458e48
Python
412
18
from scaden.simulation import BulkSimulator """ Merge simulate datasets """ def merge_datasets(data_dir, prefix, files=None): bulk_simulator = BulkSimulator() if files: files = files.split(",") # Merge the resulting datasets bulk_simulator.merge_datasets(data_dir=data_dir, ...
02c63962967ad36bf650c3a9713a59c8983ad58dffa7cfddd2f89d52e2c73a40
Python
413
14
from ._base import BaseGraphicalIdentification, BaseFormulaIdentification # isort: skip # noqa: E402 from .ID import ID from .adjustment import Adjustment from .frontdoor import Frontdoor from .probability_expression import ProbabilityExpressionTree __all__ = [ "BaseGraphicalIdentification", "BaseFormulaIden...
3eb9272e6d2718ad9b27e67ee268b199d5a8483e7d73fc5b9875dfc0c2ae4409
Python
414
19
from voxcell import VoxelData import numpy as np import sys import flatmap_util as fmutil flatmap_nrrd = sys.argv[1] rdepth_nrrd = sys.argv[2] fmap_vd, fmask = fmutil.load_flatmap(flatmap_nrrd) rdepth_vd = VoxelData.load_nrrd(rdepth_nrrd) mask = ~np.isnan(rdepth_vd.raw) n_total = np.sum(mask) n_mapped = np.sum(fma...
7df9ce238031eb3cb591c2159eeaba948cf62b1012e09d3cc1afb83a0cc5e664
Python
414
15
import re import pytest from langchain_core.utils import check_package_version def test_check_package_version_pass() -> None: check_package_version("PyYAML", gte_version="5.4.1") def test_check_package_version_fail() -> None: with pytest.raises( ValueError, match=re.escape("Expected PyYAML version ...
e0815f2a8f9da17126681b32727c62ca05a553f98b065f2a67fd0a5aed5ac6ad
Python
415
16
#!/usr/bin/env python # -*- coding: utf-8 -*- "FPDF for python" __license__ = "LGPL 3.0" __version__ = "1.7.2" from .fpdf import FPDF, FPDF_FONT_DIR, FPDF_VERSION, SYSTEM_TTFONTS, set_global, FPDF_CACHE_MODE, FPDF_CACHE_DIR try: from .html import HTMLMixin except ImportError: import warnings warnings.war...
6470d00e81b37237b53121cf2b0b6d5995dbd9be2e87ead7aa76f88b25e7f52a
Python
420
11
""" This package contains four submodules, with each submodule implementing a series of subclasses based off typical tensorflow objects. In other words, this module can be conceptualized as an extension of tensorflow for the purpose of bridging `motornet.plants` classes and tensorflow itself. """ from . import callbac...
f2e83747b64ed1c025f07daf0ada847f7af16a28a31cfac51b2c91b9fedd7b69
Python
420
14
# write log file import time def write_log(log_file, parameters): # step, step_time, vacancy_id, vacancy_type, vacany_x, vacancy_y, vacancy_z, neighbor_id, neighbor_type, neighbor_x, neighbor_y, neighbor_z # time_1 = time.time() log_file.write("%d\t%f\t%d\t%d\t%f\t%f\t%f\t%d\t%d\t%f\t%f\t%f\n" % t...
6587c888d44a47a796aabef97b0014062bcb8570d3d81b01b34b1b8c286914a5
Python
421
17
import numpy as np from voxcell import VoxelData import sys from scipy.ndimage import laplace rdepth_nrrd = sys.argv[1] mask_nrrd = sys.argv[2] output_nrrd = sys.argv[3] rdepth = VoxelData.load_nrrd(rdepth_nrrd) mask = VoxelData.load_nrrd(mask_nrrd) lapl = laplace(rdepth.raw, mode='nearest') lapl[mask.raw != 1] = n...
d6cf648c0b1fc32d776f05877f761da406f4528a95da223cb3a90dfe5ad327c0
Python
421
19
from langchain_core.utils.html import ( DEFAULT_LINK_REGEX, PREFIXES_TO_IGNORE, PREFIXES_TO_IGNORE_REGEX, SUFFIXES_TO_IGNORE, SUFFIXES_TO_IGNORE_REGEX, extract_sub_links, find_all_links, ) __all__ = [ "DEFAULT_LINK_REGEX", "PREFIXES_TO_IGNORE", "PREFIXES_TO_IGNORE_REGEX", "S...
c0e2cc570734892bab86399dd3d56b6bc9c87f8ac1ce04e4aeca3cd20f222ecd
Python
423
7
from .peak_det_amp_threshold import peak_det_amp_threshold from .peak_det_local_search import peak_det_local_search from .peak_det_matched_filter_robust import peak_det_matched_filter_robust from .peak_det_modified_pan_tompkins import peak_det_modified_pan_tompkins from .peak_det_pan_tompkins import peak_det_pan_tompki...
ccbdce77c9cf7a00a089f76ff1fc5a5f8795e433cc4629f89992ae83ac3291e8
Python
424
14
import os, glob import numpy as np def get_image_list(input_folder, string_filter='', mode_filter='include'): flist = glob.glob(os.path.join(input_folder,'*.tif')) if string_filter: if mode_filter=='include': flist = [f for f in flist if string_filter in f] elif mode_filter=='exclu...
c0832bd7357925ba213b7403c19e9e48f7fb43b29ad249525bacb113aebc8d3f
Python
425
11
# Python implementation for adding Gaussian noise over the signal s for a certain target SNR. # It returns the noisy signal, the noise itself and the noise variance. import numpy as np def AddNoise(target_snr_db, s): s = np.asanyarray(s) var_n = np.mean(s**2) / (10**(target_snr_db/10)) n = np.random.normal...
c412e7ba591d7557b8bd64013fafa331e76e9cff4e2eac57d529e0d2d9d5e818
Python
425
12
# Python function that returns the beats representation of an ECG # Inputs: ecg_bwr - the input ECG # mids - the middle points between R-peaks, which represents the boundaries between different beats # Output: x_hhs - ECG beat representation def ECGHeartBeatsList(ecg_bwr, mids): x_hbs = [] for i in ran...
5893e97447e5fefd7677873ab0538021a863e4c4e7af391f9a6a77dfab4d960e
Python
426
20
from pycromanager import ZMQRemoteMMCoreJ import numpy as np import time from arduino_triggering import TriggerTester ### Setup trigger_arduino = TriggerTester('COM3') core = ZMQRemoteMMCoreJ() core.set_exposure(500) camera_name = core.get_camera_device() trigger_arduino.send_trigger(5) def wait_and_pop_image(): ...
a702477c70453ef81241b80e075da60870372004aae3f75f16de12183cc1aef1
Python
427
19
import numpy as np import pandas as pd import voxcell as vc def indices_to_mask(indices, depth): mask = np.zeros(depth.shape, dtype=bool) mask[tuple(indices.T)] = True return mask def positions_to_mask(positions, annotation): mask = np.zeros(annotation.shape) indices = annotation.positions_to_in...
72d991f9f07cbff355f104c81ddb7885c13c65e3a011102cbd3460e64a3380e8
Python
428
10
""" This package contains shifter-networks. These are used to modify the neurons' readout position based on the eye position. Usually, the input to the shifters are the pupil centers of both eyes. Given that input, a horizontal and vertical shift of the readout position is returned by the shifter. """ from .base impor...
f5779cbec4342be08e3c479330ff62a947e8c209c2a436d0d2f8e319ad663a15
Python
428
10
import sys sys.path.append("/yourpath/comformer") from comformer.train_props import train_prop_model props = [ "e_form", "gap pbe", "bulk modulus", "shear modulus", ] train_prop_model(learning_rate=0.001,name="iComformer", dataset="megnet", prop=props[0], pyg_input=True, n_epochs=500, max_neighbors=25,...
2822851883f308c9037b5b4dc9a9e9e731f047b4375e535cf9de871b9870197d
Python
429
19
import os fh=open("components.cif","r") data_count=0 curHetCode="" for line in fh.readlines(): line=line.strip() if (line[0:4]=="data"): het_code=line[5:] if (line[0:15]=="_chem_comp.type"): lastWord=line.split(" ")[-1] lastWord=lastWord.upper().strip("\"") if lastWord=="LIN...
dad8592bfd89a45a72d4135f5f9f6229f5aab05b47888e518a3bb4873a755485
Python
430
13
import spectral import matplotlib.pyplot as plt # Open HDR and RAW files using the envi.open function of the spectral library and display them img = spectral.envi.open(r'Thyroid Nodule1\2082500.HDR') # Display the grayscale image of the 100th band data band_data = img.read_band(100) plt.imshow(band_data, ...
2a474b475628e3b7df3d2b9706f1f95e3533255cddedbeda652f5f09de524ef4
Python
432
14
""" diffnets Supervised and self-supervised autoencoders to identify the mechanistic basis for biochemical differences between protein variants. """ # Add imports here from . import training, data_processing, analysis, utils, exmax, nnutils # Handle versioneer from ._version import get_versions versions = get_version...
31c0152b2a94ee3544cef01a0dd5595e5ee511951b33a1fbfacc885259831c92
Python
432
17
from fastapi.testclient import TestClient from api.main import app def test_health() -> None: client = TestClient(app) response = client.get("/api/health") assert response.status_code == 200 assert response.json()["status"] == "ok" def test_frontend_served() -> None: client = TestClient(app) ...
9b2d20fbec68429bdda2d61fde45067c5ceaf92d8774cadd613ee036f85f9526
Python
433
22
import json import sys release_tag = sys.argv[1] python_version = sys.argv[2] ci_os = sys.argv[3] platform_mapping = { "ubuntu-latest": "linux-64", "macOS-latest": "osx-64", } data = { "name": "openff-toolkit", "channel": "conda-forge", "python": [python_version], "platform": [platform_mappin...
eef6c6914cebb1cb14908d2cdcc2135061bb1217d16ae0e8281e8dc20612d242
Python
434
14
from importlib.resources import files tfs_resources = [ "human_tfs_r_hummus", "mouse_tfs_r_hummus", ] def load_tfs(tfs_list) -> list[str]: if tfs_list not in tfs_resources: raise ValueError(f"The name of the tfs list must be in {tfs_resources}") text = files("hummuspy.data").joinpath(tfs_list...
f7f05cf4797bbfc5215755d3b73871eeb0b000927c3b94735536494c4775992d
Python
434
11
from analyze_results import plot_auc_graphs def main(): plot_auc_graphs.graph_mapping['CirSqr'] = 'CircleSquareSrc' plot_auc_graphs.graph_mapping['CirSqrExt'] = 'CircleSquareDst' plot_auc_graphs.classes_to_evaluate['CirSqr'] = [0,1] plot_auc_graphs.classes_to_evaluate['CirSqrExt'] = [0,1] plot_a...
3756099ce52eaa58a50951e3ea3dcf23e85cfde41d45bf848803f7432ba746e5
Python
435
12
import pandas as pd import argparse if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('original_count', help="original count file") parser.add_argument('transposed_count', help="transposed count file") args = parser.parse_args() counts = pd.read_csv(args.original_co...
851a8d38c768847cea3b049e7b25cbec9b918c0c719acd849657cae977e929de
Python
435
16
from setuptools import setup, find_packages setup( name='btstn', version='1.0', description='Bidirectional Time-series State Transfer Network (BTSTN)', author='Shaohua Xu, Ting Xu, Yuping Yang, Xin Chen', author_email='12218022@zju.edu.cn', packages=find_packages(), install_require...
f75de78f89a0de0950f9c1c686053bbd12b8b40b01751b8120282bfe22b3653b
Python
435
15
import time import pytest from blockbuster import BlockingError from langchain_core import sys_info async def test_blockbuster_setup() -> None: """Check if blockbuster is correctly setup.""" # Blocking call outside of langchain_core is allowed. time.sleep(0.01) # noqa: ASYNC251 with pytest.raises(B...
6c484ffc362a24deb702a041603f86c4e0e5928744a4d313233d2fc68f647a82
Python
437
16
""" WSGI config for analyze_electrophysiology_data project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.s...
9e58f8549399346a922b50fed72d49d66a909a90683ba0ae6f6a245fcefdb2c5
Python
437
16
""" ASGI config for analyze_electrophysiology_data project. It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/3.1/howto/deployment/asgi/ """ import os from django.core.asgi import get_asgi_application os.environ.s...
af61f38121db01dab3d59320939df5c4b9392d9cd37d9b6fcd16af663cd82c47
Python
437
13
from pycromanager import ZMQRemoteMMCoreJ, Studio core = ZMQRemoteMMCoreJ() studio = Studio() for i in range(20): core.start_sequence_acquisition(400, 0, True) while core.get_remaining_image_count() > 0 or core.is_sequence_running(): if core.get_remaining_image_count() > 0: tagged = core.p...
c7fa8b10a2e9bf0dfdabd623a2679611025e5b15bfc29e4fd463819535eb85f3
Python
437
24
import numpy as np # Generate experimental data np.random.seed(42) X = np.random.randn(20) def z_score(x): mean = np.mean(x) std = np.std(x) threshold = 1 if std == 0: return None z = (x - mean) / std outliers = np.where(np.abs(z) > threshold) # print(outliers) ...
999c2db796d64b2508a04cc41b329188ac2466078a2fb6a9815efaa2ba69b0c3
Python
439
12
from langchain_classic.chains.router.base import MultiRouteChain, RouterChain from langchain_classic.chains.router.llm_router import LLMRouterChain from langchain_classic.chains.router.multi_prompt import MultiPromptChain from langchain_classic.chains.router.multi_retrieval_qa import MultiRetrievalQAChain __all__ = [ ...
b117969b8256b3f50f292d6e73b464dfec815d829b860b3d0ad5113f16aed3b1
Python
439
17
# -*- coding: utf-8 -*- """ Created on Thu Aug 24 10:30:41 2023 @author: biener """ import numpy as np from NN_Rslt_Anal import NN_Stat as stat NN_Stat_O = stat() Multi_fParmas_Array = NN_Stat_O.Assemble_Data() Bins_Range = np.arange(-10, 10, 0.1) Bins_Range = np.exp(Bins_Range) cou...
8a83e9dad7246dda4375b5aea9ffccbc61b5f02944c2c06b598c1b14226ff158
Python
441
23
from voxcell import VoxelData import numpy as np import sys img_nrrd = sys.argv[1] savefile = sys.argv[2] msk_nrrd = None if len(sys.argv) > 3: msk_nrrd = sys.argv[3] img = VoxelData.load_nrrd(img_nrrd) if msk_nrrd is None: valid_msk = ~np.isnan(img.raw) else: msk = VoxelData.load_nrrd(msk_nrrd) ass...
2b489a2d6a9a528a5104473954e37b1b339b2506ff09316f95e8110b9fceb90c
Python
442
14
import numpy as np import torch import neurogym as ngym def load_dataset(config_file, args): dataset = ngym.Dataset(config_file, batch_size = args.batch_size, seq_len = args.seq_len) dataset.seed(args.seed) return dataset def add_task_indicator(dataset, indicator): inputs, labels = dataset() inpu...
062453bf9e2d6ed1c5fa2d65ab8e500faf9996fedde962e36272240a62ff5361
Python
443
20
from pycromanager import ZMQRemoteMMCoreJ import gc # core = Core(debug=False, convert_camel_case=False) # # core.startSequenceAcquisition(500, 0., True) # # while core.getRemainingImageCount() > 0 or core.isSequenceRunning(): # if core.getRemainingImageCount() > 0: # tagged = core.popNextTaggedImage() # ...
07c4a5fb2c3c695823f60792077038d728b85419fbabec5d0ae3299a8f6ea591
Python
446
10
import pytest def test_SaveDownsampledTiff(tiff_path_fixture): from imagingplus.utils.images import ImportTiff start, end = 0, 4000 stack = ImportTiff(tiff_path_fixture, frames=(start,end)) from imagingplus.utils.images import SaveDownsampledTiff SaveDownsampledTiff(stack=stack, save_as=f'/home/ps...
a91e1978ccbaa84a41520d1fdf7ac330a5fd5fd1643f44c4fbc8a135f17cd330
Python
446
21
from langchain_core.prompts.loading import ( _load_examples, _load_few_shot_prompt, _load_output_parser, _load_prompt, _load_prompt_from_file, _load_template, load_prompt, load_prompt_from_config, ) __all__ = [ "_load_examples", "_load_few_shot_prompt", "_load_output_parser"...
adaa522b0593c475616a75bd96210a3904c70fe3b669052c54e49fe4d4df2187
Python
446
21
from langchain_core.utils.utils import ( build_extra_kwargs, check_package_version, convert_to_secret_str, get_pydantic_field_names, guard_import, mock_now, raise_for_status_with_text, xor_args, ) __all__ = [ "build_extra_kwargs", "check_package_version", "convert_to_secret_...
b7ceb6c65ea96734eb49166f98e7be1e4a4e26c8c9612257006c7f1282795b99
Python
446
13
import requests from ptrnets.utils.gdrive import _get_name def test_get_name_with_requests_session(mocker): mock_get = mocker.patch.object(requests.Session, "get") mock_get.return_value.headers = {"Content-Disposition": 'attachment; filename="example_model.pth"'} name = _get_name("example_id") mock...
ccd12f25871338301d3b43a7024f2f3fb0874cb199bd1b1cb303350f05f2881f
Python
446
21
from bindsnet.conversion.conversion import ( ConstantPad2dConnection, FeatureExtractor, PassThroughNodes, Permute, PermuteConnection, SubtractiveResetIFNodes, ann_to_snn, data_based_normalization, ) __all__ = [ "Permute", "FeatureExtractor", "SubtractiveResetIFNodes", "P...
4c535850635e80225e635d3ff310b3f580e30991ca9697c12709efbababba826
Python
447
16
import os import glob import importlib as importlib _files = glob.glob(os.path.join(os.path.dirname(__file__), "*.py")) __all__ = [ os.path.basename(f)[:-3] for f in _files if os.path.isfile(f) and not f.endswith("__init__.py") ] _modules = [(m, importlib.import_module("." + m, __name__)) for m in __all__]...
5b071fd943969db4551c31122f54692e205162b23e31953c2c022b49d044367b
Python
450
19
import os import numpy as np import random import torch def set_seeds(seed): np.random.seed(seed) random.seed(seed) torch.manual_seed(seed) torch.cuda.empty_cache() torch.backends.cudnn.deterministic = True torch.backends.cudnn.benchmark = False torch.cuda.manual_seed_all(seed) os.envir...
5473d9d0a0fbb1f69c738af29322b463bc1a6adc8ce7525c5cac22e4c6d0b34d
Python
454
20
# -*- coding: utf-8 -*- """ Created on Fri Sep 1 23:22:31 2023 @author: biener """ import torch import numpy as np from NN_Rslt_Anal import NN_Stat as stat import mAECell_Utils as utils NN_Stat_O = stat() GT_File = utils.fOpen(Title='Load ground truth') GT_plusCoord = np.loadtxt(GT_File) GT ...
54f7f61203ec87fbb1a6bd9b35174792bb778a153ce3233cd0252a32acab6b5b
Python
454
26
from .pipelines import ( check_cfg_parameters, close_loggers, init_wandb, load_envs, load_from_checkpoint, seed_everything, set_additional_params ) from .transform import ( TransformOptim3D, TransformRDKit3D ) __all__ = [ check_cfg_parameters, close_loggers, init_wandb,...
b3fc94426f9c0924e4ba7ba2449e3269358abf04ba70067531cd27e2aed69a61
Python
458
14
import numpy as np from neurovisfit.data.session import Session def test_session_from_path(mock_session_path, mock_responses): session = Session.from_path(mock_session_path) assert session.subject_id == "001" assert session.session_id == "123" assert (session.responses == mock_responses).all() a...
5c88ed256be99095d3fe02c23946edb2d211432b63540f0337fd18e8912ff5e4
Python
460
14
import numpy as np def compute_ensemble_average(estimates, distances, smaller_is_better=False): distances = distances.copy() distances = (distances - np.min(distances)) / (np.max(distances) - np.min(distances)) if smaller_is_better: distances = 1 - distances distances = distances ** 2 prin...
6c41636ef85f1693e4128fe5fe82d2ce5f3b446aeef663db2f45c79ad52f42f3
Python
460
19
import torch import torch.nn as nn class Flatten(nn.Module): def __init__(self): super(Flatten, self).__init__() def forward(self, x): return x.view(x.size(0), -1) def conv_block(in_channels, out_channels, kernel_size=3, padding=1): return nn.Sequential( nn.Conv2d(...
a8ee5245edd0433b448a820ed57fc27368bd4bce47464f4a33e089500c8ff7bc
Python
460
13
# third party packages class Interpolator(object): def __init__(self, fileName): try: from gridData import Grid except ModuleNotFoundError: raise ModuleNotFoundError("The dependency 'GridDataFormats' is required for this functionality!") self.grid = Grid(fil...
c29183c64861d1b80c4f7e3f130123e914fd026697fda420f9d3a58c0b5e820d
Python
460
20
from easydict import EasyDict cfg = EasyDict() cfg.batch_size = 16 cfg.epoch = 200 cfg.learning_rate = 1e-2 cfg.momentum = 0.9 cfg.weight_decay = 1e-4 cfg.patience = 25 cfg.inference_threshold = 0.75 cfg.transunet = EasyDict() cfg.transunet.img_dim = 512 cfg.transunet.in_channels = 3 cfg.transunet.out_channels = 128 ...
7afad6b837df4f19010b126d9b8652db1a5c3a4c7e3191ddaca1fb46c7aff0d9
Python
461
24
import starwrap as sw import numpy as np arg = sw.args() arg.trainFile = './input.txt' arg.testFile = './input.txt' arg.trainMode = 5 sp = sw.starSpace(arg) sp.init() sp.train() # sp.evaluate() sp.nearestNeighbor('some text', 10) sp.saveModel('model') sp.saveModelTsv('model.tsv') sp.initFromSavedModel('model'...
364dcee31a54c66b49f4c1fd1fb7dd8b6b11aad3650a9e9bd5bef1a8e8876b4a
Python
462
20
# -*- coding: utf-8 -*- import os, sys from bmtk.simulator import bionet def run(config_file): conf = bionet.Config.from_json(config_file, validate=True) conf.build_env() graph = bionet.BioNetwork.from_config(conf) sim = bionet.BioSimulator.from_config(conf, network=graph) sim.run() bionet.nr...
592439ae02e88756821310f0fe0bb1b43ea21fc4990af87a9daf138fca9f6e80
Python
462
21
import time from itertools import cycle from langchain_core.language_models import GenericFakeChatModel def test_benchmark_model() -> None: """Add rate limiter.""" tic = time.time() model = GenericFakeChatModel( messages=cycle(["hello", "world", "!"]), ) for _ in range(1_000): m...
3a7f15c54e2b4b3e7e9b2fe27854d2c9af50f23249da74e69fb8116524d6ea78
Python
463
24
import time import zmq import numpy as np NB_NRN = 1024 IP_ADDR = "tcp://*:5559" stim = np.zeros(NB_NRN, dtype=np.uint32) # stim[ 0] = 1000 # stim[ 1023] = 2000 # stim[1023] = 2000 stim[0 : 1024] = 500 def main(): context = zmq.Context() zmq_socket = context.socket(zmq.PUSH) zmq_socket....
f50bb346513a7219c23f6bdad17a026f7e5c5ff71a5c126796655532802e91f3
Python
463
20
""" This module is an example of a barebones writer plugin for napari It implements the ``napari_get_writer`` and ``napari_write_image`` hook specifications. see: https://napari.org/docs/dev/plugins/hook_specifications.html Replace code below according to your needs """ from napari_plugin_engine import napari_hook_i...
14c9114404bd894b0501e3eed1ebabde8e4ca8d40efd4b624769748ea30603d0
Python
464
21
from proto_net.train import proto_train import torch import traceback if __name__ == "__main__": try: params = { "lr": 0.0005, "bs": 20, "op": 72, "fn": 80, "optimizer": torch.optim.Adam, "shots": 1 } resu...
692d4e1b87818447ba00d905b5afcb5cf75d6a1ab2108191464d17300dc4c0be
Python
464
17
from langchain_classic.document_loaders.parsers import __all__ def test_parsers_public_api_correct() -> None: """Test public API of parsers for breaking changes.""" assert set(__all__) == { "BS4HTMLParser", "DocAIParser", "GrobidParser", "LanguageParser", "OpenAIWhisper...
7e23cbf8994d5253a71e0ce144adc26b86f29ef1b2204344289c1c88c66e75bf
Python
466
28
"""Error class for handled errors.""" class DataError(Exception): """Data exception.""" pass class FileExistsError(DataError): """Raised when file already exists.""" pass class MmcifParsingError(DataError): """Raised when mmcif parsing fails.""" pass class ResolutionError(DataError): ...
ea9b747b2aa2bd376b342e54b1793e32f0ddf782b95cd6e53e0c7a08d499cb45
Python
466
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...
bd9223c6fc609224e49c701e066b2a997fa35426976f140067c3590eef970036
Python
470
15
from pycromanager import ExploreAcquisition, ZMQRemoteMMCoreJ # core = Core() def image_process_fn(image, metadata): image[20:60, 20:60] = 0 return image, metadata def image_saved_callback(axes, dataset): print(axes) print(dataset.read_image(**axes)) ExploreAcquisition('/Users/henrypinkard/Desktop',...
c440619f7779bc8b2a4047389cedeb1642ff5e0cdd21fc00ae9b1fe999d57f37
Python
471
17
"""PyTorch model definitions for BERNN.""" from .aedann import AutoEncoder2, SHAPAutoEncoder2 from .aeekandann import KANAutoEncoder2, SHAPKANAutoEncoder2 from .aeekandann import KANAutoEncoder3, SHAPKANAutoEncoder3 from .aedann import AutoEncoder3, SHAPAutoEncoder3 __all__ = [ "AutoEncoder2", "SHAPAutoEncode...