sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
63c79b72ec965cc4eb0848dd63d0ebb65b1b5cd437dfd162519243ebe98ef851
Python
1,139
32
from lips.benchmark.airfransBenchmark import AirfRANSBenchmark from lips.dataset.airfransDataSet import AirfRANSDataSet, extract_dataset_by_simulations import dill import os import numpy as np import json ROOT = "." DIRECTORY_NAME = os.path.join(ROOT, 'Dataset') BENCHMARK_NAME = "Case1" LOG_PATH = os.path.join(ROOT,...
a59f7d006174fb069705d51f17dd104e6ede95ed76efcfd4b9e1397aa56ab808
Python
1,139
44
# 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_amp_threshold import ( peak_det_amp_threshold, ) import unit_test as testing mat = scipy.io.loadmat("../../../datasets/sample-data/SampleECG1.mat")["dat...
651a5c04b8c09670cda894a86cb5fb053fd19ee56b557447f2c2855b7e4a97c6
Python
1,140
28
"""Custom auth so `langgraph dev` knows which user a run belongs to. The handler maps the `x-user-id` header to a user identity. That identity is what `graph_factory.make_graph` reads off `runtime.user` and mints an MCP token for, so each run talks to the fleet as its own user. A real deployment validates a credential...
7303b03eeeee5e72ee0e1fce304ef97de3a62009e2fd8dc1d9f4a06360a4f6d6
Python
1,140
47
import numpy as np import nibabel as nib from time import time from dipy.data import get_sphere from dipy.reconst.shm import real_sh_tournier from dipy.reconst.shm import calculate_max_order def main(sh_fname, sh_norm_fname): sh_img = nib.load(sh_fname) sh = sh_img.get_fdata() affine = sh_img.affine ...
7269c21cd649be96c544047e3b9bbd74d4c00132842b530ce9f230f3e69a361d
Python
1,141
43
# -*- coding:utf-8 -*- import argparse import csv from rdkit import Chem import preprocess_ea_data as ped def process_reaction(line, ofile, flavor_db): row = line.split(" ") smiles = row[0].split(">") flag = False for s in smiles: mols = [] try: ped.get_mols_without_h(s, mol...
75c212f6c97830e5751a8ea6db409cf0e23feeeab11ae1be328b32cca4a4d1a6
Python
1,141
50
# Copyright (c) 2021, David Williams, Reza Sameni # All rights reserved. # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. import numpy as np import scipy.linalg as la from SynchPhaseTimes2 import SynchPhaseTimes2 def PiCA(x,peaks,varar...
6557bb81f8b7fea8eb4bab7c0783d73794ae2d89e3affe58fa6d55b1d6a41914
Python
1,142
45
from langchain_core.runnables import __all__ EXPECTED_ALL = [ "chain", "AddableDict", "ConfigurableField", "ConfigurableFieldSingleOption", "ConfigurableFieldMultiOption", "ConfigurableFieldSpec", "ensure_config", "run_in_executor", "patch_config", "RouterInput", "RouterRunn...
8f075a9c3ab38d6ed82c62adcb8de964043c4dc67d21702c2b473f7253560181
Python
1,142
34
import argparse import trimesh def convert_stl_to_obj(input_stl_path, output_obj_path): """Convert STL file to OBJ format and check mesh validity.""" # 加载STL文件 mesh_data = trimesh.load_mesh(input_stl_path) # 检查网格是否封闭(水密性) if not mesh_data.is_watertight: print("Warning: The mesh is not wate...
2858a7f00e2c6b34bbe89800b2d91a50b76e4d0efbb3ef9fed625e1923fccf12
Python
1,143
49
""" Usage: python merge_fc.py --fc_dir <fc_dir> """ import argparse import os from functools import reduce import pandas as pd def main(): parser = argparse.ArgumentParser() parser.add_argument( '--fc_dir', help='Path to the directory containing the feature count files', required=Tru...
83135cf5c7d780d4e8b77f5c94f529daf9941e71d1c643be490f510df6b22c68
Python
1,143
19
"""This package contains the classes and subclasses used to create the plants that a model will be trained to control. Plants are implemented as subclasses of the :class:`motornet.plants.plants.Plant` object. They all contain a single :class:`motornet.plants.skeletons.Skeleton` and :class:`motornet.plants.muscles.Muscl...
c553ec1bd2451645b6f7ce49acdc63484a70e3ab865e7e2dfb186747a15b6808
Python
1,143
37
""" scaden Main functionality Contains code to - process a training datasets - train a model - perform predictions """ # Imports import tensorflow as tf from anndata import read_h5ad from scaden.model.functions import get_signature_genes, preprocess_h5ad_data """ PARAMETERS """ # ===================================...
402648af94ff983022d0d8841ddb64b0793c1aa0390075261907c353f122f286
Python
1,144
40
from .BIF import BIFReader, BIFWriter from .LGBNJSON import LGBNJSONReader, LGBNJSONWriter from .NET import NETReader, NETWriter from .PomdpX import PomdpXReader, PomdpXWriter from .UAI import UAIReader, UAIWriter from .XDSL import XDSLReader, XDSLWriter from .XMLBeliefNetwork import XBNReader, XBNWriter from .XMLBIF i...
8c4fa03ccee9202fc0021fd119dff8fb148607f01d847c31fbf15a6c8a1a86f4
Python
1,144
55
import torch from torch import nn from neuralpredictors.old_constraints import positive class GradientMixin: """ Test whether the constrain correctly switches off the gradient for tensors and parameters. When subclassing, you need to implement a function ``` @staticmethod def apply_constrai...
46e0e77a2ef9cd86a94d3968f7d135e74b072e189b6fddefb84056bfeccbf807
Python
1,145
38
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.callbacks.mlflow_callback import ( MlflowCallbackHandler, MlflowLogger, analyze_text, construct_html_from_prompt_and_generation, ) # Create a way...
66c89db0b517d1bcf10c342c33b1c7a33e583253943347938b1b16bf2172009d
Python
1,145
36
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.chains.graph_qa.neptune_sparql import ( INTERMEDIATE_STEPS_KEY, SPARQL_GENERATION_TEMPLATE, NeptuneSparqlQAChain, extract_sparql, ) # Create a wa...
f4ed686194f7ab73366804141764528bb67d8ec0ae7985debb3c31af8efc9b8a
Python
1,146
35
""" Package providing miscellaneous functionalities such as datsets, input-output, visualization, profiling methods ... :Version: 1.1.0 :Date: 19.03.2017 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2017 Jan Melchior ...
78048ba347a278ab4460c4b35fe3475afecc0be60ff9fd94d1b9a264a08afaaf
Python
1,147
23
# MIT License # Copyright (c) 2023 The embanded authors # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, ...
82fe493fc7ec37db8de9fd7ceffdbb7755fe2da4883a20e591008dd61c2d0bba
Python
1,147
40
"""This module provides dynamic access to deprecated Jira tools. When attributes like `JiraAction` are accessed, they are redirected to their new locations in `langchain_community.tools`. This ensures backward compatibility while warning developers about deprecation. Attributes: JiraAction (deprecated): Dynamical...
8e4817f26d61e9a7dc4d3529c31ed6bbc26bc7d37c62dba3ed4f81f0eee84d9c
Python
1,147
30
from data import generate_recog_data_batch, generate_recog_data from networks import VanillaRNN from plotting import plot_recog_generalization, plot_train_perf #%% d=25 N=625 R = [3,6] gen_data = lambda: generate_recog_data_batch(T=500, d=d, R=R, P=0.5, batchSize=1, multiRep=False) dims = [d,N,1] net = Van...
06cca965f76fdad26b1b7ddba614f55bd6e6fe1f333dc58e1653da22c9456188
Python
1,148
36
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.utils.ernie_functions import ( FunctionDescription, ToolDescription, convert_pydantic_to_ernie_function, convert_pydantic_to_ernie_tool, ) # Crea...
4cbe5dba0bd1292c3a77816ef1a640934022c1448e4bc7aeb2ce439af6a5d610
Python
1,148
41
from typing import Any from typing import Dict from typing import Optional import torch from neuralpredictors.layers.readouts import MultiReadoutBase from torch import nn from .core import Core2d from .nonlinearity import NonLinearity class Model(nn.Module): def __init__( self, core: Core2d, ...
f679538b2a58903c99c2a65306f21adbfa4e9e854286765fdb4322cafb17b278
Python
1,149
33
#!/usr/bin/env python import os import gzip import tempfile class CombinedFragmentFiles: def __init__(self, files, chromosomes, barcodes = None): self.files = files self.chromosomes = chromosomes self.barcodes = barcodes def __enter__(self): self.tempfile = tempfile.Named...
35297ff10f5a496a8676f17b7363724af3b1f82a76662a95f5ba71691d5d1a65
Python
1,152
30
from langchain_core.prompts.prompt import PromptTemplate _CREATE_DRAFT_ANSWER_TEMPLATE = """{question}\n\n""" CREATE_DRAFT_ANSWER_PROMPT = PromptTemplate( input_variables=["question"], template=_CREATE_DRAFT_ANSWER_TEMPLATE ) _LIST_ASSERTIONS_TEMPLATE = """Here is a statement: {statement} Make a bullet point list...
8c054335f299d748e4c681e3c5e0ecd1779506d6defed922e3aa45b662864699
Python
1,152
45
# For this you need matlab and the new requirements.txt import argparse import matlab import matlab.engine import numpy as np import scipy.io from oset.ecg.peak_detection.peak_det_pan_tompkins import ( peak_det_pan_tompkins, ) import unit_test as testing mat = scipy.io.loadmat("../../../datasets/sample-data/Samp...
6837b760313805e889b06dbf812f204c37d2e0ebe702523eaedd42fc318f6b7b
Python
1,153
30
import argparse import cwas.factory import pytest from cwas.runnable import Runnable def test_make_class_name(): assert cwas.factory.make_class_name("categorization") == "Categorization" assert cwas.factory.make_class_name("annotation") == "Annotation" assert cwas.factory.make_class_name("burden_test") =...
f71436d78631e074cfaf33b6ae86514144fd8894a3335ee8e60091a87b2c554b
Python
1,155
36
import os import csv import torch from validate import validate from networks.resnet import resnet50 from options.test_options import TestOptions from eval_config import * # Running tests opt = TestOptions().parse(print_options=False) model_name = os.path.basename(model_path).replace('.pth', '') rows = [["{} model t...
14aacbce18abbb2ba201df720c36aa21f550b5189df7d348686ac9aa8e023409
Python
1,156
44
from __future__ import annotations import numpy as np class Hebb: def __init__(self, parameter: np.ndarray, lr: float) -> None: self.parameter = parameter self.mask = (self.parameter != 0) * 1 self.lr = lr def fit(self, pre: np.ndarray, post: np.ndarray) -> None: dw = np.dot...
4fc51b22ec5b96723a072870f81300cf041c6c1e70c3737a06232a309c52e897
Python
1,156
32
"""Prompt for the router chain in the multi-prompt chain.""" MULTI_PROMPT_ROUTER_TEMPLATE = """\ Given a raw text input to a language model select the model prompt best suited for \ the input. You will be given the names of the available prompts and a description of \ what the prompt is best suited for. You may also r...
c64e73b6aca464974d05fcb299d0620093cb61eb75307fa9c73f366396da9533
Python
1,156
24
from langchain_core.prompts.prompt import PromptTemplate _DEFAULT_ENTITY_SUMMARIZATION_TEMPLATE = """You are an AI assistant helping a human keep track of facts about relevant people, places, and concepts in their life. Update the summary of the provided entity in the "Entity" section based on the last line of your co...
4a782fe5217037882033fd0446b501ea6a8ce0ce62a1f23de7ec4d47c1066e60
Python
1,157
42
# import built-in modules import argparse import os import glob import shutil from time import time from pathlib import Path from tqdm import tqdm import pandas as pd # import local modules from sscd_libs.helpers import ( boolean_string, clean_output_dir, unpack_for_string, query_yes_no ) from s...
c04002c15dc6ebc2c642f0804c3a7e1ae2f77dc0ba9e007844ec78259dc3b224
Python
1,157
42
from langchain_core.callbacks import __all__ EXPECTED_ALL = [ "RetrieverManagerMixin", "LLMManagerMixin", "ChainManagerMixin", "ToolManagerMixin", "Callbacks", "CallbackManagerMixin", "RunManagerMixin", "BaseCallbackHandler", "AsyncCallbackHandler", "BaseCallbackManager", "B...
d56cb14af5a824f589d13947ed07ee2e81f226297d4a8dac57747368616f2678
Python
1,158
39
#! /usr/local/bin/python #'################################################################################# #'################################################################################# #' Transform hdf5 data to list with input for biodnn model #'#################################################################...
d870aad36a110ead42cd3ed190e429b77d7b028a48be19cc083da35b72c75eee
Python
1,158
41
import numpy as np import struct def writemda(X, fname, dtype="int16"): '''Python implementation of .mda file write function About MDA files: http://magland.github.io//articles/mda-format/ Currently only supporsts <int16> format export ''' # confirm number of dimensions of array # TODO ha...
4d7f2e4cc915d6a6fb1af8b72d10ad21d287aaa4add6a3899141c477f55b7ca3
Python
1,160
42
#!/bin/env python3 import voxcell as vc import numpy as np import sys hierarchy_json = sys.argv[1] brain_regions_nrrd = sys.argv[2] output = sys.argv[3] include = [] if len(sys.argv) > 4: include = sys.argv[4] include = include.split(",") exclude = [] if len(sys.argv) > 5: exclude = sys.argv[5] excl...
4d5754b891497727dc72564fe89612e53d311f2be1521963f39a9870e001769d
Python
1,162
28
# Generated by Django 3.1.4 on 2022-05-11 19:55 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Analysis', fields=[ ('id', models.AutoField...
d8ac97c5e8fcf16ed689781dcb0676b74a99029e4bd0dfd7eb53c62a42dbff2b
Python
1,162
34
#%% dataset_dir = "spatial_prompt/" import pandas as pd import numpy as np import scanpy as sc import STAGATE import time import tensorflow as tf tf.compat.v1.disable_eager_execution() dt_dir = "benchmark/" import stlearn as st #%% import data libd_data_dir = dataset_dir+"benchmark/spatiallibd/st_data/spatialLIBD/" li...
655da0be83d3a08e56e8a084b5ba48332d468153504911396d9367a647fbb15b
Python
1,163
35
#!/usr/bin/env python import os import tempfile import unittest import hashlib from ldr.utilities.utilities import untar class TestUntarOutput: def __init__(self, tar): self.tar = tar def __enter__(self): self.directory = tempfile.TemporaryDirectory() untar(self.tar, self.direct...
d14a9e854d67fe30d65904e3d5d0d9008bfb93b852b53edc07cb36c8d004b681
Python
1,164
39
import pandas as pd import matplotlib.pyplot as plt import numpy as np from statsmodels.tsa.seasonal import seasonal_decompose # read data df = pd.read_csv('o1_i900s_w1_s1_fmean.csv', index_col='dateTime',parse_dates=True) def stl(data, freq): decomposition = seasonal_decompose(data, model='additive', pe...
180a4811c65e3c220fa4f9e23124575e20ff85e3d2f4060485551bdcfd2068bf
Python
1,165
37
#! /usr/local/bin/python #'################################################################################# #'################################################################################# #' Extract features from network #'################################################################################# #'######...
45785f8f87ad40d924225c2ab0282af9505508abbd59b8690cce5d13f584a113
Python
1,166
37
from PIL import Image from PIL import ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True import numpy as np from tiatoolbox.tools.stainaugment import StainAugmentor class StainAugment(object): def __init__(self, p=0.5) -> None: stain_matrix = np.array([[0.91633014, -0.20408072, -0.34451435], ...
5dee11cc01dcc5e8eb84f31e9e10f911e68a7467523de9703943c4b1db15c5a3
Python
1,166
35
from pycromanager import ZMQRemoteMMCoreJ import numpy as np import time core = ZMQRemoteMMCoreJ() camera_name = core.get_camera_device() #trigger mode core.set_trigger_mode(camera_name, 'FrameStart', True) print(core.get_trigger_mode(camera_name, 'FrameStart')) core.set_trigger_mode(camera_name, 'FrameStart', False...
4e069c8c63d54aff1bad882ee0fcad6b73911d60b58fd04fe7d871abae9f59f1
Python
1,167
41
import os import json # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) class Params: """ Class that stores and loads hyper-parameters """ def __init__(self, params=None): if params: self....
37ca3c65b985e6e5abac72c4639fd879daf548162587641d576a75f88a9758ff
Python
1,168
40
import pytest from langchain_core.tools import BaseTool, tool from langchain_classic.tools.render import ( render_text_description, render_text_description_and_args, ) @tool def search(query: str) -> str: # noqa: ARG001 """Lookup things online.""" return "foo" @tool def calculator(expression: str)...
ae043da3d9be1b56f14e6c0b29e6219bef7a55a1707333a2671850fc3c450ac9
Python
1,169
46
import matplotlib.pyplot as plt import pandas as pd import numpy as np mean = 20.22 vari = 0.96 def target_distribution(x): return np.exp(-(x - mean) ** 2.0 / (2.0 * vari ** 2.0)) / (np.sqrt(2.0 * np.pi) * vari) def proposal_distribution(x, step): return np.random.uniform(x - step, x + step) ...
5c5383390342f04fd14a31c9015f56bc73909bb245dba663f0746c5f2c755c33
Python
1,170
39
from datetime import datetime import pytest from langchain_core.exceptions import OutputParserException from langchain_classic.output_parsers.datetime import DatetimeOutputParser def test_datetime_output_parser_parse() -> None: parser = DatetimeOutputParser() # Test valid input date = datetime.now() #...
c4b9822916548b9d71e55d784c99eeb56c39ab4ae8b06344b75c93c1440173a7
Python
1,170
37
import torch import torch.nn as nn class simpleECG(nn.Module): def __init__(self,num_classes=5,num_channels=12,**kwargs): super(simpleECG, self).__init__() self.num_channels = num_channels self.num_classes = num_classes k = 64 M = 7 modules = [] #m...
46d4e0d1257a7864bdd52d7a88c5e5c744d6068093310b88c0b7f68741bfa69b
Python
1,172
26
import mne import os.path as op from config_FaceName import MEG_data_path,group_name,Ids,conditions_encode,conditions_recall,eq_conditions_encode,eq_conditions_recall from custom_functions import eq_cond_name for subject_id in Ids: subject = group_name+"%02d" % subject_id print("processing subject: %s" %...
f4a955a83abb806bd3f4dab2312645fa2f6b8799e8a520e38459aa6bea5f268e
Python
1,172
46
'''Trackers for analysing chromatin tracks.''' import os import sys import re import types import itertools import glob from PeakcallingReport import * from cgatReport.Tracker import * class TrackerTracks(TrackerSQL): mPattern = "_tracks$" def getTracks(self, subset=None): return [x for x in Tracke...
f9c074ee6426ce1348daefa54166d0f6e789eae505594b8c34663d62e327fe3b
Python
1,172
38
import logging import sys import uuid import pytest from langchain_classic.callbacks.tracers import LoggingCallbackHandler def test_logging( caplog: pytest.LogCaptureFixture, capsys: pytest.CaptureFixture[str], ) -> None: # Set up a Logger and a handler so we can check the Logger's handlers work too ...
d11a1d0ce8808b9dec897c88ebdffe9e4511bebe768e9d35343f920bc0ae5aa5
Python
1,173
32
################################################################################## # DNN gene expression autoencoder pathways network 3 ################################################################################## ################################################################################## from tensorflow.k...
abaf12d462179dface22b1d3780aea4faef91fac92bac079506593e3a8e35ff8
Python
1,174
48
import sys import numpy as np import torch import torch.nn as nn import joblib from dt_utils import Timer from data_utils import generate_recognition_data from plastic import PlasticNet from neural_net_utils import random_weight_init d = 50 #length of input vector R = int(sys.argv[1]) ...
b79dc60c5863aa34d20569bd15e9555b26f63e67b1ecd1bbfb45e55f1136b57f
Python
1,175
42
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.tools import ( BaseRequestsTool, RequestsDeleteTool, RequestsGetTool, RequestsPatchTool, RequestsPostTool, RequestsPutTool, ) # C...
5d62d20770a761f865eb6479271db5aaa1eadc25cdb604e48c3065cda8d1a397
Python
1,177
49
import numpy as np import scipy.sparse as sp #################################################### # This tool is to collect neighbors, and reform them # as numpy.array style for futher usage. #################################################### # This is for DBLP pa = np.genfromtxt("./dblp/pa.txt") a_n = {} for i in ...
cdeade09fc884a78de833b257e90951ec35f3e540272bc1017325a203366f388
Python
1,178
42
"""Logic for selecting examples to include in prompts.""" from typing import TYPE_CHECKING, Any from langchain_core.example_selectors.length_based import ( LengthBasedExampleSelector, ) from langchain_core.example_selectors.semantic_similarity import ( MaxMarginalRelevanceExampleSelector, SemanticSimilari...
1ad553ca62874ae6512ac4820e3bb417ff6cc93a1a2846d11f586b7d8219c986
Python
1,180
36
""" Package providing basic/fundamental functions/structures such as cost-functions, activation-functions, \ preprocessing ... :Version: 1.1.0 :Date: 13.03.2017 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2017 J...
ecd9e6558aa4eb499f44bca65c98a75b6454d49bc675c28cc9f078fb3c7ee98f
Python
1,180
36
from langchain_core.prompts import PromptTemplate from langchain_core.prompts.chat import ( ChatPromptTemplate, HumanMessagePromptTemplate, SystemMessagePromptTemplate, ) from langchain_classic.chains.prompt_selector import ( ConditionalPromptSelector, is_chat_model, ) prompt_template = """Use the...
28ea75039bc1d263eac4771854d659d4d9bef2579d18a13fb4923a39322ea354
Python
1,181
38
import os import pydicom import numpy as np from glob import glob,iglob from tqdm import tqdm import skimage.transform as sktf from joblib import Parallel,delayed from engine import utils from constants import BASE_DATA_DIR,CXRAY_SZ,MIMIC_DIR def resize_mimic_dcms(): dst_folder = utils.get_prepared_path('%sdcm3...
76c654cd1bc5db379893c9b6ed534bfacbf3f105e4016ec3261aab6d3e6110b2
Python
1,181
29
from pycromanager import Acquisition, multi_d_acquisition_events, AcqNotification import time import numpy as np events = multi_d_acquisition_events(num_time_points=10, time_interval_s=0) print_notification_fn = lambda x: print(x.to_json()) start = time.time() with Acquisition(directory='C:\\Users\\henry\\Desktop\\d...
51c2d3c097f46f71bdf1b173e592064512975d02f29d8a42617f34febf8b8b5f
Python
1,182
38
import os __all__ = ["dynamic_metadata"] def __dir__(): return __all__ KEYS = {"env-prefix"} DEFAULT_EXTRA_PREFIX = "default-" def dynamic_metadata(field, settings, project): """Return the list of package dependencies This function reads dependencies from the project.optional-dependencies table ...
ddc555ae9c65c7c695c30ebf50f01d3ef5eae6631f1442dcd8bd2fafbf3c2e50
Python
1,182
36
from astrocast.autoencoders import CNN_Autoencoder, TimeSeriesRnnAE, PaddedDataLoader from astrocast.helper import DummyGenerator class TestAutoEncoders: def setup_class(self): pass def teardown_class(self): pass def test_cnn(self, trace_length=16, num_rows=128): DG = DummyGener...
8de20dd0dffdac5fec4780ce190a3800c5d21a1b8e1c1c5ed31d278a1e0ff0db
Python
1,183
33
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Dec 13 21:12:37 2020 @author: shni2598 """ import numpy as np #%% class get_stim_scale: def __init__(self): self.seed = 10 self.stim_dura = 200 # ms self.separate_dura = np.array([300,500]) # ms self.dt_stim = 1...
6f745f88814a7e9a3e53e1110e452c6ef58ed17ac7c06725b639f21199d1951f
Python
1,184
41
import numpy as np from dival import TaskTable from dival.measure import PSNR, SSIM from dival.reconstructors.odl_reconstructors import FBPReconstructor from dliplib.utils import Params from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset from dliplib.utils.reports import save_results_...
87da503ab9a83c5f464192666cb3bc3bef5c8834b2767a78e4b13e4f92a05e5c
Python
1,184
34
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Apr 19 22:15:19 2021 @author: shni2598 """ import numpy as np #%% class get_stim_scale: def __init__(self): self.seed = 10 self.stim_dura = 200 # ms self.separate_dura = np.array([300,500]) # ms self.dt_stim = ...
d87da19061aa14fe400c1bcd07c82d07019ac29d319b81ecce9f2e2b26ff1523
Python
1,184
38
import numpy as np from dival import TaskTable from dival.measure import PSNR, SSIM from dival.reconstructors.odl_reconstructors import FBPReconstructor from dliplib.utils import Params from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset from dliplib.utils.reports import save_results_...
e3a5ed99188c2e9d1185145c4ad53560a9ad34227b04d211c884e7f0d06bac2d
Python
1,185
29
SYSTEM_MESSAGE_PREFIX = """Answer the following questions as best you can. You have access to the following tools:""" # noqa: E501 FORMAT_INSTRUCTIONS = """The way you use the tools is by specifying a json blob. Specifically, this json should have a `action` key (with the name of the tool to use) and a `action_input` ...
fa0fbb6a4e232c64bd2f55c6b321e1f4e98940b07c294c219b1d763f84413235
Python
1,185
48
from __future__ import print_function import argparse import sys # for commanad line import os # for file paths import re import itertools import cPickle as pickle import numpy as np def main(): '''Read reactions''' global v found_counts = [] times = [] candidate_counts = [] f = open(inf...
9d3e84a6632a2108a56465be5ad5642a3103acfad378ec7d36a45026d8983358
Python
1,186
27
import setuptools with open("README.md", "r") as fh: long_description = fh.read() setuptools.setup( name="brainagemodel", version="0.0.1", author="Amir H. Ansari, Kirubin Pillay", author_email="amirans65.ai@gmail.com", description="This package provids the essential implimentations of a deep ...
fb434d07e13fc36616abc7a1cace92aff6393ee55f14fae5bde98402f07e6424
Python
1,187
24
import os import setuptools setuptools.setup( name='nowcasting', version="0.1.dev0", author="Xingjian Shi, Zhihan Gao, Leonard Lausen, Hao Wang, Dit-Yan Yeung, Wang-chun Woo, Wai-kin Wong", author_email="xshiab@cse.ust.hk, zhihan.gao@connect.ust.hk, lelausen@connect.ust.hk, hwangaz@cse.ust.hk, dyyeung...
28c199d383521cb01aa323a4403808fd2ce7ebb9698f36c032e83e1151595b86
Python
1,188
45
from typing import TYPE_CHECKING, Any from langchain_classic._api import create_importer if TYPE_CHECKING: from langchain_community.utilities.clickup import ( ClickupAPIWrapper, Component, CUList, Member, Space, Task, Team, ) # Create a way to dynamical...
bb58e2d98e91d233ffeac6d9c62b256e51593319e3722620222de8b42abfb042
Python
1,188
40
from torch.utils.data import DataLoader, Subset, TensorDataset from vulcanai.models import ConvNet, DenseNet import sys sys.path.append('.') from vulcanai.models.metrics import Metrics import torch def dataloader(): """Create a dataset by importing from the test csv""" test_input = torch.rand(size=[13, 15]) ...
2c4241a8c7eb5e2d2f183eeb987ba1522aeb7b9de805a3e54543ccfea1878a87
Python
1,189
42
import torch import torch.nn as nn r''' Minimal implementation to test: Fast parameter insert for PyTorch modules (Forecaster). ''' def replace_params_with_custom_tensor(module, custom_tensor_func): for name, param in list(module.named_parameters(recurse=False)): # Delete the original parameter de...
f9c9ea514e14f960a5a73ee94cee4bfcda47afdc739e5bd47838cdfa9a036162
Python
1,190
40
from __future__ import annotations import re from langchain_core.output_parsers import BaseOutputParser from typing_extensions import override class RegexParser(BaseOutputParser[dict[str, str]]): """Parse the output of an LLM call using a regex.""" @classmethod @override def is_lc_serializable(cls)...
b2309df48d6074b4a80bc8a341db5abfa5207d5fc5730b8a1b4c59541ce019af
Python
1,191
48
from openff.toolkit import unit from openff.toolkit.typing.engines.smirnoff import ParameterHandler, ParameterIOHandler from openff.toolkit.typing.engines.smirnoff.parameters import ( ParameterAttribute, ParameterType, _NonbondedHandler, ) class CustomHandler(ParameterHandler): _TAGNAME = "CustomHandl...
bcb041953d599d16ecf4cbaaffa1d2bdff6d5649471944b8e12e0e973c096690
Python
1,192
44
"""py.test configuration""" import os from pathlib import Path import numpy import pytest from bids.layout import BIDSLayout test_data_env = os.getenv('TEST_DATA_HOME', str(Path.home() / 'sdcflows-tests')) test_output_dir = os.getenv('TEST_OUTPUT_DIR') test_workdir = os.getenv('TEST_WORK_DIR') layouts = {p.name: BIDS...
9afe5307e0c1d105ebc0ce00018c040d7a6ff88311cd4bcb597b902a12294a89
Python
1,193
39
#! /usr/local/bin/python #'################################################################################# #'################################################################################# #' Combine methy from hdf5 data and labels #'#################################################################################...
9a73e14f7e98f79a0265c03b99669db56429cac6b73bbcfa6759511ade90ef51
Python
1,194
48
from voxcell import VoxelData import flatmap_util as fmutil import numpy as np import sys flatmap_nrrd = sys.argv[1] hemi_nrrd = sys.argv[2] output_nrrd = sys.argv[3] xmax = 1.0 if len(sys.argv) > 4: xmax = float(sys.argv[4]) # load fmap, _ = fmutil.load_flatmap(flatmap_nrrd) hemi = VoxelData.load_nrrd(hemi_nrrd...
8aad9d335dcf082167101f1af1f44af3e8a50c59083332cf03a23a0a9e3a376e
Python
1,195
42
#! /usr/local/bin/python #'################################################################################# #'################################################################################# #' Train TCGA network #'################################################################################# #'#################...
c636818b079868243514cd548d128004588379f3116a54d1adcc9241354164c5
Python
1,195
42
from setuptools import setup, find_packages setup(name='pensa', version='0.2.7', description='PENSA - protein ensemble analysis', url='http://github.com/drorlab/pensa', author='Martin Voegele, Neil Thomson, Sang Truong, Jasper McAvity', author_email='mvoegele@stanford.edu', license=...
ed4c4fa991ca7cf6da1989e3ef9d84d920937e28fd4390a3ec0e2137111ee56c
Python
1,195
1
import os import sys from pathlib import Path root_dir = Path(__file__).resolve().parent.parent work_space = str(root_dir) + os.sep sys.path.append(work_space) import uvicorn as uvicorn from fastapi import FastAPI, HTTPException, Form from web.options.options import SERVER_PORT from web.model.model import Adaptor fr...
648a88a29c338d040f6d89c877cffc39a0edc0597e5a16cd13498eb77852339b
Python
1,196
41
import numpy as np from dival import TaskTable from dival.measure import PSNR, SSIM from dival.reconstructors.odl_reconstructors import FBPReconstructor from dliplib.utils import Params from dliplib.utils.helper import select_hyper_best_parameters, load_standard_dataset from dliplib.utils.reports import save_results_...
6d9408ee1928283673a9369bac538c76bd36993932045166d82d6f5f4f443bbd
Python
1,196
39
import torch import numpy as np def tv_loss(x): """ Isotropic TV loss similar to the one in (cf. [1]) References ---------- .. [1] https://en.wikipedia.org/wiki/Total_variation_denoising """ dh = torch.abs(x[..., :, 1:] - x[..., :, :-1]) dw = torch.abs(x[..., 1:, :] - x[..., :-1, :]) ...
eb300dcf54dba0ff1fdf8f45de2e98ff0a73b92d12a94f330931a7a4345e36f8
Python
1,196
29
from cv2 import imread, imwrite, resize import os """path = "Z:\Projets\I3DOPPORTUNITES\I3DOP049UNIVERCELL\Acquisitions\\2022-08-HCD-manip7-Harmine\\2022_08_12\sphero-redim-EdU" res_path = os.path.join(path, "resultats") if os.path.isdir(res_path) is False: os.mkdir(res_path) onlyfiles = [os.path.join(path, f) fo...
3768463ccd00da6a0b2dcd9a24b120e355001183f5def35509d7a8f48b27285d
Python
1,197
38
txt_file = '../string/preprocessed/protein.sequences.corpus_partial.txt' inp = txt_file ofile = 'string_vec_partial.txt' #train import logging import os.path import sys import multiprocessing import time from gensim.corpora import WikiCorpus from gensim.models import Word2Vec from gensim.models import P...
fd7e7711f2402e916f0929d6d9bfc5609add31fe009fd146a4dd1d24662980d8
Python
1,197
33
import os d="/jukebox/griffiths/bert-brains/" d="/jukebox/griffiths/bert-brains/" #ds=['layer_'+str(i)+"_activations" for i in range(12)] #ds+=['layer_'+str(i)+"_z_representations" for i in range(12)] #ds+=['bert-base-uncased_syntactic_complexity_L-inf_T-128_D-concat'] #ds=['ling_features'] #ds=['bert-base-uncased_...
17a047bd689626aacb7c45b777a524cf7f6dbd924ec3adc94fbdca748da96430
Python
1,198
32
import numpy as np from statsmodels.nonparametric.smoothers_lowess import lowess from scipy.interpolate import interp1d def loess_ci(x, y, percentile, frac, n_bootstrap=100): n_points = y.shape[0] # allow for multiple confidence interval percentiles n_ci = len(percentile) # one column for loess curve...
f94cc9d6bd4e54f176bfa401f687d42fd01f588e5ea57858dcea8c23bd0da337
Python
1,199
44
#!/usr/bin/env python import argparse import json import re arg_parser = argparse.ArgumentParser() arg_parser.add_argument("--delete_objects_from", nargs='+') arg_parser.add_argument("--delete_object_keys", nargs='+') arg_parser.add_argument("--merge_files", nargs=2) ARGS = arg_parser.parse_args() def loadFile(file_n...
04063820387f74f5bd6811d22b5cc3733edfc36fbe5a04cbb16b1f7676eae350
Python
1,201
36
import pandas as pd df = pd.read_csv('genemap2.edited.collapsed.txt', sep='\t') print(df.head()) print(df.shape) #AD: autosomal dominant #AR: autosomal recessive # AD print('\nAnnotation has AD:') ad_df = df.loc[df.Annotation.str.contains('AD'), :] pd.Series(ad_df['Approved_Symbol'].unique()).to_csv('AD_genes.txt', ...
438895476dd4f6c5ba00b5b8e843dc273c0505d081cb5393aa76263cdf1d58aa
Python
1,202
36
#! /usr/local/bin/python #'################################################################################# #'################################################################################# #' Reshape hdf5 data to add channel dimension #'##############################################################################...
869afcd8642d525177edb00f2fc990ab4a031bdcbecc227956a0b8bc399814e8
Python
1,202
36
""" Make main plots for the given subject data file. - Summary table - Performance over sessions - Learning rate around change points - Learning rate modulation by variables - Individual sequences """ import argparse import data_analysis_utils as dana import subject_summary_table import performance_over_sessions_subj...
ce8be16593a02e8722d775dece5ffd96961ca82dabe8c31b34222dc77146c24e
Python
1,202
31
# -*- coding: utf-8 -*- #################################################################################### # # 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 t...
7ad5f94486d2126089ca22575d318db1809fa8e62d9a7f5782f90b2ef7d9cc6c
Python
1,204
33
# Copyright 2022 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...
67899c752f59233f0763eed71d14c665b7f54b0988d0128e8b19659d678bdd34
Python
1,205
45
'''very basic utility functions. We avoid module level imports in order to avoid dependencies if not required. ''' def set_seeds(seed_val=42): '''fix seeds for reproducibility. ''' from numpy.random import seed from tensorflow import set_random_seed seed(seed_val) set_random_seed(seed_val) ...
8a07d1ddab6e7cd980b1dce3cb8fa8260ac88284fa4676f286788e069b13f6d5
Python
1,205
44
# Copyright 2020 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...
daaa8ee644e95cb06fc33f7cef30ca6a50aa21bc941d38bbbdb0175ced61444f
Python
1,205
44
from skimage.io import imread, imsave import os import numpy as np from PIL import ImageDraw, ImageFont, Image line_nb = 8 col_nb = 8 path = "/home/clement/Bureau/res_cam_trous" case = "im" # im pour mosaique image ou cam pour l'autre if case == "im": keyword = "rgb" elif case == "cam": keyword = "visu" on...
1c504685c621c624681b40b540e4c13f43726effe08eb54f8b0796e69fe9c627
Python
1,207
28
# This file is part of the markovmodel/deeptime repository. # Copyright (C) 2017, 2018 Computational Molecular Biology Group, # Freie Universitaet Berlin (GER) # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by...
8b8f8a3b990d6e2933b7f3968f5c9f2fc0afe9241000e469557aa0dd46ddd521
Python
1,207
46
import numpy as np from matplotlib.collections import LineCollection import matplotlib.pyplot as plt def tick_curves( x0, y0, labels, idx=None, ax=None, lw=3, color='black', tick_len=0.2, text_offset=0.5, skip=1, skip_ticks=1, fontsize="xx-small", **text_kwargs ): """ create ticke...
b4603e0620b536e4c7a2d3c248406a318dbd483764adc9626489a53dd08a8eca
Python
1,207
35
import os import numpy as np from re import VERBOSE import tensorflow as tf from tqdm import tqdm from tensorflow.keras.utils import Sequence from brainagemodel.core.ensemblemodels import EnsembleModels class PretrainedSincModel(EnsembleModels): ''' To load all ensembled trained Sinc models. Note that it i...
e34ff1419f1bab4afa76d45db7d90c62fbfb1e483513840c1491e4f586f5496a
Python
1,208
44
from typing import Tuple import cv2 import numpy as np from .annotations_io import AnnotationTable, WorldlineTable from .transform import mip_threeview def hex_to_rgb(value: bytes) -> Tuple[int, ...]: value = value.lstrip(b'#') lv = len(value) return tuple(int(value[i:i + lv // 3], 16) for i in range(0,...
bc690192ef3ec4bcf0651018364289799a3436e59721d0eea009f83a6d6a19ca
Python
1,210
45
from unittest import TestCase import torch from chroma.models.graph_classifier import GraphClassifier class TestGraphClassifier(TestCase): def test_graph_classifier(self): class_config = { "dummy_1": { "tokens": ["a", "b", "c", "d"], "loss": "bce", ...
f94336bb263ae7d539e6bdf6f08369b834077b147edd3a3bf36fef4376598d69
Python
1,211
36
# 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() exec(open(osp.join(osp.dirname(__file__), "pdearena", "version.py")).read()) setup( name="pd...