sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
40dbe674be434f50ca4474a2463604e1f5655c924ee6eecccf724902928fcad5 | Python | 1,943 | 57 | import os
from torch.cuda.amp import autocast
from core.runner import runner_register, PretrainRunner
from utils.tensor_operator import to_device
os.environ["OMP_NUM_THREADS"] = "1"
os.environ["MKL_NUM_THREADS"] = "1"
from dataset.utils.mol_transform import MaskAtom
from dataset.dataloader import DataLoaderDenseMa... |
ec3924fed6239f95a85d4d437c4d6e0b59040cb7736147e54c15f4d31622dc82 | Python | 1,945 | 24 | from .base_options import BaseOptions
class TrainOptions(BaseOptions):
def initialize(self, parser):
parser = BaseOptions.initialize(self, parser)
parser.add_argument('--earlystop_epoch', type=int, default=5)
parser.add_argument('--data_aug', action='store_true', help='if specified, perfor... |
2cabaccf37c08107ecd666567e8b13ec087ed09692a6899ce0d6e2c375b2d0cb | Python | 1,946 | 51 | import os
import pandas as pd
import numpy as np
experimentalist, neuron, num_neuron_tot, neuronModel, exclude_files, noise_value, delta_abs_value =\
('Elodie', 'MSN_In_Vitro', 1, 'IAF', ['20181002_2', '20190109_1'], 0.5, 10.)
path_export = '/users/gvignoud/Documents/numeric_networks/Articles/Sequential_Learning_... |
211580cb8eb382d4f4b37ef510318e8e79a7c19136b7e3efb2564bdfc1e59885 | Python | 1,950 | 40 | # 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... |
5ee87e99ff412052dc5a281b1177d7f55cb609b602249622b7cee25988467fff | Python | 1,950 | 68 | import argparse
import pathlib
from typing import Optional
import numpy as np
import pandas as pd
import yaml
import networkx as nx
def parse_arguments(
key: Optional[str] = None, stage: Optional[str] = None, method: Optional[str] = None
):
"""
Parses command line arguments
"""
parser = argparse.... |
b8bbad2a69f949e4a01e5d9e97bc8039824dfdb28365aafe4ca590893e48d77e | Python | 1,951 | 39 | from langchain_core.prompts.prompt import PromptTemplate
_DEFAULT_ENTITY_EXTRACTION_TEMPLATE = """You are an AI assistant reading the transcript of a conversation between an AI and a human. Extract all of the proper nouns from the last line of conversation. As a guideline, a proper noun is generally capitalized. You s... |
d6964a123ab6da269d394d8382fabfb014212b249ebadf9dd3e0b76bd6c8fddf | Python | 1,953 | 53 | import argparse
from dival import DataPairs
from dliplib.reconstructors import (learnedpd_reconstructor,
diptv_reconstructor,
tvadam_reconstructor,
learnedpd_dip_reconstructor)
from dliplib.utils.helper import l... |
cc213d494ab08d0f2cff1d529f7a210265bcc64d95fadb217da66a72d0fdd172 | Python | 1,955 | 50 | import os
import subprocess
import sys
import pandas as pd
from tqdm import tqdm
# bw2bedgraph = '/home/yyasumizu/Programs/hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64.v385/bigWigToBedGraph'
bw2bedgraph = "bigWigToBedGraph"
listdir = os.listdir('../data/AMED-CREST/')
list_sample = [x.split('.')[2] for x in listdir ... |
2b3eabc4df89f963c89bf9208be2bc2bcb985f1ded9a3532b54910a84be41502 | Python | 1,956 | 53 | 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/openff-toolkit/blob/0.12... |
4d6c74a68f70b5f6e6f6fbc1de8119a52d6455e93aa30d78db2aba4a3ee33fe9 | Python | 1,956 | 49 | # -- coding: utf-8 --
# @Time : 2024/02/01 11:30
# @Author : Biao Zhang
# @Email : littlebiao@outlook.com
# @File : run_came.py
import sys
sys.path.append('../')
from analysis_utils import ttest_plot_utils
from analysis_utils import homo_random_config as config
import os
if __name__ == '__main__':
cfg = config.... |
0debfe00a13424098ae1bc3be4509d7ce64e07dcdb7abd73d5bedefee79ceb3b | Python | 1,957 | 63 | import jax
import jax.numpy as jnp
import chemoxrl
from chemoxrl.cell import Cell
def random_walk_policy(n=4):
options = jnp.linspace(0, n, endpoint=False) / n
def policy(rng, _, h):
dtheta = jax.random.choice(rng, options)
return (jnp.array([dtheta]), h)
return jax.jit(jax.vmap(policy,... |
5fa33792a51d9c9e420ae215d6bbcc3a8b7a853e8761e9a86fe9204d8ad09142 | Python | 1,957 | 73 | from __future__ import unicode_literals
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join("..", "src")))
autodoc_mock_imports = ['adjustText',
'altair',
'gseapy',
'kneed',
'matplotlib',
... |
134caeea01774557e9546418ad9cc38b6dcd21aac01f002673e3ea9955bd2aa1 | Python | 1,958 | 42 | from django.shortcuts import render
from django.contrib import messages
from django.views.generic.edit import FormView
from django.core.exceptions import ValidationError
from .forms import MappingForm
from .models import Map
from .analyze_coordinates import analyze_coordinates
class IndexView(FormView):
model = ... |
62c59238b6df3ce0cc2010617d8a711f3b5a5bcd9a35a572ecb92cc650a4632d | Python | 1,958 | 66 | import os
import sys
import glob
import numpy as np
from genie.config import Config
from genie.diffusion.genie import Genie
def get_versions(rootdir, name):
basedir = os.path.join(rootdir, name)
return sorted([
int(version_dir.split('_')[-1])
for version_dir in glob.glob(os.path.join(basedir, 'version_*'), re... |
291c93c5d5c2acc365664910028283f1366036f020039aff9f41b44647432df3 | Python | 1,961 | 49 | # -- coding: utf-8 --
# @Time : 2024/02/01 11:30
# @Author : Biao Zhang
# @Email : littlebiao@outlook.com
# @File : run_came.py
import sys
sys.path.append('../')
from analysis_utils import ttest_plot_utils
from analysis_utils import homo_random_config as config
import os
if __name__ == '__main__':
cfg = config.... |
13c6cdc541d859435d2530ffb726c721148da4f795aebe078729ca6ab3224ac9 | Python | 1,963 | 80 | """Code of the publication 'xxx' published in
https://doi.org/10.1016/xxx
by Alexander Henkes and Henning Wessels from TU Braunschweig and
Jason K. Eshraghian from University of California, Santa Cruz.
"""
import argparse
import numpy as np
import random
import torch
import experiment_elasticity
import experiment_ramb... |
8040309d6db39fad5f925040d55cfd0e83fbbcb0b6d944079277e292eca1bbd7 | Python | 1,963 | 64 | """
Usage: python merge_rsem.py --rsem_dir <rsem_dir>
"""
import argparse
import os
from functools import reduce
import pandas as pd
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
'--rsem_dir',
help='Path to the directory containing the RSEM files',
required=True,... |
07c61001666ce3e145dfdd43d41df89840d44a27ed46d3130f7fe7a8aab914e4 | Python | 1,964 | 31 | #TO BE UPDATED
import numpy as np
from NetworkModel import networkClass
from NeuronModel import fire
from WeightModel import weightClass, potentialBased
from InitFunctions import dirac_sparse, dirac
class CA3(networkClass) :
parameters = {'n' : 1000, 'N' : 500, 'c' : np.zeros((2,2)), 'J' : np.zeros((2,2)), 'g' : ... |
29f238e64c2da83f140cd8c8b65a817c784f1dc53a944bae1dfc4af9edafcba3 | Python | 1,964 | 56 | import pandas as pd
from tqdm import tqdm
from joblib import delayed,Parallel
import wfdb
import numpy as np
from constants import PTBXL_DIR,BASE_DATA_DIR,PTBXL_DIS
from constants import LUNG_DIS,LUDB_DIR
from engine import utils
from scipy import signal
# /cluster/projects/mcintoshgroup/Results/PTB-XL/ptbxl_splits.c... |
9bdd6e47172e84d1898da09470e5796af0832c7fc1ceca1bc00829eb191a5c6d | Python | 1,967 | 77 | # Configuration file for the Sphinx documentation builder.
# -- Project information
import uniport
project = 'uniPort'
copyright = u'2022, Kai Cao'
author = 'Kai Cao'
release = uniport.__version__
version = uniport.__version__
# -- General configuration
extensions = [
'sphinx.ext.duration',
'sphinx.ext.do... |
a48e99cb14291e34269258e2d9ee340d490831beb5825be0f9050212e498b8f7 | Python | 1,968 | 64 | import time
import zmq
import random
import matplotlib.pyplot as plt
import pyqtgraph as pg
import numpy as np
from PyQt5 import QtWidgets, QtCore
from PyQt5.QtCore import pyqtSignal, QThread
from pyqtgraph import PlotWidget, plot
import pyqtgraph as pg
import sys
import os
from tqdm import tqdm
NB_NRN ... |
ec5bdca7bf98bef5304b1a54f0f190955f72b13106b753e493156f917e540bf2 | Python | 1,968 | 52 | from torch.optim.lr_scheduler import _LRScheduler
class ConstantLR(_LRScheduler):
def __init__(self, optimizer, last_epoch=-1):
super(ConstantLR, self).__init__(optimizer, last_epoch)
def get_lr(self):
return [base_lr for base_lr in self.base_lrs]
class PolynomialLR(_LRScheduler):
def ... |
5404f9b786729153e80c9fe31801e41fe066317c4c28023ba7b370d04c88cf47 | Python | 1,969 | 46 | import pytest
from predmoter.core.constants import PREDMOTER_VERSION, GIT_COMMIT
def pytest_addoption(parser):
parser.addoption("--exclude-device", type=str.lower, action="store", default=None,
help="by default the command line tests will be executed on the CPU and the GPU, "
... |
0648b24184f5348637a8bfaf02a6c52f818c509f32bbff26ae583a900bedbf67 | Python | 1,971 | 50 | ####################################################################################
#
# 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... |
a78243f1f671f856ff4b2b0dd0b4173b1e8e59c573b48624bed2e94e421cde0a | Python | 1,971 | 44 | #MNE version: 1.1.0
import os
import pandas as pd
from custom_functions import eq_cond_name
study_path='/nashome1/wexu/Projects/FaceName-Brain/'
bids_root = '/nashome1/wexu/BIDS_Datasets/FaceName BIDS/derivatives/maxfilter/'
group_name='FN'
MRI_data_path = os.path.join(study_path,'data','subjects')
MEG_data_path =... |
88bc47afff4a41032e714a5a2cb5bf26be162ff3c868fd5263034a26c367f011 | Python | 1,972 | 47 | import os
import subprocess
import logging
LOG = logging.getLogger(__name__)
def generate_pymol_image(pdb_path, chopping, image_out_path, path_to_script,
pymol_executable):
"""
This function generates a pymol script which describes how one protein should be visualized
and saved ... |
b5a47da2741d55cbbdf9c9b496e9fbbebb2dd74299bdb9be04b176c45226950e | Python | 1,974 | 51 |
from collections import OrderedDict
import numpy as np
import cv2
def get_inst_stat(inst_id, inst_dict, slide, nuc_type):
inst_cnt = np.array(inst_dict['contour']).astype(np.float32)
inst_box = np.array([
[np.min(inst_cnt[:,1]), np.min(inst_cnt[:,0])],
[np.max(inst_cnt[:,1]), np.max(inst_cnt[... |
4f86fecf503352652528965a5370a28293523d51f6c868976c404625c947e108 | Python | 1,976 | 62 | import jax
import jax.numpy as jnp
import jax.random as jrng
import jax.tree_util as jtu
import hydra
from orbax.checkpoint import SaveArgs, RestoreArgs
from omegaconf import DictConfig
def maybe(this, that):
return that if this is None else this
def flatten(x):
return jnp.reshape(x, (x.shape[0], -1))
def gr... |
cb4bcbc4d7f26a3a93885bdafc51a8efcdffb0713cf75f8823c619032eedfdf3 | Python | 1,976 | 59 | # -*- coding: utf-8 -*-
"""
Created on Sun Mar 21 11:36:41 2021
@author: gritti
"""
import sys, time, tqdm, copy, os, glob
from skimage.io import imread, imsave
import numpy as np
import PyQt5.QtWidgets
import matplotlib.pyplot as plt
import matplotlib as mpl
import warnings
warnings.filterwarnings("ignore")
from mor... |
582870a7b210fc95bc59d1cac3429382b8adb4079ba8b0ccfb6473cc0ae975ac | Python | 1,977 | 58 | # coding=utf-8
import torch
def get_params(alg, args, inner=False, alias=True):
if args.schuse:
if args.schusech == 'cos':
initlr = args.lr
else:
initlr = 1.0
else:
if inner:
initlr = args.inner_lr
else:
initlr = args.lr
if in... |
0463bb37f2442e9054056bc6bb049630f6b365ed69d2f701b8afd201a485d77c | Python | 1,978 | 48 | # 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... |
5c250fe0798eddd9556c088d7ed88af8fc4eca42e3c8bd4f015deb96a6891d59 | Python | 1,978 | 42 | """reads back the Facial Anthropometrics workspace's own batch measurement
export (see api/routers/facial.py's export_batch) for loading into the
Cohort workspace as an attached dataset. mirrors craniumpy_core.cohort's
own load_cohort_xlsx shape/style - openpyxl-only, every cell a plain
string, blank trailing rows skip... |
3ec36f02ce893cafe77e9406c6c879742c237677f3c4cdc3a83da28fe1ea1925 | Python | 1,980 | 55 | # standard packages
import glob
import os
# third party packages
import numpy as np
# pnabind packages
from .run_nanoshaper import runNanoShaper
from .mesh import Mesh
from .map_point_features_to_mesh import mapPointFeaturesToMesh
def getPockets(atoms, mesh, nn_cutoff=1.5, radius_big=3.0, clean=True, feature_name='p... |
4f0956c5a9d52f98b29e3c887b1e9739da8e273895f15b2e4b3b2e3dbeb9a50e | Python | 1,980 | 62 | #!/usr/bin/env python
# Purpose: Find avg. FD value for each session and for each participant overall.
#
# Input: Single-column txt file FDRMS for each bold image. These were generated using the CBIG2016 preproc pipeline.
# Output: Avg. FD value for each participant's session an deach participant overall.
#
# Written ... |
93c01dbb227bda4e9b06e569ab5053cf320a8cee1287646850ab9598f77434ef | Python | 1,980 | 58 | from __future__ import annotations
from typing import Any
from langchain_core.output_parsers import BaseOutputParser
from langchain_core.utils import pre_init
from typing_extensions import override
_MIN_PARSERS = 2
class CombiningOutputParser(BaseOutputParser[dict[str, Any]]):
"""Combine multiple output parser... |
ea2a771bfa129883346da6ecd9214a7d9a7bbf9719ce1461eeea3826d4ae34a2 | Python | 1,983 | 68 | from pensa.features import \
read_water_features, \
read_atom_features
"""
For the PDB visualisation, the trajectory needs to be fit to the first frame of the simulation
so that the density and protein align with each other.
Get the water pocket data for the top 3 most probable sites (top_waters = 3).
Orient... |
a63c027e63e11ade1305eea61450bba24230c2d662ac3e4e958320ca129693f5 | Python | 1,984 | 56 | import os
import pandas as pd
import pickle as pkl
from types import SimpleNamespace
import yaml
from yaml.loader import SafeLoader
import numpy as np
from scipy.ndimage import gaussian_filter
from utils import *
from tqdm import tqdm
mpl.rcParams.update({'font.size':10})
mpl.rc('xtick', labelsize=8)
mpl.rc('ytick', l... |
0f93362c7c9a2b0c85e17771cecd9c13649d1e1eebe837cc8b53045550e4c3f0 | Python | 1,985 | 55 | import argparse
import csv
import pickle
import jcamp
import numpy as np
import re
import requests
from bs4 import BeautifulSoup
from rdkit import Chem
from rdkit.Chem import Descriptors
def download_ei_mass(website):
response = requests.get(website, stream=False)
if response.ok:
soup = BeautifulSoup(r... |
478ee12a9a9bab169ba82f2f42f1b7063026bb317f66b976ab2e0eab4625072b | Python | 1,986 | 60 | #!/usr/bin/env python3
"""
Snakemake SLURM submit script.
"""
from snakemake.utils import read_job_properties
import slurm_utils
from CookieCutter import CookieCutter
# cookiecutter arguments
SBATCH_DEFAULTS = CookieCutter.SBATCH_DEFAULTS
CLUSTER = CookieCutter.get_cluster_option()
CLUSTER_CONFIG = CookieCutter.CLUST... |
25927d552daa094c27418a7ae567816dc58b8db1f08ffeb68b3b16f40db3b0de | Python | 1,988 | 50 | #TO BE UPDATED
from NeuronModel.NeuronClass import neuronClass
import numpy as np
#https://web.njit.edu/~matveev/Courses/M430_635_F15/TEXT-Terman%20Ermentrout%20Computational%20Neuroscience%20Book%20-%20ML%20model.pdf
# Hopf 'T0' : 1/0.04, 'g_Ca' : 4.4, 'V3':2, 'V4':30
# SNLC 'T0' : 1/0.067, 'g_Ca' : 4., 'V3':12, 'V... |
ba8a339394e3c5997b2a5ee544fccf447f825fe9a52e452c252bbdc196921ba9 | Python | 1,988 | 60 | import hashlib
import tarfile
import urllib.request
from pathlib import Path
from fidnet import config
def download_example_data(force: bool = False):
example_files = [
config.example_file_non_deuterated,
config.example_file_hnca,
config.example_file_nus_reconstruct,
config.exampl... |
7fe213149368791e9e6c5cc6d3f59d7529e9246142001008f735d34c8d649a5a | Python | 1,989 | 49 | """Test LLMCheckerChain functionality."""
import pytest
from langchain_classic.chains.llm_checker.base import LLMCheckerChain
from langchain_classic.chains.llm_checker.prompt import (
_CHECK_ASSERTIONS_TEMPLATE,
_CREATE_DRAFT_ANSWER_TEMPLATE,
_LIST_ASSERTIONS_TEMPLATE,
_REVISED_ANSWER_TEMPLATE,
)
from... |
13c0713da7200e11216a53e3cbb023d0d4002d71ffc6a4e94136840a3c57f5e2 | Python | 1,990 | 60 | import torch
from torch.distributions.categorical import Categorical
import numpy as np
from egnn.models import EGNN_dynamics
from equivariant_diffusion.en_diffusion import EnVariationalDiffusion
def get_model(args, device, dataset_info, dataloader_train, hidden_dim):
# histogram = dataset_info['n_nodes']
... |
16269f39419c3e0b2a0345b5f7e53edb22c27ef07387d0acb66ccfb658c0e3b1 | Python | 1,990 | 55 | import argparse
import os
import shutil
from glob import glob
import numpy
import torch
from networks.unet_3D_dv_semi import unet_3D_dv_semi
from networks.unet_3D import unet_3D
from test_urpc_util import test_all_case
def net_factory(net_type="unet_3D", num_classes=3, in_channels=1):
if net_type == "unet_3D":
... |
7f848d77deb4620ec458c03e820d6cb8a00155c0b389c21780652860859dcc66 | Python | 1,992 | 64 | import typing as tp
import datetime as dt
from ..utils import _eval_remote_instance
from ..client import CatmaidInstance
from ..config import get_logger
logger = get_logger(__name__)
def get_skeleton_ids(
created_by: tp.Optional[int]=None,
reviewed_by: tp.Optional[int]=None,
from_date: tp.Optional[dt.da... |
4d89b0923c0e5045735149c91337fdebdd9fc077661aca063cf083e6b175b9fa | Python | 1,993 | 68 | from typing import Any
from langchain_core.callbacks import (
AsyncCallbackManagerForRetrieverRun,
CallbackManagerForRetrieverRun,
)
from langchain_core.documents import BaseDocumentCompressor, Document
from langchain_core.retrievers import BaseRetriever, RetrieverLike
from pydantic import ConfigDict
from typi... |
6e5ab11900ef5188d4ff4a17825c5c6206613ceb1ff27069a427d3130b9aa631 | Python | 1,994 | 50 | # Copyright 2024 DeepMind Technologies Limited
#
# AlphaFold 3 source code is 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... |
b0712120fc99db86c9588a122fb2b1d64cbc53c5878444ac11063622bc65bfa7 | Python | 1,996 | 51 | from mpl_toolkits.axes_grid1 import make_axes_locatable
from utils.constants import ALL_MODELS
from paths import TEST_DATA_PATH
import matplotlib.pyplot as plt
import numpy as np
import json
with open(f"{TEST_DATA_PATH}/result_matrix.json", "r+") as json_file:
result_matrix_dict = json.load(json_file)
# ALL
title... |
c13d55828d0aa2a27d6d51af3dbd94dc08d20eb087c7db0de6cd707cc7b65400 | Python | 1,996 | 70 | # 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... |
cd6e4536fb27e40dbacf774b7e898394d19eb42900fcca26b1ea86ca1b03331a | Python | 1,997 | 64 | # third party modules
import numpy as np
def chooseBinaryThreshold(y_gt, probs, metric_fn,
mask=None,
metric_criteria='max',
n_samples=25,
optimize="batch_mean",
**kwargs
):
""" Choose a threshold value which meets the following criteria:
y_gt: ...
probs:... |
6425b1679fa21691f770bea63da769edbe10fb1b7b566c108ee164b864532751 | Python | 1,998 | 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... |
64fa836fb1a22f5e79a45ee1db3befea9fd20ba0e3c2e7da5ad4d5a5019be4ae | Python | 2,000 | 62 | ####################################################################################
#
# 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... |
0021a081b9b623d52524717635518d0cc9834275ac7b6c12828a7c22a36faf4d | Python | 2,001 | 69 |
import os
import pandas as pd
from PoET.lib.patients import Patient, PatientCollection
def construct_data(csv_files, fs, labels=None, scaling_factor=1, verbose=True, smooth=None):
if isinstance(scaling_factor, int):
scaling_factor = [scaling_factor] * len(csv_files)
if isinstance(fs, int)... |
6d6ea174463fa8178b881bbd9666c4dfb779622798e8e546a55d6d32198bc6e2 | Python | 2,001 | 65 | from abc import ABC, abstractmethod
from collections.abc import Callable
from langchain_core.language_models import BaseLanguageModel
from langchain_core.language_models.chat_models import BaseChatModel
from langchain_core.language_models.llms import BaseLLM
from langchain_core.prompts import BasePromptTemplate
from p... |
38daa93f7510fbca0bdf34e0cdf5191284cdca37351c58a7dc79abb9b508f93b | Python | 2,003 | 43 | import mne
import pandas as pd
import os.path as op
import numpy as np
from config_FaceName import MEG_data_path,group_name,Ids,bids_root
from mne.preprocessing import read_ica
from mne_bids import BIDSPath
for subject_id in Ids:
subject = group_name+"%02d" % subject_id
print("processing subject: %s" % su... |
b78919820c28d241d79358d8e4bb56ed907292c3aef86ae8e421d9ac80fb47d6 | Python | 2,003 | 45 | ##################################################################################
# DNN gene expression autoencoder pathways network 6
##################################################################################
##################################################################################
from tensorflow.k... |
f35d25bbbcaf8a089e40b9509443a7d958ad46f86e896f4a9423e3ed2e5b97a3 | Python | 2,003 | 66 | import argparse
import pathlib
import random
import unittest
from unittest.mock import patch
from cwas.runnable import Runnable
import cwas.cli
import sys
class RunnableMock(Runnable):
@staticmethod
def _create_arg_parser() -> argparse.ArgumentParser:
parser = argparse.ArgumentParser()
parser... |
1d62e0edfbdfc10a24b615c542563bb15865cde3e09e14ba72d3ecd4050f1c60 | Python | 2,004 | 62 | # Copyright 2024 DeepMind Technologies Limited
#
# AlphaFold 3 source code is 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... |
89c253cae13c7883ec7861a14662b6bfbe69b8dc7f95b93f5ce60fd4b62762e1 | Python | 2,004 | 47 | import matplotlib
import matplotlib.pyplot as plt
from argparse import ArgumentParser
import sys, os
import glob
import pandas as pd
import ntpath
import pickle
from argparse import RawTextHelpFormatter
from mantis_ml.modules.pre_processing.data_compilation.process_features_filtered_by_disease import ProcessFe... |
ce5ec612c0b09b32480184d55385d0c6a41a1239c52fef62ac809d003d75e0a9 | Python | 2,004 | 63 | from typing import TYPE_CHECKING, Any
from langchain_classic._api import create_importer
if TYPE_CHECKING:
from langchain_community.adapters.openai import (
Chat,
ChatCompletion,
ChatCompletionChunk,
ChatCompletions,
Choice,
ChoiceChunk,
Completions,
... |
1c3811abf0f082f2c3b80656641de024317db2df9cacd42eb90699b40622325b | Python | 2,006 | 92 | '''
cgat_clean.py - remove incomplete files
=======================================
Purpose
-------
This script looks at files matching a certain pattern and will remove
incomplete files. File completeness is determined by the file itself
or an associated log-file.
For example, the file :file:`sample1.tsv` is deeme... |
849a79c8821f230a9ee00d8e56bb0f263015aa33da429f102b4d0bc9077dae39 | Python | 2,007 | 43 | from src.data import get_sim_data
import numpy as np
import os
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeRegressor, plot_tree
from sklearn.metrics import mean_squared_error, mean_absolute_error, r2_score
seeds = [15] # 37, 98, 137, 245]
results = {'mse_train': list(), 'mae_train': list(), 'r... |
250450522ec2ad15c80c72f40179e36ccc7b6b6cfadbbf9ddd6001d04c7d2c14 | Python | 2,008 | 32 | """Build submission/manuscript.docx from paper/main.tex with PNG figures (pandoc, citeproc).
The reference list is placed where \\bibliography stands (before the appendices), as in main.pdf."""
import os, re, json, subprocess
ROOT = r"C:\Users\[anon]\Downloads\research paper for proctor\Proctor Research paper 2"
paper ... |
553883a55983000ac7f1f6a1451850f5b5cafe058c8b4f3fbc3c277556ce5c33 | Python | 2,009 | 60 | from pathlib import Path
from typing import Dict, Union
import numpy as np
import pandas as pd
from omegaconf import DictConfig, ListConfig, OmegaConf
class ExpResult:
def __init__(self, args: Union[DictConfig, ListConfig], dir_data: Path) -> None:
self.args = args
self.gen_max = args.engine.gen... |
5fa52de9a88777e5df3a77f44ec4b7f2c2cbde0e08905ea3e1983948818ab851 | Python | 2,009 | 47 | import mne
import re
import os.path as op
import os
import subprocess
from config_FaceName import MEG_data_path,group_name,Ids
def mark_bad_channel(fname):
RAW=mne.io.Raw(fname,allow_maxshield=True,preload=True).pick_types(meg=True)
RAW.filter(None,80).plot(duration=20,n_channels=102,block=True) #,block=True
... |
bbe7d97096fe41dc16df993142ef1dc29c170ef42335f194cafff5662760bb83 | Python | 2,010 | 70 | from langchain_core.agents import AgentActionMessageLog
from langchain_core.messages import AIMessage, FunctionMessage
from langchain_classic.agents.format_scratchpad.openai_functions import (
format_to_openai_function_messages,
)
def test_calls_convert_agent_action_to_messages() -> None:
additional_kwargs1 ... |
0fbd587b0eb563b4c2eb18b456ef97a49e7b983ffcdaa31ec5bc84a27c6d7ce3 | Python | 2,013 | 64 | #!/usr/bin/env python
import argparse
arg_parser = argparse.ArgumentParser()
arg_parser.add_argument("cluster_file", help="clustering output from CD-HIT")
arg_parser.add_argument("seq_info_file", help="information about sequences to use for selecting representatives")
arg_parser.add_argument("--num_per_cluster", defaul... |
49bfe91bd0b8cf603871b3e07b399c2a7022f3451bccac8ed1407bd274fc7214 | Python | 2,013 | 55 | """Documents module for data retrieval and processing workflows.
This module provides core abstractions for handling data in retrieval-augmented
generation (RAG) pipelines, vector stores, and document processing workflows.
!!! warning "Documents vs. message content"
This module is distinct from `langchain_core.m... |
4baa82ac449e52ad4977de76584f318ac918da9836589ae07f1aae72616fc987 | Python | 2,013 | 51 | import numpy as np
import torch
import os
class EarlyStopping:
"""Early stops the training if validation loss doesn't improve after a given patience."""
def __init__(self, save_path, patience=7, verbose=False, delta=0.001):
"""
Args:
save_path : save path
patience (int):... |
616c789c75e6e0c96e37d585e6d6d4c99425002bc400c532a42128ff4f3a9cf9 | Python | 2,014 | 57 | import os
import pickle
import pandas as pd
pd.options.display.max_rows = 100
pd.options.display.max_columns = 10
class CustomUnpicklerModuleNotFoundError(pickle.Unpickler):
def find_class(self, module, name):
if module == 'packerlabimaging.main.paq':
print(f'replacing {module}')
... |
dc251049ac059615184a4e1ecb9eeefb88d5cfb2579640fba46c4b0f5ed03f07 | Python | 2,014 | 72 | from openff.toolkit.typing.engines.smirnoff.forcefield import ForceField
from openff.toolkit.typing.engines.smirnoff.parameters import (
ConstraintHandler,
ElectrostaticsHandler,
LibraryChargeHandler,
vdWHandler,
)
from openff.units import unit
from packaging import version
VERSION = version.Version("1... |
08a4c633e3c684e31a9ea080a24a5f034db2a292723bec4e8398edcad12a5670 | Python | 2,016 | 60 | #!/bin/env python3
import voxcell as vc
import numpy as np
from scipy.ndimage.morphology import distance_transform_edt
import sys
atlas_hierarchy = sys.argv[1]
atlas_regions = sys.argv[2]
layer = int(sys.argv[3])
side = sys.argv[4]
output = sys.argv[5]
parentRegion = sys.argv[6]
# TODO: get rid of generating layers,... |
7d13112cf66db05b32e3f90ad06799e5404cf1d974e649b295f59f1a3a99e022 | Python | 2,017 | 68 | from tensorboardX import SummaryWriter
import numpy as np
import os
import datetime
import subprocess
class Logger(object):
def __init__(self, log_dir="./logs", dummy=False, prefix="", suffix="", full_log_dir=None, rank=0):
self.suffix = suffix
self.prefix = prefix
self.dummy = dummy
... |
db2f95c9ff70a0ee2b489d96f2671d1395c300d5607e4594d292c626698fbe1c | Python | 2,017 | 74 | """Document compressor."""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import TYPE_CHECKING
from pydantic import BaseModel
from langchain_core.runnables import run_in_executor
if TYPE_CHECKING:
from collections.abc import Sequence
from langchain_core.callbacks import... |
621beeefe0bef3788e51c902e9e0bd0a0b5afad1981f49effcc96d3abeeccbac | Python | 2,019 | 80 | import argparse
import csv
import pathlib
import pandas as pd
import tqdm
def get_introns(data):
gene = data.query("Type == 'gene'").iloc[0]
start = gene.Start
results = []
for _, exon in (
data.query("Type != 'gene'").sort_values("Start", ascending=True).iterrows()
):
results.app... |
4ace7689bb81a08418fb5c631e3e8066ca29e74553883a17c9647b2533749b69 | Python | 2,020 | 55 | from collections.abc import Callable, Mapping
from operator import itemgetter
from typing import Any, cast
from langchain_core.messages import BaseMessage
from langchain_core.output_parsers.openai_functions import JsonOutputFunctionsParser
from langchain_core.runnables import RouterInput, RouterRunnable, Runnable
from... |
ae97492fcd4e3a83758ad8acd2ef6c22847286956913fdb7edd83412c32dfc65 | Python | 2,020 | 66 |
from params import n_s_beh_1s
import numpy as np
beh_mapping = {
0: 'background',
1: 'walk',
2: 'rest',
3: 'back',
4: 'groom',
5: 'leg rub',
6: 'posterior'
}
def remove_trials_beh_pre(
fly_data,
pre_beh_to_filter_for: str,
threshold: float = 0.25,
):
"""
Remove... |
81581c3675de596deb3adde87d498f24d5b3ae0c22c578093f10052793c2db9f | Python | 2,023 | 63 | import os.path
# import logging
from LSTM import preprocess, predict, evaluate
from logger import ResultLogger
from utils import *
setting = {
'train_size': 0.8,
'epochs': 70,
'input_size': 60,
'batch_size': 32,
'pre_len': 8,
'fileName': "o1_i900s_w10_s1_fmea... |
fa196e8d07677bdf432ec06d051489428f1ebecc29b812226a80024a65770286 | Python | 2,023 | 67 | """
This file is intended as an example of setting up an ALIGNN model to listen
for and respond to prediction requests using ZMQ.
A minimal set of dependencies required for this example would be:
Python 3.9
pyzmq = 25.1.1
alignn = 2023.8.1
It may be best, and even necessary, to create a separate Python environment
fo... |
059444ebf863baa69c7c019319e53120850c2095f216f51b305f7c827f777427 | Python | 2,024 | 74 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import math
def make_tri_prism(k,m,scale):
# Generate triangular prism with k line segments along each triangular
# edge and m along vertical extrusion axis. Each line segment is length scale.
nvert_per_slice = ((k+1)*(k+2))/2
ntri_per_slice = k*k
# ... |
b28e49e97f16dbdc2266e8916d8f15be0bdf5e8d8addd99fd1ca932438d9eaae | Python | 2,024 | 62 | # 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... |
06476ce88a3c9abc9815a254f8f3a6f7b3cbfa42b9526ee77d955c4eca5b74bf | Python | 2,026 | 36 | """Download a cross-chemistry SUBSET of Battery-Life/BatteryLife_Processed (gated, MIT licence) from Hugging Face.
Authentication is read automatically by huggingface_hub from the user's cached login (hf auth login) or the HF_TOKEN
environment variable; this script never prints or stores the token.
Subset (~30 GB): CA... |
c46678b9b97de88029e1855d6b0962cdc35188adb1b1f5727390f986c69516e5 | Python | 2,026 | 66 | import h5py
from glob import glob
import numpy as np
import pandas as pd
from tqdm import tqdm
from joblib import Parallel, delayed
from engine import utils
from constants import ILD_DIR,BASE_DATA_DIR
COMMON_ID = 'SeriesInstanceUID'
def get_paths(which='train'):
if which == 'train':
paths = glob('%sILD_... |
10bc66bb78cbfe7858f901ee24813ca28fe06bc3ad2e77671172d5ee92c0d7c0 | Python | 2,027 | 58 | # 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... |
50ff06dee34ab361e599a56570d39376fbd85c923d0128fe54d09903a390dc8b | Python | 2,027 | 81 | import numpy as np
import steps.interface
from steps.geom import *
from steps.model import *
from steps.rng import *
from steps.saving import *
from steps.sim import *
########################################################################
# Inject species in the center of the mesh and let it diffuse
################... |
85f6a24ed08c80929ad11ab16526661ee9d1dfbf7d8f6982c58f23b28e6117f2 | Python | 2,027 | 65 | ###########################
# Latent ODEs for Irregularly-Sampled Time Series
# Author: Yulia Rubanova
###########################
import time
import numpy as np
import torch
import torch.nn as nn
import lib.utils as utils
from torch.distributions.multivariate_normal import MultivariateNormal
# git clone https://gi... |
a41ce1fc3c1ebc8d91fafe8a8f43ce0432c162cc1b88cef7e14702451df8a02e | Python | 2,027 | 63 | #! /usr/bin/env python
import os
from setuptools import setup, find_packages
descr = """M/EEG power regression pipelines in Python"""
version = None
with open(os.path.join('coffeine', '__init__.py'), 'r') as fid:
for line in (line.strip() for line in fid):
if line.startswith('__version__'):
v... |
f886d0040d201717f173e045a0bbf81d69cafbf3f7b70abccf6b450ddf083c0f | Python | 2,027 | 68 | 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... |
fc65590d8d1732683bcec6497a95c4e5f7e3f18713c839a6cb5cf6df8d221109 | Python | 2,027 | 51 | # 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... |
7553d6d7284bf7e712e389053a9d2a6a53415365cf2b508b1ee36775ad0a071e | Python | 2,028 | 32 | import numpy as np
from enum import Enum
from mlagents_envs.base_env import ActionTuple
##A class to help access the discrete action space of AAI environment.
class AAIActions():
def __init__(self, no_agents=1):
self.NOOP = AAIAction("noop", ActionTuple(continuous=np.zeros((no_agents,0)), discrete=np.array... |
8b8f18c1e50a0e6dd976c753424fc20dae778d7951a1f61cd28851fa0e045902 | Python | 2,028 | 60 | import os
import imagingplus as pli
from conftest import alloptical_trial_fixture
from imagingplus import AllOpticalTrial
LOCAL_DATA_PATH = '/Users/prajayshah/data/oxford-data-to-process/'
REMOTE_DATA_PATH = '/home/pshah/mnt/qnap/Data/'
BASE_PATH = LOCAL_DATA_PATH
# %%
# %%
def test_AllOpticalClass(alloptical_tr... |
e152cee55953839635acea00679a4a6fc5683c55c7bd4cd7ade69387d27553e0 | Python | 2,028 | 45 | # 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... |
37ee24e5f43c138efd83c23ac16e4aafee02b138d18beb5435c20e5c77796958 | Python | 2,029 | 64 | import numpy as np
from voxcell import VoxelData
import sys
def flatten_morpho(flatmap, points, reflect=False, interp=False, include_oob=False):
"""
Get flat coordinates of 3D morphology points
Parameters
flatmap : VoxelData object with flatmap
points : array of morphology points in atlas space
... |
74d201431486a853404a6f61de463728f903aa31db00cf0f410d6a913f7163cc | Python | 2,029 | 61 | #!/usr/bin/env python
# Purpose: Find remaining volumes (post-censoring) for each session and for each participant overall.
#
# Input: Single-column motion outliers txt file for each bold image. These were generated using the CBIG2016 preproc pipeline.
# Output: Total remaining volumes for each participant's session an... |
3e8c345e27ec3ddf88d52632aa65f980648b26dd4d0914e2e13761578501a1ef | Python | 2,030 | 61 | #############################################################################
#
#Updated by: Yiqin Wang
#
##############################################################################
import os, sys
if (__name__ == "__main__"):
if (len(sys.argv) != 5):
print >>sys.stderr, "Usage: %s combined_variant_file individu... |
73e6554e5314ed517376e52eedbd1b13705d4861f2c18508e1864234244550b5 | Python | 2,030 | 51 |
from copy import copy
import sys
import pandas as pd
class Input:
def __init__(self, Table, pdata):
""" FragPipe output
FragPipe output is composed by a combined_protein.tsv file and it contains
several parameters that can be used to filter the data.
Args:
... |
fb8198a2bf033a8b7c66b62a51efea8f7eb526732e1ad4393e29bb2068a3409e | Python | 2,030 | 66 | # The script calculates the Inter Spike Intervals (ISIs) and plots the
# results in a histogram. The proportion of ISIs violating a threshold
# is also calculated and indicated in the histogram.
# authors: Stefano Diomedi
# date: 10/2022
import numpy as np
import matplotlib.pyplot as plt
from supportFunctions import ... |
4ccf57871b6003d195d917875d2c2f80bd85b24b6ed0c6511a8f71085e23eb16 | Python | 2,033 | 49 | import os
import subprocess
import sys
import pandas as pd
from tqdm import tqdm
# bw2bedgraph = '/home/yyasumizu/Programs/hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64.v385/bigWigToBedGraph'
bw2bedgraph = "bigWigToBedGraph"
listdir = os.listdir('../data/Blueprint/')
# df_metsig = pd.read_csv('../data/Blueprint/met... |
92df7cd6a9b4c1987dcb210ee91d2089c714c8b50fec3157d39216ddccc632f7 | Python | 2,033 | 54 | # 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 ... |
3ed5fafe370f0d1298c5babe07831d61e3996e3dab60b92c949dd2bb9a802b18 | Python | 2,034 | 62 | ####################################################################################
#
# 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.