sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
f8d9a9266d3a9801d042b581946d5370ce5bf29c314032d7b21d02ef278de53c
Python
1,617
57
"""Implementations of key-value stores and storage helpers. Module provides implementations of various key-value stores that conform to a simple key-value interface. The primary goal of these storages is to support implementation of caching. """ from typing import TYPE_CHECKING, Any from langchain_core.stores impor...
4daf18c02bc5d16a3882684e64b45fd13ce45f81e50c8f26d02f58cabf504663
Python
1,618
38
import re import os from time import time import utils.fpdf as fpdf def get_segment_index(segment_name: str) -> int: return int(re.search("seg([0-9]+)", segment_name)[1]) def get_cluslabel_from_figname(figname: str) -> int: return int(re.search("waveform_clus([0-9]+).png", figname)[1]) os.makedirs("./tmp_pd...
6c8a1414fbaec794a13b9d0ee8da47190c102f90706acc5d4ca7d89a61ae92dd
Python
1,619
34
from pdearena.data.twod.datapipes.coal2d import ( onestep_test_datapipe_coalSquare_grid, onestep_valid_datapipe_coalSquare_grid, onestep_train_datapipe_coalSquare_grid, trajectory_test_datapipe_coalSquare_grid, trajectory_valid_datapipe_coalSquare_grid, trajectory_train_datapipe_coalSquare...
cd560e1d4a4f5a5388326b07a45c71a09aa0580452626b4f668d4d3514579bf0
Python
1,619
63
import numpy as np from voxcell import VoxelData from sys import argv, exit, stderr from os import cpu_count from tqdm import tqdm from collections import defaultdict import scipy.ndimage as nd import flatmap_util as fmutil argc = len(argv) if argc < 3: print('Usage: {} <flatmap> <flat xlen> [<ncpu>]'.format(ar...
0b971d450b14725e52aec08f1c2f01f22f8008684a30b94b15444830b3735b2e
Python
1,623
50
import joblib import matplotlib.pyplot as plt from dt_utils import Timer from plastic import PlasticNet from plastic_gated import ThreeGateSynapse, GSP1 from recurrent_nets import VanillaRNN, LSTM, nnLSTM from data_utils import generate_recognition_data, recog_chance from neural_net_utils import plot_train_per...
47f9df66f32f10bb24d8ccaa4a2d624a09d8a9056fe6a2915992587dd662575e
Python
1,623
46
import torch import torch.nn as nn from typing import List from typing import Union from typing import TypeVar Self = TypeVar('Self', bound = 'VGG') class VGG(nn.Module): """VGG-like network without a linear layer""" def __init__(self: Self, cfg: List[Union[int, str]], in_c...
40ae7c7a8d72e4e46b00d5707259edf7dcb8bc54479eb23e398847ac3f7671f7
Python
1,626
32
import argparse import numpy as np def extract_peak_numbers(bed_file, bl_file): chroms = np.loadtxt(bed_file, delimiter="\t", dtype=str, skiprows=1, usecols=0) if bl_file is not None: # blacklist reading specific lines bl_chroms = np.atleast_1d(np.loadtxt(bl_file, dtype=str, usecols=0)) ...
6a0f40a8e80567512c0aa1c47da0fc37de102cee732f2a9c1aaf394da39a4098
Python
1,626
42
from __future__ import annotations import re from langchain_core.output_parsers import BaseOutputParser class RegexDictParser(BaseOutputParser[dict[str, str]]): """Parse the output of an LLM call into a Dictionary using a regex.""" regex_pattern: str = r"{}:\s?([^.'\n']*)\.?" """The regex pattern to us...
e3210629cd9582fac4be6703838fb4c35f9fc8ad10b18f3428f2dac76cf81705
Python
1,627
43
import numpy as np import pandas as pd from sklearn.neighbors import kneighbors_graph from scipy.sparse.csgraph import dijkstra def get_pairwise_distances(pX, return_predecessors=False, return_adjacency=False, verbose=False): """ Computes cells geodesic distances as shortest path in the minimal-fully-connecte...
007d08e2c207027a4e0a12b029ae6d0430d85088d0a2f71f5fb34574487663e7
Python
1,628
51
"""Test LLMSummarization functionality.""" import pytest from langchain_classic.chains.llm_summarization_checker.base import ( ARE_ALL_TRUE_PROMPT, CHECK_ASSERTIONS_PROMPT, CREATE_ASSERTIONS_PROMPT, REVISED_SUMMARY_PROMPT, LLMSummarizationCheckerChain, ) from tests.unit_tests.llms.fake_llm import ...
0a6fc00920b087447e5925be9432e549417b8866896b27ec9871c1a4abaaf0c1
Python
1,630
66
from langchain_core.prompts import PromptTemplate from langchain_classic.output_parsers.regex import RegexParser output_parser = RegexParser( regex=r"(.*?)\nScore: (\d*)", output_keys=["answer", "score"], ) prompt_template = """Use the following pieces of context to answer the question at the end. If you don...
f7902b15ac367b5a781d8572899c5a1226a0f69a37b2979f7857abdab32e10b9
Python
1,632
28
import argparse def build_arg_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser(description="PACE development") parser.add_argument("--device", type=int, default=6) parser.add_argument("--seed", help="random seed", type=int, default=3) parser.add_argument("--split", help="train/tes...
4c92e2f1a35e391a742ca13827a8d26624c785fe3e4e0c50102d042dbd4d4022
Python
1,633
58
import torch as tr # Mapping of nucleotide symbols # R Guanine / Adenine (purine) # Y Cytosine / Uracil (pyrimidine) # K Guanine / Uracil # M Adenine / Cytosine # S Guanine / Cytosine # W Adenine / Uracil # B Guanine / Uracil / Cytosine # D Guanine / Adenine / Uracil # H Adenine / Cytosine / Uracil # V Guanine / Cytos...
443855683c3fc63cf2e9094fb91464a5c695f9f90a8f21c6d3dc1070f2ad74d8
Python
1,634
47
# Copyright 2019 DeepMind Technologies Limited. All Rights Reserved. # # 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 # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
50481c1e4933cd786e2f4523b7c7160e4a9f78461ddee5c67bd9cf6f21fa8c33
Python
1,634
40
import h5py import numpy as np def get_all_data_from_level_h5_rec(filename, group_name, markers, all_strings_mk, spikes, all_strings_sp): """ This function recursively reads data from an HDF5 file. Parameters: filename (str): A string that identifies the HDF5 file from which to extract data. group...
cf944bd01758c69eac07a303eeaeaf73b9c4a316ccae61d6ba7380436f66cc1a
Python
1,637
41
import torch from torch.nn import Sequential, Conv2d, ReLU, MaxPool2d, AdaptiveAvgPool2d, Linear, Module, BatchNorm2d, Softmax class CNN2D(Module): def __init__(self, labels_number, channels_nb, depth, kersize): super(CNN2D, self).__init__() nconv = 16 npool = 2 layers_list = [] ...
11417533a8b2f7933eb2081876d36528e2c34851ef70955fcfe87db0925b0dc2
Python
1,638
37
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os import xarray as xr import h5py from tqdm import tqdm import numpy as np from argparse import ArgumentParser def collect_data2h5(datapath, batch, mode, save_dir): datals = os.path.join(datapath, "seed=*", "run*", "output.nc") # ...
3cb2d1f4336f05da57eb15528ea72fb9e6d576b8ae7c4428131bae71e674c3ad
Python
1,638
39
# import libraries import ants import numpy as np import matplotlib.pyplot as plt indir = '/xdisk/hutchinsone/cjoy1895/Data/Development/PM/TLobe/12_sample_dataset/ISMRM_data/' outdir = '/xdisk/hutchinsone/cjoy1895/Data/Development/PM/TLobe/12_sample_dataset/data_analysis/1D_hist/' maps ='PA_15-82' #map input ext = '.n...
932e9a18e40a5ef23679aae4729dce07d65ddf6b4c9f2edc88e95ab00f7f4731
Python
1,638
52
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np class GCN(nn.Module): def __init__(self, in_ft, out_ft, act=nn.PReLU(), drop_prob=0.0, isBias=False): super().__init__() self.linear = nn.Linear(in_ft, out_ft, bias=False) # if isBias: # self....
a13e5ecce372211e89410cecc298c84c162e9577cf521356f2aa12f88fa67a3e
Python
1,638
68
import os import subprocess from click.testing import CliRunner from pkg_resources import resource_filename from perses.app.cli import cli test_yaml = """ protein_pdb: Tyk2_protein.pdb ligand_file: Tyk2_ligands_shifted.sdf old_ligand_index: 0 new_ligand_index: 3 forcefield_files: - amber/ff14SB.xml - amber/tip3p...
b22949c4a29185b4d6d2bf2c364220af35ea1ba93abbad3a79a1f983156ddb6e
Python
1,638
48
import re from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_classic.agents.agent import AgentOutputParser from langchain_classic.agents.conversational.prompt import FORMAT_INSTRUCTIONS class ConvoOutputParser(AgentOutputParser): ...
4a7323a5b81701fe537ff9df104851cf5548bced714d299042cff1e4a03c6b60
Python
1,640
50
import os def getDSSP(model, dssp_map=None, feature_name='secondary_structure', formatstr="{}({})", clean=True): try: from Bio.PDB.DSSP import DSSP except ModuleNotFoundError: raise ModuleNotFoundError("The module 'Bio.PDB.DSSP' is required for this functionality!") if dssp_map is None...
19c52e81eb0cf9951999d8fe0075355f008739ec9868aba5ea346907d665e807
Python
1,642
53
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import math from abc import abstractmethod import torch from torch import nn def zero_module(module): """Zero out the parameters of a module and return it.""" for p in module.parameters(): p.detach().zero_() return module ...
2576c3943c7f67cde28c2e1a4b814dd94031896f400ce23c5a2f456a71889dd4
Python
1,643
32
# Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany # # 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://w...
15e2cdbc214a45c1526b8f47449d82915c71ddf7eeffd8b403ec25649091c3c1
Python
1,644
51
import argparse from dival import DataPairs from dliplib.reconstructors import tv_reconstructor from dliplib.reconstructors import tvadam_reconstructor from dliplib.reconstructors import fbp_reconstructor from dliplib.utils.helper import load_standard_dataset from dliplib.utils.plot import plot_reconstructors_tests ...
8cd7bf40c8d1ffe452207586a13dfd07daefd6852bca08dbbe050fbcb51c6d67
Python
1,644
47
import argparse from dival import DataPairs from dliplib.reconstructors import get_reconstructor from dliplib.utils.helper import load_standard_dataset from dliplib.utils.plot import plot_reconstructors_tests def get_parser(): """Adds arguments to the command""" parser = argparse.ArgumentParser() parser....
1cebcca2dacfbb927b0ab582ec194abc487438098bf572357fd454afeef636bf
Python
1,645
50
import torch import numpy as np def MMD(x, y, kernel, device=None): """Emprical maximum mean discrepancy. The lower the result the more evidence that distributions are the same. Args: x: first sample, distribution P y: second sample, distribution Q kernel: kernel type such as "...
60ac7bb2d3e9026694cc0b0645ed184c48ddfed2688506889d53c516f67f265e
Python
1,646
49
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os from pdearena import utils from pdearena.data.datamodule import PDEDataModule from pdearena.lr_scheduler import LinearWarmupCosineAnnealingLR # noqa: F401 from pdearena.models.pdemodel import PDEModel logger = utils.get_logger(__name_...
c45bf7a339175d1ee6a7f1592990e25ece80297a89bb53f3fb5c7fd605a789fb
Python
1,646
67
import os import yaml from dlutils.layers.input_scaler import ScalingLayer from dlutils.layers.padding import DynamicPaddingLayer, DynamicTrimmingLayer CUSTOM_LAYERS = { cls.__name__: cls for cls in [ ScalingLayer, DynamicPaddingLayer, DynamicTrimmingLayer ] } def get_number_of_output_ch...
0dc20471c151489d4bbcee845ac1b49addc3e00ffc82080ce9ee6b37eca04a13
Python
1,647
53
# Rdkit import should be first, do not move it try: from rdkit import Chem except ModuleNotFoundError: pass import pickle import torch.nn.functional as F from qm9.analyze import analyze_stability_for_molecules import numpy as np import torch def flatten_sample_dictionary(samples): results = {'one_hot': [...
1dd12592b09acbfb090008c984cb64e397fd85f4c516ce4af1ecfe651041635a
Python
1,647
57
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Sep 7 14:45:59 2021 @author: athanasiadis """ import numpy as np def computer(x_data,global_vectors,gravity_centers): """ computer ______________________ This is a function that corrects the input dataset based on the grav...
c878ea840ed2c8b65023bb1ebc173c46a7bb3b6b669b73d61a0c0a4e24f82dbe
Python
1,647
68
import numpy as np from edNEGmodel.edNEGmodel import * from functions.initial_values import * from functions.solve_edNEGmodel import * import os print('*************************************************') print('* Computing referece simulation *') print('*************************************************...
ad52eaaf77ea27e17f4f0484d4f58237f8aff78b1aca964993a6b5bf69db17ba
Python
1,648
70
""" Functions to extract trajectory from a perses relative calculation """ import numpy as np import mdtraj as md from perses.analysis.utils import open_netcdf def get_hybrid_topology(file): """ Extracts hybrid_topology object from the .npy file generated by relative calculations Parameters ----------...
595d3c680d124fe2589cc78acdfa830acc49642e7a2ea2d6454d776ec7ddfbdf
Python
1,649
49
import numpy as np import pandas as pd import matplotlib.pyplot as plt def get_mean_bucket_exp(X, pseudo, n_buckets=5, plot=False): """ Compute the expression profile based on bucket assignment X - expression bucket - bucket assignment """ # check pseudo is valid if isinstance(pseudo, pd.S...
b23b9b46f831e6326120c461c9101e469a25209aac24b3a2c2da7857b9111078
Python
1,650
38
# pnabind packages from .data import data def getAchtleyFactors(structure, feature_name="achtley_factor", formatstr="{}{}"): """Citation: www.pnas.org/cgi/doi/10.1073/pnas.0408677102""" atoms = structure.get_atoms() achtley_factors = { 'A': [-0.591, -1.302, -0.733, 1.570, -0.146], 'C':...
d21dbbd8cea7c55c97d222dc16b4fdf5f0748ccb6c3892b1f17789ef8e50061e
Python
1,651
51
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # pylint: skip-file import matplotlib import matplotlib.pyplot as plt from sklearn.linear_model import ARDRegression, BayesianRidge from sklearn.linear_model import RidgeCV, LassoCV, LinearRegression import numpy as np from embanded.embanded_numpy import EMBanded np.rand...
08fa47feb97813af2c029415936a57a79a9802272798b276c5cb6ff6d1733bf9
Python
1,652
52
from collections.abc import Sequence from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from typing_extensions import override from langchain_classic.agents.agent import AgentOutputParser class SelfAskOutputParser(AgentOutputParser): """Parses ...
e2f1f73fb6ae2bfa1eacc82114c0319f5c003d4b2ff24e5dbc28edadfa114125
Python
1,652
41
import numpy as np from scipy.linalg import toeplitz def notch_filter_cls(x, ff, gamma): """ A constrained least squares notch filter. Apply a constrained least squares notch filter to an input signal. This filter is designed to cancel mains frequency noise from a signal. Parameters: x (numpy...
795390f4cfc0385b4a95ddc141c324f90cb6f50c54b2aacaadb22db417255e5b
Python
1,653
89
#!/usr/bin/env python # coding: utf-8 # In[17]: import pickle import os import yaml from sklearn.impute import SimpleImputer import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.decomposition import PCA from sklearn.cluster import KMeans from sklearn.preprocessing import StandardScale...
97f1162584ac0c09c77a5b84ce1c89450ba740fc4e5fb7e20d461b46284940cd
Python
1,653
56
import os import requests import argparse import MDAnalysis as mda from pensa import download_from_gpcrmd def subsample(psf_file, xtc_file, out_file): u = mda.Universe(psf_file,xtc_file) print(len(u.trajectory)) a = u.select_atoms('all') with mda.Writer(out_file, a.n_atoms) as W: for ts in u.t...
9ec615761fab1b402be0a464c6d005c39ceb20219d31e5aeedc880b751fca007
Python
1,653
44
"""This script adds marker genes for three brain regions to the pathway matrix """ import argparse import os import pandas as pd if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument('--marker_files', nargs='*', help='A series of fil...
58b9ebefa2da947c1fc010c4045d7fb0ae153488a909451f498a8db13b12124a
Python
1,654
68
import wandb import argparse from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.trainer import Trainer, seed_everything from pytorch_lightning.loggers import WandbLogger, TensorBoardLogger from genie.config import Config from genie.data.data_module import SCOPeDataModule from genie.diffusio...
d4bb4ccdc5464ca2292213f859f05b5c84f9a61c5f226a64123d16a4d5ed1dc7
Python
1,654
50
import torch from torch_geometric.loader import DataLoader from dataset.PygrMD17 import rMD17 class WeightedEnergyForcesLoss(torch.nn.Module): def __init__(self, energy_weight=1.0, forces_weight=1.0) -> None: super().__init__() self.register_buffer( "energy_weight", torch.t...
7630754e583f9b04d43790f52b40f6d87bebba1e08da294b50e26134ba2b97fb
Python
1,655
48
from setuptools import setup, find_packages with open("README.md", "r", encoding="utf-8") as fh: long_description = fh.read() setup( name="AnnoSpat", version="1.0.0", author="Aanchal Mongia", author_email="aanchal.mongia@pennmedicine.upenn.edu", description="A tool for annotating and inferrin...
4f768ecc0b56c7439433e44f699d055ec7b586f2bbe4cab030082dce49aaac14
Python
1,656
72
from __future__ import annotations import numpy as np def Normalize(data: np.ndarray) -> np.ndarray: return (data - data.min()) / (data.max() - data.min()) def NormalizeAxis(data: np.ndarray, axis: int) -> np.ndarray: _min = np.min(data, axis=axis, keepdims=True) _max = np.max(data, axis=axis, keepdims...
4055e768acf03d5af7c139584b47c790be37bb9b4060990e9439d58a59ee9adc
Python
1,657
48
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.llms import AzureMLOnlineEndpoint from langchain_community.llms.azureml_endpoint import ( AzureMLEndpointClient, ContentFormatterBase, CustomOpenAIContent...
7dedaef4ad86875bb9b8a2b8f48bda829cb3cbe244fe9015366ebfb7faba93f7
Python
1,658
63
import numpy as np from voxcell import VoxelData import sys from scipy.ndimage import distance_transform_edt def is_background(array, val = np.nan): return np.isnan(array) if np.isnan(val) else (array == val) # CLI interface rdepth_nrrd = sys.argv[1] thresh = float(sys.argv[2]) side = sys.argv[3] if side not ...
9334a48590a0e112451bcf42e3356ee3845de9816e3300cc74cd293f6b9b62c6
Python
1,658
48
import torch import torch.nn as nn from typing import List from typing import Union from typing import TypeVar Self = TypeVar('Self', bound = 'VGG_CNNC') class VGG_CNNC(nn.Module): """VGG-like network including a linear layer""" def __init__(self: Self, cfg: List[Union[int, str]], ...
55315ca47ac88bbf001201cef839a9cbac7d1f756ce4bf4405a63ae86d03fb26
Python
1,659
50
# 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...
8445148190a8030e79bd2add81caf660e5521802045bce7565c9388d611ca313
Python
1,659
49
import numpy as np from dival import TaskTable from dival.measure import PSNR, SSIM from dliplib.reconstructors import learnedpd_dip_reconstructor from dliplib.utils import Params from dliplib.utils.data.datasets import CachedDataset from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset ...
2991ec29f6af474463448825b1e0aeb4403384e109c491643e2d30507b99f870
Python
1,660
46
"""Setup script for uploading package to PyPI servers.""" from setuptools import setup, find_packages tests_require = [ 'pytest', 'numpydoc' ] docs_require = [ 'Sphinx', # TODO: maybe numpydoc? ] with open('requirements.txt') as f: install_requires = [l.strip() for l in f] setup( name='vulcanai...
2c2bf478a7fdec07da6e4f4c50b3ba3c071405fe15b9db03bdc4c9f381cf5b51
Python
1,660
41
import numpy as np import pandas as pd # Import xlsx file df = pd.read_excel('data/PXD015912/Mapping_file_PXD015912.xlsx', sheet_name='PXD015912') matrix = pd.read_csv('data/PXD015912/Peptide_intensity_matrix_b9369842-f3cf-4383-9e5c-6734dadcfbc9.csv', sep='\t') matrix.index = matrix.loc[:, 'Peptide'].to_numpy() # 18...
4d73f776e2e8fbe867cbd42d85c0c5d36e9181873436d6133383efa3e7a74b9e
Python
1,661
32
import numpy as np from src.PID import compute_store, format_data def get_fullorder_FF(model_PID, activations, args): measures = compute_store.compute_discrete_measures(activations['inputs'], activations['layers'][0], args) model_PID = compute_store.store_measures(model_PID, args, 'x2h_', measures, True) ...
751ae2cb8789da36e71b1e48128e749b64d4513a4b9234a3208917faae30c146
Python
1,662
59
import logging import os import hydra import pandas as pd from omegaconf import DictConfig, OmegaConf from tqdm import tqdm from src import PROJECT_DIR log = logging.getLogger(__name__) @hydra.main( config_path=os.path.join(PROJECT_DIR, 'configs'), config_name='find_best_epoch', version_base=None, ) de...
9d6c514d0a0fff298262c7b11ac038be3f4dfae2a367c16f5123fc8669f22bbd
Python
1,663
44
import torch from torch import nn import torch.nn.functional as F import torch.nn as nn class RecurrentNetwork(nn.Module): """ Recurrent network for neurogym experiments. Stores activations for easy extraction. Uses leaky relu activation for continuous measures """ def __init__(self, input_size, o...
ce2e4bd872ba753b5ace9dbe912e3adaea5e59fc436659397eae19acf123135a
Python
1,663
51
import glob import tensorflow as tf import numpy as np def return_single_result(non_linear, nonlinear_cut_model, agg, data_dir, num_folds): model_name = "model_non_linear" + \ str(non_linear) + '_'+str(nonlinear_cut_model) cv_summary = [] for path in [glob.glob(data_dir+"/"+model_name+'_fold'+...
2aaac306ec3fefc63a5eefcba582442bb9fa4153a5a3d3a5eeed5bcee89a873d
Python
1,664
52
from typing import Literal from langchain_core.agents import AgentAction def _escape(xml: str) -> str: """Replace XML tags with custom safe delimiters.""" replacements = { "<tool>": "[[tool]]", "</tool>": "[[/tool]]", "<tool_input>": "[[tool_input]]", "</tool_input>": "[[/tool...
44ad208846f3e1dcdaf01db73e0258c182730e74829107bb60bcffbd4a785cf2
Python
1,664
59
import argparse import numpy as np from dt_utils import Timer from hebbian import LearnedSynHebb from data_utils import generate_recognition_data #%% parser = argparse.ArgumentParser() parser.add_argument('--R', type=int) parser.add_argument('--T', type=int) parser.add_argument('--batchsize', type=int) pa...
aa67514a26841dc8d5f812a1edc674bea57cf248be1cd96b4333f350157e4839
Python
1,664
56
"""Criteria or rubric based evaluators. These evaluators are useful for evaluating the output of a language model or chain against specified criteria or rubric. Classes ------- CriteriaEvalChain : Evaluates the output of a language model or chain against specified criteria. Examples: -------- Using a predefined crit...
1b6c526bfebf8c0a068e2555baae4f4021175e2388aaf637392ecf6c954396ed
Python
1,665
51
"""Tests for FlareChain.from_llm preserving supplied ChatOpenAI instance.""" from typing import cast import pytest from langchain_core.documents import Document from langchain_core.retrievers import BaseRetriever from langchain_core.runnables import RunnableSequence from langchain_classic.chains.flare.base import Fl...
23805acbe8463fefa6b30a7eb7e1bb1d5899ff1e17e6da9789b0ecd9cf07479e
Python
1,666
52
import numpy as np from dival import TaskTable from dival.measure import PSNR, SSIM from dliplib.reconstructors import learnedpd_dip_reconstructor from dliplib.utils import Params from dliplib.utils.data.datasets import CachedDataset from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset ...
404ef39e6dae643e7e0f155e4da6f56b851fa2d6633ed8b1566e60ef0c321f27
Python
1,667
26
from batchgenerators.utilities.file_and_folder_operations import * import numpy as np if __name__ == '__main__': input_file = '/home/xuesheng3/liuyuchen/Data/nnSegnext_raw_data_base/nnSegnext_preprocessed/Task004_BrainTissueIBSR/nnSegnextPlansv2.1_plans_3D.pkl' output_file = '/home/xuesheng3/liuyuchen/Data/nnS...
ea9e59964945d4bc56c62d34ef30f5657b0c2e1e64e7a43da823a44f0c35e96f
Python
1,667
41
import sys import scipy.stats as stats control1_1={} control2_1={} control1_2={} control2_2={} list1=[] list2=[] list4=[] #################The script is for comparing the genes between GSCs samples and astrocyte samples. rsemdir='/scratch/users/txie/RNA-seq/3rsem_out/' f=open(sys.argv[1].replace("neoloop95...
0802cc9f9a588d4f0be1cb4fba478e6250e3c31708175e3fffbb5be26aeac187
Python
1,669
60
import torch def get_rotation_frames(coords): """ Returns a local rotation frame defined by N, CA, C positions. Args: coords: coordinates, tensor of shape (batch_size x length x 3 x 3) where the third dimension is in order of N, CA, C Returns: Local relative rotation frames in...
8efdc74745c6ab64b2c64557c7a48652a15ac88a1e2fa2f76cb60398f1a1e116
Python
1,669
35
import mne from config_FaceName import Results_data_path,Ids,MEG_data_path,group_name,MRI_data_path,stats_conds_list,stats_comparisions from custom_functions import do_cluster_permutation_1samp_test from functools import partial import os.path as op bands = dict(theta=[4, 7],alpha=[8, 13],beta=[14, 30],gamma=[40, 90])...
b36b703a38374c8753629a00b56a4b3e227c4d15a09255f119f2448a6b2552d8
Python
1,670
50
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders.parsers.pdf import ( AmazonTextractPDFParser, DocumentIntelligenceParser, PDFMinerParser, PDFPlumberParser, PyMuPDFParser, ...
b9199b55108632ae822592404855e8d988aba232d56be9eef7664c1d645d2bfb
Python
1,670
48
from torch import nn import SimpleITK as sitk import torch from nnsegnext.utilities.to_torch import maybe_to_torch, to_cuda from nnsegnext.utilities.tensor_utilities import sum_tensor def CannyEdgeDetectionImage(image,LH,UH,Var): canny_op = sitk.CannyEdgeDetectionImageFilter() canny_op.SetLowerThreshold(LH) ...
fcee402966b6f03d464c3e193a2a16feefc1e5faa2deeb8c1f2b0410bbbedfa2
Python
1,671
40
import sys import warnings from pathlib import Path _PACKAGE_DIR = Path(__file__).resolve().parents[1] # Leave tests outside the skipped prefixes so warnings identify the test caller. _SKIP_FILE_PREFIXES = tuple(str(path) for path in _PACKAGE_DIR.iterdir() if path.name != "tests") class ExperimentalWarning(UserWarni...
3f42803316bb464c9a8914740cb408d2fcd4d869f93c9565d82033b68de32402
Python
1,672
51
"""One adapter, three transports. `MCPAdapter` infers the transport from whatever you hand it, so the only thing that changes between an in-process server, a local script over stdio, and a remote URL is the target itself. uv run examples/mcp/transports.py """ from __future__ import annotations import asyncio fr...
1146407e749c105df87b07ed4273f9a15d64bb4ea4d793a7dc56b11672b5a657
Python
1,674
60
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. _base_ = [ '../_base_/models/upernet_convnext.py', '../_base_/datasets/ade20k.py', '../_base_/default_runtime.py...
efb48c5157d200baab96378441e7e29971c7e47a9d81d5f194d763ea7b903310
Python
1,675
50
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_transformers import ( EmbeddingsClusteringFilter, EmbeddingsRedundantFilter, get_stateful_documents, ) from langchain_community.document_tran...
57aecd94415016725321945a6282593fc269bb6c129361d50f58995d6411cd5c
Python
1,677
43
#!/usr/bin/python import sys import json import hashlib import os import shutil import subprocess def md5sum(filename, blocksize=65536): hash = hashlib.sha1() count = 1 with open(filename, "rb") as f: # for block in iter(lambda: f.read(blocksize), b""): # hash.update(block) whi...
687dfcdff94de5f435233d9772c3f90dc6e2b2f72c95169785219032bbde2221
Python
1,677
47
# pnabind modules from .data import data as D def isAA(resname, regexes): if regexes['PROTEIN']['STANDARD_RESIDUES'].search(resname): return True if resname in D.chem_components: ccd = D.chem_components[resname] if '_chem_comp.mon_nstd_parent_comp_id' in ccd: parent = ...
88fb75a54165d1ea22232ee85aa5608d4174d59592fdceab16876c25ef16a875
Python
1,677
59
import warnings from types import SimpleNamespace from bernn.dl.train.train_ae_classifier_holdout import TrainAEClassifierHoldout # [`bernn.dl.train.train_ae_classifier_holdout.TrainAEClassifierHoldout`](bernn/dl/train/train_ae_classifier_holdout.py) # 1) Minimal args — let TrainAE fill the rest with safe defaults a...
e6e1e8e940a874987a03b07e6501df5869789507e374b1f5d9214b359215646a
Python
1,679
60
from pytorch_lightning import LightningModule import torch import numpy as np from torch.nn import MSELoss class FCNNModel(LightningModule): def __init__( self, input_dim: int, output_dim: int = 1, reduction: float = 3, activation="ELU", lr: float = 1e-3, ): ...
f8dd08d6709fb80d5038d7f7adc5c92afad82f77138f06bd6b51fa055e7bc08e
Python
1,679
61
import os import requests # -- Functions to download from online repositories def download_from_gpcrmd(filename, folder): """ Downloads a file from GPCRmd. Parameters ---------- filename : str Name of the file to download. Must be a file that is in GPCRmd. fo...
f923d1368d5b80f63d45a643abbee27f701a59b955630f6de4cb47f12088ebe1
Python
1,680
48
import torch from torch_geometric.data import InMemoryDataset,Data from os.path import join, isfile from os import listdir import numpy as np import os.path as osp from imports.read_abide_stats_parall_behavior import read_data class ABIDEDataset(InMemoryDataset): def __init__(self, root, name, transform=None, pre...
6df840f29e6b4dd4d028239bd60e6e7a312ffd1840ef0f68860bce613957a9f9
Python
1,681
67
import pandas as pd pd.set_option('display.max_columns', None) pd.set_option('display.max_rows', 150) disease_search_term = 'Kidney' # no spaces allowed hgnc_genes_series = pd.read_csv('../../exac-broadinstitute/all_hgnc_genes.txt', header=None).loc[:, 0] full_df = pd.read_csv('GTEx_Analysis_2016-01-15_v7_RNASe...
800f0eef87ffc1a41b13742f1b1359281814aadc14cbf77836cfcf445bc8b0db
Python
1,681
54
import os import argparse import MDAnalysis as mda from pensa.preprocessing import download_from_gpcrmd def subsample(psf_file, xtc_file, out_file): u = mda.Universe(psf_file, xtc_file) print(len(u.trajectory)) a = u.select_atoms('all') with mda.Writer(out_file, a.n_atoms) as W: for ts in u.tr...
498e78d9c5628736bca57cd1fbf1be2ccdd2e151ff73a1a18aee2ab65f539480
Python
1,683
61
#!/usr/bin/env python3 """Copy the openff-toolkit examples suite to a local directory""" import argparse from os import environ from pathlib import Path from shutil import copytree, ignore_patterns class NoExamplesLibraryError(Exception): """Slightly more descriptive error for when the examples library is not fo...
5446d54cc99c6b8e3bdd98fc04babf241e33fbe8c9ad25881772794ace9c037c
Python
1,683
65
# Copyright (c) Microsoft Corporation. # Licensed under the MIT license. import os.path as osp from setuptools import find_packages, setup # with open("README.md", encoding="utf-8") as fh: # long_description = fh.read() long_description = "" exec(open(osp.join(osp.dirname(__file__), "pdearena", "version.py")).re...
57642aca80a8474f3d112a42d8cd19bd878327114e4287182d304b83758496d6
Python
1,684
73
import torch from torch import nn from genie.model.template import get_template_fn class PairFeatureNet(nn.Module): def __init__(self, c_s, c_p, relpos_k, template_type): super(PairFeatureNet, self).__init__() self.c_s = c_s self.c_p = c_p self.linear_s_p_i = nn.Linear(c_s, c_p) self.linear_s_p_j = nn....
97b1c5247c46139ad4a76a34db42472032dd327f1b2bc7ababb82e2a7c23bc12
Python
1,684
59
#%% ''' This script is for training the proposed Sinc model. Before using it the marked lines corresponding the training and validation datagenerators should be altered. ''' import os import numpy as np import tensorflow as tf import tensorflow.keras.backend as K from tensorflow.keras.callbacks import EarlyStopping fr...
adb5c975c6a60239492678034cb66e536165760e2ca05b0326e355f92259dcb2
Python
1,684
62
import os import matplotlib.pyplot as plt import torch from bindsnet.analysis.pipeline_analysis import MatplotlibAnalyzer, TensorboardAnalyzer class TestAnalyzer: """ Sanity checks all plotting functions for analyzers """ def test_init(self): ma = MatplotlibAnalyzer() assert plt.isi...
e104898c89ab10a25913bde6285729d8a2220468ac1b063f489e6a1fe60826e2
Python
1,686
55
# 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_matched_filter_robust import ( peak_det_matched_filter_robust, ) import unit_test as testing mat = scipy.io.loadmat("../../../datasets/sample-data/Sample...
5eb4f366569997be6b2402cb03f7c9403bb1ed2d45d6e44779b8597043eea43b
Python
1,687
50
import os # High-level locations REPO_LOC = os.path.dirname(os.path.dirname(__file__)) DATA_LOC = os.path.join(REPO_LOC, "data") OUT_LOC = os.path.join(REPO_LOC, "out") # Data locations WORKFLOW_SOURCES = os.path.join(DATA_LOC, "workflow_sources.txt") TOOL_SOURCES = os.path.join(DATA_LOC, "tool_sources.txt") RAW_GALA...
86956f5dd98717baa0f7b7c95618ab0c479512b553013aac905bb12e44f62c82
Python
1,687
41
# conding: utf-8 from pathlib import Path SCRIPT_DIR = Path(__file__).parent.resolve() GIT_DIR = SCRIPT_DIR.parent.resolve() TOOL_DIR = GIT_DIR.joinpath("tool").resolve() TEMPLATE_NO_TEST = "|[`{tool_file_name}`]({tool_file_path_from_script_dir})|no test|" TEMPLATE_EXISTS_TEST = "|[`{tool_file_name}`]({tool_file_path...
8870dcecf0876c7edff6f3f73fd341e302e4a9bfd38f6a73737e10c0e438f2aa
Python
1,687
59
#! /usr/local/bin/python #'################################################################################# #'################################################################################# #' Train autoencoder from CNN network #'################################################################################# #'#...
09117d6b8629831d4e0c4df53a584f1a70361753cd520b6813d58bd3a1bd96a3
Python
1,689
50
from typing import Any from typing import Callable from typing import Dict from typing import Optional import torch.utils.model_zoo from .cornet_r import CORnet_R from .cornet_rt import CORnet_RT from .cornet_s import CORnet_S from .cornet_z import CORnet_Z from ptrnets.utils.config import load_state_dict_from_model_...
159fd7ad2b139d5ee97665d79cf572c0d9963c60df769b98c66cdfcc6cc65533
Python
1,690
62
import os import pandas as pd import matplotlib.pyplot as plt import re from collections import OrderedDict import numpy as np def remove_duplicates_and_convert_npy(val_list): tmp_dist = OrderedDict() for ele in val_list: tmp_dist[ele[0]] = ele[1:] val_list = [] for k, v in tmp_dist.items(): ...
24d12d0d63ef1e6c3ca11c929e986da55f307cc54f772097bfaa6dca58bcfbf3
Python
1,692
39
from omicscope.cli import main def test_main(): assert main([]) == 0 class TestInput(object): def test_Progenesis(self): from omicscope.Input import Input ctrlWT = Input('tests//data//proteins//progenesis.csv', Method='Progenesis') ctrlNone = Input('tests//data//proteins//progenesis....
9f9af32238dfb0ef1227b1011e6315058a7201a79449cc690be2863ea6400ef6
Python
1,692
51
# Batch acquisition of protein sequence, pocket sequence, and absolute position information of pockets import os import pandas as pd 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', 'PRO':'P', ...
d43630e2f66053dde18e2b6da530246b1cc2b659d0325f4747f11639eb431ea7
Python
1,692
81
from sys import path from pathlib import Path import mne study_name = "age-prediction-benchmark" # On drago N_JOBS = 80 bids_root = Path("/storage/store2/data/TUAB-healthy-bids-bv") #deriv_root = Path("/storage/store3/derivatives/TUAB-healthy-bids2") deriv_root = Path("/storage/store3/derivatives/TUAB-healthy-bids3")...
8317da5c8906d88d1e236339867bdeceb7b870d3ac6ef358e1743ac804b71439
Python
1,693
49
import numpy as np from dival import TaskTable from dival.measure import PSNR, SSIM from dliplib.reconstructors import learnedpd_dip_reconstructor from dliplib.utils import Params from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset from dliplib.utils.reports import save_results_table ...
ba5951c2829f3b0eb724b27e66189b5d43d0c9762b19a76f1bfbc0da7add5bab
Python
1,693
55
import torch import torch.nn as nn import numpy as np class LSTM(nn.Module): def __init__(self, input_size, hidden_size): super().__init__() self.input_size = input_size self.hidden_size = hidden_size self.lstm = nn.LSTM(input_size=self.input_size, hidden_size=self.hidden_size, num_...
e794d4d42d74801ddfb2efe273b32a266ff7cefdc37ccd5bb3057c10914934ad
Python
1,694
56
__all__ = ["LoggingCallbackHandler"] import logging from typing import Any from uuid import UUID from langchain_core.exceptions import TracerException from langchain_core.tracers.stdout import FunctionCallbackHandler from langchain_core.utils.input import get_bolded_text, get_colored_text from typing_extensions impor...
5b2886d7d3b1333ca9ae6c0554aec8087557348fa54d9397a03cfb36b858b43b
Python
1,695
54
import argparse from dival import DataPairs from dliplib.reconstructors import tvadam_reconstructor from dliplib.reconstructors import diptv_reconstructor from dliplib.reconstructors import fbp_reconstructor from dliplib.utils.helper import load_standard_dataset from dliplib.utils.plot import plot_reconstructors_test...
c4fa4b2120af7054f91a57aad0a91919f85d148cd0b478cf364cff887ed45338
Python
1,695
42
#!/usr/bin/env python import os import tempfile from joblib import Parallel, delayed class CombinedBAMs: def __init__(self, bams, chromosomes): self.bams = bams self.chromosomes = chromosomes def __enter__(self): self.bam = tempfile.NamedTemporaryFile('rb', suffix='.bam') ...
cacb0f53ccf601ca7e24abaea7318215610999b0e692a518428bd2190f79b66a
Python
1,695
73
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Oct 26 17:28:57 2017 @author: chiara """ import numpy as np from scipy.io import loadmat from scipy.stats import norm import pandas as pd filename = 'fit.mat' mat = loadmat(filename) param_pop = mat['param_pop'][0] Covb = mat['stats']['c...
eeac5384dfe8776a41c63a28a6a2cc72e36b8e7947af967044e8726b2c5cc3dc
Python
1,695
83
"""Test the public API of the tools package.""" from langchain_classic.vectorstores import __all__ as public_api _EXPECTED = [ "AlibabaCloudOpenSearch", "AlibabaCloudOpenSearchSettings", "AnalyticDB", "Annoy", "AstraDB", "AtlasDB", "AwaDB", "AzureCosmosDBVectorSearch", "AzureSearch...