sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
8cedbb16cb462b5732ccd4f4f7a183f6516ad9880dc58d4367a36d03fc8a751f
Python
1,852
72
"""Global values and configuration that apply to all of LangChain.""" from typing import TYPE_CHECKING, Optional if TYPE_CHECKING: from langchain_core.caches import BaseCache # DO NOT USE THESE VALUES DIRECTLY! # Use them only via `get_<X>()` and `set_<X>()` below, # or else your code may behave unexpectedly wi...
805e062800afe90fc9c949728590d427fdfabdc553dbbd7a73ebf88c99f02aba
Python
1,854
52
import glob import os import subprocess import pandas as pd from tqdm import tqdm ''' /mnt/media32TB/home/yyasumizu/bioinformatics/MEnet/notebooks/210422_array2bismark.ipynb convert methyaltion arry file (series_matrix.txt downloaded in GEO) to bismark. n_read : virtual coverage ''' n_read = 10 list_manifest = ['.....
64cae150b63f8f03619e6ba20ce9d6fae2f483cbcd93d705e675a9d6af34aa14
Python
1,855
48
"""Test in memory docstore.""" from langchain_classic.output_parsers.regex_dict import RegexDictParser DEF_EXPECTED_RESULT = {"action": "Search", "action_input": "How to use this class?"} DEF_OUTPUT_KEY_TO_FORMAT = {"action": "Action", "action_input": "Action Input"} DEF_README = """We have just received a new resu...
9b15f3c00782db51f6c1707a6a5bba6f9497708005aad13126f1fe6448dc3eb2
Python
1,857
53
# coding=utf-8 import torch import torch.nn.functional as F from alg.algs.ERM import ERM class VREx(ERM): """V-REx algorithm from http://arxiv.org/abs/2003.00688""" def __init__(self, args): super(VREx, self).__init__(args) self.register_buffer('update_count', torch.tensor([0])) self....
08713afa30605457b50460c0a560f79a5c11892cb60b6d8f8fefddfef731b1d2
Python
1,858
72
#!/usr/bin/env python3 """ Warp a probabistic atlas onto a brain containing a lesion. Requires a T1w image of the lesioned brain and a binary lesion mask, both in the same space. This command outputs lesion volumes within each probabilistic atlas label Usage ---- atlas2lesion.py -i <lesion T1w> -m <lesion mask> -t <at...
9d7eb52f5f9c9328626893a8509d7ffa7763a51a920d57fd4152298d17bff4cb
Python
1,860
54
from importlib.resources import open_text import pytest from neurovisfit.common.config import TomlConfig def test_toml_config_get_dict(mock_toml_config, mock_data_path): database_config = mock_toml_config.get_dict("some_data_name") print(database_config) assert isinstance(database_config, dict) asse...
c870594ea1f7bdecf856070a535ce432d61e7cb310fedd24a2e452e6a411d9c7
Python
1,860
46
# this will combine a single command that will run all analysis and save everything from . import plotting, wrangle if __name__ == "__main__": import argparse parser = argparse.ArgumentParser(description="Get input") parser.add_argument("csv", type=str, help="Path to the results csv file") parser.add_...
3d40cdb4b025ecc65e9110fd0a9ed09b5fe1679b179d9d14d211d7e14f7b7561
Python
1,861
60
import os import pytest from qupkake.mol_utils import Tautomerize from rdkit import Chem @pytest.fixture def example_tautomer(request): smiles = "Oc1c(cccc3)c3nc2ccncc12" tautomer = Tautomerize(smiles=smiles, name="pytest_mol") # Delete the mol_t0.mol file before the test tautomer.mol_dir = "molecul...
5e6a1c97f999f683556718690b7ce2bad31d5c52c3e7f742c6ce5f135f60eb6d
Python
1,861
58
from typing import Dict import openmm import openmm.unit def _compare( system1: openmm.System, system2: openmm.System, tolerances: Dict[str, openmm.unit.Quantity], ): """Check that two OpenMM systems have the same parameters. Adapted from the OpenFF Toolkit: https://github.com/openforcefield...
c9381d9138e2064f8455f70816a7e2e73d671f97ad2e9fc9d83b5a0978394e68
Python
1,861
65
from __future__ import annotations import numpy as np from sklearn.cluster import KMeans from tslearn.clustering import TimeSeriesKMeans from libs.function.utils import pca, tsne # time x dim -> time def ts_kmean(data: np.ndarray, n_cluster: int) -> np.ndarray: engine = KMeans(n_clusters=n_cluster, max_iter=300...
8d695a632289288461258ee332d09c1ecde0a39a6278af389d9aaddd212d66e2
Python
1,862
53
from langchain_core.agents import AgentAction from langchain_core.messages import AIMessage, HumanMessage from langchain_classic.agents.format_scratchpad.log_to_messages import ( format_log_to_messages, ) def test_single_intermediate_step_default_response() -> None: intermediate_steps = [ (AgentActio...
db6ad5dd8167da230922ec0afe93a7c2bb2edc34cba414522ed63af4a62b6a20
Python
1,862
59
from ChipseqReport import * class MacsSummary(DefaultTracker): pattern = "(macs_summary)" def getTracks(self, subset=None): return self.getValues("SELECT track FROM macs_summary ORDER BY track") def __call__(self, track, slice=None): resultsdir = os.path.abspath(os.path.join(EXPORTDIR, ...
311102100d614e982c4bff9d334682661c2b6c3a82c57e71da435ddf1b3cb72e
Python
1,863
54
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.document_loaders import ( UnstructuredAPIFileIOLoader, UnstructuredAPIFileLoader, UnstructuredFileIOLoader, UnstructuredFileLoader, ) from lan...
bd4934ea559a8f9e254080e430cd4900e72973b71ec3bfe77f2375aa7be49b6c
Python
1,863
44
from config_FaceName import group_name,Ids,RSA_data_path,Results_data_path,MRI_data_path import mne import os.path as op from custom_functions import prepare_X_and_one_data,prepare_stats_list,write_stats_list,generate_adjacency_matrix from scipy import stats as stats import numpy as np from mne.stats import permutation...
9274ca3bc01cce9a47113ff5ea4cf2ece2ec41370473a6131dd33c0f7261fd2a
Python
1,864
56
# Copyright Generate Biomedicines, Inc. # # 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 ...
aa28e3d3962bcafaa5a65bbdef4bc332756a937f80fc19972ed9907d8e5173bb
Python
1,864
60
import numpy as np import pandas as pd import pytest from coffeine import (make_filter_bank_regressor, make_filter_bank_classifier) frequency_bands = {'alpha': (8.0, 15.0), 'beta': (15.0, 30.0)} n_subjects = 10 n_channels = 4 n_frequency_bands = len(frequency_bands) @pytest.fixture def toy_data...
8fb4ba110fce4bd49ff6dbe53399029b40f9e6a182dec7fbe661dbb8ab4759d8
Python
1,865
57
import torch from equivariant_diffusion.utils import \ center_gravity_zero_gaussian_log_likelihood_with_mask, \ standard_gaussian_log_likelihood_with_mask, \ center_gravity_zero_gaussian_log_likelihood, \ sample_center_gravity_zero_gaussian_with_mask, \ sample_center_gravity_zero_gaussian, \ sam...
a94e76b33265cd784fec529728c9c4154a38745b92495de3e72a7e4f49387c7f
Python
1,865
83
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import division, print_function import argparse from time import time # import pylab as pl import nibabel as nib import numpy as np DESCRIPTION = """ Compute average from an arbitrary amount of images. """ class CustomFormatter(argparse.ArgumentDefa...
d369b4e0783880a1ea06bc0e3d58fb43b2b400c110b01c5141555dc53b2545ef
Python
1,867
54
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import APIOperation from langchain_community.tools.openapi.utils.api_models import ( INVALID_LOCATION_TEMPL, PRIMITIVE_TYPES, SCHEMA_TYPE, S...
5e850844b8e4ce75002ab379dd9652928a7c1c3de4a8a86a375262a479ff8495
Python
1,868
76
#!/usr/bin/env python3 import argparse import pathlib from typing import Optional import yaml import subprocess def parse_arguments( key: Optional[str] = None, stage: Optional[str] = None, method: Optional[str] = None ): """ Parses command line arguments """ parser = argparse.ArgumentParser(descr...
30a1bf743735c1f46a55d085aae5cb4205bc9b3b98cc041fa4b52413eb294017
Python
1,869
53
# Prepare images and labels for validation #2 # Copyright (c) 2022 Laurent Caplette import numpy as np import os, csv, h5py from PIL import Image np.random.seed() homedir = '' ### path of home directory nBlocks = 5 nTrialsInBlock = 20 nTrials = nBlocks * nTrialsInBlock f = h5py.File('vis_mostnamed_ultimatefinal.h5'...
6bd2abdd773a00823429e456fce34291119f9ea1cd46f9cab2861e6a7f98d442
Python
1,869
44
import numpy as np def width_estim(df, model, processor, train_data_notnormalized, slide_window): """ Predicts drop width from side-view features using a trained model. Args: df (pd.DataFrame): DataFrame containing raw drop measurements. model (tf.keras.Model): Trained LSTM model for predi...
728ff86e92e5cd8d2ac0f4794b53f5e8da69fec1e4c6512b3a824f5bdcf9b8e2
Python
1,869
43
import argparse from pensa.preprocessing import load_selection, extract_coordinates_combined # -------------# # --- MAIN --- # # -------------# if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--sel_file", type=str, default='') parser.add_argument("--sel_base_a", type=s...
2d5ee957582c5cad01ea9078514e749a0fdde3b13c7908cb193baf59d20c1767
Python
1,872
44
import argparse from pensa import load_selection, extract_coordinates_combined # -------------# # --- MAIN --- # # -------------# if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument("--sel_file", type=str, default='') parser.add_argument("--sel_base_a", type=str, default=...
8e55fce7994bbcea9cf4fd2263cae28c711267466307b52aa5b8e417d4f397ca
Python
1,872
35
PREFIX = """Assistant is a large language model trained by OpenAI. Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text base...
903e4549b233acdffef46a5d6bb4cfc02a402d6b679fbaac342fccbc375dc4c2
Python
1,872
52
import numpy as np import cy_argwhere as argwhere def test_argwhere_1d(): # Test with a simple case assert argwhere.argwhere_1d([0, 1, 2, 0, 3, 0, 4]) == [1, 2, 4, 6], "Test case 1 failed." # Test with all zeros assert argwhere.argwhere_1d([0, 0, 0, 0]) == [], "Test case 2 failed." # Test with no...
79f60bf4808bc817b10e7db67f5bfc092e0fe89deb466ee9babc88c5d94ffb9d
Python
1,873
74
#!/usr/bin/env python3 import re import subprocess as sp import shlex import sys import time import logging from CookieCutter import CookieCutter logger = logging.getLogger("__name__") STATUS_ATTEMPTS = 20 jobid = sys.argv[1] cluster = CookieCutter.get_cluster_option() for i in range(STATUS_ATTEMPTS): try: ...
7d11edc08fd8d0f007ca9ab7fe3f7d7a0615e9a59a3fa81ab8c820b6e3fe00d3
Python
1,874
76
from __future__ import annotations from typing import List import numpy as np import numpy.linalg as LA from libs.common.graph import Graph from libs.function.utils import sparse_matrix class Weight(Graph): def __init__( self, input_size: int, hidden_size: int, output_size: int,...
8938c9927d9202659d640ee44563dd519d444d7d1329e20368eea4f41d7905e4
Python
1,874
64
import torch import torch.nn as nn import torch.nn.functional as F def l2loss_atomwise(pred, target, reduction="mean"): dist = torch.linalg.vector_norm((pred - target), dim=-1) if reduction == "mean": return torch.mean(dist) elif reduction == "sum": return torch.sum(dist) else: ...
f4783a9809e795f048ddc3d2e744d432a843e2155486d62245b5ae79762c05eb
Python
1,874
53
def path_functions(linux:bool=False): import os directory = os.getcwd() if linux == True: directory_functions = str(directory +"/functions/") path = directory_functions else: path = str(directory +"\\functions\\") #path = "C:\\Users\\gabri\\Box\\Do...
073216bed5ff771b81db72612aec36fbda06d7a52b25805f9b0ebf61bf913f96
Python
1,876
66
"""**Chat Models** are a variation on language models. While Chat Models use language models under the hood, the interface they expose is a bit different. Rather than expose a "text in, text out" API, they expose an interface where "chat messages" are the inputs and outputs. """ import warnings from langchain_core._...
00264126d82055110fdd75d8b1cfbfa441e520c625a85c5e3ba38cdcc6157538
Python
1,877
71
""" This script summarized DE results by chromosome """ import session_info import pandas as pd from pyhere import here from scipy.stats import kstest from functools import lru_cache @lru_cache() def load_data(): fn = "BrainSeq_sexGenotypes_4features_3regions.txt.gz" return pd.read_csv(fn, sep='\t') @lru_cac...
a2e3eede5b8504d7889a9e2b148cf1add5d89537df1f9e14c1c74e0d6c56b9cc
Python
1,884
63
from torch import nn class Cov1(nn.Module): def __init__(self, input_size, output_size): super(Cov1, self).__init__() self.cov1 = nn.Sequential( nn.Conv1d(input_size, output_size, kernel_size=3, padding=1), nn.BatchNorm1d(output_size), nn.MaxPool1d(ke...
53157c577261b90b932084242409c800e230d6eb7455fd7bba9bf7b9431d99d1
Python
1,885
55
# 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 writing, s...
cb5ed5c70c052ba6a5fb7165cab51996cce3be8b95e7fcd2409b035ba94be048
Python
1,885
55
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for d...
b67bc8078809e676e0a7c83e18b8ac3990581ad441e15a4dccd180c4626dc7e5
Python
1,886
55
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for detai...
4c8e08d00b98b2e5bbd5d1a36286b3afb08bd86e754801ae1b37c52e81214ba7
Python
1,887
80
import numpy as np import joblib import torch import matplotlib.pyplot as plt from matplotlib import colors, gridspec from dt_utils import Timer from data_utils import generate_recognition_data from torch_net_utils import maxabs, plot_W_seq, plot_xahy_seq, run_net, plot_corr, list2tensor from neural_net_utils...
07985a49bf9fff01421a6c2395168d20c2bf701c807f3ea949cd3d7644287328
Python
1,888
61
import tifffile as tiff import os from pynwb import NWBHDF5IO # this script reads .nwb files and writes corresponding new .tif files, for analysis in ImageJ. # source data: https://dandiarchive.org/dandiset/000467 # written by Taylor Hart # specify the input and output directories below: indir_path = "/Volumes/My ...
2c748e00ddb7b0837804cf8ad2a96242971d5a7e183e43ef84d4e104df988d4a
Python
1,888
66
from llama_index.core.schema import TextNode from llama_index.core import Settings from llama_index.core import VectorStoreIndex import pandas as pd from tqdm import tqdm def evaluate( dataset, embed_model, top_k=5, verbose=False, ): corpus = dataset.corpus queries = dataset.queries releva...
45a90cf529edc38158d95aad74102ec7ef21dfdef105453000cf9a6b65eebb34
Python
1,888
66
from __future__ import annotations import logging from copy import deepcopy from typing import List, Union import numpy as np from libs.common.connenction import Connection from libs.common.position import Position from libs.common.weight import Weight log = logging.getLogger(__name__) class Generator: def __...
4a13da1d0af9e5c9fe3a12eedae7b8ef3680812abb0fd69c27dddf8e3387a30c
Python
1,889
49
"""tests for asymmetry.py. a perfectly symmetric mesh (icosphere, symmetric across x=0 just by how it's built) should score close to zero, and pushing one side out should clearly raise the score. just checking this behaves sensibly, no need for a real registered face scan for that. """ import numpy as np import trime...
b4bcd01f2b6552439a80b98817ab12978b609d8a647483f780afd7ba9c408fb0
Python
1,890
54
import subprocess import sys import pytest from pytest_benchmark.fixture import BenchmarkFixture @pytest.mark.parametrize( "import_path", [ pytest.param( "from langchain_core.messages import HumanMessage", id="HumanMessage" ), pytest.param("from langchain_core.tools import...
18ac4afe4026134cbb9dfe7cb245f0d5a0f2da8c280c61cfe84252737e8f5a12
Python
1,891
70
import torch from pdearena.configs.config import Config from typing import Tuple class Normalizer(torch.nn.Module): def __init__(self, args: Config): super().__init__() self.norm = args.normalize def reshape_stats( self, shape: torch.Size, mean: ...
6941b5c604df778a1539f751f183c065c7380cdba4da4c4572392209ccaddbf6
Python
1,891
51
from langchain_core.prompts.prompt import PromptTemplate EXAMPLES = [ """Setup: You are now playing a fast paced round of TextWorld! Here is your task for today. First of all, you could, like, try to travel east. After that, take the binder from the locker. With the binder, place the binder on the mantelpiece. Alr...
87d240616e573e8f3ada8241465f8eaacd536db7503196bed7f43a691325fff5
Python
1,891
63
"""String output parser.""" from typing_extensions import override from langchain_core.output_parsers.transform import BaseTransformOutputParser class StrOutputParser(BaseTransformOutputParser[str]): """Extract text content from model outputs as a string. Converts model outputs (such as `AIMessage` or `AIM...
be150001019611582f8e176f038139bc3c8de3a23dc8c0795b4ed4f30684a49f
Python
1,891
51
import re class Tokenizer(): def __init__(self): pass def tokenize_words(self, doc_string): token_list = doc_string.strip().split() token_list = [x.strip("\u200c") for x in token_list if len(x.strip("\u200c")) != 0] return token_list def tokenize_sentences(sel...
98e40f138b6455ed15faa340aa9d25d670db3b54facfd73978d1d4d6d544c33e
Python
1,892
62
""" This script runs tensorQTL in python. """ import pandas as pd import argparse, session_info from functools import lru_cache from tensorqtl import cis, read_phenotype_bed from tensorqtl import calculate_qvalues, genotypeio @lru_cache() def get_genotypes(): plink_prefix_path = "../../plink_format/_m/genotypes" ...
c17d56f82f02f61dacfb007dd68f0b76c5cb00f42cf2a59cf23c9178b2236c6b
Python
1,892
69
import pandas as pd import numpy as np import pathlib import yaml import argparse import decoupler as dc def main(): parser = argparse.ArgumentParser() parser.add_argument("--key", type=str, required=True) parser.add_argument("--method", type=str, required=True) args = parser.parse_args() with op...
d42b087398f27f260ce688deb63df4a09532f037a4955176914bd338ea67d358
Python
1,892
54
""" Prepares input for Zilany et al. (2014) model. This is my pipeline to prepare the speech waves for the Zilany model. The speech waves are normalized, resampled to 100 kHz (as required by the model), and scaled to a given presentation level. The arrays are then saved as .npy files. """ import numpy as np import sc...
f9dec942d8208664cf116b1391f823c7e27767297e56df5fc52f2bbb0065aa2b
Python
1,892
58
import shutil import sys from pathlib import Path # ruff: noqa: E402 REPO_ROOT = Path(__file__).parent.parent.parent.resolve() sys.path.append(f"{REPO_ROOT}") from get_predictions import predict, load_model, PredictionResult DEFAULT_DISORDERED_DOMAIN_THRESHOLD = 0.35 def get_length_from_pdb_file(pdb_file): with...
5e271b572e251865e53f5ac1ead8f6cb11bc17a3efe4b5e905ce89c068c70950
Python
1,893
56
import argparse arg_parser = argparse.ArgumentParser() arg_parser.add_argument("chain_info_file") arg_parser.add_argument("--chain_mapping_file") arg_parser.add_argument("--sep_char", default="") ARGS = arg_parser.parse_args() import sys import json def readChainMappings(file_name): with open(file_name) as FH: ...
606e29f59012f1d4b98f418a2745acce746656ea91fd277e3f4d5c3167900eeb
Python
1,895
61
import os import glob import numpy as np import matplotlib.pyplot as plt from PIL import Image, ImageDraw PATH = r"H:\learned spectral unmixing\test_final\forearm/" for folder_path in glob.glob(PATH + "*"): if not os.path.isdir(folder_path): continue folder = folder_path.split("/")[-1].split("\\")[-1]...
4b6bde841200327b5e5a99bb65bcdaacef23292e0ccb0b32226542a9919cd566
Python
1,896
68
import logging import os from pathlib import Path import hydra import pandas as pd from omegaconf import DictConfig, OmegaConf from tqdm import tqdm from src import PROJECT_DIR from src.data.utils import get_file_list log = logging.getLogger(__name__) log.setLevel(logging.INFO) @hydra.main( config_path=os.path...
6b5776bfce4f79fbbe6133ab9d30407ea9bd1404b19446f18b15d10e2ebd7e0c
Python
1,896
69
import os import logging import datetime from tensorboard.backend.event_processing import event_accumulator from utils.distribution import is_master_process, sync_barrier_re1 from utils.my_containers import singleton, Register from torch.utils.tensorboard import SummaryWriter @singleton class SummaryWriterManager(o...
5c2db227927e10cb08e52d280c8eddd03535c77aa4f48a713072626bc1c00847
Python
1,897
66
import numpy as np from scipy import interpolate from skimage.morphology import binary_dilation, disk import matplotlib.pyplot as plt from matplotlib import rc rc('font', size=17) rc('font', family='Arial') # rc('font', serif='Times') rc('pdf', fonttype=42) # rc('text', usetex=True) def compute_spline_coeff(ma, bf, an...
7c9d534a50902d3b6bf5f4351da322fa6eec959fea95a2a9cce920b7ac2d6541
Python
1,898
61
from typing import List, Union import torch from torch_geometric.data.datapipes import functional_transform from torch_geometric.transforms import BaseTransform @functional_transform("y_to_indices") class YToIndices(BaseTransform): r"""Normalizes node features to mean :obj:`0` and standard deviation :obj:`1` ...
115d579c7404f6c989a25d37b543311fbe9ba84c874aa5aa07a0e331223dc870
Python
1,901
38
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
6357b4110dee0d033dac40881b8ab96488c11287249ffef38c3e1ebeb8f1a532
Python
1,902
50
"""this FastAPI app is shared by both the web version and the desktop app. desktop/app.py just runs this exact same app via uvicorn on localhost and points a pywebview window at it. same backend, same frontend, two ways to run it, no duplicated code. """ import sys from pathlib import Path from fastapi import FastAP...
91049daf30df203343600005e30eb2d004ae52ce65a80c9c25e55fb14cf6b460
Python
1,902
51
#!/usr/bin/env python # Imports import unittest import os import sys import tempfile import filecmp import shutil PATH_TO_DATA = os.path.join(os.path.dirname(os.path.realpath(__file__)), 'data') sys.path = [os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')] + sys.path from enrichm.predict import Predict...
2a490690a6b044e64e5498aa6cecd0087251b55a6a4480fcb32a2a960959f144
Python
1,903
88
import torch from torch import nn from genie.model.modules.invariant_point_attention import InvariantPointAttention from genie.model.modules.structure_transition import StructureTransition from genie.model.modules.backbone_update import BackboneUpdate class StructureLayer(nn.Module): def __init__(self, c_s, c_...
25f42c96fff8fe7b0eda34515a05f25dbac9b73b36fcd06f111fb37704a17023
Python
1,904
57
from __future__ import annotations import logging from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.utils.json import parse_json_markdown from typing_extensions import override from langchain_classic.agents.agent import AgentOut...
e13d7c97ef77009081abc3791f5fd243db285f5d9dcd390e43370612043903c8
Python
1,904
68
from torchvision.models import densenet121 import torch.nn as nn import torch from torchvision.models import resnet34 from networks import vgg3d from networks import ecg1d def get_arch(arch,pretrained=False,num_classes=14,num_channels=1): if arch == 'dn121': net = densenet121(pretrained=pretrained) ...
e45c6e48d39d919939d9f594adbc10077da48b4ef2a1ede59cc6127d9f3a5061
Python
1,905
66
# Adapted from OpenFold # Copyright 2021 AlQuraishi Laboratory # Copyright 2021 DeepMind Technologies Limited # # 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/l...
5e63dd0dcbf933c0132e0f4651022f280fcc067ad5acd5b4e0d261bfa65fbd0a
Python
1,906
58
import os import requests import time from src import constants def download(source): # Download all public/shared workflows from the given usegalaxy source out_dir = os.path.join(constants.RAW_GALAXY_FILES, source.replace(".", "_")) os.makedirs(out_dir, exist_ok=True) # Don't download workflows ...
3ad97dd7cff316e8b4d594eda4e1afce646215f5d4b0b1b5025889164ac8b7e8
Python
1,907
48
""" Analyze time taken by participants to complete the experiment (from the moment the subject gave their informed consent to the end of the last session of the task). """ import argparse import data_analysis_utils as dana import numpy as np import os.path as op import pandas as pd OUT_FNAME = "experiment_completion_...
5b819a07474e4a73ed59072ce2c52a2adeb2ec5ed1627c738dfb0fffcdb86774
Python
1,907
75
''' cgat_ini2yml ======================================= ''' import sys import re import cgatcore.experiment as E def main(argv=None): """script main. parses command line options in sys.argv, unless *argv* is given. """ if argv is None: argv = sys.argv # setup command line parser ...
53a4e0fb4e69946b2b521375529e6c3498c92f38a6dc1d96d8257ac07fca7fa2
Python
1,908
51
# Copyright 2024 DeepMind Technologies Limited. # # 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 applicable law or agreed...
6b608a5fdb7e86c4dbd9924ef349ac46fe59470d3487cba9ff603ee1a8b1c453
Python
1,908
58
import os from pathlib import Path def run_input_indiv(pdbname, num, output_folder, localopt_data_path, localopt_exec_path): Path(f"{output_folder}/relaxed").mkdir(exist_ok=True) Path(f"{output_folder}/relaxation_scripts").mkdir(exist_ok=True) input_line = f"""data_directory {localopt_data_path} to...
b5b11c288dab5ea69dee18cc0b2a0b4c3a28a7b050269ebd3653b4d479120fce
Python
1,908
70
#!/usr/bin/env python3 import yaml import pathlib # yaml makes me cry # https://github.com/yaml/pyyaml/issues/98#issuecomment-436814271 # This was causing a warning of NA coercion in R because some kegg pathways were specified as "03602,034,0230" # and were not being quoted properly by this pkg from yaml import Dumpe...
83029af50dbf23e7102c01f524a9e5105ad08017a18da543782551b5efdae6db
Python
1,909
54
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup -------------------------------------------------------------- # If extensions (or module...
1b5b32ecb2ef9196d848c5096d38e5586831693830c6b647e8443b24eb952927
Python
1,911
43
from langchain_core.prompts.prompt import PromptTemplate _DEFAULT_TEMPLATE = """Question: Who lived longer, Muhammad Ali or Alan Turing? Are follow up questions needed here: Yes. Follow up: How old was Muhammad Ali when he died? Intermediate answer: Muhammad Ali was 74 years old when he died. Follow up: How old was Al...
c612548e4c733634f5145958843c46abd2c6ab0eed8f3b1980ef71e1329501f5
Python
1,911
45
import os import time import pandas as pd from get_predictions import predict, load_model, parse_args import matplotlib.pyplot as plt if __name__=="__main__": args = parse_args() # structure_dir = "/Users/judewells/Documents/dataScienceProgramming/data_for_domdet/human_200_c2m" outer_save_dir = "/Users/...
06ee952f3852286bdbe5ac7cdcffdbd1792eaa97a4078f94ad99d77e4a087c69
Python
1,912
69
import os from bindsnet.network import Network, load from bindsnet.network.monitors import Monitor from bindsnet.network.nodes import Input, LIFNodes from bindsnet.network.topology import Connection class TestNetwork: """ Tests basic network functionality. """ def test_empty(self): for dt in...
08c36c2ab361b327dd46395ac6cc4773a35eb0eb21518fad709170a0481542bf
Python
1,912
53
"""This is an automatic script to run all the Python-Matlab Unittests at ones""" import unittest from lp_filter_zero_phase_unit_test import lp_filter_zero_phase_unit_test from peak_det_amp_threshold_unit_test import ( peak_det_amp_threshold_unit_test, ) from peak_det_local_search_unit_test import peak_det_local_se...
d1de61ae1a14889c112e27792ae2b5b35581df4061240ba4af5d99b44167bdb8
Python
1,912
50
# coding=utf-8 import numpy as np import torch def Nmax(test_envs, d): for i in range(len(test_envs)): if d < test_envs[i]: return i return len(test_envs) def random_pairs_of_minibatches_by_domainperm(minibatches): perm = torch.randperm(len(minibatches)).tolist() pairs = [] ...
490e45b8869a5862944ab08ef901ec5fedde2bfd843775497a5d80a2992bf6bf
Python
1,915
54
#! /usr/local/bin/python #'################################################################################# #'################################################################################# #' Run random search on tcga data #'################################################################################# #'######...
5d4c1838c9a6e49556922a959ff62e1cdd9d3bd121a31b71363661832d4526ee
Python
1,918
70
import os import torch from torch import distributed as dist from functools import partial from utils.my_containers import singleton @singleton class DeviceManager(object): def __init__(self, device=''): self.device = setup_device(device, mannul=False) def get_device(self): return self.devic...
5bba9e2b66f286f8ce79f3f1972c49ee4500f70388e11b48128ef51d0c825424
Python
1,919
27
PODCAST_DOCS = """API documentation: Endpoint: https://listen-api.listennotes.com/api/v2 GET /search This API is for searching podcasts or episodes. Query parameters table: q | string | Search term, e.g., person, place, topic... You can use double quotes to do verbatim match, e.g., "game of thrones". Otherwise, it's ...
59b8f364d265bd0be6f978277fd147734b6de4b5c66fa46e9cc33d51820e814b
Python
1,920
62
#!/usr/bin/env python3 import argparse import os import struct import subprocess from datetime import datetime import contextlib @contextlib.contextmanager def cd(cd_path): saved_path = os.getcwd() os.chdir(cd_path) yield os.chdir(saved_path) parser = argparse.ArgumentParser( description='Conve...
bb53ccaa2c7f46baf6d9041f87be6159bffd8ebd75e21d22e8bc3c8c396abc0d
Python
1,922
32
import argparse import torch def get_training_config(args=None): parser = argparse.ArgumentParser( description="Graph Neural Network based reinforcement learning solution for Power network reconfiguration") parser.add_argument('--features_dim', type=int, default=128, help="Embedding length") ...
bedbc4498ea89751bb55b006b6d133bf17a7e57340e7d281b0d77b6514772398
Python
1,923
46
from langchain_core.prompts.prompt import PromptTemplate web_search_template = """Please write a passage to answer the question Question: {QUESTION} Passage:""" web_search = PromptTemplate(template=web_search_template, input_variables=["QUESTION"]) sci_fact_template = """Please write a scientific paper passage to supp...
af52c1e3870c632b1e1825e23424881f77ea0e75627b81a1484f37f12e98051d
Python
1,924
53
from langchain_core.prompts.chat import ( ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, ) from langchain_core.prompts.prompt import PromptTemplate from langchain_classic.chains.prompt_selector import ( ConditionalPromptSelector, is_chat_model, ) templ1 = """You are a...
d1e63d4c19fc404a609acebe3a6d2eed4316d766318454c80e7f8f486150d44d
Python
1,924
72
from pathlib import Path from omegaconf import OmegaConf from libs.eval.character import Eval as CEV from libs.eval.expresult import ExpResult from libs.eval.metrics import Eval as MEV from libs.eval.structure import Eval as SEV from libs.utils.utils import set_seed from libs.visualizer.metrics import CompGenVisualiz...
3357251fb79b7ad13010f4995ac36c6aab729a743ec1bbf3d0bb6de686d001a7
Python
1,927
61
from .clean_protein import ResidueMutator, cleanProtein from .get_atom_charge_radius import getAtomChargeRadius from .get_atom_sesa import getAtomSESA from .get_atom_sasa import getAtomSASA, Radius from .get_atom_depth import getAtomDepth from .get_dssp import getDSSP from .get_achtley_factors import getAchtleyFactors ...
40996cbdf90d471206a76731f9c804ebe9bfec9e4a45aebe1c1043e76fd5b150
Python
1,929
39
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Description: : @Date : 2022/06/15 12:27:12 @Author : Zilan Yu @version : 1.0 ''' from argparse import ArgumentParser #Args parser parser = ArgumentParser(description="Specifying Input Parameters") # Data directory parser.add_argument("-pd", "--p...
7f635a4aa60a42b75db84f8594a3a341907c223169e13339863dcf7408d63c04
Python
1,930
57
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2023 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for d...
edca3dd54454783d594adb2a794521147bcfafef15b78c1c4a2ec710dc2b1250
Python
1,930
57
#################################################################################### # # STEPS - STochastic Engine for Pathway Simulation # Copyright (C) 2007-2026 Okinawa Institute of Science and Technology, Japan. # Copyright (C) 2003-2006 University of Antwerp, Belgium. # # See the file AUTHORS for detai...
f22d38f579c2ca82c0194b34d2b87c20d542c1085191d32213b93664747b3f22
Python
1,932
44
#External imports import torch from torch.utils.data import TensorDataset import torch.nn.functional as F #My imports from data import generate_recog_data_batch from networks import HebbNet from plotting import plot_train_perf from net_utils import binary_classifier_accuracy def generate_juri_data(T=100): ...
0404f74b129f4b24baaf473629b6268600e4294374bceb00c0026901f58df8e7
Python
1,933
52
"""Preserve legacy notebook molecules and MSAs in Boltz's RGI-capable YAML.""" import copy def notebook_input( entries, *, config=None, conformer_chains="ligands", single_sequence=False ): sequences = [] ligands = set() for header, sequence in entries: fields = header.lstrip(">").split("|") ...
20bd651515c94f97bed59f040b6832038e9ed314c023bda45854e26435f4d5b5
Python
1,934
32
import argparse import torch def get_training_config(args=None): parser = argparse.ArgumentParser( description="Graph Neural Network based reinforcement learning solution for Power network reconfiguration") parser.add_argument('--features_dim', type=int, default=128, help="Embedding length") ...
b8d3d946c68080d0bc708bca9fef7db489e10e2e0597bfc1f40a1695c844d5ac
Python
1,934
79
# 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...
467748b09bf0e416c30d8791f6d75347a9a9173fdf807c7c5329d49c1c907d06
Python
1,935
70
# Copyright (c) 2023 Shihao Ma, Haotian Cui, WangLab @ U of T from typing import Iterable import numpy as np import skunk from matplotlib.offsetbox import AnnotationBbox, OffsetImage, TextArea, VPacker def _nearest_spiral_layout(x, y, offset): # make spiral angles = np.linspace(-np.pi, np.pi, len(x) + 1 + of...
a4d8bede5a8aca4ec58bf245661735aa46fcfa545a3aab4e3cf91618d7b6953d
Python
1,935
66
import torch import torch.nn as nn from core.network.model import model_register from core.network.utils import cosine_similarity @model_register class VariationalAutoEncoder(torch.nn.Module): def __init__(self, cfg): super(VariationalAutoEncoder, self).__init__() self.cfg = cfg self.emb_...
b7e466776b206208ca75ba8073475468b35b2be94ca55b062a376c56506d998f
Python
1,936
62
from enum import Enum from typing import Callable from typing import Optional from neuralpredictors.measures import modules as ml_measures from pydantic import BaseModel from pydantic import PositiveFloat from pydantic import PositiveInt from torch import nn from ..common.config import get_config_file from ..common.c...
23a239918997e48f81c90a953a0854109459efe94f6fb7346c3f5effaef3fb0a
Python
1,938
60
import warnings from contextlib import contextmanager import torch @contextmanager def eval_state(model): """ Context manager, within which the model will be under `eval` mode. Upon existing, the model will return to whatever training state it was as it entered into the context. Args: mo...
a799161210496cfaf397730954b17ba43ae6ea6957927f3f7aefbda7b90cb6c4
Python
1,938
52
# Copyright 2022 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...
0a1dcc0b2beedfa9ace76aeb4e5fb1871ce95cede56c602ec62578eda5c00aed
Python
1,939
54
# -- coding: utf-8 -- # @Time : 2022/12/19 21:16 # @Author : Biao Zhang # @Email : littlebiao@outlook.com # @File : test_tree.py # @Description: This file is used to ... import pandas as pd from treelib import Node, Tree tree = Tree() tree.create_node('root', 'root') def add_node(tree_dict, key_input): if tree_di...
1155a0cdb14e99fea198388066a600273b2235eae9dd8342fd366af43edf7f44
Python
1,939
77
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Most of this script is simply copied from: https://scikit-learn.org/stable/auto_examples/linear_model/ In the example Comparing Linear Bayesian Regressors """ # pylint: skip-file from matplotlib.colors import SymLogNorm import seaborn as sns import matplotlib.pyplo...
392ed55811893d346eb55a228faeafbc6155e05db1b59b4f534a3c9d896160ac
Python
1,939
59
import numpy as np import os from brian2 import * from brian2modelfitting import * from Analysis.dataloader import dataloader_AP experimentalist = 'Elodie' neuron = 'MSN_In_Vitro' path = '/users/gvignoud/Documents/numeric_networks/Data/'+experimentalist+'_'+neuron+'/' file_list = [u for u in os.listdir(path) if u[-7:...
2b03bf5ef94772aa024a269603bd972170183c3a2e932dad411754ea09241e74
Python
1,943
53
"""A server that needs input mid-call, answered by a human. Some MCP tools cannot finish without asking something. `MCPAdapter` surfaces the question as a LangGraph `interrupt()`, so the person already reviewing the agent's work answers it and the run resumes. The adapter arms every client it builds to advertise the ...