sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
fed61f7cd59871fb39c22c72744ffebe7557cdc9eacc2b48398769e06601822b
Python
945
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.callbacks.streamlit.mutable_expander import ( ChildRecord, ChildType, MutableExpander, ) # Create a way to dynamically look up deprecated imports. # Used...
094c7bc535c7251d00e5cd9cf1f06cde746f9e497b99f51a9b7b3a656ed9b9c3
Python
946
36
"""Test suite for the util module.""" import os from nose.tools import with_setup from ..utils import path def f_setup(): """Creates test file in `./data/` dir.""" open("../data/test.txt", "w") def f_teardown(): """Removes test file from `./data/` dir.""" files = os.listdir("../data/") if "test...
114342e246d824a903ab325dfd0cb7638bea70b0a5aeb089e6ac1e5aca204be8
Python
946
32
''' Module initializer includes all sub-modules. :Version: 1.0 :Date: 06.06.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 Jan Melchior This program is free software: you can redistribute it and/or m...
1eb9d7da062e6cdba04da7c83d3f1cf10bb0204b541de19732e08c7b01efaebd
Python
946
32
''' Module initializer includes all sub-modules. :Version: 1.0 :Date: 08.02.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 Jan Melchior This program is free software: you can redistribute it and/or m...
784eb2348138e9b39a990100cc0527710b6e58f4231b93b8d8aaedd2ab553ba4
Python
946
23
import glob import os import subprocess import pandas as pd from tqdm import tqdm list_biscov = glob.glob('./data/**/*bismark.cov*', recursive=True) +\ glob.glob('./data/**/*bismark.sort.cov*', recursive=True) list_xbpwin = glob.glob('./data/**/*bpwin.bed*', recursive=True) for winbp in tqdm(['100','500','1000']): ...
8c2db49ee23fc2534d4cbe672ca2b3d286c0aa6a0b9ae547e018a1520c600f64
Python
946
25
# Copyright 2022 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 writi...
1f8bb1bc3a74bb8eadf3692488ce17dfdc92c25ad2f00900d5187d056b8354d3
Python
947
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.retrievers.web_research import ( QuestionListOutputParser, SearchQueries, WebResearchRetriever, ) # Create a way to dynamically look up deprecated import...
45ce180a01650b151e02f78d17a1e5905065ccd71798e58295309a487f02717f
Python
947
47
''' Created on Oct 17, 2011 @author: yjin ''' def base_m(m_ref1,m_ref2): target = [] for i in range(len(m_ref1)): target.append((m_ref1[i]+m_ref2[i])/2) return target def raw_count_mean(m_ref1,m_ref2,norm_ref) : target_ref = [] for i in range(len(m_ref1)): target_ref.append(raw_...
e1e1e8c0b1dd7eede87fab87dc764161d0ebcbee18d6652ec67bbb28802f3a56
Python
947
39
import sys sys.path.append("/yourpath/comformer") from comformer.train_props import train_prop_model props = [ "formation_energy_peratom", "optb88vdw_bandgap", "bulk_modulus_kv", "shear_modulus_gv", "mbj_bandgap", "slme", "magmom_oszicar", "spillage", "kpoint_length_unit", "encu...
c3e87ce51a8be4995468a56a409e4dfe956ea2321732dfc4be8326f9a9ab5285
Python
948
25
# third party modules import numpy def visualizeMesh(mesh, data=None, color_map='seismic', shift_axis='x', **kwargs): if data is None: return mesh.show(**kwargs) try: import trimesh except ModuleNotFoundError: raise ModuleNotFoundError("The dependency 'Trimesh' is required for this ...
00f5088c7df22dbe6950a3b247e1b96f1ff9b9324209b28da982b1b1abedd1df
Python
949
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.callbacks.aim_callback import ( AimCallbackHandler, BaseMetadataCallbackHandler, import_aim, ) # Create a way to dynamically look up deprecated imports. ...
067b19fcf45167d2feb079b2ef35354056ab98952e7e3a34a6f489a5a898ac76
Python
950
35
import pandas as pd pd.set_option('display.max_columns', None) pd.set_option('display.max_rows', 80) import re from IPython.core.interactiveshell import InteractiveShell InteractiveShell.ast_node_interactivity = "all" # more inclusive all_df = pd.read_csv('ALL_SOURCES_ALL_FREQUENCIES_genes_to_phenotype.txt', sep='\t...
1f2086ff098b4ebc21318c908ef0a16dd8763e86b1de5b3481deee686ee4c052
Python
950
28
### Revert ordering and save likelihoods import sys sys.path.append('/project/src/python/') from pathlib import Path import mlflow.pytorch import torch import numpy as np run_dir="get_likelihood_ADHD200_8" transformer_uri="/project/mlruns/0/281c9ece0d8f44d6b05f4ce1836fda35/artifacts/final_model" output_dir = Path("...
e841e25535ee8e9171bb7c4e69045ba743aebe22584e3cb10dfea50d4f73fdd5
Python
950
35
def plot_roi_step(roi_path, template_path, title=None, cut_coords=(0, -34, -9), cmap='autumn', threshold=0.0, draw_cross=False, save_path=None): ''' Plot an ROI mask over a template brain and optionally save the figure. ''' from nilearn import plotting, image import matplotlib.pyplot as plt im...
b48d399339fe8a2f6238507421550eded17bb619db993876c7ebc7a2f8b12776
Python
951
31
import os import random import shutil def obtain_files_list(): for root, dirs, files in os.walk(test_set_path): return files def move_step_files(move_list): for file_name in move_list: move_file = test_set_path + "\\" + file_name new_path = val_set_path + "\\" + file_name shu...
0c403ce5440950ddaf143c0fada0e17001277395dc85e9cdd2c08b7a8a5ea929
Python
952
28
#!/usr/bin/env python import os import tempfile class IntersectedBED: @staticmethod def intersectRegions(snps, regions, bed, wb = False): if os.system("bedtools intersect -a \"{snps}\" -b \"{regions}\" -wa {wb} | sort | uniq > {bed}".format( snps = snps, regions = regions, bed = bed, wb =...
28d98d28b267372ea3417b41b900d9e8f3fe65dbc7b79d0e96b3037173343cf2
Python
952
29
"""Signature inspection that does not evaluate annotations.""" import inspect import sys from collections.abc import Callable, Mapping from typing import Any if sys.version_info >= (3, 14): from annotationlib import Format def _signature_parameters(obj: Callable[..., Any]) -> Mapping[str, inspect.Parameter]: ...
0b634fa5f46725e9b54b055b28fabec185b7b045c23f77eb7ca9e473df4b3c7a
Python
953
29
from mimic3models import common_utils import numpy as np import os def load_data(reader, discretizer, normalizer, small_part=False, return_names=False): N = reader.get_number_of_examples() if small_part: N = 1000 ret = common_utils.read_chunk(reader, N) data = ret["X"] ts = ret["t"] la...
d540578e6839eba8f1363da502aeef28f1eeb245964ef0c19ca504134c384805
Python
956
28
from tensorflow.keras import layers from tensorflow.keras.models import Sequential class ReadoutLayer(layers.Layer): def __init__( self, hidden_size, num_readout_fc_layers, name='readout_layer', num_targets=12, activation=None, kernel_initializer='glorot_uni...
8590e94c3cc1f92843eed2240685f47d7af60ae8e622b021a7339101486e2819
Python
957
36
#### Combine data import session_info import polars as pl import pandas as pd def load_data(tissue, dx): new_dx = dx.replace("SZD", "SZ") fn = f"../../_m/{tissue.lower()}/{dx}/zsummary_table.tsv" return pl.from_pandas(pd.read_csv(fn, sep='\t')\ .reset_index()\ ...
da6f9a144fc2252f801f3a1ca2469d40eec0b5dde3254c3f458281eb5c4661ee
Python
959
22
import numpy as np from sys import argv argc = len(argv) fit_r0_file = argv[1] fit_r1_file = argv[2] fit_err_file = argv[3] fxlen = int(argv[4]) fit_r0 = np.fromfile(fit_r0_file, dtype=np.float32).reshape((fxlen, fxlen)) fit_r1 = np.fromfile(fit_r1_file, dtype=np.float32).reshape((fxlen, fxlen)) fit_err = np.fromfile...
3ea3d853ec9f40f648250e2c2daa076bb7b4fe5c1ecc6e5fd775a15930e42a0f
Python
960
33
class BoundingBox: def __init__(self, classID, confidence, x1, x2, y1, y2, image_width, image_height): self.classID = classID self.confidence = confidence self.x1 = x1 self.x2 = x2 self.y1 = y1 self.y2 = y2 self.u1 = x1 / image_width self.u2 = x2 / ima...
7b6f3cb51e3eb889201b7a7cae9860a9114db7b83cac183b0e0bc46c6c92981e
Python
961
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores import TencentVectorDB from langchain_community.vectorstores.tencentvectordb import ( ConnectionParams, IndexParams, ) # Create a way to dynamic...
8d1fe55585411dcbc21885124a10ca64a563501518bd0c5193043f99c00f7805
Python
961
27
import pandas as pd import matplotlib.pyplot as plt df = pd.DataFrame({ "Ratio of training set" : [.0, .2, .4, .6, .8, 1], "Avg_pwn_one_inter" : [0.532047788, 0.612610353, 0.634283209, 0.663306835, 0.707324699, 0.734117295], # "Avg_pwn_no_inter" : [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }) plt.plot(df["Ratio of tr...
b3b7068fee1e9ecbddd58a458ea40bcaa30dc099add09adde58544607af1601b
Python
961
23
from train_prop import train_prop_model import yaml import argparse # Set up argument parser if __name__ == '__main__': parser = argparse.ArgumentParser(description='Training configuration of PotNet') parser.add_argument('--config', type=str, help='Path to YAML configuration file') parser.add_argument('--...
24d41740e12d406e2479b6682c3c65f91df9468b38662222c9e836836aff09b8
Python
964
29
clmns = ["290", "293", "296", "299", "302", "305", "308", "311", "314", "317", "320", "323", "326", "329", "332", "335"] threads = len(clmns) import pandas as pd import sys,os file_name = 'Cell' idf = sys.argv[1] + '_' + sys.argv[2] + '_' + sys.argv[3] at_least = 0 values = [] names = [] for i in range(th...
878b8ac21fd7246c62cd263fd690707d5e13fa6163148a1fdfdf2e8993fbf7fb
Python
964
34
import os import cv2 from glob import glob from tqdm import tqdm from joblib import Parallel,delayed from engine import utils from constants import NIH_DIR,CXRAY_SZ def resize_nih_images(): def resize_save(src): name = src.split('/')[-1].replace('.png','.jpg') dst = '%snih_images_320/%s'%(NI...
8b870b6b10392bb04ef1397b96a53df527af8842ac09a5cc855f3fc814afae32
Python
964
29
clmns = ["290", "293", "296", "299", "302", "305", "308", "311", "314", "317", "320", "323", "326", "329", "332", "335"] threads = len(clmns) import pandas as pd import sys,os file_name = 'Cell' idf = sys.argv[1] + '_' + sys.argv[2] + '_' + sys.argv[3] at_least = 0 values = [] names = [] for i in range(th...
8ed255ede9a0deb5ed9366a14095187b4ba396e16ff672cecaea858b03fca816
Python
964
29
clmns = ["290", "293", "296", "299", "302", "305", "308", "311", "314", "317", "320", "323", "326", "329", "332", "335"] threads = len(clmns) import pandas as pd import sys,os file_name = 'Cell' idf = sys.argv[1] + '_' + sys.argv[2] + '_' + sys.argv[3] at_least = 0 values = [] names = [] for i in range(th...
a8711e719e47752eba9959aaf178bcb0fbe661f9d6e6df657cc44cbe53059ec0
Python
964
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores import Redis from langchain_community.vectorstores.redis.base import ( RedisVectorStoreRetriever, check_index_exists, ) # Create a way to dynami...
ee440d3c3d09769fb2cf62c164d93cc465f2d92753b3f21258eab6dcd936f362
Python
964
35
import torch import torch.nn as nn from torch.autograd import Function class ReverseLayerF(Function): @staticmethod def forward(ctx, x, alpha): ctx.alpha = alpha return x.view_as(x) @staticmethod def backward(ctx, grad_output): output = grad_output.neg() * ctx.alpha re...
340ba75104c62ba329a3e0ac5e891a264093c17a88e71e61c4d0bd0d8a410757
Python
965
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import BearlyInterpreterTool from langchain_community.tools.bearly.tool import ( BearlyInterpreterToolArguments, FileInfo, ) # Create a way to dynamica...
ca5552c57bcebd71e0a15cc3270f02056e10fdd8de32b8355691cd0bfd71f847
Python
966
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.vectorstores.utils import ( DistanceStrategy, filter_complex_metadata, maximal_marginal_relevance, ) # Create a way to dynamically look up deprecated imp...
61e935130f8830b117daa554d003a99ff99bf9d8d8475cf387afb6f1cf2f0f58
Python
967
30
import pytest from langchain_core.utils.iter import batch_iterate @pytest.mark.parametrize( ("input_size", "input_iterable", "expected_output"), [ (2, [1, 2, 3, 4, 5], [[1, 2], [3, 4], [5]]), (3, [10, 20, 30, 40, 50], [[10, 20, 30], [40, 50]]), (1, [100, 200, 300], [[100], [200], [300...
2f2a94d05a674bc4a0816223c4b2f50eb0ea8a2ef281aedcce53a04aba087b3a
Python
968
38
from logging import Logger from pathlib import Path from typing import List from ..data import AnnotationTable, WorldlineTable, Annotation def insert_annotation( dataset: Path, annotations: AnnotationTable, worldlines: WorldlineTable, window_state, arg: str, logger: Logger ) -> List[dict]: ...
95a5ed2e7b45babf78df37f61a2313da7cb7daf016e12e1cac34ef74ef01f777
Python
968
34
"""Top-level package for MRdataset.""" __author__ = """Pradeep Raamana""" __email__ = 'raamana@gmail.com' # __version__ = '0.1.0' import logging import sys from MRdataset.config import configure_logger logger = logging.getLogger(__name__) logger = configure_logger(logger, output_dir=None, mode='w') from MRdataset....
99038d41b7c97851a363ccd549cea6be95aaf670d01f1121688e8772acb6b6c5
Python
968
25
# this is a class to contain all parameters for a run # it also contains parameters generated at runtime class RunParameters: # empirical hyperparameter 0.001; 1000; 10000; 512*4 LEARNING_RATE = LR = 1 * 10 ** -3 BATCH_SIZE = 1000 MAX_EPOCHS = 10000 FINGERPRINT_VECTOR_SIZE = FP_SIZE = 512 * 6 # ...
33d84783ca2cb929b51f89b4b5eeb4f873fdd798a3ba280d2344d27f6c598046
Python
969
25
"""Test conversation chain and memory.""" from langchain_core.documents import Document from langchain_core.language_models import FakeListLLM from langchain_core.prompts.prompt import PromptTemplate from langchain_classic.chains import create_retrieval_chain from tests.unit_tests.retrievers.parrot_retriever import F...
58076cd6cf675dfce6330021a729b690d63b30bee12ebdb3cb9a36c53a3fce81
Python
969
38
""" This script consolidates qc reports from individual samples into one report Usage: python3 consolidate_qc_report.py --qc_dir qc_logs --output_name Sinai_batch1_qc_info_bic.csv """ import argparse import os import pandas as pd def main(): parser = argparse.ArgumentParser() parser.add_argument( '-...
8d5e2ee81c27342b07bc2b2ae7a2268d3d3393b84a693165b04e8d1dc0275761
Python
969
23
from EPI_MRI.EPIMRIDistortionCorrection import * from optimization.GaussNewton import * from optimization.LinearSolvers import * import torch device = 'cuda:0' if torch.cuda.is_available() else 'cpu' # load the image and domain information # change this function call to be the filepath for your data data = DataObject...
385e43c28dc13672acd45b3301e7313c2c6200c259be3bbfa2e5d72130f9aea4
Python
970
32
from LSTM import preprocess, train from utils import * from DirStrategy import get_pre_len setting = { 'train_size': 0.8, 'epochs': 100, 'input_size': 60, 'batch_size': 16, 'pre_len': 1, 'fileName': "", 'model_name': 'cnn-lstm', 'checkpoint_ro...
17ea710dfe62e43f5a57da0251dc35a3028785918cebd8fe2b253d20bf76ecfe
Python
971
40
#!/usr/bin/python # see https://github.com/fabridamicelli/kuramoto from SMdRQA.RQA2 import RQA2, RQA2_simulators, RQA2_tests, RQA2_ml from kuramoto import Kuramoto, plot_phase_coherence, plot_activity import numba import ast import memory_profiler from scipy.interpolate import pchip_interpolate from functools import p...
53b33549c6a3195099051d3fedc30809c95c416db172fbccd6a275e7345dda28
Python
971
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chains.openapi.requests_chain import ( REQUEST_TEMPLATE, APIRequesterChain, APIRequesterOutputParser, ) # Create a way to dynamically look up deprecated ...
61532e5dc1dcc058c858fff39a527b03d86a88251662f0b82f50b42bdad1c012
Python
971
37
import hydra from hydra.core.config_store import ConfigStore from config import Scenario from model import Net from make_data import make_data from train import Trainer from analyzer import Analyzer from utils import plot import numpy as np import torch import time import os cs = ConfigStore.instance() ...
9c6900ff96e50461a9888a7a1344287d220b6784650964720d9207f21757dca2
Python
971
33
"""Package version information.""" from typing import Optional def _get_version() -> Optional[str]: """ Retrieve the package version. Using setuptools-scm dynamically sets the package version depending on the latest git release and commits since that point. This function returns the current versi...
aba298e1158413c7da9b00fb7be94263137a76a58a8401f0bc6ab964d6458968
Python
971
35
# -*- coding: utf-8 -*- """ Created on Thu Aug 31 13:35:22 2023 @author: biener """ import os import numpy as np import mAECell_Utils as utils import re File_Names = utils.fOpen(Title = 'Load Data File') # directory/folder path dir_path = os.path.dirname(File_Names) Data_fName = os.path.basename(F...
eb08ef0087508d1ae7d4c158734a650f77b587fd61089c344b291a5974e8d8fe
Python
971
38
from synister.catmaid_interface import Catmaid import numpy as np from get_neurotransmitter import catmaid_transform import configargparse import csv p = configargparse.ArgParser() p.add("-s", required=True, help="FAFB skid") p.add("-o", required=True, help="out file") p.add("-n", action='store_true', ...
5ea329c78582c40389266866e040e56e7cedcb2b4e5749452974a0ae26d7dd9f
Python
972
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import NotebookLoader from langchain_community.document_loaders.notebook import ( concatenate_cells, remove_newlines, ) # Create a way to dy...
757209dcf72d9ec31f7b8b7bedb03fbba0aa1222794385e2e8a78be50502e1e0
Python
972
34
"""Package version information.""" from typing import Optional def _get_version() -> Optional[str]: """ Retrieve the package version. Using setuptools-scm dynamically sets the package version depending on the latest git release and commits since that point. This function returns the current vers...
c80eda0e87d6393d3fae2ae01334ce23c3907335fa74ca4e3b7f2c37df0c6742
Python
972
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import LakeFSLoader from langchain_community.document_loaders.lakefs import ( LakeFSClient, UnstructuredLakeFSLoader, ) # Create a way to dy...
db08cf0ce6333b8d8d4fa80931fc9d02da9153906e08ab53310cf288b456b34f
Python
972
42
import logging.config import os import torch import random import numpy as np DEFAULT_RANDOM_SEED = 42 log_config_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'logging.conf') if not os.path.isfile(log_config_path): raise IOError log_output_path = "logfile.log" ...
3d77d4465f74226397afb80f7dbac8824ce26a12b4fad20b655b7a9c7ee3058e
Python
973
28
from tensorflow.keras import layers from tensorflow.keras.models import Sequential class ResidualLayer(layers.Layer): def __init__( self, tensor_size, name='residual_layer', activation=None, use_bias=True, kernel_initializer='glorot_uniform', bias_initialize...
94fbfb11207449c200eb19e87c8c05f934f4c44779d2dba9bc53d979f66a47e3
Python
973
33
""" Transplant of pregenerated barrel annotations into the annotation_10.nrrd file. This script overwrittes parts of the SSp-bfd (primary somatosensory barrel cortex) with new barel column in the mouse annotations in place, following the indices in hierarchy.json. Input files: - annotation_barrels.nrrd - annotatio...
538f3f6e18cad7f3a54b3956bdf0b18b343266edca1284397b47c2a7ea625192
Python
974
29
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chains.openapi.response_chain import ( RESPONSE_TEMPLATE, APIResponderChain, APIResponderOutputParser, ) # Create a way to dynamically look up deprecated...
0e464fa7d704566b27cfd48cd71b6e79f1ff7c6405bc0d96b69446ea278f3c1b
Python
975
39
"""Document loaders.""" from typing import TYPE_CHECKING from langchain_core._import_utils import import_attr if TYPE_CHECKING: from langchain_core.document_loaders.base import BaseBlobParser, BaseLoader from langchain_core.document_loaders.blob_loaders import Blob, BlobLoader, PathLike from langchain_co...
2716d71feec76b02ebae2d45264a438ff6c80856b0f55f83a4083d5e30923267
Python
975
30
# #! /bin/env python # # # # Michael Gibson 27 April 2015 # # modified by jz103 Dec 20 2021 # import numpy as np # import scipy.signal as signal # def notch_filter(input, fSample, fNotch, Bandwidth): # """Implements a notch filter (e.g., for 50 or 60 Hz) on vector 'input'. # fSample = sample rate of data (i...
f98be17d3e26b6a3a6bad5abe78822f6f849671777f6518756d22531b9c76bc9
Python
975
28
import warnings from unittest.mock import MagicMock, patch class TestHubPullDeprecation: """Tests that `hub.pull` is deprecated in favor of the LangSmith SDK.""" def test_pull_emits_deprecation(self) -> None: from langchain_core._api import LangChainDeprecationWarning from langchain_classic....
99d93a946a6fca07acf8c9ac8f02c22a868d12628f69d12495dfe655c58ad6f6
Python
976
30
import numpy as np from napari_svetlana import napari_get_reader # tmp_path is a pytest fixture def test_reader(tmp_path): """An example of how you might test your plugin.""" # write some fake data using your supported file format my_test_file = str(tmp_path / "myfile.npy") original_data = np.random....
c91b7e38d318dd5f2cb2cd0134978e76a6bbeeef925a8a023726a3619e4bd362
Python
976
44
import click import pandas from pathlib import Path @click.command() @click.argument( "amber_frcmod_path", type = click.Path(), ) def main(amber_frcmod_path): ion_nb_params = list() nonbonded = False with open(Path(amber_frcmod_path), "r") as amber_frcmod_file: for line in amber_frcmod_f...
021cbbd485d6f2f8a882ac48b2bc675e49aab921df2eeb013adbc75d5613046a
Python
977
33
import pandas as pd from sklearn.impute import SimpleImputer, KNNImputer def impute(df, imputation): """ Apply imputation method to a DataFrame with missing values. Parameters: df (pd.DataFrame): Input data. imputation (str): Method to use: 'none', 'zeros', 'median', or 'knn'. ...
2d9135b11a56e640c56e0029ae64a8973b7800de15d23ca2594345b547c1838d
Python
980
29
clmns = ["1160", "1163", "1166", "1169", "1172", "1175", "1178", "1181", "1184", "1187", "1190", "1193", "1196", "1199", "1202", "1205"] threads = len(clmns) import pandas as pd import sys,os file_name = 'Cell' idf = sys.argv[1] + '_' + sys.argv[2] + '_' + sys.argv[3] at_least = 0 values = [] names = [] f...
2f6ec1e75f2becaf8531ce8a9a152a5bb626614fbacb81f5710171cfdde6ce8a
Python
980
29
clmns = ["1160", "1163", "1166", "1169", "1172", "1175", "1178", "1181", "1184", "1187", "1190", "1193", "1196", "1199", "1202", "1205"] threads = len(clmns) import pandas as pd import sys,os file_name = 'Cell' idf = sys.argv[1] + '_' + sys.argv[2] + '_' + sys.argv[3] at_least = 0 values = [] names = [] f...
549ff5b7843720737608a2a99b8bcd75c461a724634d583b9ee91c2ff6736f4d
Python
980
29
clmns = ["1160", "1163", "1166", "1169", "1172", "1175", "1178", "1181", "1184", "1187", "1190", "1193", "1196", "1199", "1202", "1205"] threads = len(clmns) import pandas as pd import sys,os file_name = 'Cell' idf = sys.argv[1] + '_' + sys.argv[2] + '_' + sys.argv[3] at_least = 0 values = [] names = [] f...
f7f7940947d1e04b355e54a408ea2cc4bf23c000f3b9940bb2bcf52d60f8befc
Python
982
31
"""Test formatting functionality.""" import pytest from langchain_core.utils import formatter def test_valid_formatting() -> None: """Test formatting works as expected.""" template = "This is a {foo} test." output = formatter.format(template, foo="good") expected_output = "This is a good test." a...
08074288571246c18f2714720e6150e7de7dba39409aac3dc030e9997a08e5b0
Python
983
33
''' Module initializer includes all sub-modules. :Version: 1.0 :Date: 08.02.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 This program is free software: you can redistribute it and/or modify ...
6e0de5ee9e98f8891be85a828069033dbbc30399222f4e6ae33be0a9f876279a
Python
984
22
from EPI_MRI.EPIMRIDistortionCorrection import * from optimization.ADMM import * import torch device = 'cuda:0' if torch.cuda.is_available() else 'cpu' # load the image and domain information # change this function call to be the filepath for your data data = DataObject('../data/156334_v.nii.gz', '../data/156334_-v.n...
c581652ecbcf22d3aa24f648ba475f6ceafeb52ea1d273442217b07169233d3b
Python
984
32
import numpy as np from torch.utils.data import Dataset from genie.utils.data_io import load_coord class SCOPeDataset(Dataset): # Assumption: all domains have at least n_res residues def __init__(self, filepaths, max_n_res, min_n_res): super(SCOPeDataset, self).__init__() self.filepaths = filepaths self.max...
dcc3f18ed290c28200ccd73ae4c4588a4f41b533cd8f42a075aa13305bc79785
Python
984
32
""" This script generated input json files for a set of files for computing md5sums Usage : python make_json.py comma_separated_list_of_files path_to_run_folder """ import sys import os import simplejson def main(): filelist = sys.argv[1].split(",") output_path = sys.argv[2] os.chdir(output_path) for...
24e694fab9381d5085e5188b017fb641405e70eb6e448efbb0a3e142112850da
Python
985
25
import numpy as np import omicscope as omics np.seterr(divide='ignore', invalid='ignore') class TestOmicScope(object): def test_user_input_stat(self): progenesis = omics.OmicScope(Table='tests/data/proteins/progenesis.xls', Method='Progenesis', ...
e1f63ecacd49c7999cca70eeeb674c401f76f2b48aeffbf88058be530c96d744
Python
985
33
''' Module initializer includes all sub-modules. :Version: 1.0 :Date: 08.02.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 This program is free software: you can redistribute it and/or modify ...
4cc523a384f3bc106f259e3cf181a28712dc992a592a2dee9d71595f96c29ba8
Python
986
34
from torch import nn class SqueezeExcitationBlock(nn.Module): def __init__(self, in_ch, reduction=16): """ A squeeze and excitation block as proposed by https://arxiv.org/abs/1709.01507 Args: in_ch (int): number of input channels reduction (int): reduction factor to...
604170351b8ea5b3fb52994c0efddebf2681caa91e64a6b0ce968a629cc880df
Python
987
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.retrievers import AmazonKnowledgeBasesRetriever from langchain_community.retrievers.bedrock import ( RetrievalConfig, VectorSearchConfig, ) # Create a way to...
ab01dbac521c7a4e013269d95b84a0699a24e60890191b62c202a2f72fed5eae
Python
988
40
from langchain_classic.agents import agent_toolkits EXPECTED_ALL = [ "AINetworkToolkit", "AmadeusToolkit", "AzureCognitiveServicesToolkit", "FileManagementToolkit", "GmailToolkit", "JiraToolkit", "JsonToolkit", "MultionToolkit", "NasaToolkit", "NLAToolkit", "O365Toolkit", ...
c36103c1ae509623a7585eb231c9b883f18dbe2334f1afad93e89aae70bb164c
Python
988
31
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from MEnet import utils, _version import os import argparse def tile(args): f_input = args.input tile_bp = args.bp print(f_input, tile_bp) if os.path.exists('{n}.tile{t}bp.csv'.format(n=f_input.split('.bis')[0].split('_bis')[0], t=tile_bp)): prin...
6858fdc0e68dd4a3383765709ccdca15b739cfaea00efb90201b86b8f87b95ce
Python
990
26
import sys import os import os.path ###############################################To convert neoloop CNV segment to circos format CNV## new format CNV outputs are located in the same folder with old########## inputdir=sys.argv[1] ##########################'/home/uni08/txie/analysis/Pan/08trans/cnv' def g...
94da36b979af449cde3aec307ea66eb732d1cfb490dff8672aa1d302f63807d0
Python
991
33
# coding: utf-8 """ MIT License """ ''' Project: Parenchymal Attention Network Authors: Axel Masquelin Description: Utility functions to plot metrics ''' # Libraries # ---------------------------------------------------------------------------- # from sklearn.metrics import roc_curve, auc, confusion_matrix ...
04a15b8b11708108277e2b59d313e78921a8dde4590c855fdcbbe81c043524e3
Python
992
38
"""Slack tools.""" from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ( SlackGetChannel, SlackGetMessage, SlackScheduleMessage, SlackSendMessage, ) # Create a way to dynamically look...
9f8ada61a57f55eeeb79e7ceb957ca8c9f140961d2da14b8d012760ac818c521
Python
993
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.parsers.audio import ( OpenAIWhisperParser, OpenAIWhisperParserLocal, YandexSTTParser, ) # Create a way to dynamically look up deprecate...
993642747c6c0b26f84441a625b9a6df999b6a76b82a340c32e89de04980ab7c
Python
994
22
import os from django.db import models def get_upload_path(instance, filename): return '/'.join(filter(None, ('mapping/files', filename))) class Map(models.Model): PROBE_TYPES = [ ('neuronexus_a1_32_poly2', 'Neuronexus_A1_32_Poly2'), ('cambridge_h7b', 'Cambridge_H7b'), ] probe_...
9997e7b61b0f34eccbab734c38944e45c0cdaabb0ddb069c23a64eaf7dfd7077
Python
994
33
''' Module initializer includes all sub-modules. :Version: 1.0 :Date: 08.02.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 Jan Melchior This program is free software: you can redistribute it ...
202ffe47e7d2417ed754a1d93ed792dec1ad0be7084b2d027ae0611d90e3bfaa
Python
995
41
#! /bin/env python # # Michael Gibson 23 April 2015 import sys, struct, os def read_qstring(fid): """Read Qt style QString. The first 32-bit unsigned number indicates the length of the string (in bytes). If this number equals 0xFFFFFFFF, the string is null. Strings are stored as unicode. ""...
303da0fe0a1122e6857403139c774ceb0ad0c8fca147d8f015623e17094b277b
Python
996
27
# Method for unpickling probabilities/logits saved in process of evaluation. import pickle # Example of unpickle FILE_PATH = 'probs_resnet110_c10.p' # Open file with pickled variables def unpickle_probs(file, verbose = 0): with open(file, 'rb') as f: # Python 3: open(..., 'rb') (y_probs_val, y_val), (y...
985da766864b6f252f929b102fcded128e7863865f1be077ca097727bc9fce69
Python
996
38
from langchain_classic.evaluation import __all__ EXPECTED_ALL = [ "EvaluatorType", "ExactMatchStringEvaluator", "RegexMatchStringEvaluator", "PairwiseStringEvalChain", "LabeledPairwiseStringEvalChain", "QAEvalChain", "CotQAEvalChain", "ContextQAEvalChain", "StringEvaluator", "Pa...
e5b34c896cad6e3aa30a92c8f2bf58fb9cbc0682a2a960ba9b00584144f6b4e5
Python
998
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import E2BDataAnalysisTool from langchain_community.tools.e2b_data_analysis.tool import ( E2BDataAnalysisToolArguments, UploadedFile, ) # Create a way ...
692fb067f242567a953f290c70394f07d31246d273630c4497e41987e642027f
Python
999
28
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name = 'vmdpy', packages=setuptools.find_packages(), version = '0.1', description = 'Variational Mode Decomposition (VMD) algorithm', url='http://github.com/vrcarva/vmdpy', ...
7b6b1a08dd452c796480231c60749ecf2fa7c9f990d569eee832ec545364b1d1
Python
1,000
22
# Copyright 2022 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 writi...
bce500a19cc65a9f4f847a69b2066201abd38e054b8df29396f12f6a31d217aa
Python
1,001
27
import numpy as np from scipy.signal import filtfilt __author__ = 'Reza Sameni' __source__ = 'The Open-Source Electrophysiological Toolbox (OSET) - https://github.com/alphanumericslab/OSET' __reference__ = 'Mitra, S. (2010). Digital signal processing (4th ed.) New York, NY: McGraw-Hill Professional.' def lp_filter_ze...
e2ed2df9bc478365cb90afb49acd816ff082e6bf9d2ae0b0a2c8e9b6c3220ce1
Python
1,001
38
import numpy as np import tensorflow as tf from tensorflow.keras import Model from tensorflow.keras.layers import Add, Dense, Input, Subtract from explainability.utils import infer_graph_structure def test_infer_graph_structure(): i1 = Input((5,)) d1 = Dense(5)(i1) c1 = tf.constant(np.arange(5).reshape(...
3e846d93380a34b4256aa8a377b7f77a27b9eff2d265fb76fefcbb61605a25d6
Python
1,003
34
import numpy as np import scipy.sparse as sp #################################################### # This tool is to generate meta-path based adjacency # matrix given original links. #################################################### pa = np.genfromtxt("./dblp/pa.txt") pc = np.genfromtxt("./dblp/pc.txt") pt = np.gen...
ea45d92b80905dd010e8b4deac259b24d56cf520af37debe1890239f5526b888
Python
1,004
33
''' Module initializer includes all sub-modules. :Version: 1.0 :Date: 08.02.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 Jan Melchior This program is free software: you can redistribute it and/or m...
4b3333870981a76ac289b768093ec4a2ef1149ce3f79a9ba69b90142681bdbba
Python
1,005
27
"""Logic for formatting intermediate steps into an agent scratchpad. Intermediate steps refers to the list of (AgentAction, observation) tuples that result from previous iterations of the agent. Depending on the prompting strategy you are using, you may want to format these differently before passing them into the LLM...
adbcd32988f0965a6f3614ee9c22534e20afba1070e3fc337c602b81325b22a9
Python
1,005
33
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.callbacks.human import ( AsyncHumanApprovalCallbackHandler, HumanApprovalCallbackHandler, HumanRejectedException, ) # Create a way to dynamically look up...
0b5eb546ef0794518c30fa2ba6462d7eab67953409b254ecca94d0ae600bf5d5
Python
1,006
34
import os import re import argparse def main(): parser = argparse.ArgumentParser() parser.add_argument('log', type=str, nargs='+') args = parser.parse_args() if not isinstance(args.log, list): args.log = [args.log] for log in args.log: if log.find("renamed") != -1: pr...
dd02da3baf30abe050ba64dce30b83c9c3ae9e7c04b33cf4ac69044d35565fb3
Python
1,007
19
import argparse args = argparse.ArgumentParser(description='config of VGG on fMRI') args.add_argument('--feature_map', default='all', help='feature map of dataset--all, ALFF, fALFF, ReHo, VMHC') args.add_argument('--model', default='VGGgap', help='name of model--VGG, VGGgap') args.add_argument('--lr', type=float, defa...
e9c362caa5267148951eed0e8fb57582f42454345f1d9f787417525ae17dc8ec
Python
1,007
32
""" SMdRQA interactive UI. Launch with ``smdrqa-ui`` or ``python -m SMdRQA.ui`` (requires the ``ui`` extra: ``pip install SMdRQA[ui]``). This package deliberately avoids importing streamlit at package level so that ``SMdRQA.ui.recorder`` and ``SMdRQA.ui.sensitivity`` stay usable (and testable) without the UI dependen...
3e0223e7381625f3869bdf577094235edf93f379c60b6e52f9889b7ad9c779d2
Python
1,009
38
#### Combine data import session_info import polars as pl import pandas as pd def load_data(tissue, dx): new_dx = dx.replace("SZD", "SZ") fn = f"../../_m/{tissue.lower()}/{dx}/zsummary_table.tsv" return pl.from_pandas(pd.read_csv(fn, sep='\t')\ .reset_index()\ ...
29c39aae390f427b9821f8fc2409545e6051480e967fea9e5a72986f55dd7347
Python
1,010
35
"""3D phase reconstruction using the waveorder API.""" from waveorder.api import phase settings = phase.Settings( transfer_function=phase.TransferFunctionSettings( wavelength_illumination=0.532, yx_pixel_size=0.1, z_pixel_size=0.25, numerical_aperture_illumination=0.9, nume...
ea5df7fc9da180aaf62948e9b7659f5804995b391f15e835b72d2ee405919b62
Python
1,010
26
from neurovisfit.data import loaders from neurovisfit.data.dataset import DataSplit from neurovisfit.data.loaders import get_loader_split from neurovisfit.data.params import DataLoaderParams def test_get_loader_split(mock_image_cache, mock_toml_config): params = DataLoaderParams(**mock_toml_config.get_dict("some_...
67bad3789d43a9441ff1024e699125522bc1d5dd479185af4c53ca3385c019d4
Python
1,011
33
''' Module initializer includes all sub-modules for the autoencoder module. :Version: 1.0 :Date: 21.01.2018 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2018 Jan Melchior This program is free software: you c...
ceb5e7ae7a2121eb49a8f2d8a6e3ad6278472b90b66706a044f282bc4f86038b
Python
1,011
37
import numpy as np from pycromanager import multi_d_acquisition_events, JavaBackendAcquisition import copy def img_process_fn(image, metadata): image2 = np.array(image, copy=True) image2 = np.swapaxes(image2, 0, 1) md_2 = copy.deepcopy(metadata) image[250:350, 100:300] = np.random.randint(0, 4999) ...