sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
98a8579af26bccde69ab42b8d7336df4a50b48539ac0140d31ed4598d3e1d3b9
Python
4,534
177
from numbers import Number import numpy as np import pandas as pd import matplotlib.pyplot as plt import puffbird as pb import seaborn as sns import proplot as pplt from scipy.stats import norm from chreyesees import utils from chreyesees import WLS import dreye from scipy.spatial import convex_hull_plot_2d, ConvexHull...
b9f55b8067627e542d2f8b45df0473d91e86fd6009c1c146b2a835b5e7e673be
Python
4,534
122
# Inspired by https://github.com/NVIDIA/NeMo/blob/main/nemo/collections/common/metrics/perplexity.py # But we compute the perplexity correctly: exp(average(nll)), not average(exp(nll)) # Also adapted from https://github.com/Lightning-AI/metrics/blob/master/src/torchmetrics/text/perplexity.py # But we pass in the loss t...
674e2bf3adea2ea9de765805bccd40c529df478389ce7da30a8b308dc2efb71b
Python
4,535
109
# 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...
dac6a16324c31cd576c40946d1c85542ecc2f08da9d00cda48598437b17188ea
Python
4,535
108
#################################################################################### # # 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...
7a8fbc7874d10d8a8e345e6ac4409d1461b881380ab70604697b310c8681f6ea
Python
4,538
116
# Copyright (c) <2021> <University of Paderborn> # Signal and System Theory Group, Univ. of Paderborn, https://sst-group.org/ # https://github.com/SSTGroup/independent_vector_analysis # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated d...
fdb919b08ab2264c8cdf5ccb5b5213d2f0731aa9a95456c6dfeb78374aa086d0
Python
4,538
123
# 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...
075c75b810c0f95faed05fe620c147b9eb309a4b79d49c322164e6014e41381d
Python
4,541
118
# 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 ...
5ea0a9e489772d152b76a710ee9ff8b6d5c3b27c467ed1da13281c8780cdb3b1
Python
4,541
113
#!/usr/bin/env python """Tests for `MRdataset` package.""" import shutil import tempfile from pathlib import Path import hypothesis.strategies as st import pytest from hypothesis import given, settings, HealthCheck from MRdataset import import_dataset from MRdataset.tests.simulate import make_compliant_test_dataset...
61737b928c43acb44ba27ae2f43c4531e4e3aabad41898b90e9291e51cbda113
Python
4,542
141
#################################################################################### # # 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...
055ea54a78b9ff9531244cfff26e2fa7e0a45c6e506edcbcc1b83dfedc4c458a
Python
4,543
141
#################################################################################### # # 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...
9db83cfeda18280a12a46917f30939fdba1fca68db72f5abc22cd724dc8b8cc9
Python
4,544
113
nameModelBase = 'MHATT_bonds_deeper_benchmark_clipping_weights' logfile = open('Log_MHATT_bonds_deeper_benchmark_clipping_weights.txt','w') import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from sklearn.neighbors import KernelDensity import pandas as pd import rdkit, rdkit.Chem, rdkit.Chem.rdD...
c7c20e1588e7204688632b8627f2d4ce438c5c60fb075357f372ed7b16082863
Python
4,544
97
import sys sys.path.append('..') from src.utils import set_random_seed import argparse import torch from torch.utils.data import DataLoader from torch.optim import Adam from torch.nn import MSELoss, BCEWithLogitsLoss, CrossEntropyLoss from torch.utils.tensorboard import SummaryWriter from torch.utils.data.distributed ...
44805942c4f50d5cc5da872a36beb36add0846133e019f9e34ceb5a3060d5075
Python
4,545
113
nameModelBase = 'MHATT_bonds_deeper_benchmark_clipping_weights' logfile = open('Log_MHATT_bonds_deeper_benchmark_clipping_weights.txt','w') import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from sklearn.neighbors import KernelDensity import pandas as pd import rdkit, rdkit.Chem, rdkit.Chem.rdD...
70cf61138d278420b4c0a1b282a40a3b2153159c1856ba2a74e618089abf12d0
Python
4,545
137
from collections.abc import Sequence import pytest from langchain_core.chat_history import ( BaseChatMessageHistory, InMemoryChatMessageHistory, ) from langchain_core.messages import BaseMessage, HumanMessage @pytest.mark.parametrize( "history_class", [BaseChatMessageHistory, InMemoryChatMessageHistory]...
9db6a97627418e4c8288a38fa3abf657d669984b49616f3aeb78d2f4c9c954c3
Python
4,545
113
nameModelBase = 'MHATT_bonds_deeper_benchmark_clipping_weights' logfile = open('Log_MHATT_bonds_deeper_benchmark_clipping_weights.txt','w') import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from sklearn.neighbors import KernelDensity import pandas as pd import rdkit, rdkit.Chem, rdkit.Chem.rdD...
e7104a2a36c1ed49a873877692eed649b83740c7f8690bf917dd9c555b7ecf4f
Python
4,546
155
from openff.toolkit.typing.engines.smirnoff.forcefield import ForceField from openff.toolkit.typing.engines.smirnoff.parameters import ( ConstraintHandler, ElectrostaticsHandler, LibraryChargeHandler, VirtualSiteHandler, vdWHandler, ) from openff.units import unit from openff.units.elements import S...
1a8f688212a510cff08f567885f7b877b4beb108043ad1fadafa2ede72f2342f
Python
4,547
150
import torch import numpy as np def calc_dmap(xyz, epsilon=1e-12, backend="torch"): if backend == "torch": B = torch elif backend == "numpy": B = np else: raise KeyError(backend) if len(xyz.shape) == 2: if xyz.shape[1] != 3: raise ValueError(xyz.shape) e...
b7c217de02da79a25f86fe584729bf63cf7e50cea4fb70b620317aa5280e11f0
Python
4,547
141
#################################################################################### # # 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...
34d33ba30b275e6941dfc7a72904ad50c8e4f97ccd6c99eae44d91147c31a91d
Python
4,548
141
#################################################################################### # # 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...
59f9d7feb57ced83a0cccf52bd09b4857fea6202e6f510c8610fc1a2b9638431
Python
4,548
89
"""Mask, resample and normalize scalar channels with reusable stage outputs.""" import argparse from pathlib import Path import shutil import subprocess import sys if __package__ in (None, ''): sys.path.insert(0, str(Path(__file__).resolve().parents[1])) import nibabel as nib from preprocessing.cache import vali...
a545d6b28033852ed04a7fd225e4345dd3159a0027db8440244dd041dd9844a4
Python
4,548
132
# This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it. import torch from ._contract import Contracter import itertools from typing import Dict # we do lazy imports of cueq to allow `nequip-package` to pick this file up even if cueq is not installed # s...
f94471969dec58f9b8e5c1037ebf18e34965d79e906bdfef531087639f9e653d
Python
4,548
76
import torch from .rk_common import _ButcherTableau, RKAdaptiveStepsizeODESolver A = [ 1/18, 1/12, 1/8, 5/16, 3/8, 59/400, 93/200, 5490023248/9719169821, 13/20, 1201146811/1299019798, 1, 1, 1] B = [ [1/18], [1/48, 1/16], [1/32, 0, 3/32], [5/16, 0, -75/64, 75/64], [3/80, 0, 0...
ff11522840a7c6637a2d70dae69e018618011d9f5284926a410169a3924edb74
Python
4,548
65
"""Re-run the conformal variants affected by the audit fixes (run AFTER final_cpu.py finishes): weighted : covariate-shift weighted conformal with CROSS-FITTED calibration weights sm_weighted : shift-matched scores + cross-fitted weights shift_matched_bal : shift-matched pool with each source da...
9259a3fbceead0900fc939ab12c49587f9c21a095e66043de36183e94bd69d86
Python
4,549
113
#nameModelBase = 'MHATT_bonds_deeper_benchmark_clipping_weights' #logfile = open('Log_MHATT_bonds_deeper_benchmark_clipping_weights.txt','w') import numpy as np import tensorflow as tf import matplotlib.pyplot as plt from sklearn.neighbors import KernelDensity import pandas as pd import rdkit, rdkit.Chem, rdkit.Chem.r...
bc342d74f6a45fad3c08a173c1760d30702229aa8a9f331e65974268b4b2e097
Python
4,549
165
# adapted from https://github.com/papkov/noise2same.pytorch/blob/d65d5a10f35208f43aed92f3a750025cb9a03a39/noise2same/network.py # translated from # https://github.com/divelab/Noise2Same/blob/main/network.py # https://github.com/divelab/Noise2Same/blob/main/resnet_module.py from functools import partial from typing impo...
f4cf18a8f9b3d4e44f29796a380475f1380b8e425114b803c10306433c3f130c
Python
4,551
144
from typing import Dict, List, Sequence, Union import arviz as az import matplotlib.pyplot as plt import numpy as np import pandas as pd from hbayesdm.base import TaskModel __all__ = ['rhat', 'print_fit', 'hdi', 'plot_hdi', 'extract_ic'] def rhat(model_data: TaskModel, less: float = None) -> Dict[str, Uni...
446dd0ca227742fb0e2790e478dcb0cbdb52102dbff9626bd16920c065ade32b
Python
4,555
123
import platform from pathlib import Path import numpy as np import pytest from astrocast.analysis import Events from astrocast.detection import Detector from astrocast.helper import EventSim, SampleInput from astrocast.preparation import IO class TestDetector: @pytest.mark.parametrize("extension", [".h5"]) ...
b8ec7ce34c4d3ebd5d1352240e527267fe8a9ebd6f01d47af6758c1a54072132
Python
4,556
118
from ..utils.utils import * def build_annotations( container, annotation, t_ref, wlid_ref, n_ref,): """Load and handle annotations from annotations.h5 file. Annotations are loaded and sorted according to user arguments, and used to populate an empty results array. This array will be f...
de155473a985f389f4d0e7c39f404d587593829430c466ca8298232d53d7d4b7
Python
4,558
158
#################################################################################### # # 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...
37d576c527563042c61164fd9c2755773587d5cddb2c7ae30789b647733bd5a9
Python
4,559
140
''' Example using BB-RBMs on the MNIST handwritten digit database. :Version: 1.0 :Date: 06.06.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 Jan Melchior This program is free software: you can redistribute i...
c110c776ebdfa15dcd7386e8e9e0e00c8680c2d70c9d72c432555939dc25170f
Python
4,559
158
#################################################################################### # # 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...
e04b92049cf7f333506a22e21d376dffe19ab8bb2ff668ac3c358ff8a9a3f4de
Python
4,561
110
import os import argparse import numpy as np import pandas as pd import random random.seed(49297) from tqdm import tqdm def process_partition(args, partition, sample_rate=1.0, shortest_length=4.0, eps=1e-6, future_time_interval=24.0): output_dir = os.path.join(args.output_path, partition) ...
185ed9d1ea3765b8963ec05673f73935a63f418bbe0dd2a0160560512eac8586
Python
4,562
112
""" Module to generate figures related to functional imaging during optogenetic stimulation of flies for which the VNC was cut. Author: jonas.braun@epfl.ch """ import os import sys import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib as mpl from matplotlib.backends.backend_pdf impor...
2c55d8370dbb9421238f02bf82b0040d20c137aa0dd1cebf15b137f87c2a471a
Python
4,563
133
import pytest import torch from e3nn import o3 from e3nn.util.test import assert_equivariant from nequip.utils import torch_default_dtype, dtype_from_name from nequip.utils.versions import _TORCH_GE_2_6 from allegro.nn._strided import Contracter _TRITON_INSTALLED = False _CUEQ_INSTALLED = False if _TORCH_GE_2_6: ...
6224b6795926be2f855e6a5c21e3c59d83ca280b1e9e6114b4ea44fe08e11587
Python
4,563
133
from typing import Callable, Dict import torch.nn as nn from e3nn.nn import Gate from e3nn.o3 import Irreps from e3nn.util.jit import compile_mode import hienet._keys as KEY from hienet._const import AtomGraphDataType @compile_mode('script') class EquivariantGate(nn.Module): """ wrapper of e3nn.nn Gate (equ...
6613d843fe67c9e6b46ac93538c1e32e1c39fbba4ba3d00884b046d8aa82d595
Python
4,564
117
""" Implementation of Hao et al., 2018's method to obtain tissue-specific proteins Hao, Y., Quinnies, K., Realubit, R., Karan, C., & Tatonetti, N. P. (2018). Tissue‐Specific Analysis of Pharmacological Pathways. CPT: Pharmacometrics & Systems Pharmacology, 7(7), 453–463. https://doi.org/10.1002/psp4.12305 """ import ...
c6021f8de833c469e6fb8444ccb570db3039f23b73d922676f73f32fc58743a9
Python
4,564
141
import os import time import tensorflow as tf import tensorflow_probability as tfp from tensorflow.keras import backend as K import numpy as np ''' References: github.com/eriklindernoren/Keras-GAN https://www.tensorflow.org/tutorials/quickstart/advanced https://www.tensorflow.org/tutorials/generative/dcgan ''' BCE_...
c7b4ae0cf123995f1d67dd18b21746fd2ffa9d32ab450868b6f616e7f9f84543
Python
4,564
121
from torch.utils.data import DataLoader import torch import numpy as np from torch import nn,optim from bestmodel import MyModule from Dataset import MyDataset import sklearn.metrics as m from tqdm import tqdm import os def RMSE(y_true, y_pred): return np.sqrt(m.mean_squared_error(y_true, y_pred)) de...
8b478fcb44ae5ea877848d65f64ff9aa65ef3b54e27d87b12dd7376495dfd903
Python
4,566
133
from PyQt5.QtWidgets import QMessageBox from sklearn.preprocessing import PolynomialFeatures from sklearn.linear_model import LinearRegression from enum import Enum import json import cv2 as cv import numpy as np def check_is_valid_int(n, err_msg, min_val=1, max_val=None): show_err = False if isinstance(n, flo...
20130b131fdb00b04ab966cb35144aa99c5f869a42eccd5d20b2d517d2822ff4
Python
4,567
157
# Read and write data from disk. # # A dataset is a single folder. To get data from the folder, you need to create # a file called "getters.py" containing functions that return data and # metadata. # # Authors: vivekv2@gmail.com from functools import lru_cache, partial import importlib.util import json from pathlib im...
6fbcf10d7f0e2f61f20f0935d9e21bf41b48ce8590bcd8d606ee3cea4037d300
Python
4,569
152
#!/usr/bin/env python3 """ Calculate an optionally padded ROI for a single probabilistic label Author ---- Mike Tyszka, Caltech Brain Imaging Center License ---- This file is part of atlaskit. atlaskit is free software: you can redistribute it and/or modify it under the terms of the GNU General Public Licens...
77317dc2102b41746ba4431d40f5c794ef6ad7cc1d0815d52e8e9a837dfdf9ab
Python
4,570
149
""" Write OPC parameters into a SMIRNOFF force field. Based on ambertools-22.0-py310h206695f. Water Lennard-Jones parameters and geometry from $AMBERHOME/dat/leap/parm/frcmod.opc3 Water hydrogen charge from $AMBERHOME/dat/leap/lib/solvents.lib Ion Lennard-Jones parameters from $AMBERHOME/dat/leap/parm/frcmod.ionslm_126...
ad657efebb21dc31f6e552f0b8515deaded2af18f15eb5ee4daaacc9816926e4
Python
4,570
91
import os import argparse import pandas as pd from tqdm import tqdm def is_subject_folder(x): return str.isdigit(x) def main(): n_events = 0 # total number of events empty_hadm = 0 # HADM_ID is empty in events.csv. We exclude such events. no_hadm_in_stay = 0 ...
54f9a986716d0ce4dda8a306e028ebea6a27d5c2d4aee25bc40b87c97e097172
Python
4,572
137
# Copyright (c) <2021> <University of Paderborn> # Signal and System Theory Group, Univ. of Paderborn, https://sst-group.org/ # https://github.com/SSTGroup/independent_vector_analysis # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated d...
6ea85b1471a6345faa9f9e11a925fe97a1872420c000712656248b74d0770357
Python
4,572
132
from typing import Optional, List, Tuple import numpy as np from .fingerprints import ( create_RDKFingerprint, merge_bit_fingerprints, weight_sum_fingerprints, reduce_fp_set, apply_reduction_fp_set, create_AtomicPairFingerprint, ) from ._types import FingerprintFunction, PfpData from .utils impo...
b2798105d68d14f843f2c88be0fe5a34e1dc1026cf2bef61d49a93ff2ecc1578
Python
4,572
112
import argparse from pathlib import Path from MRdataset import import_dataset, save_mr_dataset, logger from MRdataset.utils import is_writable def get_parser(): """Parser for MRdataset""" parser = argparse.ArgumentParser( description='MRdataset : generates dataset for analysis', add_help=Fals...
c45cf0cf53ef7dd1ed6b2108a7ab9203ac7dda80805a6d780a5684bc0b7d4445
Python
4,572
129
''' Toy example using BB-RBMs on Bars and Stripes. :Version: 1.0 :Date: 06.06.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 Jan Melchior This program is free software: you can redistribute it and/or modify ...
fd02dba2b768b5293b86498bf9cf947986fa7dd3f4710b74e434aa9096dba099
Python
4,573
114
''' concatenate all .rhd files into a single .mda this line is inserted with vi. feels good ''' import os import gc import warnings from copy import deepcopy import numpy as np import pandas as pd from scipy.io import loadmat, savemat from load_intan_rhd_format import read_data, read_header, get_n_samples_in_data fr...
a946ac7ee3ac47c3e310fa7a4c45a02ab0c9c51c4d97493a2c7177f04732cbef
Python
4,574
101
''' read channel info 8/31/2022 jz103 ''' import os import gc import warnings from copy import deepcopy from time import time import re import datetime import json import numpy as np import matplotlib.pyplot as plt SESSION_NAMING_PATTERN = r"[A-Za-z_ ]+_([0-9]+_[0-9]+)" VALID_SESSION_LAMBDA = lambda x: (('_' in x) a...
ea495f787b85e465a43bb284c9512bcd2a04696456051b8ccf2069180d4b32d9
Python
4,574
108
import numpy as np import torch torch.set_printoptions(precision=4, sci_mode=False, threshold=5000) import matplotlib.pyplot as plt from matplotlib.gridspec import GridSpec plt.rc('savefig', format='pdf', bbox='tight') plt.rc('font', size=8) #plt.rc('legend', fontsize=8) from data import generate_recog_data...
36fbd060a407e2951295362f8567111961ed0dea8648f1cdab69c382e6e96548
Python
4,577
93
import os int_or_none = lambda x: int(x) if x is not None else None str_list_or_none = lambda x: x.strip().split(',') if x is not None else None int_list_or_none = lambda x: int(x.strip().split(',')) if x is not None else None eval_if_str = lambda x: literal_eval(x) if isinstance(x, str) else x class Config: def __...
ddfaf0be1e876652645efdd97cba073106d789cc76ad683ae4ee49c532d9337a
Python
4,577
85
import enum import numpy as np """Parses the raycast observations from AnimalAI and returns a shortened version with only relevant objects""" class RayCastObjects(enum.Enum): """Enum for the parsed objects from the raycast""" ARENA = 0 IMMOVABLE = 1 MOVABLE = 2 GOODGOAL = 3 GOODGOALMULTI = 4 ...
fe6c6a52c810adc100d3f2b117bb2f5db68c8bb4070f1a5079abb01ee766fe06
Python
4,577
112
#! /usr/bin/env python2 import subprocess, time, os, sys LOCAL_DIR = '/Users/danil/My/School/Columbia/Research/ongoing_plasticity/' REMOTE_SYNC_SERVER = 'dt2586@habaxfer.rcs.columbia.edu' #must have ssh keys set up REMOTE_SERVER = 'dt2586@habanero.rcs.columbia.edu' REMOTE_PATH = '/rigel/home/dt2586/ongoing_plast...
5167d261e1f0b23c24099da3e2ae8e0f2406fb6abbdfdabad8c63fb1dc3b9477
Python
4,583
118
import sys import os import numpy as np import torch import torch.utils.data as du from torch.autograd import Variable import torch.nn as nn import torch.nn.functional as F import util from util import * from DrugGene_Network import * import argparse from sklearn.preprocessing import MinMaxScaler def predict_drugGene...
77550925eed8a002460dbd1f2c538ad41944bf19e1d706062938c6e6df575ac5
Python
4,583
148
#!/usr/bin/env python # coding: utf-8 # In[1]: import os, sys import numpy as np import pandas as pd from bed_reader import open_bed # sys.path.append('/u/home/z/zhengton/project-sriram/wes/scripts/gene_h2/') # sys.path.append('/u/project/sriram/zhengton/wes/scripts/gene_h2/') from regional_her import RegionalHer ...
25e34f043dc14b9745115086d8dd79fe3505850a1a1f512f429a5cb17ba563fa
Python
4,584
93
""" Find the optimal combination of hyperparameters """ import numpy as np from hyperopt import fmin, tpe, hp, STATUS_OK, Trials from keras.models import Sequential from keras.layers import Dense, GRU, Dropout from keras.layers.embeddings import Embedding from keras.layers.core import SpatialDropout1D from keras.opti...
5978b2800b01f71dee1f6509a412f4ea0e50a94e2937fc53423cddf863f35c4a
Python
4,587
135
import msgpack # import h5py import os import numpy as np import torch from torch.utils.data import BatchSampler, DataLoader, Dataset, SequentialSampler import argparse def batch_stack(props): """ Stack a list of torch.tensors so they are padded to the size of the largest tensor along each axis. Para...
de00879503aac638f3e3e119db623b1838614b095752041ee85643ec1f65c182
Python
4,587
135
import contextlib from typing import Any from langchain_core.callbacks import ( UsageMetadataCallbackHandler, get_usage_metadata_callback, ) from langchain_core.language_models import GenericFakeChatModel from langchain_core.messages import AIMessage from langchain_core.messages.ai import ( InputTokenDetai...
1df77504705a765bfbbad5ef666b4f13fa62af3f0c5e8c69b6917985d965a912
Python
4,588
133
# Load in data of Birds Dataset (CUB_200_2011) import scipy.io import numpy as np from os import listdir from os.path import isfile, join from PIL import Image # Paths to files, change if necessary. LABELS_PATH = '../../data/data_birds/CUB_200_2011/image_class_labels.txt' TRAIN_TEST_SPLIT_PATH = '../../data/data_bir...
42d32f634a4f91a515416eab102f3f127d2f4eb747858c0d51fd2b1076cd1936
Python
4,588
114
#!/usr/bin/env python import gzip import glob import sys import os import tempfile import subprocess import math from joblib import Parallel, delayed import matplotlib matplotlib.use('Agg') import matplotlib.pyplot import matplotlib.font_manager def dformat(xxl): x = xxl if type(xxl) is str else xxl[0] xx =...
95f0cb84669503a385162c40c332391852f354a3949f40a30997ed8c30cbc568
Python
4,589
122
# -*- coding: utf-8 -*- """ Created on Thu May 30 23:46:20 2019 @author: Iluva """ import matplotlib.pyplot as plt import collections def plot_curve(curve, xs, ys_mean, ys_upper, ys_lower, ax, color, hatch, alpha, line, title, **kwargs): title = 'ADNI test' if title=='test' else title assert curve in ['roc',...
0e92943f6880b2600a75022cdac72530bf9b104c40865c4ab1956dfd1b571aee
Python
4,592
129
# FCN model # when tuning start with learning rate->mini_batch_size -> # momentum-> #hidden_units -> # learning_rate_decay -> #layers import tensorflow.keras as keras import numpy as np from sklearn.model_selection import train_test_split import time import tensorflow as tf from utils.utils import save_logs from utils....
42bac5cb2b50a67ed9d3217e27938197c026a062e9d854ef3f438ed21b605d7d
Python
4,592
81
"""Printed font size of text inside figures, measured in the compiled PDFs. Figures are embedded as vector PDFs, so their text survives as real text spans whose size in the compiled document is the size a reader sees. This script finds every figure image block on each page, collects the text spans that lie inside it, ...
68fb3da59a5e66bce8920203a52804cca83c4edd6bfab0166b6bc465c33266e0
Python
4,593
143
#################################################################################### # # 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...
cb44c29d656027002b613776e4286c909d29b1956c0a8717ce153c05fda36180
Python
4,594
143
#################################################################################### # # 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...
fd097379e9895d337672103f5aa5f629ef9a45eb98b1a691b59371834a21bd0a
Python
4,595
145
import logging import os import socket import sys import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from configs.configs import get_config_dict from helpers.data import reorder_ica_components from helpers.hcp import scan_id_to_scan_name def plot_brain_state_cluster_centroi...
11f8581609ebdb7867b4abfa3bddc9dbd782fda7f8d8e4b14926f6f84f047b6e
Python
4,596
140
"""Test groq block translator.""" from typing import cast import pytest from langchain_core.messages import AIMessage from langchain_core.messages import content as types from langchain_core.messages.base import _extract_reasoning_from_additional_kwargs from langchain_core.messages.block_translators import PROVIDER_...
e6a1128ddc62a866921db044fd71b73776718270a272b5879ed6c833ca06918a
Python
4,596
128
# coding=utf-8 from pyexpat import features import torch import torch.nn as nn import torch.nn.functional as F from alg.modelopera import get_fea from network import common_network from alg.algs.base import Algorithm import numpy as np import re from torch.cuda.amp import autocast class Vanilla(Algorithm): """ ...
ebd9401b22b65e26301590a668b4fe5ebd018ba6c0551704f33116233ee8a197
Python
4,597
115
"""unit tests for api/sessions.py's Session.snapshot_target/restore_target/ switch_active_target - the per-target scene snapshot that lets the frontend switch between cranial and facial without re-running align/clip/run against whichever target it switches back to. pure dataclass-field tests, no FastAPI/pipeline needed...
a8eebce509c36e713e8f6c1b19fb42f253efe3652de3e4b35a93182a7ee38016
Python
4,601
138
#################################################################################### # # 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...
a83ba1254c7307cff0b038ce067bfd034c037b7c414917d262196aaa85cdb69d
Python
4,602
138
#################################################################################### # # 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...
dcfc4c6c4cef3d458de0e5da3d36a789e9564e6806eb5f67e2a9b0c83273ffc6
Python
4,602
193
"""Pydantic model for default configuration and validation.""" """Implementation based on the template of ALIGNN.""" import subprocess from typing import Optional, Union import os from pydantic import root_validator # vfrom pydantic import Field, root_validator, validator from pydantic.typing import Literal from matf...
22e3284f218a008475d2d1fe9672391bf78f1a059c03a5ddfb89a1fdac4c1833
Python
4,604
138
""" This script summarized DE results. """ import numpy as np import pandas as pd import session_info from pyhere import here from functools import lru_cache @lru_cache() def get_annotation(feature): """ Get the annotation file based on feature. """ feat_lt = {"genes": "gene", "transcripts": "tx", ...
503386eaf93d46da4a2e2352c81a3edc7c6eed583a5015c550277d645c7a25fb
Python
4,610
117
# Copyright (c) <2021> <University of Paderborn> # Signal and System Theory Group, Univ. of Paderborn, https://sst-group.org/ # https://github.com/SSTGroup/independent_vector_analysis # # Permission is hereby granted, free of charge, to any person # obtaining a copy of this software and associated d...
2055331e8f3991431cf8366593ef4b29f605985b8bb4ecfef87bb63623de3480
Python
4,611
155
"""SSRF Protection - thin wrapper raising ValueError for internal callers. Delegates all validation to `langchain_core._security._policy`. """ import os import socket from typing import Annotated, Any from urllib.parse import urlparse from pydantic import ( AnyHttpUrl, BeforeValidator, HttpUrl, ) from l...
ffd0b695d29a43c01555083bfd2f4ae67fbe57ef68ce23215c2f7699c9d4fdd1
Python
4,612
107
"""tests for io.py. test_strip_uninteresting_vertex_colors_* cover a real bug: some .ply files carry an explicit but uniform vertex-color array (every vertex literally [255, 255, 255, 255]) rather than no color data at all. trimesh treats that as real per-vertex color (visual.kind == "vertex"), which round-trips into ...
865df8fb2bd3bd3482c1bfb1273f558469f1bb67bbef5b7c9999eb5a90b7b0fa
Python
4,618
83
"""C5: stimulated vs unstimulated, SHARED-GENES-ONLY, on Kang 2018 (GSE96583 batch 2). GSM2560248 (2.1) = control, GSM2560249 (2.2) = IFN-beta stimulated. The paper's claim: removing genes exclusive to one condition (the trivial split), the conditions are still separable by a coordinated shift across SHARED genes. We ...
97459b099d46b7f2e1fa8a8d276fc66be0c8972fdd936186d7bf1d9cf177cc5f
Python
4,623
150
import glob import sys import matplotlib.pyplot as plt import numpy as np # Define grid dimensions globally ROWS = 28 COLS = 28 def plotGrids(gridData): if gridData.shape[0] % ROWS != 0 or gridData.shape[1] != COLS: raise ("Incompatible grid dimensionality: check data and assumed dimensions.") grid...
2deb565708af3e0892ad4aca34705ac0aa9c3243aa4bb7cc97deefa7b8da2218
Python
4,625
121
from torch.utils.data import DataLoader import torch import numpy as np from torch import nn,optim from bestmodel import MyModule from Dataset import MyDataset import sklearn.metrics as m from tqdm import tqdm import os def RMSE(y_true, y_pred): return np.sqrt(m.mean_squared_error(y_true, y_pred)) de...
786a6246fe0b0f3b0871e328a97104399479c58ac7efa63a19e8d3eb6073f005
Python
4,625
131
""" Author: Anna M. Puszkarska SPDX-License-Identifier: Apache-2.0 """ import keras import numpy as np from keras.layers import (Dense, Dropout, Conv1D, BatchNormalization, MaxPool1D, Flatten, Input) from keras.models import Sequential, Model from keras.models import load_model from keras.reg...
38fdc8c5508512fa80092a1ddafabbb82558e2aba22ca3f336fd6a6bafca5bfe
Python
4,628
131
# builtin modules import subprocess import os # pnabind modules from .data import data def getAtomChargeRadius(structure, source="AMBER", min_radius=0.6): """ Assign atomic parameters to every atom in a protein chain. Values are stored in atom.xtra dictionary. The following keys are used ----------------...
ad9d432b691b49f693da4a3ff6dbed7d2edd76428218f0ebbd832f49ec6a58dd
Python
4,628
82
# Sconda conda activate TensorFlow_CPU_01; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/results/gene_expression_distribution; python import pandas as pd import numpy as np import matplotlib.pyplot as plt import os # Calculate the mean and standard deviation of the TPM values def p...
4fb79d9e9264635bc71b8e0fec7a8a9d276c8f20d543f60e5d2d5f9c04a6bc08
Python
4,635
110
"""Test rate limiter.""" import time import pytest from freezegun import freeze_time from langchain_core.rate_limiters import InMemoryRateLimiter @pytest.fixture def rate_limiter() -> InMemoryRateLimiter: """Return an instance of InMemoryRateLimiter.""" return InMemoryRateLimiter( requests_per_seco...
0a2a4f630cb7fb5d8251c3e2152fb303398aa482b8c0bf35ae8dba6996f1394b
Python
4,636
106
""" Statistic Module comprises all statistical tests performed by OmicScope for differential expression analysis. Returns: DataFrame: DataFrame with recommended statistical analysis performed """ import os import pandas as pd def perform_static_stat(self): """log2 transformation for express...
a5b8016b6c2d1b6bff9a7a72a540236ef54045cbca192deaf8a60df968650166
Python
4,636
98
"""shared reshaping helper: craniumpy_core.cohort.GroupMeasurements (the dataclass measure_mean_shape returns) -> CohortMeanShapeMeasurementsResponse (the same per-metric response models ResultsResponse uses). factored out of api/routers/cohort.py's own get_mean_shape_measurements so api/routers/longitudinal.py can reu...
c04f512e6cc0160deab3fac1eaf714fd0462f41928ec6e1ef31b3b8a1dfaffb9
Python
4,638
96
from copy import copy import pandas as pd class Input: def __init__(self, Table, pdata, quant_strategy='LFQ intensity'): """ MaxQuant output MaxQuant output is composed by a ProteinGroup.txt file and it contains several parameters that can be used to filter the data. ...
ac5ea15b4391713875c56d5e89a1d4cd465744b6b721a890359c3d87f28aec8f
Python
4,640
142
#!/usr/bin/env python3 """ Merge cortical and subcortical Harvard-Oxford atlas labels into single image - 1 mm spatial resolution - Deterministic threshold p > 0.25 - Split cortical labels into LH and RH AUTHOR ---- Mike Tyszka, Ph.D. LICENSE ---- MIT License Copyright (c) 2019 Mike Tyszka Permission is hereby gra...
ea56afec7576632be9076e8885f8e7ac58dc7fd4cc4113b18c4827effd421543
Python
4,640
156
#################################################################################### # # 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...
2efa19f11e778d63660523a083c0583fd512b9e3169a6e22679b1b33e0430162
Python
4,641
156
#################################################################################### # # 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...
38e93793de3b9f82187c779d743733106a8fdd377a60813a7e43b8281796e8ef
Python
4,641
95
import torch import torch.nn as nn from .utils import prod import e3nn.o3 as o3 class Expansion(nn.Module): def __init__(self, irrep_in, irrep_out_1, irrep_out_2): super(Expansion, self).__init__() self.irrep_in = irrep_in self.irrep_out_1 = irrep_out_1 self.irrep_out_2 ...
eaf87d7d42a07a6d3c70a2f987fc53801485b66b5eda9f2cfe1b00b33671fb2b
Python
4,642
151
""" Test the methods in cwas.core.common """ import cwas.core.common as common import numpy as np import pytest def test_cmp_two_arr(): # Empty arrays arr1 = np.array([]) arr2 = np.array([]) assert common.cmp_two_arr(arr1, arr2) # Different lengths arr1 = np.array([1, 2, 3, 4, 5]) arr2 = ...
e7d3eb982b79b182136fa85941664a219eb4b8999c8e42fb916aa47e1437694f
Python
4,644
130
import glob import os import logging LOG = logging.getLogger(__name__) def get_versioned_dir(output_dir, version=None, resume=False): """version gets dir for specific version, resume gets dir for last version.""" if version is None: current_versions = glob.glob(os.path.join(output_dir, "version*")) ...
ed4d266259fa6d8367c1dedc644a9e4ea4072b11cfdd6600ece0ba42985ad0b5
Python
4,645
180
# These are tools to be used along with Python dataclasses. # # Author: vivekv2@gmail.com from dataclasses import asdict from datetime import datetime from pathlib import Path from typing import Type, TypeVar import pandas as pd import numpy as np import h5py def add_backup_timestamp(path: Path) -> Path: timest...
d540065a242673d3c4cff91105cfa561d024ed1cd3fcc9f0e3a86fcef3441bd8
Python
4,648
122
# -*- coding: utf-8 -*- """ Created on 20 may 22 @author: degano """ import matplotlib.pyplot as plt import numpy as np import mne from scipy import stats outfile = 'decoding_results_nested_LeftDepProsody_final_classes_logistic_full_slideF_NCfull_sel_cv10.npz' npzfile = np.load(outfile) Ttimes = npzfi...
5180d8c3bca435f61a047531aeac2b3d5677c9dafd60bffedc8d115d48daa2d1
Python
4,649
157
import sys import uuid from typing import Any from uuid import UUID import pytest from langchain_core.callbacks import AsyncCallbackHandler, BaseCallbackHandler from langchain_core.callbacks.manager import ( adispatch_custom_event, dispatch_custom_event, ) from langchain_core.runnables import RunnableLambda f...
6566956c1c84e793578997768c7e1762a3307241ace8586982818bac51c18874
Python
4,649
133
## Tensorflow models and callbacks import math import numpy as np from contextlib import redirect_stdout import tensorflow as tf from tensorflow.keras.layers import ( Dense, Conv1D, Activation, SpatialDropout1D, BatchNormalization, Flatten, Dropout, Input, GRU, LSTM, Bidirec...
8f8941427d7eee0122b5460996ee407e6247a0849bc1242f00801e55d9b5a033
Python
4,650
110
# Our proposed model CNN + LSTM import tensorflow.keras as keras import tensorflow as tf import tensorflow_addons as tfa import numpy as np import time from utils.utils import save_logs from utils.utils import calculate_metrics class Classifier_ENCODER: def __init__(self, output_directory, input_shape, nb_classe...
f2ed38b82d78e0e2ba9942657c8e36797ca23c06990aeadf67b6550dcfa2088d
Python
4,651
117
"""Interface with the [LangChain Hub](https://smith.langchain.com/hub).""" from __future__ import annotations from collections.abc import Sequence from typing import Any from langchain_core._api.deprecation import deprecated from langsmith import Client as LangSmithClient @deprecated( since="1.0.6", remova...
d660c28cf6d3d55bccba7ca9589e305476b4ad5bcf1ea33296e0f9889a53225a
Python
4,653
106
""" Import PatternLab Output PatternLab V allows user to export Excel file with filtered identified proteins, sample information, biological and technical replicates. Here, we advise users to export data with at least 1 unique peptide/protein and protein abundance normalized by XIC. @author: Reis-de-Oliveira G <gu...
94cf4c2bd36538cf395348994b8d1d5cd983839883f8ee7f8994310e463b0f66
Python
4,655
134
from collections.abc import Callable from typing import Any from langchain_core.documents import Document from typing_extensions import override from langchain_classic.retrievers.multi_vector import MultiVectorRetriever, SearchType from langchain_classic.storage import InMemoryStore from tests.unit_tests.indexes.test...