sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
5546062d66f01a2bf4dda48c5b9b23746370b046bd14a82ad1170ae68de5907e
Python
1,079
30
"""Prompt for the router chain in the multi-retrieval qa chain.""" MULTI_RETRIEVAL_ROUTER_TEMPLATE = """\ Given a query to a question answering system select the system best suited \ for the input. You will be given the names of the available systems and a description \ of what questions the system is best suited for....
b62c8a5b591217bb3c61fb10a5f9074a0e291ea0d846a2279fb6182da82dca95
Python
1,080
35
from setuptools import setup def readme(): with open('README.md') as f: return f.read() setup(name='independent_vector_analysis', version='0.3.6', description='Implementation of IVA-G and IVA-L-SOS', long_description=readme(), long_description_content_type='text/markdown', ...
4c0dddcdc585f00372ab0412146152f66513583830b2f1df7fce0ded446c8705
Python
1,081
32
# third party packages import numpy as np def clipOutliers(data, method="IQR", axis=None, impute_nans=True): if method == "z-score": try: from scipy.stats import zscore except ModuleNotFoundError: raise ModuleNotFoundError("The dependency 'SciPy' is required for this functio...
52d6681d66a35e3e0bafa2e75fdb83d2035918ee4f631651ebc353df5167c02f
Python
1,081
38
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2023/9/28 10:46 # @Author : zhangchao # @File : loader.py # @Software: PyCharm # @Email : zhangchao5@genomics.cn import numpy as np import scipy.sparse as sp from torch.utils.data import Dataset class DNNDataset(Dataset): def __init__(self, adata, ...
b1e070ae167182ada780340ea727f3c825319a83f4e34f66cab564d26e1827da
Python
1,081
40
# %% imports import argparse import pandas as pd import seaborn as sns import matplotlib.pyplot as plt DATASETS = ['chbp', 'lemon', 'tuab', 'camcan'] BENCHMARKS = ['dummy', 'filterbank-riemann', 'filterbank-source', 'handcrafted', 'shallow', 'deep'] parser = argparse.ArgumentParser(description='Comput...
e8dc05596f091c6d3260a011991de1b4c397106e3006ff4cd44092330a4b7c35
Python
1,081
42
import torch from torch import nn from genie.utils.encoding import sinusoidal_encoding class SingleFeatureNet(nn.Module): def __init__(self, c_s, n_timestep, c_pos_emb, c_timestep_emb ): super(SingleFeatureNet, self).__init__() self.c_s = c_s self.n_timestep = n_timestep self.c_pos_emb = c_pos_em...
53172f776f1c19a2cfe88308ab466078e04a86150a94489eb38de4817d7bcd21
Python
1,082
29
import pkgutil from pathlib import Path import pytest from langchain_core.messages.block_translators import PROVIDER_TRANSLATORS def test_all_providers_registered() -> None: """Test that all block translators implemented in langchain-core are registered. If this test fails, it is likely that a block transl...
c5f5e552d77aad166383b9ecb3ed43f99742a54664a3240fd2b477eb321b23b9
Python
1,082
26
########################################################################################### # # # Set up paths for the Object Detection Metrics # # ...
eaff4de8b65f6aa9e1d054331e7af08fc84b0cc452f1cc26aa496dc206c34e01
Python
1,082
44
#!/usr/bin/python3 -B import matplotlib import matplotlib.pyplot as plt import numpy as np def plot(rayx_times, rayui_times, beamlines): """ Plot the Beamline time; x, for rayx. ui, for RAY-UI beamlines is also the chaning variable throughout the beamline """ assert(len(rayx_times) == len(rayui_times)) N = le...
50d1a3b71c2612ba58bb711e638bacfe9e52a19fadca99ef4d0d58f0d9f2b633
Python
1,083
27
""" Analyze participant demographics data. """ import pandas as pd DEMOGRAPHICS_DATA_FILE = "data/demographic-data/ada-learn_23-02-17/ada-learn_23-02-17_demographics_data.csv" DEMOGRAPHICS_SUMMARY_FILE = "data/demographic-data/ada-learn_23-02-17/ada-learn_23-02-17_demographics_summary.csv" def main(): data = pd....
b43f304fce8cde21a92d7147c90692135b1904396748273892e51e977df9194c
Python
1,084
43
# For this you need matlab and the new requirements.txt import argparse import matlab import matlab.engine import scipy.io from oset.ecg.peak_detection.peak_det_local_search import ( peak_det_local_search, ) import unit_test as testing mat = scipy.io.loadmat("../../../datasets/sample-data/SampleECG1.mat")["data"...
c9e0aeef6546671b52079cb033d4ab0160131314a843a9abcca8d12656ac400e
Python
1,084
37
from langchain_core.prompt_values import ChatPromptValue, ChatPromptValueConcrete from langchain_core.prompts.chat import ( AIMessagePromptTemplate, BaseChatPromptTemplate, BaseStringMessagePromptTemplate, ChatMessagePromptTemplate, ChatPromptTemplate, HumanMessagePromptTemplate, MessageLike...
333e1e2d2d0e6358c3893fdd2cc9fb375fa5bb0a6d1a866a0e8a57cddf3cd3bb
Python
1,085
35
""" Module initializer includes all sub-modules. :Version: 1.1.0 :Date: 29.03.2017 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2017 Jan Melchior This file is part of the Python library PyDeep. PyDe...
cc705ebede944c8b374b87e0919c26f12930f938024e61975e4e95d76f59e042
Python
1,085
36
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chat_loaders.utils import ( map_ai_messages, map_ai_messages_in_session, merge_chat_runs, merge_chat_runs_in_session, ) # Create a way to dynamic...
1e3082dcb4f97335f15a1ad25af0225ca98986e35be0288650642e5ab3d917d9
Python
1,086
35
import torch import numpy as np from contextlib import nullcontext FORWARD_ITERS = np.array([1, 2, 3, 4, 5]) FORWARD_ITERS_P = np.array([10, 6, 3, 2, 1], dtype=float) FORWARD_ITERS_P /= np.sum(FORWARD_ITERS_P) def loss_function(model, sample): input1 = sample["input1"] input2 = sample["input2"] output1 =...
4ff54c1476fc01b50956733d9495828c3061709ffd438a4cc617e62b3b8b3296
Python
1,086
35
from functools import lru_cache from typing import Dict import biomart @lru_cache() def get_ensembl_mappings() -> Dict[str, str]: # Set up connection to server server = biomart.BiomartServer('http://uswest.ensembl.org/biomart') mart = server.datasets['mmusculus_gene_ensembl'] # List the types of da...
ba6645485e32224fbff7fb412cfd837f67b8b977f7e92a23210a66e5ea60c3b2
Python
1,086
50
''' R.py - Intergrate python and R =========================================================== :Tags: Python Purpose ------- This module file contains code to allow integration of python and R: - Redefined R class which enables saving R history. Usage ----- ''' from rpy2.robjects import R as RBase class R_wi...
e77845b84377f2ee0a89e3252a55ee78a1561fc483f4ab4bfd14fe7c4d4959f2
Python
1,086
36
"""**Docstores** are classes to store and load Documents. The **Docstore** is a simplified version of the Document Loader. """ from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.docstore.arbitrary_fn import DocstoreFn from lang...
7fbb4f861e6ba0f9a27903a139a7168e7864f0357b0cf53cb561f6808328766b
Python
1,087
38
import numpy as np from dival import TaskTable from dival.measure import PSNR, SSIM from dliplib.utils import Params from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset from dliplib.reconstructors.tv import TVReconstructor from dliplib.utils.reports import save_results_table # load ...
9de4898605f1a6f6eba33fbaaa0d54c1d015e148751646d4fdd8080be6d25acc
Python
1,088
41
import numpy as np import matplotlib.pyplot as plt import functions_emt as f from params_emt import * import time import pandas as pd def main(): tm = 10000. # simulation time (dt=0.1 is set in the time_course_emt() function ) b = 1. np.random.seed(100) # load initial conditions for E, E/M, and ...
caa23ea3ec9934ad474eb85f5fc48c290693c1b12a1302a1a474d9aa1db70bc5
Python
1,089
25
from nowcasting.encoder_forecaster import * from nowcasting.ops import * from nowcasting.operators import * class MovingMNISTFactory(EncoderForecasterBaseFactory): def __init__(self, batch_size, in_seq_len, out_seq_len): super(MovingMNISTFactory, self).__...
f8861ff311b2d894473df5a1e40c1b1887d3229af11bc35d00fececc281cac49
Python
1,090
47
import numpy as np import scipy.sparse as sp from collections import Counter #################################################### # This tool is to generate positive set with a thre- # shold "pos_num". # dataset pos_num # acm 5 # dblp 1000 # aminer 15 # freebase 80 # # # Notice: The best pos_num of acm is ...
01f163ab37b9c3683965339f2956cc08db10ad26ba8e6949978422073d966d11
Python
1,091
42
""" Add ground-truth labels to deepsignal call_mods output. """ import sys import pandas as pd sys.path.append("..") from utils.constants.functional import METHYL_BED_COLS_NA from utils.constants.functional import DS_CALL_COLS if __name__ == '__main__': call_filename = sys.argv[1] methyl_filename = sys.arg...
31152fe76505e28ce59108a822f6a75255509bd7e2922644ac04fd2cf99b15f7
Python
1,091
28
from torch import nn import sys sys.path.append("../../") from TCN.tcn import TemporalConvNet class TCN(nn.Module): def __init__(self, input_size, output_size, num_channels, kernel_size=2, dropout=0.2, emb_dropout=0.2): super(TCN, self).__init__() self.encoder = nn.Embedding(output_size, input_siz...
95c9b8bf330b0ba31dd5d55df91f110e6a0c14a555b47b291efdffc059693a37
Python
1,092
36
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.agent_toolkits.powerbi.prompt import ( POWERBI_CHAT_PREFIX, POWERBI_CHAT_SUFFIX, POWERBI_PREFIX, POWERBI_SUFFIX, ) # Create a way to dynamically ...
2b50a34ca1d1cf2b2ecf05601b619cb70cc4aaa9447a49624f33f082c9b3aeb0
Python
1,093
34
aa_list = list("QWERTYIPASDFGHKLCVNM") aa_one_letter = set(aa_list) aa_three_letters = ["GLN", "TRP", "GLU", "ARG", "THR", "TYR", "ILE", "PRO", "ALA", "SER", "ASP", "PHE", "GLY", "HIS", "LYS", "LEU", "CYS", "VAL", "ASN", "MET"] aa_one_to_three_dict = { "...
84febd5d9f85048c9acb71b4d069cf08d8cecbe4ca93f43b0ec4e6fe18e279ef
Python
1,093
53
#!/usr/bin/env python """ geometry (/trigonometry) functions for cilium analysis """ import numpy def calculate_theta(disp): x, y, z = disp return numpy.arctan2(numpy.sqrt(x**2 + y**2), z) def calculate_phi(disp): x, y = disp[:2] return numpy.arctan2(y, x) def calculate_dist(disp): return nump...
22b34bbf4fa70d40b7628644d4ea4a128f9f15d8756ae0331341872134128ece
Python
1,094
27
model_names_eps30 = ['24x6_e1000_OGMW6BZD', '24x8_e1000_PXTN6NGN', '14x8_e1000_JPEMNEVL', '24x8_e1000_MKE3W7TE', '18x7_e5000_3ZDQ3YRK', '24x5_e1000_JQIWIS62', '18x8_e1000_KO2T5FHQ', ...
788b2c7206a950cf60be712dc2dd0e1b3b0dedbb2bafbf17f2f58083cd2d798d
Python
1,094
41
"""O365 tools.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ( O365CreateDraftMessage, O365SearchEmails, O365SearchEvents, O365SendEvent, O365SendMessage, ) # Create ...
505af8d2718876eac68857c7e72711c181f8007083b3742f32cf25157c4b1e39
Python
1,095
38
# Copyright 2021 AlQuraishi Laboratory # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to i...
d93cd88bc7555ed572d33c6c61620a400687f7c11ff56c52d7e53b6f94514681
Python
1,095
35
""" Package providing rbm models and corresponding sampler, trainer and estimator. :Version: 1.1.0 :Date: 04.04.2017 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2017 Jan Melchior This file is part of the Py...
0202012181a2d6f13d10423f258a0279afeacc55ca1b47892f68ebae3c8781d0
Python
1,098
36
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chains.graph_qa.gremlin import ( GRAPHDB_SPARQL_FIX_TEMPLATE, INTERMEDIATE_STEPS_KEY, GremlinQAChain, extract_gremlin, ) # Create a way to dynami...
3d443cdbe1e4e0006dd347bc9da6bcae879807e044814a0941e6bd099cc62464
Python
1,098
23
from dliplib.utils.models.skip import Skip from dliplib.utils.models.unet import UNet from dliplib.utils.models.iradonmap import IRadonMap def get_unet_model(in_ch=1, out_ch=1, scales=5, skip=4, channels=(32, 32, 64, 64, 128, 128), use_sigmoid=True, use_norm=True): assert (1 <= scales <= 6) skip_channels = [s...
cdf41512bc413e5db9aca3bb3aa26debab1a5265312a758d82dba4bc55c5844e
Python
1,099
39
import sys; import numpy as np import joblib from dt_utils import Timer from data_utils import generate_recognition_data from plastic import PlasticNet d = 50 #length of input vector R = int(sys.argv[1]) #repeat interval P = .5 #probability of repeat np.random.seed(12345) #for re...
5917f59422571fc0b092d05143108d5cd451aba6c64038f00266aa87eada5f63
Python
1,100
32
import scrublet as scr import scipy.io import matplotlib.pyplot as plt import numpy as np import os import sys plt.rcParams['font.family'] = 'sans-serif' plt.rcParams['font.sans-serif'] = 'Arial' plt.rc('font', size=14) plt.rcParams['pdf.fonttype'] = 42 args = sys.argv input_dir_prefix = args[1] input_dir_suffix = a...
7205aaa9a192b97ad05d90ebe7a3eaff0ab86fa8d36edd5ad7e3a5242f2ba7aa
Python
1,100
45
import numpy as np import cv2 from collections import abc as container_abc import io from PIL import Image import matplotlib.pyplot as plt COLOR_POOL = [(255, 0, 0), (0, 255, 0), (0, 255, 255), (255, 255, 0)] def plt_show(x, title=None): import matplotlib.pyplot as plt plt.imshow(x) if title is not None:...
72bf1990f865db85b012a444de2e3f5115dfeb64b37d3aeeb9963263da1aae38
Python
1,100
38
import setuptools with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setuptools.setup( name="comformer", version="2024.06.05", author="Keqiang Yan, Cong Fu, Xiaofeng Qian, Xiaoning Qian, Shuiwang Ji", author_email="keqiangyan@tamu.edu", description="comformer", ...
aaffee5905be6d0fcdc2e2ed604caf9cc0b2fcb17c8866dbc5a323315782b02b
Python
1,100
45
from collections.abc import Iterable from itertools import chain, combinations def _variable_or_iterable_to_set(x): """ Convert variable, set, or iterable x to a frozenset. If x is None, returns the empty set. A string is one variable. Parameters --------- x : None, str or Iterable[Hashable]...
80c220c9387382756cebbc27f20bd48e6f5e82e8c6923ee6fbcd5deb291310f3
Python
1,101
33
import torch import torch.nn as nn # 定义双向LSTM模型 class BiLSTM(nn.Module): def __init__(self, input_dim, hidden_size, num_layers, output_dim): super(BiLSTM, self).__init__() self.hidden_size = hidden_size self.num_layers = num_layers # 定义双向LSTM层 self.lstm = nn.LS...
2c9f4dcc7cc376648a5045e387062d35890ea0bec4dd131682a6eda59aee3137
Python
1,103
55
import random import numpy as np import torch import torch.nn as nn from torch.nn import functional as F from rdkit import Chem import io import numpy as np import threading def nan_to_num(vec, num=0.0): idx = np.isnan(vec) vec[idx] = num return vec def _normalize(vec, axis=-1): return nan_to_num( ...
c3da88a944bb92ffa4d8263e8440011c1cbd12b5f049ce4255551ae6114233a3
Python
1,103
26
import os import re def get_segment_index(segment_name: str) -> int: return int(re.search("seg([0-9]+)", segment_name)[1]) def connec_wrapper_main(postproc_folder, fs=30000): segment_folders = os.listdir(postproc_folder) segment_folders = sorted(segment_folders, key=get_segment_index) segment_folders ...
f3a337719ec7bbdb267e58d184de35869d23220b65b9661c4d2ae460bc3daee7
Python
1,103
49
import sys sys.path.append('../classes') import class_stimuli import numpy as np import pickle import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt ### MAIN SCRIPT stimulus_tasks = ['varyposition', 'varysize', 'varyrotation'] stimulus_folder = '../stimuli/simple_seqs/' ## load classes if Tru...
3a604211191709969da3af40975db88d982971478e257b0337d87d86986c5302
Python
1,104
45
"""3D fluorescence deconvolution using the waveorder API.""" from waveorder.api import fluorescence settings = fluorescence.Settings( transfer_function=fluorescence.TransferFunctionSettings( yx_pixel_size=0.1, z_pixel_size=0.25, wavelength_emission=0.532, numerical_aperture_detecti...
6a6b09f4a537760e38d8e9f75b27ce41670bd8b85ffe58f7bb0931c1e03d489c
Python
1,104
45
#!/usr/bin/env python3 from setuptools import setup, find_packages version = "1.1.2" with open("README.md", "r", encoding="UTF-8") as fh: long_description = fh.read() with open("LICENSE", encoding="UTF-8") as f: license = f.read() setup( name="scaden", version=version, description="Cell type d...
e1a4fe5f4c0bd8f0b651b058ad91a59017cda828db6b17465ef82554465e9af7
Python
1,106
30
import torch import torch.nn as nn class TransformerModel(nn.Module): def __init__(self, input_dim, nhead, num_encoder_layers, num_decoder_layers, hidden_dim, dropout, output_dim): super(TransformerModel, self).__init__() self.embedding = nn.Linear(input_dim, hidden_dim) self.trans...
c587c1b58344a6ea198ec73ad2ec682c3e53020a2ae33777e8f5af60b445e51f
Python
1,107
36
from pymaid.fetch.annotations import filter_by_query import pandas as pd import pytest NAMES = pd.Series(["potato", "spade", "orange", "bears"]) @pytest.mark.parametrize("query", ["spade", "~spade", "annotation:spade"]) def test_filter_by_query_exact(query): out = filter_by_query(NAMES, query) assert list(o...
1caf8a8cf7d07c1363d15fdab68d3f18decf16c0be5a2c6df15d90e75e457499
Python
1,108
16
"""Format instructions.""" JSON_FORMAT_INSTRUCTIONS = """STRICT OUTPUT FORMAT: - Return only the JSON value that conforms to the schema. Do not include any additional text, explanations, headings, or separators. - Do not wrap the JSON in Markdown or code fences (no ``` or ```json). - Do not prepend or append any text ...
72afe7b4822d7dcd59d46658168c18a59c35ec1ad4a29f46623a8a1c40118e98
Python
1,109
39
import numpy as np from dival import TaskTable from dival.measure import PSNR, SSIM from dliplib.utils import Params from dliplib.utils.helper import select_hyper_best_parameters from dliplib.utils.helper import load_standard_dataset from dliplib.reconstructors.tv import TVReconstructor from dliplib.utils.reports imp...
03ba4bb437fef083fe2a5da32be0eab58fc94cda5b0b67d811672ed7a99acb84
Python
1,110
35
''' producing random numbers as an example to test the codes ''' import numpy as np from tensorflow.keras.utils import Sequence class BaseGenerator(Sequence): def __init__(self, batch_size, CH): self.batch_size = batch_size self.CH = CH self.__fullepoch_recordings_indices=[] print('...
1859d33bd76595146a9b0e2b27a1562297e09622593160db3f6466a90d114142
Python
1,110
37
import pytest from langchain_classic.base_memory import BaseMemory from langchain_classic.chains.conversation.memory import ( ConversationBufferMemory, ConversationBufferWindowMemory, ConversationSummaryMemory, ) from langchain_classic.memory import ReadOnlySharedMemory, SimpleMemory from tests.unit_tests....
2f153a7d1f131e74ff553677024e1bd57eb6281f49dbdc03ec258cb3f6a70766
Python
1,111
42
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2023/10/7 16:09 # @Author : zhangchao # @File : setup.py.py # @Software: PyCharm # @Email : zhangchao5@genomics.cn import setuptools from wheel.bdist_wheel import bdist_wheel __version__ = "1.0.4" class BDistWheel(bdist_wheel): def get_tag(self): ...
59e91a0c1b1eeb8e9c56f30aa391e43c32fca16da1b4b6ef7e0650c418f3360c
Python
1,112
31
# -- coding: utf-8 -- # @Time : 2022/12/1 18:38 # @Author : Biao Zhang # @Email : littlebiao@outlook.com # @File : load_part_expression.py import sys import pandas as pd sys.path.append('..') from analysis_utils import ttest_plot_utils from analysis_utils import homo_random_config as config import os import scanpy as...
989ff39d52979969591c563e1fc375d15b29f5b6ab213f0fd721386f90bcbd9c
Python
1,112
33
import argparse import trimesh # Function to convert obj to stl def convert_obj_to_stl(input_obj_path, output_stl_path): # Load the obj file using trimesh mesh_data = trimesh.load_mesh(input_obj_path) # Check if the mesh is valid if not mesh_data.is_watertight: print("Warning: The mesh is not ...
0b7dd196c5d3e6033cae301a1211ee57acc29ed7baa909602d0d3b25b8b43f40
Python
1,114
31
"""Scoring evaluators. This module contains evaluators for scoring on a 1-10 the output of models, be they LLMs, Chains, or otherwise. This can be based on a variety of criteria and or a reference answer. Example: >>> from langchain_openai import ChatOpenAI >>> from langchain_classic.evaluation.scoring import...
3a66a5fc59f28eae5dd5e34a08f3291b770c92447d333b22179e92130ad2a094
Python
1,114
33
"""MutliOn Client API tools.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools.multion.close_session import MultionCloseSession from langchain_community.tools.multion.create_session import MultionCreateSession from...
96dab2d72c17ee01a3c479fbd84b65917ecbb0f9c149dfc0fd56560081c3e482
Python
1,114
38
import torch from .solvers import FixedGridODESolver from .rk_common import rk4_alt_step_func class Euler(FixedGridODESolver): order = 1 def __init__(self, eps=0., **kwargs): super(Euler, self).__init__(**kwargs) self.eps = torch.as_tensor(eps, dtype=self.dtype, device=self.device) def _...
0d52a1585f0d0c9c405d322d936a41f3df23753e574e0454648c0adb54c1607a
Python
1,115
36
import os from _cif_to_substructure_dict import CifSubstructures from openff.toolkit.utils import get_data_file_path if not os.path.exists("aa-variants-v1.cif"): import requests r = requests.get("https://files.wwpdb.org/pub/pdb/data/monomers/aa-variants-v1.cif") print(r.ok) if r.ok: with ope...
2bf7082c2785b044c480a03b61a37389e769cdaa5a87cf1e642ff668ac59a7a2
Python
1,115
48
# plots trajectories of male and female fruit fly for one small period of courtship import sys sys.path.append('../classes') import class_reconstruct import numpy as np import pickle import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt ### MAIN SCRIPT ## load tracks if True: data_folder = '...
3822263d73eae597b4f1bc77f5b5dc48b8cd006fab063ea13cc646daffe88311
Python
1,115
36
from langchain_classic.output_parsers.regex import RegexParser # NOTE: The almost same constant variables in ./test_combining_parser.py DEF_EXPECTED_RESULT = { "confidence": "A", "explanation": "Paris is the capital of France according to Wikipedia.", } DEF_README = """```json { "answer": "Paris", "so...
a5bde2bd4a8809200a17d438c25af1fd6092f5321d3dee7de9f3d6ec372bfa3d
Python
1,115
38
# -*- coding: utf-8 -*- """ Created on Tue May 5 11:43:19 2020 @author: nishe """ import numpy as np #%% def ignore_shortevent(event, threshold=20): ''' event: an array consists boolean value that indicates if an event happens threshold (ms): if the duration of consecutive events(length of cons...
fee4cde93d8fa98269309f4f604d1c06aef8e6ba814beede9cb43e63bd27008a
Python
1,116
21
import torch # using x entropy loss. 3 year threshold, right inclusive (so if survive to 3 years, not progressors) def sur_loss(preds, obss, hits, bins=torch.cuda.FloatTensor([[0, 24, 48, 108]])): bin_centers = (bins[0, 1:] + bins[0, :-1])/2 survived_bins_censored = torch.ge(torch.mul(obss.view(-1, 1),1-hits.vi...
08eb70dbb7f7abf5b0298cd6eebe29c184ce7679098155acac0dc2ef90a8e37d
Python
1,117
39
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ( BaseSQLDatabaseTool, InfoSQLDatabaseTool, ListSQLDatabaseTool, QuerySQLCheckerTool, QuerySQLDataBaseTool, ) # Create a way...
103b038605b3867a5d1c35cd288f930fd4d0e37d3b721f38ab84b6ed3701ddaf
Python
1,117
30
import logging import os import sys import os.path as osp import time def setup_logger(name, save_dir, if_train): logger = logging.getLogger(name) logger.setLevel(logging.DEBUG) ch = logging.StreamHandler(stream=sys.stdout) ch.setLevel(logging.DEBUG) formatter = logging.Formatter("%(asctime)s %(nam...
a394b23d167f32214bd6b96027e030ef0b8e1d6f79068fd177b91aadc827acb4
Python
1,117
46
"""Unittests for langchain.agents.chat package.""" from langchain_core.agents import AgentAction from langchain_classic.agents.chat.output_parser import ChatOutputParser output_parser = ChatOutputParser() def get_action_and_input(text: str) -> tuple[str, str]: output = output_parser.parse(text) if isinstan...
b15811780f5fbe118c7af0a429ccee3326d0d08bb914c4e7b0b56013fb04c4fb
Python
1,117
38
"""Test configuration loading""" import pytest import yaml from casanovo.config import Config def test_default(): """Test that loading the default works""" config = Config() assert config.random_seed == 454 assert config["random_seed"] == 454 assert config.accelerator == "auto" assert config....
cbe6fe731dc20f68b25c8040c944657f51acbc69fde7d17d36093001ad34253d
Python
1,117
36
"""LLM Chain for generating examples for question answering.""" from __future__ import annotations from typing import Any from langchain_core.language_models import BaseLanguageModel from langchain_core.output_parsers import BaseLLMOutputParser from pydantic import Field from typing_extensions import override from ...
337e99f07b2000d0939b29ac5f1cc99fd15e16308877f022ad811cdd41416229
Python
1,118
51
from langchain_core.runnables.utils import ( Addable, AddableDict, AnyConfigurableField, ConfigurableField, ConfigurableFieldMultiOption, ConfigurableFieldSingleOption, ConfigurableFieldSpec, GetLambdaSource, Input, IsFunctionArgDict, IsLocalDict, Output, SupportsAdd,...
465b9efa23c33da06103cbe887efe49472bdecfcc8c23de3d78fcfdbd3cda625
Python
1,118
41
import os import pathlib import urllib.request import pandas as pd DEBUG = False url_lemon = ('https://ftp.gwdg.de/pub/misc/MPI-Leipzig_Mind-Brain-Body-LEMON' '/EEG_MPILMBB_LEMON/EEG_Raw_BIDS_ID/') lemon_info = pd.read_csv( "./META_File_IDs_Age_Gender_Education_Drug_Smoke_SKID_LEMON.csv") data_path =...
79e187936abcf911bce85919b193227e58431c9f0d17f02cbbf5cce95f8440b7
Python
1,119
32
# Copyright (c) MONAI Consortium # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, so...
9c58f62a43c8770f0175697ada5fa234e513ff421851d55bb0c67bd11fd3b4d2
Python
1,120
36
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.embeddings import ( HuggingFaceBgeEmbeddings, HuggingFaceEmbeddings, HuggingFaceInferenceAPIEmbeddings, HuggingFaceInstructEmbeddings, ) # Create...
280329b20532ca5c54b0aacd996af8fb3e9b719c22e74c9cade9b1e216d1b839
Python
1,121
36
import pandas as pd import sys print('\n> Processing GWAS locus file...') gwas_df = pd.read_csv('gwas_locus_column.txt', index_col=None, header=None) gwas_locus_gene_dict = {} for row in gwas_df.iloc[:, 0]: genes = row.split(';') for g in genes: gwas_locus_gene_dict[g] = gwas_locus_gene_dict.get(g, 0)...
98cef4cfbd27920542f1390632cfd94d2f893a25814ca4da9af8b9a85bde635d
Python
1,121
35
""" Module initializer includes all sub-modules. :Version: 1.1.0 :Date: 13.03.2017 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2017 Jan Melchior This file is part of the Python library PyDeep. PyDe...
d33f8e131ddd861fbfd1c96578fa9c160ea519a7b1e13fa957f28d600bc3d7fb
Python
1,121
41
import logging import os import socket import matplotlib.pyplot as plt import numpy as np if socket.gethostname() == 'hivemind': import matplotlib matplotlib.use('Agg') def save_elbo_plot( maxiter, log_interval: int, logf, savedir: str = None, figure_name: str = None, figsize=(12, 6), figure...
e53b6e55272133bcd03bf0cc8af786d09311e057a51e8af5e4322765356b9d20
Python
1,122
31
import argparse from pensa import load_selection, extract_coordinates # -------------# # --- MAIN --- # # -------------# if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--sel_base", type=str, default='protein and ') parser.add_argument("--sel_file", type=str, default='...
6b7138614549013807e6fe53c69e376cff08a47a4e8491f91c6252ec04abdeb1
Python
1,123
42
import torch from .linear_operator import aslinearoperator, TorchLinearOperator def cg(A, b, x0=None, max_iter=None, tol=1e-5): if max_iter is None: max_iter = 20 * b.numel() if x0 is None: x = torch.zeros_like(b) r = b.clone() else: x = x0.clone() r = b - A.mv(x) ...
ad7037dceaa4bc732099aba0db2a070d37b8ec7bf12cdd62e6e301cc614b2abf
Python
1,123
29
from .attention import AttentionReadout from .base import ClonedReadout, Readout from .factorized import FullFactorized2d, FullSXF, SpatialXFeatureLinear from .gaussian import ( DeterministicGaussian2d, FullGaussian2d, Gaussian2d, Gaussian3d, GeneralizedFullGaussianReadout2d, RemappedGaussian2d,...
db6a1ac71aef3849793efe6246c17380f830c86ead41bd0f78ff0cc81c986ae1
Python
1,123
32
import numpy as np import pandas as pd import os import anndata import scanpy as sc dataset_dir = "spatial_prompt/" dt_dir = "benchmark/" import time #%% import data libd_data_dir = dataset_dir+"benchmark/spatiallibd/st_data/spatialLIBD/" libd_st_obj = sc.read_visium(libd_data_dir+"151673/") libd_st_meta = pd.read_tab...
41ba190bfefd634458b57b803d0626d064e01acfa715037bf78c80f8373826ae
Python
1,124
30
import fnmatch import os,re,sys if len(sys.argv)>2 : d=sys.argv[1] if not os.path.exists(d): sys.exit(" ERROR : the directory you provided as data directory does not exist. Breaking up.") else : sys.exit(" ERROR : please provide the name of the data directory (where you have all your snapshots) and the name of th...
09b5d868ff6ef030ce5a51fb26dbe8e25c7bbefba365cbbc7622ba250b440783
Python
1,125
31
#!/bin/python3 # Author: Nicole Gay, Anna Scherbina # Updated: 7 May 2020 # Script: truncate_narrowpeak_200bp_summit.py # Purpose: For an input peak file (concatenated .narrowpeak.gz file), truncate each peak to 100bp on either side of the summit import gzip import argparse def parse_args(): parser=argparse.A...
c0eebd6eca09ea202711333b5589a6126772ad41a2e4734a4ee717afcc37717a
Python
1,125
33
import sys sys.path.append('../source') from matplotlib import pyplot as plt # for visualisation of imagedata import networkx as nx import tinaui as ui import numpy as np import os # plt.ion() t1 = ui.load_status(folder='../test/sampledata/ocn', load_imagedata=True) ui.load_stack(t1, folder=os.path.join(t1.folder,...
def60b5d4abe73c652ff57db19ccc6880b3f07926f84caec9c88fdb4df32d3e5
Python
1,125
39
from typing import Any import pytest from langchain_core.messages import AIMessage from langchain_core.outputs import ChatGeneration @pytest.mark.parametrize( ("content", "expected"), [ ("foo", "foo"), (["foo"], "foo"), (["foo", "bar"], "foobar"), ([{"text": "foo", "type": "t...
1c470be70e9fbc18058bf0d7a6d7ad693cab97ab9a4452054abdbde57a081dc5
Python
1,126
33
class ScaleEdgeFeatures(object): r"""docstring """ def __init__(self, method="norm"): self.method = method def __call__(self, data): assert data.edge_attr is not None if self.method == "clip": # scale edge features to lie within [0,1] e_mean = d...
c570c6e5fc855bd6b155683c47eae632e9a6ec3e44c53ddcd6ea4af2e01e3411
Python
1,127
34
import numpy as numx import pydeep.misc.visualization as VIS def load_Van_Hateren_Image(path): import array fin = open( path, 'rb' ) s = fin.read() fin.close() arr = array.array('H', s) arr.byteswap() return numx.array(arr, dtype='uint16').reshape(1024,1536) def create_shift_trajectory...
4611190d5e19dca89646a6c7c9ca46364985defb38e07ac8e757f8f6aab9eea3
Python
1,128
35
from langchain_classic._api.module_import import create_importer def test_import_from_non_deprecated_path() -> None: """Test importing all modules in langchain.""" module_lookup = { "Document": "langchain_core.documents", } lookup = create_importer(__package__, module_lookup=module_lookup) ...
10882ea9ac23c05fdfda416752044ed120ef93190ec7ca8d117fdbb68e0dbfb8
Python
1,129
19
import sys, time, warnings; sys.path.insert(0,"."); warnings.filterwarnings("ignore") import numpy as np def log(m): print(m, flush=True) from pydeepmapper.io import load_10x_populations, highly_variable_subset from sklearn.model_selection import train_test_split from tabfm import TabFMClassifier, tabfm_v1_0_0_pytorch ...
0cae98e385a4c6e6b0852c87e4dfcfe53cfe576a73764f10ec1fc0ec108ecf44
Python
1,130
46
"""2D fluorescence deconvolution using the waveorder API.""" from waveorder.api import fluorescence settings = fluorescence.Settings( transfer_function=fluorescence.TransferFunctionSettings( yx_pixel_size=0.1, z_pixel_size=0.25, z_focus_offset=0, wavelength_emission=0.532, ...
a259ec73fc86bd606919eb745eecbbb5c56fcf42338760d516acc22411b52018
Python
1,130
30
import argparse from pensa.preprocessing import load_selection, extract_coordinates # -------------# # --- MAIN --- # # -------------# if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--sel_base", type=str, default='protein and ') parser.add_argument("--sel_file", type=...
e9f8d51ec3cbd571ad0d5441afa4f0aaf1bdae54547dcb2199679cb34c3fc620
Python
1,130
38
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import ( TelegramChatApiLoader, TelegramChatFileLoader, ) from langchain_community.document_loaders.telegram import ( concatenate_row...
6ea77d5aad46749f67311da62662f00981a7e3f6958a7b1ea849b5b65a639c6f
Python
1,131
52
""" This example shows how to do basic micro-manager introspection using pycro-manager. """ from pycromanager import Core # Connect to MM. core = Core() # Current configuration. def current_config(): devices = core.get_loaded_devices() for i in range(devices.size()): devstr = devices.get(i) ...
d3984577acae3ae80dccd36c0def67cb7ec894e09f93eb263f75baf0122e2854
Python
1,132
46
import hexalattice.hexalattice as hex from voxcell import VoxelData from scipy.spatial import KDTree import flatmap_util as fmutil import numpy as np import math import sys flatmap_nrrd = sys.argv[1] output_nrrd = sys.argv[2] hex_diam = 0.07 if len(sys.argv) > 3: hex_diam = float(sys.argv[3]) # rule of thumb hex...
ead6e64a3f9abd19d76ecb3d25bb699820edce49684664d49f54226fa95b05f1
Python
1,133
35
from pycromanager import ZMQRemoteMMCoreJ, JavaBackendAcquisition, multi_d_acquisition_events, start_headless import time mm_app_path = 'C:/Program Files/Micro-Manager-2.0' config_file = mm_app_path + "/MMConfig_demo.cfg" # start_headless(mm_app_path, config_file, debug=True) # mmc = Core() # mmc.set_property('Z', 'U...
37259ad24f5301a4da96ebb441a2978ceb222f2bd9200e40b56b2d7480d5a971
Python
1,134
35
from .ori_QHNet_wo_bias import QHNet as QHNet_wo_bias from .ori_QHNet_with_bias import QHNet as QHNet_w_bias __all__ = ['QHNet_w_bias', 'get_model', 'QHNet_wo_bias'] # version: wo bias and with bias model are used to load the model for the paper reproduction # QHNet is the clean version, and we use QHNet to build th...
7d2e20feea7b59a1933037959cbbf8ceda1ea013e2e568a87a07da3cfaafd3d4
Python
1,135
29
from langchain_core.documents import Document from langchain_core.language_models import FakeListLLM from langchain_core.prompts import PromptTemplate from langchain_classic.chains import create_history_aware_retriever from tests.unit_tests.retrievers.parrot_retriever import FakeParrotRetriever def test_create() -> ...
931bd9e675c7e9a6189503b08463519649b078ae80396429d333f45fa9ff6281
Python
1,135
36
import os import cv2 from glob import glob,iglob from tqdm import tqdm from joblib import Parallel,delayed from engine import utils from constants import COVID_KAGGLE_DIR,COVID_XRAY_SZ from constants import BASE_DATA_DIR def resize_covid_kaggle_images(): dst_folder = utils.get_prepared_path('%scovid_kaggle_...
f0bf4b94850ca2b7ee752af46430807c675e1812aa011444e5dbd344e17efcdd
Python
1,135
30
import numpy as np import pandas as pd def augmente_data(raw_df, x_cols, y_cols, n_augmented=0, y_std_cols=None, x_std=0, y_std=0, id_col='sID', da_col='DA#', random_state=None): if y_std_cols is not None: y_std_df = raw_df[std_cols] else: y_std_df = np.ones...
397f8bf34a04754af8c9ff83172b7227c426a8342acddb5d7bb3598624643206
Python
1,136
42
import sys import numpy as np import torch import torch.nn as nn import joblib from dt_utils import Timer from data_utils import generate_recognition_data from plastic import PlasticNet from neural_net_utils import random_weight_init d = 50 #length of input vector R = int(sys.argv[1]) #repe...
6084cc72f056cdfb006ae0c25e91bcbfcbec23f50d834e42c01df4a80fcfbfcb
Python
1,136
29
import argparse import pandas as pd from preparation.dataset_functions import create_stratified_splits_master_file, replace_dict def main(): # Set up the argument parser parser = argparse.ArgumentParser(description="Generate master split file for BCN_20K dataset.") parser.add_argument("--input_csv", type=s...
6bdcd69447dcd439aa8b573bc2d737fafc78c48b6babd81c224f255160d15740
Python
1,137
27
# This module is used to obtain the absolute position information of the entire protein sequence and pockets def get_pro_seq(path): aa_codes = { 'ALA': 'A', 'CYS': 'C', 'ASP': 'D', 'GLU': 'E', 'PHE': 'F', 'GLY': 'G', 'HIS': 'H', 'LYS': 'K', 'ILE': 'I', 'LEU': 'L', 'MET': 'M', 'ASN': 'N'...
63a251b2a967fd1ebe425c05871cdaeebb7fd1b0f1b2496baf8bdb3db8f7e5ca
Python
1,138
40
from functools import partial import torch import torch.nn.functional as F from torch.autograd import Variable from utils_for_tests import compare_vars from neuralpredictors.layers.cores import TransferLearningCore def test_detached_mode(): model = TransferLearningCore( input_channels=1, tl_mode...
d05bd41e9dccead8823dc7efac017be00fabd2be1f7ea41b8a54ebbe4e19c1f3
Python
1,138
44
# File to deal read and write the .mask extensions import zlib import numpy as np from concurrent.futures import ThreadPoolExecutor, wait _executor_pool = ThreadPoolExecutor(max_workers=16) def read_mask_file(filepath, out): """Load mask file to numpy array Parameters ---------- filepath : str ou...