sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
86d15323f7e8d724832acf5038e9a381b5087971d7a03c4b52415fb20f0e1711
Python
262
11
from langchain_classic.schema.runnable.history import __all__ EXPECTED_ALL = [ "RunnableWithMessageHistory", "GetSessionHistoryCallable", "MessagesOrDictWithMessages", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
9ca0edfed15e34213f89a6f91ac866d992e12ab2eaae7c6c155f3fd300d5f133
Python
262
7
import argparse from operator import attrgetter class SortingHelpFormatter(argparse.ArgumentDefaultsHelpFormatter): def add_arguments(self, actions): actions = sorted(actions, key=attrgetter('option_strings')) super().add_arguments(actions)
c3f69c44c29b544518d987b5b1dc2c112a9578587975e220d2a6e7bd457b14dc
Python
262
8
import os from pathlib import Path root_dir = Path(__file__).resolve().parent.parent.parent WORK_SPACE = str(root_dir) + os.sep WORK_OUT_DIR = '/data/easyDesign/output/' # default work out dir SERVER_PORT = 8001 # default server port
1ee9f50f7a32eb5bd216f1fa032fbf4f8454a300a8479bbe6e3dd35ada95255a
Python
263
5
import os default_num_threads = 8 if 'nnSegnext_def_n_proc' not in os.environ else int(os.environ['nnSegnext_def_n_proc']) RESAMPLING_SEPARATE_Z_ANISO_THRESHOLD = 3 # determines what threshold to use for resampling the low resolution axis # separately (with NN)
1a54900f51dcb14d000db96b8eef9ab48b3c45612f4d1b82ae35eee17f5c8969
Python
264
10
#!/usr/bin/python import sys import json doc = json.loads(sys.stdin.read()) if doc['state']['iteration'] == 1: doc['input']['outputFile'] = 'a' * 100000000 output = { "output": { "outFile": doc['input']['outputFile'] } } sys.stdout.write(json.dumps(output))
e20df60de9bf5ed2840f29283cc489251a4bed9d1294bd472ea0a3b49532671a
Python
265
11
from langchain_core.prompts.few_shot import ( FewShotChatMessagePromptTemplate, FewShotPromptTemplate, _FewShotPromptTemplateMixin, ) __all__ = [ "FewShotChatMessagePromptTemplate", "FewShotPromptTemplate", "_FewShotPromptTemplateMixin", ]
0ffa7ef99b7ebaddf656e5399c776a98fbf9bc56446ced1ff692275661bc36a5
Python
266
11
"""Models for the Constitutional AI chain.""" from pydantic import BaseModel class ConstitutionalPrinciple(BaseModel): """Class for a constitutional principle.""" critique_request: str revision_request: str name: str = "Constitutional Principle"
893be8d4d30aacf2a2dea548fe07afe77e4499caddc061fc7c9ca5f5a75e2663
Python
266
10
from utils.my_containers import Register loss_register = Register() from .contrastive_loss import PlainContrastiveLoss from .cm_contrastive_loss import PlainDualModalityContrastiveLoss def get_loss(loss_cfg): return loss_register[loss_cfg['name']](loss_cfg)
ed28c4863bb55f80dc811f3a22bc6e1bc1d80abbc71224074719e4ac4689ea0f
Python
267
11
#Python function that removes duplicates (or multicates) from a list # Input: list # Output: unique_list def uniqueListValues(list): unique_list = [] for x in list: if x not in unique_list: unique_list.append(x) return unique_list
944a5d7211edbb99d93bbbd63af1597707467e8714ce538a87a8d49679ce63de
Python
268
13
from math import log # calculate aic for regression def calculate_aic(n, mse, num_params): aic = n * log(mse) + 2 * num_params return aic # calculate bic for regression def calculate_bic(n, mse, num_params): bic = n * log(mse) + num_params * log(n) return bic
d81205fa2da3ade9ba03451346bbd49cb96c7a7f1e23d2c28f33a9ddf206072d
Python
268
9
"""SSRF protection exceptions.""" class SSRFBlockedError(Exception): """Raised when a request is blocked by SSRF protection policy.""" def __init__(self, reason: str) -> None: self.reason = reason super().__init__(f"SSRF blocked: {reason}")
fcfd4b9fd4245aa2a91d81afecf3fb69e213aa31b8151fd1f8ef2fdd9acc0425
Python
270
6
from ptrnets.zoo.third_party.cornet import cornet_r from ptrnets.zoo.third_party.cornet import cornet_rt from ptrnets.zoo.third_party.cornet import cornet_s from ptrnets.zoo.third_party.cornet import cornet_z __all__ = ["cornet_z", "cornet_r", "cornet_rt", "cornet_s"]
07af7b12597ff54885ec888d298d7155e21008cef4c0197b6025833c08234336
Python
271
8
from dipgnn.utils.common_util import CommonArgs, setup_imports from dipgnn.utils.register import registers if __name__ == "__main__": setup_imports() args = CommonArgs().get_args() task = registers.task.get_class(args.task_name)(args) task.run()
43b9a899a7984c986eee6688b682544c696d39112e48c9e9e82ec835ca8f5efa
Python
271
15
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author: oesteban # @Date: 2015-11-19 16:44:27 """sdcflows setup script.""" def main(): """Install entry-point.""" from setuptools import setup setup(name='sdcflows') if __name__ == '__main__': main()
70a57b66de83cdd434df9259af717cf3540dcdab7a91ff253d3b9274c94d459c
Python
271
9
from scipy.stats import binom_test def binom_two_tail(n1: int, n2: int, p: float): return binom_test(x=n1, n=n1 + n2, p=p, alternative="two-sided") def binom_one_tail(n1: int, n2: int, p: float): return binom_test(x=n1, n=n1 + n2, p=p, alternative="greater")
c472d361e6a61d64c53c7a205103c6bc7c26519d10471146ad51b14fbf3612bd
Python
272
9
def get_list_from_file(input_file_name, col=0): '''get a list from a file column''' x_list = [] input_file = open(input_file_name, 'r') for line in input_file: x = line.split()[col] x_list.append(x) input_file.close() return x_list
4335d4d7694519d79055894ab44a39b671b0cb056c1048dde768a1ed2e4e2141
Python
273
12
import numpy as np from sys import argv, exit, stderr argc = len(argv) input_file = argv[1] fxlen = int(argv[2]) data = np.fromfile(input_file, dtype=np.float32).reshape((fxlen, fxlen)) ngoodfit = np.sum(data >= 0.995) print('{} {}'.format(fxlen,ngoodfit / data.size))
e3409010d891cc126586e2ccf6c619e09553ddc3da74e26f0aac0c628ae64eed
Python
273
6
# This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it. # Allegro package version file # See Python packaging guide # https://packaging.python.org/guides/single-sourcing-package-version/ __version__ = "0.8.3"
1748ea1158e106076c230d8d84c821899cf11506b3b64daf33cdb64ad6179e84
Python
275
13
""" A PyTorch-powered python toolbox to train deep neural networks to perform motor tasks. """ __name__ = "motornet" __version__ = "0.3.0" from . import muscle from . import skeleton from . import environment from . import effector from . import plotor from . import policy
c326afd76bddde33cbb7363d1dc008d8d137920f528ff89e44178ac94a31b1fd
Python
275
11
"""Shims for asyncio features that may be missing from older python versions.""" import sys if sys.version_info[:2] < (3, 11): from async_timeout import timeout as asyncio_timeout else: from asyncio import timeout as asyncio_timeout __all__ = ["asyncio_timeout"]
4adc7d5f72c0d1e7c1a1d829719da83f3e50d239503d945d42ce00ccb5ad263d
Python
276
5
from pgmpy.parameterization.adapters.distribution import DistributionAdapter from pgmpy.parameterization.adapters.sklearn import SklearnAdapter from pgmpy.parameterization.adapters.skpro import SkproAdapter __all__ = ["DistributionAdapter", "SklearnAdapter", "SkproAdapter"]
1519ff7294d15ee3fd3753e9ae7746aa49be01f5797fe9a2857d580250195061
Python
277
14
from pydantic import BaseModel, ConfigDict class AttributeInfo(BaseModel): """Information about a data source attribute.""" name: str description: str type: str model_config = ConfigDict( arbitrary_types_allowed=True, frozen=True, )
12b10fe15c5a73e8384cbd5e9dfb0b80f5ec7415536b80313c08c5b3069bb2f2
Python
278
14
# coding=utf-8 import torch class Algorithm(torch.nn.Module): def __init__(self, args): super(Algorithm, self).__init__() def update(self, minibatches, opt, sch): raise NotImplementedError def predict(self, x): raise NotImplementedError
8f2a1532aa3a2bc6da5794620b68ed2e8d68427070c3f3fc7292081dffc13925
Python
279
7
from .build_annotations import build_annotations from .build_models import build_models from .build_springs import build_springs from .build_tree import build_tree from .track_all import track_all from .save_annotations import save_annotations from .save_movie import save_movie
152eb5b5f28699d9ec32574458d463ee99eafaf2a2898fd00b07642e3591e3fd
Python
281
6
from createdir import createdir, parse_bellybuttonseg_args if __name__ == "__main__": args = parse_bellybuttonseg_args('Create BellyButton example 3 (Spacefoam) project in specified directory') createdir(3, file_path=args['file_path'], folder_name=args['folder_name'])
cc084662692d0d3d1855800605956c5c579a1aebd6d54f22cbb845254484a9be
Python
281
6
from createdir import createdir, parse_bellybuttonseg_args if __name__ == "__main__": args = parse_bellybuttonseg_args('Create BellyButton example 2 (Honeycomb) project in specified directory') createdir(2, file_path=args['file_path'], folder_name=args['folder_name'])
112e409289fa764272ffa9c04c63680793e2c00c2b879954eac678906f2c0e3f
Python
282
13
from langchain_core.utils.pydantic import PYDANTIC_VERSION def get_pydantic_major_version() -> int: """Get the major version of Pydantic. Returns: The major version of Pydantic. """ return PYDANTIC_VERSION.major __all__ = ["get_pydantic_major_version"]
2eb8da028f08732138bd1ae82959cca47aeb629fb0684a23d017a41c768534ab
Python
282
15
from langchain_core.outputs import __all__ EXPECTED_ALL = [ "ChatGeneration", "ChatGenerationChunk", "ChatResult", "Generation", "GenerationChunk", "LLMResult", "RunInfo", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
d093ae9573a2408c642f2d28f41e95a2f3dc1c655c87dc0d1381cbca51fda766
Python
282
10
class ConfoundingVariablesError(Exception): """Exception raised when confounding variables are detected. Attributes: message -- explanation of the error """ def __init__(self, message): self.message = message super().__init__(self.message)
f4e733268ef1e0a40fab14b18a198ff210ec97b8f5e31a2c0eb89dfba86b8d16
Python
283
15
"""DEPRECATED: Kept for backwards compatibility.""" from langchain_core.utils.input import ( get_bolded_text, get_color_mapping, get_colored_text, print_text, ) __all__ = [ "get_bolded_text", "get_color_mapping", "get_colored_text", "print_text", ]
b06be69b1bdcb15357e251f84a0751089f106b8e48c904c0ab259c0eef5449bb
Python
284
10
from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = CoalVelocityVfracTempTimeIntegratorConfig( model="CNO-v2-L-cond2", lr=2e-4, weight_decay=0.0, devices=2, seed=SEED0 )
c5233363f3d7cca99f39454f9262fc25c5da388ab9e71b4fd830de6ffb034a82
Python
285
9
"""Entrypoint to building [Agents](https://docs.langchain.com/oss/python/langchain/agents) with LangChain.""" # noqa: E501 from langchain.agents.factory import create_agent from langchain.agents.middleware.types import AgentState __all__ = [ "AgentState", "create_agent", ]
0871a7dfa096e99e1a5a1c3ceb4e3bf38d8a4e1054bfe6fe46dc0eb3eb9eaccd
Python
286
12
import numpy as np def dirac(value): def f(size): if hasattr(value, 'shape'): if len(value.shape) == 0: return value * np.ones(size) else: return value else: return value*np.ones(size) return f
8f55d904d302f3579169ce5e2ece766b2401f1a4d7064d0fefc67e9c6fd818de
Python
286
7
"""Entrypoint to using [chat models](https://docs.langchain.com/oss/python/langchain/models) in LangChain.""" # noqa: E501 from langchain_core.language_models import BaseChatModel from langchain.chat_models.base import init_chat_model __all__ = ["BaseChatModel", "init_chat_model"]
bfbdd196f046d0b1879452ce817f4dc798ee73a70420e10f2f81450c5fefa92c
Python
286
10
from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = CoalVelocityVfracTempTimeIntegratorConfig( model="Transolver_cond2", lr=6e-4, weight_decay=0.0, devices=4, seed=SEED0 )
11e1c7a666c9e8c1d35a5edf7138418f2635417770de36f0acd2bb1829bb5f51
Python
287
11
import importlib from utils.my_containers import Register, Constructor runner_register = Constructor() from .pretrain_runner import PretrainRunner from .pretrain_runner_dense_matrix import DenseGraphPretrainRunner def get_runner(runner_name): return runner_register[runner_name]
19f54f0b24cf3201f810ca12abc475d6af2ade6aa17791b4a2cc8ebdb3443cbb
Python
287
8
import subprocess import os PREDMOTER_VERSION = "0.3.2" GIT_COMMIT = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"], cwd=os.path.dirname(os.path.realpath(__file__))).decode("ascii").strip() EPS = 1e-8 MAX_VALUES_IN_RAM = 21_384_000
858441520cb734a857d4ce3e11155b250fddb6ec9be3ceb33620a727a1289ef4
Python
287
9
# Copyright (c) DP Technology. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from __future__ import absolute_import, division, print_function import os BASE_DIR = os.path.dirname(os.path.abspath(__file__))
d97d82c8a9455b62c048baa5cb88c01eae3a132e9dfe581460dbbd8bd6edcfa3
Python
287
15
import tensorflow as tf from typing import List from .layer import LRPLayer class NoOpLRP(LRPLayer): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) def call(self, inputs: List[tf.Tensor]) -> tf.Tensor: _, R = inputs return R
1c27d78096e2aed34e9c8c80b92e7e2d6818b7340cfb822a84c380ecdbe93489
Python
288
11
from langchain_core.example_selectors.semantic_similarity import ( MaxMarginalRelevanceExampleSelector, SemanticSimilarityExampleSelector, sorted_values, ) __all__ = [ "MaxMarginalRelevanceExampleSelector", "SemanticSimilarityExampleSelector", "sorted_values", ]
eb869f25281c780374b42af3b4cb7c996711972ebf1aed35ef5cf897e4b5c377
Python
288
12
from .clustering import \ obtain_clusters, \ obtain_combined_clusters, \ obtain_mult_combined_clusters, \ find_closest_frames from .trajectory import \ write_cluster_traj from .wss import \ wss_over_number_of_clusters, \ wss_over_number_of_combined_clusters
71a170ebfd710c3e72d39d95461922555d17953c92ac696958ac1aaad368f6bd
Python
289
14
import numpy as np from sys import argv, exit, stderr argc = len(argv) nvox_file = argv[1] fxlen = int(argv[2]) nvox = np.fromfile(nvox_file, dtype=np.float32).reshape((fxlen, fxlen)) assert(np.min(nvox) >= 0.0) nvox1 = np.sum(nvox > 0) print('{} {}'.format(fxlen,nvox1 / nvox.size))
898af58f74b13442f1dbc19920559f90839d1724ec5a4bbff5ef0deac72dcc48
Python
289
6
from createdir import createdir, parse_bellybuttonseg_args if __name__ == "__main__": args = parse_bellybuttonseg_args('Create BellyButton example 1 (PhotoelasticDisks) project in specified directory') createdir(1, file_path=args['file_path'], folder_name=args['folder_name'])
2886d40bb37c4e399a82b352661c3a6a57b2652e929dbb935d3e01a9b44eab7e
Python
290
10
from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = CoalVelocityVfracTempTimeIntegratorConfig( model="CNO-v2-L-cond2-euler", lr=2e-4, weight_decay=0.0, devices=2, seed=SEED0 )
37f1962a1ff4522c9cb96a526424050e223332cbd2f18d95ff3a3a5d880c1cb3
Python
291
15
from langchain_classic.schema.output import __all__ EXPECTED_ALL = [ "ChatGeneration", "ChatGenerationChunk", "ChatResult", "Generation", "GenerationChunk", "LLMResult", "RunInfo", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
79bb3ad67774af0363087e8628e9874414a4dc57cd9b051fb532e13931097dde
Python
291
12
"""Utilities for working with interactive environments.""" import sys def is_interactive_env() -> bool: """Determine if running within IPython or Jupyter. Returns: `True` if running in an interactive environment, `False` otherwise. """ return hasattr(sys, "ps2")
7e3d6d40f071dbba71e7a41fa7bf71a6b555b1a7b793c1b4a88f9e147c714153
Python
291
13
""" Open Force fields """ # Add imports here from .openforcefields import get_forcefield_dirs_paths # Handle versioneer from ._version import get_versions versions = get_versions() __version__ = versions['version'] __git_revision__ = versions['full-revisionid'] del get_versions, versions
98c203770404bf8cc0eefdd525f1f5789712d9267f543f0f07aef61f68d0f622
Python
291
10
from utils.my_containers import Register head_register = Register() from .attn_agg_head import SelfAttentionAggregationHead from .sim_agg_head import SimAggregationHead from .max_agg_head import MaxAggregationHead def get_head(head_cfg): return head_register[head_cfg.name](head_cfg)
0b2ca8d41eaae178f63a633d1de4b121f95f796f608086da0a4a61fa8bf5669f
Python
292
15
from langchain_classic.indexes import __all__ EXPECTED_ALL = [ # Keep sorted "aindex", "GraphIndexCreator", "index", "IndexingResult", "SQLRecordManager", "VectorstoreIndexCreator", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
2484075e7317bbd97aef536e97c9048d46b7110ef8b3b227d7c795f486f97dd3
Python
292
10
from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = CoalVelocityVfracTempTimeIntegratorConfig( model="Transolver_cond2_euler", lr=6e-4, weight_decay=0.0, devices=4, seed=SEED0 )
dd83044736840440a2a4753cd6ee020528ea62426a42fd9c59caf9e03ba77caf
Python
292
12
from cgatReport.Tracker import TrackerSQL class ProjectTracker(TrackerSQL): '''Define convenience tracks for plots''' class WordFrequencies(ProjectTracker): pattern = "(.*)_counts" def __call__(self, track): return self.getValues("SELECT freq FROM %(track)s_counts")
c0f5a11c6efa37d08e46eb351b174a4d7066af0361eb944f0812417f9701707d
Python
293
12
#Python implementation for SNR computation # Inputs: s - the signal # n - the noise # Inputs: snr - the SNR between s and n import numpy as np def ComputeSNR(s, n): s = np.asanyarray(s) n = np.asanyarray(n) snr = 10 * np.log10(np.mean(s**2)/np.mean(n**2)) return snr
d43f8f89d971ffadef6b165fd8db2e8007070b1cc538e61ddc352807881c3262
Python
293
12
import numpy as np from voxcell import VoxelData import sys input_nrrd = sys.argv[1] output_xyz = sys.argv[2] vd = VoxelData.load_nrrd(input_nrrd) w = np.array(np.where(vd.raw == 1)).T pos = vd.indices_to_positions(w + 0.5) # add 0.5 for voxel centers np.savetxt(output_xyz, pos, '%.12f')
dbe770926063ea04ac8f99b7f3e47d808830929407e2a30f48ed8551449d31ea
Python
293
10
from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = CoalVelocityVfracTempTimeIntegratorConfig( model="Unetmod-cond2-v2-64_4_1", lr=2e-4, weight_decay=0.0, devices=1, seed=SEED0 )
e2d113d9b3247fb9321bc97439d798bf7bfdf36f6433f61bcd2ce5f7530cbb03
Python
293
11
import flatmap_util as fmutil import numpy as np import sys input_nrrd = sys.argv[1] pixel_res = int(sys.argv[2]) output_nrrd = sys.argv[3] fmap, fmask = fmutil.load_flatmap(input_nrrd) fmap_d = fmutil.discretize_flatmap(fmap, fmask, pixel_res) fmap.with_data(fmap_d).save_nrrd(output_nrrd)
37d1f5977991f06ec6d6fd6531a38de491d4470bf209b41b38c08f72d960d87a
Python
294
10
from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = CoalVelocityVfracTempTimeIntegratorConfig( model="CNO-v2-L-cond2-moeulerx4", lr=2e-4, weight_decay=0.0, devices=8, seed=SEED0 )
e292ea39a64cc00605b78698e39b063f65a64c87239d29bf57d911f051fbbd36
Python
294
13
"""String distance evaluators.""" from langchain_classic.evaluation.string_distance.base import ( PairwiseStringDistanceEvalChain, StringDistance, StringDistanceEvalChain, ) __all__ = [ "PairwiseStringDistanceEvalChain", "StringDistance", "StringDistanceEvalChain", ]
6af25c406054fb48b6edc443237332b5e43e346301ec82419cb3e67973d0a271
Python
295
15
from langchain_classic.tools.base import __all__ EXPECTED_ALL = [ "BaseTool", "SchemaAnnotationError", "StructuredTool", "Tool", "ToolException", "create_schema_from_function", "tool", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
81a7b50f10c47214c6dd12ad7adc4dd9e06fcbb119a3f9d084bf49318f5ae5ae
Python
295
13
from langchain_classic.schema.language_model import __all__ EXPECTED_ALL = [ "BaseLanguageModel", "_get_token_ids_default_method", "get_tokenizer", "LanguageModelOutput", "LanguageModelInput", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
271c675ffaf6e99b13d57f143505bd86e9391607a6df4c5d7c0328e61320dd09
Python
297
15
import sys import numpy as np import voxcell as vc rmap = vc.RegionMap.load_json(sys.argv[1]) ids = np.loadtxt(sys.argv[2]) acrs = [] for x in ids: try: acr = rmap.get(x,attr='acronym') acrs.append(acr) except: acrs.append(None) np.savetxt(sys.argv[3],acrs,"%s")
9c3ba7b28670fafc867a93109cca7a17136ef2a2d998ff767c58e341604aeb0f
Python
297
10
from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = CoalVelocityVfracTempTimeIntegratorConfig( model="Transolver_cond2_moeulerx4", lr=6e-4, weight_decay=0.0, devices=8, seed=SEED0, )
9281e7ee971b07d127e806afab43bc81d8d99c69ca46369f39944a05464dc637
Python
298
14
import numpy as np from sys import argv, exit, stderr argc = len(argv) ncomp_file = argv[1] fxlen = int(argv[2]) ncomp = np.fromfile(ncomp_file, dtype=np.float32).reshape((fxlen, fxlen)) assert(np.min(ncomp) >= 0.0) ncomp1 = np.sum(ncomp == 1) print('{} {}'.format(fxlen,ncomp1 / ncomp.size))
aa01a3d4d2ddab36f58bc7268011ba76f6beb1f5c540d08ed0c57a24ced89b43
Python
298
5
# dictionary of terms, phrases, etc. that are used in the processing and analysis of imaging cellsdata terms_dictionary = { 'dFF': "normalization of datatrace for a given imaging ROI by subtraction and division of a given baseline value", 'ROI': "a single ROI from the imaging cellsdata" }
a02fee9df856b96765e13e53f4db29441742922b5713ab4acf3a759c830cdff4
Python
299
10
from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = CoalVelocityVfracTempTimeIntegratorConfig( model="Unetmod-cond2-v3-euler-64_4_1", lr=2e-4, weight_decay=0.0, devices=1, seed=SEED0 )
cd523d8ac4aad6d900a5eae6a9ea9dae8b02b011b768c9afaa0e1f00eeee6206
Python
299
13
from typing import Any from langchain_classic._api import create_importer _importer = create_importer( __package__, fallback_module="langchain_community.agent_toolkits.load_tools", ) def __getattr__(name: str) -> Any: """Look up attributes dynamically.""" return _importer(name)
0ba3368dd6f0b86100342f9b5f698ac262b0741fb5974ef5fb35fa915df0f847
Python
300
9
import flatmap_util as fmutil import sys flatmap_nrrd = sys.argv[1] output_prefix = sys.argv[2] fmap, _ = fmutil.load_flatmap(flatmap_nrrd) fmap.with_data(fmap.raw[:,:,:,0]).save_nrrd('{}_x.nrrd'.format(output_prefix)) fmap.with_data(fmap.raw[:,:,:,1]).save_nrrd('{}_y.nrrd'.format(output_prefix))
2bc9e97258dcc4b8f27850a0fd383289d3a37d3a0a97304ffbabcb2f84eb4dab
Python
300
10
#!/usr/bin/env python from openeye.oechem import OEGraphMol, OEReadMolecule, OEWriteMolecule, oemolistream, oemolostream ifs = oemolistream('imidazole/imidazole-epik-charged.mol2') ofs = oemolostream('imidazol.pdb') mol = OEGraphMol() while OEReadMolecule(ifs, mol): OEWriteMolecule(ofs, mol)
56a303157585ff805b18c04263814a22aeab05677df4d5baa2da3e6906e3cbb2
Python
300
7
NB_NRN = 1024 NB_FRAME_PER_BUFFER = 100 DATAWIDTH_BIT_FRAME = 32 DATAWIDTH_BYTE_FRAME = int(DATAWIDTH_BIT_FRAME/8) NB_SPK_DATA_PER_FRAME = int(NB_NRN/DATAWIDTH_BIT_FRAME) SIZE_BYTE_FRAME = (NB_SPK_DATA_PER_FRAME+1)*DATAWIDTH_BYTE_FRAME # +1 for time stamp
a2938a04c4d3d84ab8ca9a4022f10241ea2682a22cf9403f7ac9243a7f4502bd
Python
300
13
#!/usr/bin/env python import os def untar(path, directory): return os.system("tar -C {directory} -{z}xf {path}".format( z = 'z' if path.endswith(".gz") else "", directory = directory, path = path )) def readSNPList(f): with open(f, 'r') as ff: return ff.read()
a15e089bb6ea25a3ef391625bc0aa7c3080048b384560879b1f50a53c94a0e1e
Python
301
13
#!/usr/bin/python import sys import json doc = json.loads(sys.stdin.read()) for site, inputs in doc['input'].items(): if inputs['mode'] == 'remote': raise Exception('remote throws error') output = { "output": { "foo": "foo" }, "success": success } sys.stdout.write(json.dumps(output))
a978ea71074447db9acb27f61e852aac49f6a6073f5b4e65bf97b2758ee5ae3d
Python
301
9
######################################################################## # Validation: checkpointing # These models perform the usual validation tests for the stochastic # solvers, with an additional checkpointing step. ########################################################################
c5747d8d44529fb2e4907601a2601a76f557edbb13393c53625cb2f3b8653b20
Python
301
14
# -*- coding: utf-8 -*- """ Methods to read in and process features from coordinates. """ from .pyemma_features import * from .mda_distances import * from .processing import * from .atom_features import * from .water_features import * from .txt_features import * from .csv_features import *
938d87572fe9bdf763e4f12783657dea2ab56a808c12d380fdd322d0656da65d
Python
302
12
import requests from requests.auth import HTTPBasicAuth class StateTokenAuth(HTTPBasicAuth): def __init__(self, token): super().__init__(None, None) self.token = token def __call__(self, r): r.headers['Authorization'] = 'Bearer {}'.format(self.token) return r
68beecaa48be92af0b1a01d5480784f6586b03c49c801ebeb9fca553cca60db4
Python
303
15
""" Unit and regression test for the qupkake package. """ # Import package, test suite, and other packages as needed import sys import pytest import qupkake def test_qupkake_imported(): """Sample test, will always pass so long as import statement worked.""" assert "qupkake" in sys.modules
7f87d2b1426a21c03d59fc2309ae48cf11dc11a74ecf79b44ad0db74f4185d83
Python
303
13
from langchain_classic.schema.runnable.configurable import __all__ EXPECTED_ALL = [ "DynamicRunnable", "RunnableConfigurableAlternatives", "RunnableConfigurableFields", "StrEnum", "make_options_spec", ] def test_all_imports() -> None: assert set(__all__) == set(EXPECTED_ALL)
aa416acb6238c915a7c5624b86d49b35fa78ffbb16023d4157f375d3f3a228cf
Python
303
12
""" Unit and regression test for the diffnets package. """ # Import package, test suite, and other packages as needed import diffnets import pytest import sys def test_diffnets_imported(): """Sample test, will always pass so long as import statement worked""" assert "diffnets" in sys.modules
45d52c2ddc486ff9657ceb0579091e688851f11151a33114157db0e79f4a0c67
Python
304
12
import scanpy as sc import squidpy as sq from SpaceFlow import SpaceFlow adata = sq.datasets.seqfish() sf = SpaceFlow.SpaceFlow(expr_data=adata.X, spatial_locs=adata.obsm['spatial']) sf.preprocessing_data() sf.train() sf.segmentation() sf.plot_segmentation() sf.pseudo_Spatiotemporal_Map() sf.plot_pSM()
cd744366c2d95920c2df511c3bc874f93f8ada6d50da40d015cefacaed872fc9
Python
304
17
import datajoint as dj import pickle class Pickle(dj.AttributeAdapter): @property def attribute_type(self): return 'longblob' def get(self, value): return pickle.loads(value) def put(self, obj): return pickle.dumps(obj) pickletype = Pickle()
e8b0b6eca4f1155316d9ded9397978249ee9df172b6d8c4541f9458e1582fb2a
Python
304
11
"""Training modules for BERNN.""" from .train_ae import TrainAE from .train_ae_classifier_holdout import TrainAEClassifierHoldout from .train_ae_then_classifier_holdout import TrainAEThenClassifierHoldout __all__ = [ "TrainAE", "TrainAEClassifierHoldout", "TrainAEThenClassifierHoldout", ]
1a9d3972434d35cefe43d9f0a2d243e59201918c3127edb065fd031fea369ca0
Python
305
10
from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = BlastVelocityDensityTemperatureTimeIntegratorConfig( model="CNO-v2-L-cond1", lr=2e-4, weight_decay=0.0, devices=2, seed=SEED0 )
5ae13d27e4c5c90ebece9687decdf5c7e0bdd223dfde7362eeee19a0bef4d3a6
Python
305
10
from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = CoalVelocityVfracTempTimeIntegratorConfig( model="Unetmod-cond2-v5-MOEx4-euler-32_4_1", lr=2e-4, weight_decay=0.0, devices=1, seed=SEED0 )
02bcfb436db82f3a15be903eaedbfd05ba4a47ada87e6e92bf4fbbe7884c863f
Python
306
21
from bindsnet.learning.learning import ( MSTDP, MSTDPET, Hebbian, LearningRule, NoOp, PostPre, Rmax, WeightDependentPostPre, ) __all__ = [ "LearningRule", "NoOp", "PostPre", "WeightDependentPostPre", "Hebbian", "MSTDP", "MSTDPET", "Rmax", ]
d87b7ba7922205093c43e34518018d06464d640a8f510cedbfae1ad8d48f1132
Python
307
14
from voxcell import VoxelData import numpy as np import sys file_nrrd = sys.argv[1] pixel_res = int(sys.argv[2]) data = VoxelData.load_nrrd(file_nrrd) vals = data.raw[~np.isnan(data.raw)] # valid values are not NaN mean = np.mean(vals) std = np.std(vals) print('{} {} {}'.format(pixel_res, mean, std))
f57397574d47e765c5a5f1b389245ae64784574993ef239eb5abd1b9efe15bca
Python
307
10
from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = BlastVelocityDensityTemperatureTimeIntegratorConfig( model="Transolver_cond1", lr=6e-4, weight_decay=0.0, devices=1, seed=SEED0 )
62d44208e309ee455c1b5a87382f7d70d5a07a62847f14d70a817d79667a163f
Python
308
14
from pycromanager import _Bridge, JavaBackendAcquisition import numpy as np def hook_fn(event): coordinates = np.array([event["x"], event["y"], event["z"]]) return event # magellan example acq = JavaBackendAcquisition(magellan_acq_index=0, post_hardware_hook_fn=hook_fn) acq.await_completion()
00b104fa085d14b44461e2ede8f7555a196689a91e5e6fcc82695020e848e552
Python
309
12
from torch.utils.ffi import _wrap_function from ._batch_norm import lib as _lib, ffi as _ffi __all__ = [] def _import_symbols(locals): for symbol in dir(_lib): fn = getattr(_lib, symbol) locals[symbol] = _wrap_function(fn, _ffi) __all__.append(symbol) _import_symbols(locals())
3ab861596d2d378de1a935547b4cefa1011b10351d40db0faf5a883d6d13bba5
Python
310
13
from langchain_core.output_parsers.list import ( CommaSeparatedListOutputParser, ListOutputParser, MarkdownListOutputParser, NumberedListOutputParser, ) __all__ = [ "CommaSeparatedListOutputParser", "ListOutputParser", "MarkdownListOutputParser", "NumberedListOutputParser", ]
5df8d3326700c9fa22f39381d83dba447364e0034ed124d1ca83ecfb8af7161e
Python
310
11
from langchain_classic.document_loaders.blob_loaders import __all__ def test_public_api() -> None: """Hard-code public API to help determine if we have broken it.""" assert sorted(__all__) == [ "Blob", "BlobLoader", "FileSystemBlobLoader", "YoutubeAudioLoader", ]
c40da427dcb387174dd5a405a8f3a2b3c22a546b3dc802d214e1eaad43a0855c
Python
310
9
######################################################################## # Validation: checkpointing # These models perform some validation tests for the tetvesicle solver # reaction-diffusion component with a checkpointing step. ########################################################################
5bd8228448595a8c7219fec4e388301f54f3169683d6d03efb7726c4452d665e
Python
312
10
from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = BlastVelocityDensityTemperatureTimeIntegratorConfig( model="CNO-v2-L-cond1-euler", lr=2e-4, weight_decay=0.0, devices=2, seed=SEED0, )
d950f0554193eedfe1e7b2070056b3853a941bb282b69b3deef0852d37899498
Python
312
11
from pydantic import BaseSettings as PydanticBaseSettings class BaseSettings(PydanticBaseSettings): """Add configuration to default Pydantic BaseSettings.""" class Config: """Configure BaseSettings behavior.""" extra = "forbid" use_enum_values = True env_prefix = "jv_"
50b54d4c7af725563150aa1d2676f27cd05cb1b32905accbdec33473897d1d17
Python
313
11
from pdearena.configs.config_coal import CoalVelocityVfracTempDeltaTPredConfig from pdearena.utils.constants import Paths, CoalConstants config = CoalVelocityVfracTempDeltaTPredConfig( model="convNeXT-tiny", noise_level=1e-2, lr=2e-4, weight_decay=0.0, loss="mae", devices=1 )
8b0d29c08283013846438c1f2d52487ae7b23021ee1529013f8e8b30a094a2a6
Python
313
10
import logging PFPLOGGER = logging.getLogger("polyfingerprints") PFPLOGGER.setLevel(logging.INFO) handler = logging.StreamHandler() handler.setLevel(logging.INFO) formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s") handler.setFormatter(formatter) PFPLOGGER.addHandler(handler)
e5878848456e70d7b02a15e69309f777c3b8f15087d2cb7763b400f4888ba83a
Python
313
15
# Producer ########################## import zmq import numpy as np import time NB_TEST = 10 IP_ADDR = "tcp://127.0.0.1:6666" context = zmq.Context() zmq_socket = context.socket(zmq.PUSH) zmq_socket.bind(IP_ADDR) tx = [] for _ in range (NB_TEST): zmq_socket.send(np.zeros(1024, dtype=np.uint32).tobytes())
f3eee853a7164c552343cd934dd6c165a64f608ecd8772f007a81eca59e64bdb
Python
313
10
from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = BlastVelocityDensityTemperatureTimeIntegratorConfig( model="Transolver_cond1_euler", lr=6e-4, weight_decay=0.0, devices=1, seed=SEED0 )
3fc0330104960f91d2612c0853424d394a1e9c22b520b0208ce1069524ec59d2
Python
314
10
from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = BlastVelocityDensityTemperatureTimeIntegratorConfig( model="Unetmod-cond1-v2-64_4_1", lr=2e-4, weight_decay=0.0, devices=1, seed=SEED0 )
24be4692c823fe0164e343d42a45d729c561402fe37a44affb3d600dc578cf40
Python
315
10
from pdearena.configs.config_blast import BlastVelocityDensityTemperatureTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = BlastVelocityDensityTemperatureTimeIntegratorConfig( model="CNO-v2-L-cond1-moeulerx4", lr=2e-4, weight_decay=0.0, devices=8, seed=SEED0 )
dd2ded18846d52e4227e2c3cd0b69084632ad50f4db7e18651aa198ab8c214ac
Python
315
12
from setuptools import setup, find_packages setup( name='EN_diffusion', version='1.0.0', url=None, author='Author Name', author_email='author@gmail.com', description='Description of my package', packages=find_packages(), install_requires=['numpy >= 1.11.1', 'matplotlib >= 1.5.1'] )
2c685d2873fed418d085d7efe9d0b9dc61dcabef0de9061148230e4be94d1084
Python
317
10
from unittest.mock import patch from neuralpredictors.layers.shifters import MLP def test_xavier_initialization_is_used(): with patch("neuralpredictors.layers.shifters.mlp.xavier_normal_") as mock_xavier: MLP(shift_layers=3) # One Linear layer per shift layer assert mock_xavier.call_count == 3
765312afc832284b8c4b17e09709ed9e91f16e78c09c2425482e0f3a03830dcc
Python
317
12
from pdearena.configs.config_coal import CoalVelocityVfracTempTimeIntegratorConfig from pdearena.utils.constants import SEED0 config = CoalVelocityVfracTempTimeIntegratorConfig( model="FFNO_cond2_moeulerx4", lr=1e-3, weight_decay=0.0, devices=4, xpad=2, ypad=2, seed=SEED0 )