sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
23f1f374f3ac255ba2891c9d8f63dfe8d9c5e50f79e4ed1d72c1c7ebe4046496
Python
10,153
264
"""Test pipeline functionality.""" import re import pytest from langchain_core.callbacks.manager import ( AsyncCallbackManagerForChainRun, CallbackManagerForChainRun, ) from typing_extensions import override from langchain_classic.chains.base import Chain from langchain_classic.chains.sequential import Seque...
dff73e5691251c5e7f3fad6ba7c3d60a413729ea8ce6e97fb16486ce677722cb
Python
10,153
251
"""Functions for working with guides. """ import logging logger = logging.getLogger(__name__) # Store the unambiguous bases that make up each # ambiguous base in the IUPAC notation FASTA_CODES = {'A': set(('A')), 'T': set(('T')), 'C': set(('C')), 'G': set(('G')), ...
fac1647e7e3f254330c0f88e92f5db1df9c3477e36e3c4fcb277cd0c93fbc676
Python
10,158
273
"""Configuration for run evaluators.""" from collections.abc import Callable, Sequence from typing import Any from langchain_core.embeddings import Embeddings from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import BasePromptTemplate from langsmith import RunEvaluator from lang...
9f5377000e9c6928cef0bf5f6d9ebeb9a1b44ea1b9e74b3ee10d12f0b8eba213
Python
10,160
243
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import prl_preprocess_func __all__ = ['prl_fictitious'] class PrlFictitious(TaskModel): def __init__(self, **kwargs): ...
5d4048595c6f6a277f106218f5070dc5eb09eaeef3be3fe2ab992eabb8ffc7cc
Python
10,162
265
import pickle as pk import spglib import numpy as np from tqdm import tqdm from pymatgen.core.lattice import Lattice from pymatgen.core.structure import Structure from e3nn import o3 from e3nn.io import CartesianTensor import torch import json from pymatgen.io.vasp import Poscar import pdb from pymatgen.io.jarvis impor...
9fefe2552f759f757c05aa4008063d27c9dc12fdc3cad077a6ee005beaa3db50
Python
10,167
222
import numpy as np from pensa import * from pensa.comparison import * from pensa.dimensionality import * import random import math """ Calculates the average and maximum Jensen-Shannon distance and the Kullback-Leibler divergences for each feature from two ensembles. Each of four functions uses the relative_entro...
ab6b35fc3c66987d28bce586536d36a0bc5ddd837151fba6a860928e7fbb5189
Python
10,169
357
''' cgat_check_deps.py - check whether the software dependencies are on your PATH ============================================================================= Purpose ------- .. The goal of this script is to provide a list of third-party command-line programs used in a Python script given as input, and check whether...
2202fdb5c249f9279175c52210913f970c00f27c60dd815b9748b8d64f45c771
Python
10,172
238
### MAIN SCRIPT """ This is the main collection of functions for processing and analysis of calcium imaging cellsdata in the Packer lab. The fundamental object of cellsdata is one t-series of imaging, along with its associated .Paq file, accessory files generated from the microscope during cellsdata collection, and an...
2bbfa910e429198dab8316b9fb109b272bd4973fd9fd0b5372e7bb759fe7623f
Python
10,176
314
"""Implementation based on the template of ALIGNN.""" from multiprocessing.context import ForkContext from re import X import numpy as np import pandas as pd from jarvis.core.specie import chem_data, get_node_attributes # from jarvis.core.atoms import Atoms from collections import defaultdict from typing import List, ...
6007634d368610e86db3046a069514b72f7e5d32e22c4a4365645c54ecabaa64
Python
10,178
244
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import dd_single_preprocess_func __all__ = ['dd_cs_single'] class DdCsSingle(TaskModel): def __init__(self, **kwargs): ...
8e03e58c19cd4bee7c37eb4e558ffb3d6fdcfafe1832fc5ae2ae98f7f9a4ff53
Python
10,178
311
"""Implementation based on the template of ALIGNN.""" from multiprocessing.context import ForkContext from re import X import numpy as np import pandas as pd from jarvis.core.specie import chem_data, get_node_attributes # from jarvis.core.atoms import Atoms from collections import defaultdict from typing import List, ...
d6162648e7ab47f43d6125c434b35821e240ec51780ccead52cc922b46a1b670
Python
10,180
287
""" Generate Python codes for hBayesDM using model information defined in YAML files. .. moduleauthor:: Jethro Lee <dlemfh96@snu.ac.kr> .. moduleauthor:: Jaeyeong Yang <jaeyeong.yang1125@gmail.com> """ import sys import argparse import re from pathlib import Path from collections import OrderedDict import yaml try:...
c1a39f696329c8ead7d82e93c46fdbdb985fdd52ee7f2c2b0b616a935ae46e5f
Python
10,187
236
#!/usr/bin/env python3 """ Some code in this script was generated in part with ChatGPT, OpenAI's large-scale language-generation model. Upon generating draft code, the author reviewed, edited, and revised the code to their own liking and takes ultimate responsibility for the content of this script. """ import sys imp...
d80a67ceb8af44f6252791f13b9b23f645cd09ee4cc344f225d9317a413f3731
Python
10,188
257
from jsonargparse import ArgumentParser, ActionConfigFile r"""An important module that is used to define all arguments for both argument container and configuration container. """ import pathlib import sys from typing import List from tap import Tap from typing_extensions import Literal from dataclasses import datacl...
b70d906e1076f8fff25adb0164248b4c1593f65ce07794d7e057618bb56c4318
Python
10,190
160
import argparse import os from util import util import torch import models import data os.environ["CUDA_VISIBLE_DEVICES"]="0" class BaseOptions(): """This class defines options used during both training and test time. It also implements several helper functions such as parsing, printing, and saving the option...
b5ade591db30bdf217d814abd9b4aa3eecdbecdfb5b334c3ac6593d4c1565737
Python
10,192
364
import os import re import nibabel as nib import matplotlib.pyplot as plt import numpy as np from tqdm import tqdm from nilearn import plotting from skimage import morphology def rescale(array, tup) -> tuple: """ rescale Feature scales image to range tup _extended_summary_ Parameters ---------- ...
39a0395d9d4d1f19512d49cc92d5cd77ae7a30e4a0b9d56f201c97a502260500
Python
10,193
304
import torch.nn.functional import torch_scatter import e3nn from e3nn import nn, o3 from .embs import MLP from .irreps_tools import ( reshape_irreps, get_feasible_irrep, recollect_features, ) from .symmetric_contraction import SymmetricContraction class EdgeBoosterBlock(torch.nn.Module): def __init__...
10d7cf7f4b0e46fb6c1b58c31d126c47e3bed5721d285e6bd773c4645552a515
Python
10,198
139
"""Figures for corpus B (raw-curve corpus): physics indicators, twelve datasets, K = 11 calibration, cell-level CV+. fig15_physics.pdf (a) MAPE by protocol and feature set, four-dataset subset and twelve-dataset corpus (log scale) (b) P4 error per held-out dataset, statistics against st...
16bd90fc3bc501083f16d2f221f5e485d054c9d1b12b4fc2476532eed1b55428
Python
10,211
281
# Copyright (c) 2008-2026 the MRtrix3 contributors. # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # # Covered Software is provided under this License on an "as is" #...
3604f60bb45bd561307c4bf84a44c64cb5468101eeddbe8988d1319fc1343be2
Python
10,211
291
import os from typing import Dict import matplotlib.pyplot as plt import numpy as np import pandas as pd import tabulate import torch import torch.nn as nn import torch.optim as optim from sklearn.metrics import classification_report from torch.utils.data import DataLoader from torch.utils.tensorboard import SummaryWr...
e2f90bfe4dc9446ec4ff199cfed1b08a8b0ead8764eb05ac0aff083945e580f5
Python
10,212
238
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import pst_preprocess_func __all__ = ['pst_Q'] class PstQ(TaskModel): def __init__(self, **kwargs): super().__ini...
cfafa867f56163ef6bb7b39572138695b303e7413f4f29b960e24d3bac628349
Python
10,213
237
import os # from config import args import pandas as pd from miga_emblaze.emblaze import ProjectionTechnique from utils.distribution import DeviceManager os.environ['RANK'] = '-1' DeviceManager('1') from collections import OrderedDict import cv2 import umap from rdkit.Chem import AllChem from rdkit.Chem import Draw...
26cc08bf5ee0a259b8467e8caebb8af6f5d6b7964f3115072b1a7b2e29f39108
Python
10,216
263
# this script inference based on trained models # Mask-RCNN on detectron2: # the folder structure should be: # data/test (images) # pretrained: the pretrained model model_best.pth # Running: # module load Detectron2/0.3-fosscuda-2019b-Python-3.7.4-PyTorch-1.6.0 # import argparse import os import random import shu...
3d3be4357a888e9fd94613df07b69b1fecb55dd861cf790c01432f3ec184cca6
Python
10,216
210
""" Parameters used for analysis of 2p and behavioural data. Author: jonas.braun@epfl.ch """ import os import matplotlib.pyplot as plt from datetime import date today = date.today().strftime("%y%m%d") """ # FH version # handling summary data of all recording data_summary_dir_JB = "/mnt/nas2/JB/_data_summary" data_s...
a29d63a169098b02f28404f43933f4f35c88d2e068d40f416aa59eccae2129c1
Python
10,224
183
import torch.nn.functional as F import torch import torch.nn as nn from models.GFNO import GConv2d, GConv3d, GMLP2d, GMLP3d, GNorm from functools import partial # ---------------------------------------------------------------------------------------------------------------------- # GCNN2d # ---------------------------...
2681e1c9e155391eeebe0c6743e65fcf47397d0f4b61b04b2e7d6e50f75e1e98
Python
10,225
323
# -*- coding: utf-8 -*- """ Methods to obtain a distribution for the water pockets which respresents a combination of the water occupancy (binary variable) and the water polarisation (continuous variable). For a water molecule to exist within a water pocket, just the oxygen must occupy the pocket. If there is ever an...
a01ff7b9f7c579e71b970ce205e02aa954c01099403c81d9618587b370771444
Python
10,226
267
"""Tests for SSRF protection utilities.""" import socket from collections.abc import Iterator from typing import Any from unittest.mock import patch import pytest from pydantic import BaseModel, ValidationError from langchain_core._security._ssrf_protection import ( SSRFProtectedUrl, SSRFProtectedUrlRelaxed,...
1370154d8237fc060c47514d09688b4fab24eea99556262f1e291f5cf45d6ed7
Python
10,228
258
import numpy as np import csv import pandas as pd import os from argparse import ArgumentParser from utils.util import print_environ import nibabel as nib from scipy.ndimage import zoom from icecream import ic from tqdm import tqdm brain_regions = {1.:'TL hippocampus R', 2.:'TL hippocampus L', 3.:'TL amygdala R', 4.:'...
046773c769b51ec7099cdc6db1a2e6bf9031a0ec253d6a69e5f045d6669780a4
Python
10,229
241
# -*- coding: utf-8 -*- """ Created on Thu Apr 23 11:36:41 2020 @author: gritti """ import sys, time, tqdm, copy, os sys.path.append(os.path.join('..')) from orgseg.ImageTools.morphology import meshgrid from orgseg.DatasetTools.straightmorphology import io as ioStr from orgseg.DatasetTools.morphology import io as io...
e6513c7fe6e26680541af03cf84fc5bb6b8c235b2e060dfaecc24ab899337e6c
Python
10,232
267
# 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...
68e7efac3d23dc991189a152a8121000e7546b55896ca6d7cd8bba48f8b3ef93
Python
10,237
283
# 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...
e5cc2a34c465d039f590f2e16414cd08f2be346028ca82a1a3ef0647259f8b03
Python
10,237
251
"""tests for api/routers/longitudinal.py's LongitudinalMeshRef.template support - the "distance heatmap" overlay's custom-reference mode (see the Longitudinal workspace's 3D Morphing tab) needs to diff an arbitrary NICP-fit session against a bare shipped template, not just another session. self-contained rather than im...
9951e0704ddb9d7b9e19c99395f2100a4b196a06757ca74e2c5b7e92721267ff
Python
10,240
253
from copy import copy import numpy as np import pandas as pd from patsy import PatsyError from patsy import dmatrix from statsmodels.stats.multitest import multipletests def Spline_Model_Full(self, pdata, df): """ Natural Cubic Spline This algorithm perform the Natural Cubic Spline regression Args: ...
9f1af44ee204121a1b890b08c89aabe6365f9c5ca2e6201ff3fde05acf07bc7f
Python
10,247
309
import os import numpy as np import mne class EEGLoader(): """ Class to load raw EEG data. The EEG data is loaded and bad as well as reference channels are set based on previous visual data inspection. The reference channels are set to the average mastoids or to T7 and T8, depending on the subject. ...
1dea65833f46cdc5bc15b22e9dab81584174953e1c594ac484a56cc28975be19
Python
10,258
249
#!/bin/env python import numpy as np from openff.toolkit.typing.engines.smirnoff.forcefield import ForceField # Function definitions for parsing sections within parameter file def _parse_nonbon_line( line ): """Parse an AMBER frcmod nonbon line and return relevant parameters in a dictionary. AMBER uses rmin_half ...
32112569e5702aa5614fc67e19309c1cf20e9760622dd1db553f48840066faf1
Python
10,266
244
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import bandit4arm2_preprocess_func __all__ = ['bandit4arm2_kalman_filter'] class Bandit4Arm2KalmanFilter(TaskModel): def ...
7857272a6a2a98075cf823a8b59f9ec6ab2d408c7bf4d6c21f026a226f6b3350
Python
10,270
291
""" Sei architecture (see https://github.com/FunctionLab/sei-framework for more details) """ import numpy as np import torch import torch.nn as nn from selene_sdk.utils import NonStrandSpecific import numpy as np from scipy.interpolate import splev def bs(x, df=None, knots=None, degree=3, intercept=False): """ ...
e646089b43960d63dad1a21bfe271636e600f5383bc842a3d949c404927ef173
Python
10,270
243
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import prl_multipleB_preprocess_func __all__ = ['prl_rp_multipleB'] class PrlRpMultipleb(TaskModel): def __init__(self, *...
85fd4edceef10a1c93b51877397283746e177f85a7198d9dfb640bd6963dc505
Python
10,271
310
""" =============================================================================== File: painn Date: 6/16/2024 Description: Code is adapted from PaiNN OC20 implementation https://github.com/facebookresearch/fairchem/tree/fairchem_core-1.10.0/src/fairchem/core/models/painn. All rights reserved t...
fd2139ee16c2438c472b5aa8da7a7cd2147ec68a092e4d19dab4ac90355ef675
Python
10,272
204
''' Test module for RBM estimators. :Version: 1.1.0 :Date: 04.04.2017 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2017 Jan Melchior This file is part of the Python library PyDeep. PyDeep is free so...
baf8e968d144d8ee585adfe055256ef82a80fa2a7a1f6e019ba00a24d9e320ba
Python
10,276
248
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import gng_preprocess_func __all__ = ['gng_m3'] class GngM3(TaskModel): def __init__(self, **kwargs): super().__i...
81fb137f8b499d42caea32df8fdc85380ce4c8bc7ca9b84cae4985fe5da367de
Python
10,277
283
# 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...
509de3a41ecc7c23aeba05fce86977cb25d39e834f878f8ca3ce46a517ee42cf
Python
10,278
248
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import peer_preprocess_func __all__ = ['peer_ocu'] class PeerOcu(TaskModel): def __init__(self, **kwargs): super(...
e0c611cb9354610ca336a7cb3078bf5ba0df87cb18ab0cba73d93d3dbe6c215e
Python
10,278
179
# 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...
d1d4698e7181525457efeebe3fafcc2831fab3948128af415f7e557fd09d7377
Python
10,279
244
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import igt_preprocess_func __all__ = ['igt_pvl_delta'] class IgtPvlDelta(TaskModel): def __init__(self, **kwargs): ...
ea1b07a569766998f7682e4cb057553f2aba76388b33c25b117b89bd6ffc1e31
Python
10,282
228
""" Runs a simulation with OpenMM. """ import sys # Configure logging import logging from rich.logging import RichHandler FORMAT = "%(message)s" from rich.console import Console logging.basicConfig( level=logging.INFO, format=FORMAT, datefmt="[%X]", handlers=[RichHandler(markup=True)] ) log = logging.getLogger("ri...
a28a01ce3e6cf2add09f478a162d6d1427d5490be135b9d88a41f0053ee6d6f0
Python
10,286
276
# coding: utf-8 import os import tensorflow as tf import keras from absl import flags from absl import app from dlutils.layers.input_scaler import ScalingLayer from dlutils.models.unet import GenericUnetBase from retchat.callbacks import CosineAnnealingSchedule from retchat.callbacks import ExtendedTensorBoard from...
f3c9f74c549c25d54ada9d8efaee2e2dffc6476bf45ff304ff6b7a844cea9b9e
Python
10,286
279
from ChipseqReport import * class TrackerROI(TrackerSQL): def getTracks(self, subset): return self.getValues("SELECT DISTINCT(class) FROM regions_of_interest") ########################################################################## #####################################################################...
4e62ed588ba74d0a84f42c00fea01967b419b0424d5d9ff3cc607d49d9f39c44
Python
10,287
276
# coding: utf-8 import os import tensorflow as tf import keras from absl import flags from absl import app from dlutils.layers.input_scaler import ScalingLayer from dlutils.models.unet import GenericUnetBase from retchat.callbacks import CosineAnnealingSchedule from retchat.callbacks import ExtendedTensorBoard from...
32200e9379d86e157016835522f218ece9a9305528b061ceb836160c9d798458
Python
10,293
174
import numpy as np import pandas as pd import pytest from skbase.utils.dependencies import _check_soft_dependencies from sklearn.base import BaseEstimator, ClassifierMixin from sklearn.dummy import DummyClassifier, DummyRegressor from sklearn.ensemble import HistGradientBoostingClassifier, RandomForestRegressor from sk...
a2fde23c37045658514b206e1ee4f22ea0a98e9c52d6c07a0ecbc095c70b8ce5
Python
10,295
338
# -*- coding:utf-8 -*- """ A file for utilities used in other files. Methods: segment_words """ import sys import random import numpy as np reload(sys) sys.setdefaultencoding('utf-8') random.seed(1) ############### # English pre-processing ############### def tokenize_sentence(senlist, choice="string"): im...
e4764ede6da7ec6ae9388c5590b0ce07ea879a137e77ab89717ce97a900ac249
Python
10,302
235
from pgmpy.base import ADMG, DAG from pgmpy.identification import BaseFormulaIdentification from pgmpy.identification.probability_expression import ( DivisionNode, ProbabilityExpressionTree, ProbabilityNode, ProductNode, ) class ID(BaseFormulaIdentification): r""" Given a causal graph, identif...
60b224d57fe7a508a88f2ee7bad217f5996ddfcd005aa59e63386bf215382fa3
Python
10,308
262
import torch import torch.nn.functional as F from ogb.graphproppred.mol_encoder import AtomEncoder, BondEncoder from torch_geometric.nn import MessagePassing from torch_geometric.nn import global_add_pool, global_mean_pool, global_max_pool, GlobalAttention, Set2Set from torch_geometric.utils import add_self_loops from...
8bb8fa28bf95b65b9d704e51275a5f6e881dac9b9d44e71042373a7d0eb6fe01
Python
10,308
247
import random from collections import defaultdict from itertools import compress import numpy as np import torch from rdkit.Chem.Scaffolds import MurckoScaffold from sklearn.model_selection import StratifiedKFold def generate_scaffold(smiles, include_chirality=False): """ Obtain Bemis-Murcko scaffold from smiles...
e1f531d1f8837ec94485a76f3fa0356ef00dc303d37fe7b9fcb26fc73b9ccc2d
Python
10,313
352
# -*- coding: utf-8 -*- """ Created on Thu Oct 25 11:43:39 2018 @author: 2624224 """ import random import os import sys from OCC.Core.TopExp import TopExp_Explorer, topexp, topexp_MapShapesAndAncestors from OCC.Core.TopAbs import TopAbs_FACE, TopAbs_REVERSED, TopAbs_EDGE, TopAbs_VERTEX from OCC.Core.TopoDS import top...
6f81e74264ad5fc69bcaf9a069080fc23ad9db262625192dcf60ec767e355b67
Python
10,314
209
import torch import torch.nn as nn import torch.nn.functional as F """Springer2023 最近,深度学习已被证明在多视角立体视觉 (MVS) 中表现出色。然而,基于深度学习的 MVS 方法很难平衡其效率和有效性。为此,我们提出了 DSC-MVSNet,这是一种新颖的粗到精和端到端框架,用于在 MVS 中更高效、更准确地估计深度。 具体来说,我们提出了一种注意力感知的 3D UNet-shape 网络,它首先使用深度可分离卷积进行成本体积正则化。该机制通过将成本体积上的普通卷积转换为深度卷积和点卷积,实现了信息的有效聚合,并显著减少了模型参数和计算量。 此外...
59ad4a3884cf9d8be50ed7bbd2c5058439f3cdcbb3031e2826cfc5e26c879d14
Python
10,322
278
#################################################################################### # # 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...
219952463f43b30237e5fc20d2678aa2a9c607b28c82984f61af307633820864
Python
10,329
270
from sumstats import Sumstats from trace import Trace import time import datetime import numpy as np import os def _get_time(): """Return current epoch time (float).""" return time.time() def _get_timestr(current_time): """Format a timestamp with local timezone.""" timezone = datetime.datetime.now(d...
6e11fb445d31706bbee70e62be049adbd7e841eae14ab3986d9ee2ff29148daa
Python
10,333
211
import logging import sys import argparse from datetime import date import json import numpy as np import torch from torch.optim import lr_scheduler import monai from monai.transforms import \ Compose, ToTensord, AddChanneld, EnsureTyped, NormalizeIntensityd, \ RandFlipd, RandZoomd, RandAffined, RandAdjustCon...
a467eebedddb98c08335822c96f041fb7b871324807164912596c8fb0e2c9814
Python
10,337
247
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import cra_preprocess_func __all__ = ['cra_linear'] class CraLinear(TaskModel): def __init__(self, **kwargs): sup...
65706c13663a33aeab5ec770d43628bcf23e59b4ca724e4235471bdce47e21de
Python
10,342
274
"""Private helpers for resolving LangSmith gateway configuration. The [LangSmith LLM gateway](https://docs.langchain.com/langsmith/llm-gateway) lets a chat model reach a provider through a proxy configured via environment variables. These helpers centralize the (non-trivial) precedence rules so that each provider inte...
0f5286257608618ba42af43c0e3862e3f2f6886213f0bc092e23597378a621cb
Python
10,347
244
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import banditNarm_preprocess_func __all__ = ['banditNarm_4par'] class Banditnarm4Par(TaskModel): def __init__(self, **kwa...
aa37412e41d25020a259f0191e7615bf56ce7d83125d0a68f5a47349cc86ab9a
Python
10,347
247
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import cra_preprocess_func __all__ = ['cra_exp'] class CraExp(TaskModel): def __init__(self, **kwargs): super()._...
4ae97c4b01cb3abb781cf3a13ee3e2dcc0e0faea881cee45a2e4e78058a12b3d
Python
10,348
290
import os import numpy as np import scipy.stats as stats import matplotlib.pyplot as plt import pandas as pd from net_utils import load_from_file from plotting import get_all_pkl, plot_recog_generalization, plot_recog_positive_rates from data import generate_recog_data def plot_fit(X, Y, ax=None, color=No...
9f948a4c44f381cf1655793876c5b73953e86b7c8adc5c827386e63bed475117
Python
10,348
326
""" ############################################################################## # # Prepare tables for samples' Z-scores heatmaps (all windows/all sites) # # AUTHOR: Maciej_Bak # AFFILIATION: University_of_Basel # AFFILIATION: Swiss_Institute_of_Bioinformatics # CONTACT: wsciekly.maciek@gmail.com # CREAT...
3ec111dada14a7043569d4a23878b6559252ae1b864410af16321077ed95dd1c
Python
10,349
345
import random import numpy as np import os import torch import torch.nn.functional as F import csv import datetime import pandas as pd def current_time(): return datetime.datetime.now().strftime("%Y-%m-%d_%H.%M.%S") def cv_shuffle(pos, neg, shuffle): pass def fix_seed(seed): """ Seed all necessary...
a23da557e6ac1187f8fe6217a9d30642c86246a2dfb7a1d2920fddcc58fc5af7
Python
10,351
294
import numpy as numx import pydeep.base.numpyextension as numxExt import pydeep.misc.io as IO import pydeep.misc.measuring as MEASURE import pydeep.misc.visualization as VIS from pydeep.base.activationfunction import Sigmoid def binary_unit(activation): return numx.float64(Sigmoid.f(activation) > numx.random.ran...
da399f3b307f4908b82bb08b3fef487f345a1a59465b54989219542eb2bbf598
Python
10,358
246
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import bandit4arm_preprocess_func __all__ = ['bandit4arm_lapse_decay'] class Bandit4ArmLapseDecay(TaskModel): def __init_...
d1cefaa17c62c8addf0e949a5252337e252681673ec40453a47597796247e185
Python
10,363
228
import bisect import collections import torch from .interp import _interp_evaluate, _interp_fit from .misc import (_compute_error_ratio, _select_initial_step, _optimal_step_size) from .solvers import AdaptiveStepsizeODESolver _ButcherTableau = collections.namedtuple('_ButcherTabl...
2e75ec041a3d956a392d0278e1ca2c10ac5a9e00a4bc856549dbedd0ebaace29
Python
10,364
302
from pycromanager import multi_d_acquisition_events import numpy as np import pytest x = np.arange(0, 5) y = np.arange(0, -5, -1) z = np.arange(0, 5) xy = np.hstack([x[:, None], y[:, None]]) xyz = np.hstack([x[:, None], y[:, None], z[:, None]]) labels = [f'Pos{i}' for i in range(5)] def test_xy_positions(): exp...
ef38ab793ad7439cf412170b0b683ef0eb10c9ff3617a78194a6a814474d94b1
Python
10,365
272
"""Optional caching layer for language models. Distinct from provider-based [prompt caching](https://docs.langchain.com/oss/python/langchain/models#prompt-caching). !!! warning "Beta feature" This is a beta feature. Please be wary of deploying experimental code to production unless you've taken appropriate p...
9be7406f0a86d8bd610bbe28ea86900d2254fba53cc70d87a1c45ba75dd0b59c
Python
10,366
274
# pylint: skip-file import copy from absl.testing import absltest import numpy as np import torch import pytest from .embanded_torch import EMBanded class EMBandedTests(absltest.TestCase): """Test cases for EMBanded.""" def test_compare_model_settings(self): """Fit models with different settings and...
8f7fe38f4e86b2ea3a272b9d2c7c5cb5942dbda8526ae92345b9f52f5e8f21f6
Python
10,370
194
import os import numpy as np from tqdm import tqdm from torch.utils.data import Dataset class S3DISDataset(Dataset): def __init__(self, split='train', data_root='trainval_fullarea', num_point=4096, test_area=5, block_size=1.0, sample_rate=1.0, transform=None): super().__init__() self.num_point = ...
8809bbcca8726a3f42cc29aeded677d1d702213e96d31120ba773c1110497658
Python
10,378
368
"""Plasticity using SNN. Section ....""" import csv import dataset import model import matplotlib.pyplot as plt import trainer import torch def convergence( device, elastic_modulus, batch_size, num_samples_train, num_samples_val, num_samples_test, hidden, epochs, ): """Convergence ...
d09edf34e5311d97d99a4ba9573da550fa31cae71a2c1b01df9f7986d53c7dbf
Python
10,382
332
import colorsys import cv2 import matplotlib.pyplot as plt import numpy as np import torch import torch.nn.functional as F from .io import * # core utilities for ZephIR def blur3d(input_tensor, kernel_size, sigmas, dev=torch.device('cpu')): return F.conv3d( input_tensor.view(-1, *input_tensor.shape[2:]),...
6250627f782d52bcb9a587c5c9df27feb96ea36e93678936359b7fa7599e6b07
Python
10,384
340
import math import numpy as np import numba as nb import Utils.numba_vec as nbv @nb.njit(fastmath=True) def search_rect_inside_bound_1(verts, vec1, vec2, bnd_pnts): in_pnts = points_in_polygon(bnd_pnts, verts) if in_pnts.shape[0] == 0: return verts # find perpendicular unit vector of normal and l...
dd5f12686cb800ef59ea947136f4bfa15f1b5074d95bfeb7eaf70e9d0d75735f
Python
10,384
285
# t-leNet model: t-leNet + WW import tensorflow.keras as keras import tensorflow as tf import numpy as np import time from utils.utils import save_logs_t_leNet as save_logs from utils.utils import calculate_metrics class Classifier_TLENET: def __init__(self, output_directory, verbose,build=True): s...
94bc54b0a2a481d54394163b32e5a6e71d378d4d2a274a70bd751ec59b3cf583
Python
10,385
289
""" Algorithm introducing volumes of 33 barrel columns coming from segmentation of the average brain atlas images from Allen institute. Barrel columns are introduced as children to somatosensory area of barrel cortex and then subdivided into layers. Each barrel is subdivided into layers. * Introduction of barrels to ...
2daad25cddfa22880265e0088bc92676967a01101c8ed66de2ddb07d41a5d8ff
Python
10,389
276
""" Given a (k-mer incomplete-trained) methylated 6-mer pore model, expand using NN to learn parameters for missing k-mers. By default, only update parameters for methylated CpG k-mers which were not updated during initial training. """ import sys from itertools import product import numpy as np import pandas as pd ...
fdf582d79d8626eb09d5d4ebdc927e6c46c401996ac412122cdabd56d9b8feb2
Python
10,390
362
import torch import numpy as np import torch import math from scipy.stats import truncnorm from typing import Optional, Callable, List def _standardize(kernel): """ Makes sure that Var(W) = 1 and E[W] = 0 """ eps = 1e-6 if len(kernel.shape) == 3: axis = [0, 1] # last dimension is output ...
a484e2b060e69f2871754c32508bdb0e0d0e3caf649585d92be4c3c3c25fe9f6
Python
10,392
266
import os import sys import re import types import itertools import matplotlib.pyplot as plt import numpy import scipy.stats import numpy.ma import Stats import Histogram from cgatReport.Tracker import * from cpgReport import * ########################################################################## class replica...
7b539f59583ca1cd3d7d5e24d51062352af227b351ac99c3b0989a642d66118a
Python
10,394
232
import argparse from os.path import join import torch import pickle from qm9.models import get_model from configs.datasets_config import get_dataset_info from qm9 import dataset from qm9.utils import compute_mean_mad from qm9.sampling import sample from qm9.property_prediction.main_qm9_prop import test from qm9.propert...
665cdb8cb5ec64cc0af7724f46e09547a6b0bd438ee37ce929f98b57a0cfdaf5
Python
10,400
308
import numpy as np import numpy.testing as np_test import pytest from pgmpy.factors.discrete import DiscreteFactor, TabularCPD from pgmpy.inference import VariableElimination from pgmpy.models import DiscreteBayesianNetwork @pytest.fixture def sn2(): return { "grade": ["A", "B", "F"], "diff": ["h...
0ed7978ff5ca0556d9359290dd8f2c0887f827ab98da89a040050275fecf012e
Python
10,402
270
from torch import nn import torch # egnn code is adapted from: # https://github.com/vgsatorras/egnn/blob/main/models/egnn_clean/egnn_clean.py # https://github.com/arneschneuing/DiffSBDD/blob/main/equivariant_diffusion/egnn_new.py class E_GCL(nn.Module): """ E(n) Equivariant Convolutional Layer r...
1cf5ebeac44453625ad302cc140f19a56b3bfaec00fc6acc09e6734b3d9d4aca
Python
10,402
250
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import gng_preprocess_func __all__ = ['gng_m4'] class GngM4(TaskModel): def __init__(self, **kwargs): super().__i...
9e228b0025c503fdddf2b88b153d130e023ea52de4de930b6244b269ab0ea71b
Python
10,403
245
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import prl_multipleB_preprocess_func __all__ = ['prl_fictitious_multipleB'] class PrlFictitiousMultipleb(TaskModel): def ...
a99e71f7d05b75770c77591cb606106430ab209ef815f5e91993916d4d8f06cf
Python
10,404
246
# -- coding: utf-8 -- # @Time : 2022/12/14 17:06 # @Author : Biao Zhang # @Email : littlebiao@outlook.com # @File : run_srrsc_6regions.py # -- coding: utf-8 -- # @Time : 2022/10/18 16:19 # @Author : Biao Zhang # @Email : littlebiao@outlook.com # @File : run_analysis.py import sys sys.path.append('../../../') from Bra...
9ff0d9847e0e34e81bce4b761458ee6f409ad3c450624988ec586857bd183841
Python
10,405
366
"""Draws DAG in ASCII. Adapted from https://github.com/iterative/dvc/blob/main/dvc/dagascii.py. """ from __future__ import annotations import math import os from typing import TYPE_CHECKING, Any try: from grandalf.graphs import Edge, Graph, Vertex # type: ignore[import-untyped] from grandalf.layouts import...
3ed7fa43e28f8f5aa8c171c959ad71882ed9624bab72f1ac128ace157f53b18b
Python
10,406
241
from typing import Sequence, Union, Any from collections import OrderedDict from numpy import inf, exp import pandas as pd from hbayesdm.base import TaskModel from hbayesdm.preprocess_funcs import banditNarm_preprocess_func __all__ = ['banditNarm_delta'] class BanditnarmDelta(TaskModel): def __init__(self, **k...
c90fee1147b70372855d372e1d6dbe1d9448f53a869cff3cf6b6e626b2f0dde6
Python
10,407
277
"""Checkpoint helpers for warm-start / finetune (weights-only load).""" from __future__ import annotations import logging import shutil from pathlib import Path from typing import TYPE_CHECKING, Any, Dict, Optional, Tuple, Union import torch from lightning.pytorch import LightningModule if TYPE_CHECKING: from li...
67ca2fb6adc706c7b9c33e59523d69a22ffb0c9111ad3130db2f797efc9c4032
Python
10,408
288
import torch import torch.nn as nn import torch.nn.functional as F import torchvision import numpy as np import matplotlib.pyplot as plt import math ######################## # debug ######################## from utils.tensor_operator import sigmoid_with_clamp def get_feature(feature): return np.squeeze(feature.c...
c4132b2999618bc779e41ffb7da8499ace70257df27fb8c2c0790e38221884f9
Python
10,412
272
from rdkit import Chem import os import numpy as np import torch from torch.utils.data import BatchSampler, DataLoader, Dataset, SequentialSampler import argparse import collections import pickle import os import json from tqdm import tqdm from IPython.display import display from matplotlib import pyplot as plt import ...
28afef2cdd781e08fd3a19029df13ed32da3c76bb23b7f9720af6788d27591ae
Python
10,418
294
"""Set of tests that complement the standard tests for vectorstore. These tests verify that the base abstraction does appropriate delegation to the relevant methods. """ from __future__ import annotations import uuid from typing import TYPE_CHECKING, Any import pytest from typing_extensions import override from la...
e321397c82063ea3fc9b1892d9d7985b860883d252fd17091bc0aad7a1cf783d
Python
10,421
318
import pickle import pandas as pd import numpy as np import torch import os from sklearn import metrics import matplotlib.pyplot as plt import seaborn as sns import datetime as dt # Straight up stolen from main.py def calc_roc_auc(gts, probs): try: auc = metrics.roc_auc_score(gts, probs) if np.isn...
39e0042ed63b60d50cfcbfc8396ce80ae9871fe919a97dd144cbdb2b801eebd7
Python
10,429
275
""" This script aims to convert BRAT format data into BIO format data for NER Entities will be mapped from their original offsets to the new offsets after sentence tokenization Two sentences are separated by a empty line entities and relations information are also provided in json format """ import os import sys impor...
157cb47c48960a7a90ee571c425877e743f0800137503e125b0d3c34af43f0b3
Python
10,431
319
import argparse import os import matplotlib.pyplot as plt import numpy as np import torch from torchvision import transforms from tqdm import tqdm from bindsnet.analysis.plotting import ( plot_assignments, plot_input, plot_performance, plot_spikes, plot_voltages, plot_weights, ) from bindsnet....
75b0d92cb80c1e8fe8993ec7fee4c0b3f03341748e9f90b4337dde7dd64fe670
Python
10,431
297
import math from typing import Tuple, Union, Callable import inspect import numpy as np import torch import torch.nn as nn from sam.coords import calc_dmap, torch_chain_dihedrals from sam.nn.common import get_act_fn, AF2_PositionalEmbedding from sam.nn.geometric import GaussianSmearing, ExpNormalSmearing from sam.nn...
c65b7dd29cc7639b467ca1b24277865ad4e8779eb90eeba62ee2d81af6a502a1
Python
10,436
321
# -*- coding: UTF-8 -*- """ @author: Xingyan Liu @file: utils.py @time: 2021-06-12 """ from typing import Union, Sequence, Optional, Mapping, Dict, Any, List, Callable import logging import numpy as np import torch from scipy import sparse import torch as th from torch import Tensor import torch.nn as nn import dgl i...
59d8d874b08780ff8ed813db7721e5a1706b6d774e4da0e8e322f0fe06cfbb48
Python
10,443
263
import tkinter as tk from tkinter import filedialog import io,os,sys,shutil, argparse, requests sys.path.append(os.path.dirname(__file__)) from load_save_helpers import create_sparse_default_params, save_parameters, load_parameters from BBHP_function import param_types, BBHP from PIL import Image base_param_name = 'bas...
db701d74bc06ba63fbfe2d957780d27a84c3e3ada09a70a02b84a50799149d7e
Python
10,444
321
# -*- coding: UTF-8 -*- """ @author: Xingyan Liu @file: utils.py @time: 2021-06-12 """ from typing import Union, Sequence, Optional, Mapping, Dict, Any, List, Callable import logging import numpy as np import torch from scipy import sparse import torch as th from torch import Tensor import torch.nn as nn import dgl i...