sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
78b226a3ca3a9ad9e01a5335c912b7eb7d77298c9fe7ea1d0c0047161e0c1ad7
Python
4,075
112
from __future__ import annotations import json import logging import re from re import Pattern from langchain_core.agents import AgentAction, AgentFinish from langchain_core.exceptions import OutputParserException from langchain_core.language_models import BaseLanguageModel from pydantic import Field from typing_exte...
264e419ddcb450fbccca8eb879154c05aa53566e2f04e6f483efd77a0e7f558e
Python
4,076
107
import math from glob import glob import h5py import nibabel as nib import numpy as np import SimpleITK as sitk import torch import torch.nn.functional as F from medpy import metric from tqdm import tqdm def test_single_case(net, image, stride_xy, stride_z, patch_size, num_classes=1): w, h, d = image.shape ...
a9f1daae702fbd612200a438abc936ec5e44592494b81b60e96dc4002482b282
Python
4,076
144
# 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...
3b64127095e8b318e188ec8d08e6c1cd4ad8522586764bb85cc5bb92dcf5bbee
Python
4,077
75
import pandas as pd import params def summarise_flies_from_data_summary(path=None, headless=False, predictions=False): if path is None and not headless and not predictions: path = params.data_summary_csv_dir elif path is None and headless: path = params.data_headless_summary_csv_dir elif ...
f55a07f6d2a34130e960d5f029c28bf88394677a779eded41424e7cb7422234e
Python
4,078
108
import json import warnings class AcqNotification: class Acquisition: ACQ_STARTED = "acq_started" ACQ_EVENTS_FINISHED = "acq_events_finished" @staticmethod def to_string(): return "global" class Hardware: PRE_HARDWARE = "pre_hardware" PRE_Z_DRIVE ...
939feb03b6f89d9e8dd53d7758fda48acc012cb05c67e850f0092dd662c7c6d5
Python
4,082
116
import uncertainpy as un import numpy as np import matplotlib.pyplot as plt from prettyplot import * import scipy.integrate as integrate import os ### FIGURE5 ### data = un.Data() data.load(filename='../data/simulation_outputs/UQSA_physiological/K_se_5/K_se.h5') K_se_mean = data['K_se']['mean'] K_se_p5 = data['K_se'][...
2b26dbaa797c9d777b6a2ee30d6a35ad1de107cea311bdd831239958cc8ab66e
Python
4,083
91
''' read channel info for OpenEphys data recorded by BT 9/20/2022 jz103 ''' import os import gc import warnings from copy import deepcopy from time import time import re import datetime import json import xml.etree.ElementTree as ET import numpy as np import matplotlib.pyplot as plt VALID_SESSION_LAMBDA = lambda x: ...
b0f1da78b04365a62ac585c6c52b9c8e4e11992ed60b11810ae347e647554ea4
Python
4,085
157
######################################################################## # Stochastic second-order irreversible reaction on a surface. # RESTORE # AIMS: to verify checkpointing and restoring of the well-mixed stochastic # solver 'Wmdirect' in the context of the Second-Order Irreversible # Surface Reaction model (se...
ce5c3c1c78bb616afca83525884525fd3bf4c9136e96dbea6eac00311d59774e
Python
4,087
107
import math import torch import torch.nn.functional as F class DynamicPool3d(torch.nn.Module): def __init__(self, scale, steps, mode, irreps): super().__init__() self.scale = scale #in physical units self.steps = steps self.mode = mode self.kernel_size = tuple([math.floor(s...
2ebe0b4e2ba546682247e8b7934739b7d2999e8f6cb66f20b880ec577b9b39ba
Python
4,092
134
from typing import Any from typing import Callable import torch from torch import nn from torchvision.models import resnet50 from ptrnets.utils.config import load_state_dict_from_model_name __all__ = [ "resnet50_cifar10", "resnet50_cifar10_corrupt0", "resnet50_cifar10_corrupt0_2", "resnet50_cifar10_c...
d88910abc9a077d7c3a33a04f57c438a5a4832865905998ff28ff3ff8d9073f7
Python
4,092
114
from scipy.stats import gamma, uniform import math import numpy as np # this is an unfortunately hard-coded dictionary of the parameters of prior distributions. param_dists = { "tau_e": { "type": "gamma", "alpha": 2, "loc": 0.004492887509221829, "scale": 0.0032375996670863947, }...
d915940a47ca4f0be649a38354be85d8e27244f90f3223624fe63d1a7cf13348
Python
4,092
146
import torch from abc import ABC, abstractmethod class ImageModel(ABC): """ Defines the structure of an image model object used to offer interpolation on an image. Attributes ---------- data : torch.Tensor (size m) Original image data. omega : torch.Tensor (size # of dimensions x 2) Image domain. m : torc...
4cf02a420b6e05c71432b07895f4f1aea91b30ee26f9ac30d7c2f31d7cf3665c
Python
4,093
94
import argparse from collections import namedtuple import json import pathlib import time import dataclasses from flax.metrics import tensorboard import jax from chemoxrl import rppo from chemoxrl.cell import EnvParams parser = argparse.ArgumentParser(description="Script to run experiment.") # ExperimentConfig par...
58c732eb6caba3c88263102353898217c6f1b4a88a527c38a28d2d7b3d03a4ef
Python
4,097
130
"""Tracers that call listeners.""" from collections.abc import Awaitable, Callable from typing import TYPE_CHECKING from langchain_core.runnables.config import ( RunnableConfig, acall_func_with_variable_args, call_func_with_variable_args, ) from langchain_core.tracers.base import AsyncBaseTracer, BaseTrac...
433d12a4cc25a42871c3770a975ef7046716b4181251406d3cb7112f9d031881
Python
4,098
64
# 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...
30369de77e69ca84f782c18202501ea41a5ac8bf4381812034b66327427c1f7b
Python
4,102
157
######################################################################## # Stochastic second-order irreversible reaction on a surface. # RESTORE # AIMS: to verify checkpointing and restoring of the well-mixed stochastic # solver 'Wmdirect' in the context of the Second-Order Irreversible # Surface Reaction model (se...
40e5a048df7f981124e150fe7a3ff5e5b3ddafe8a37efad9109856a9a2719e8e
Python
4,103
108
# This extension template provides instructions to add new causal discovery algorithms to pgmpy. # # Please follow the following steps: # 1. Copy this file to `pgmpy/causal_discovery` and rename the file as `[MyCausalDiscoveryAlgo].py` # 2. Go through the file and address all the TODOs. # 3. Add an import statement in ...
73cf38a2a1ed5fa2946ff7ee441e5e1c5422457c3e4e7ce0b1306548c8bd33f0
Python
4,103
88
import torch.nn from models.GFNO import * from models.FNO import * import torch.nn as nn # ---------------------------------------------------------------------------------------------------------------------- # Ghybrid2d # ----------------------------------------------------------------------------------------------...
f364fe7a775ae172e88661868db4fe377a864907c17e7297e5a2e695695da505
Python
4,103
72
# *========================================================================= # * # * Copyright Erasmus MC Rotterdam and contributors # * # * Licensed under the GNU GENERAL PUBLIC LICENSE Version 3; # * you may not use this file except in compliance with the License. # * # * Unless required by applicable law or agre...
91c975d88b70f6e3043dfe982eab0b5c46883cfe9f1ed4667a59145eafb87680
Python
4,106
124
# -- coding: utf-8 -- # @Time : 2022/10/15 16:11 # @Author : Biao Zhang # @Email : littlebiao@outlook.com # @File : heco_config.py from yacs.config import CfgNode as CN import time # -------------------------------------------------------------- # Config of model # -----------------------------------------------------...
2d63489d917a7ca27afe4e0a0e39f88abf255506148846515117e8375b001bd4
Python
4,107
111
#!/usr/bin/env python # -*- encoding: utf-8 -*- ''' @Description: : @Date : 2022/06/17 12:22:32 @Author : Zilan Yu @version : 1.0 ''' import torch import torch.nn.functional as F import torchmetrics import pandas as pd import sys, os from scipy.stats import spearmanr from HeteroModel import * from d...
0746f53ea11435d0006c466e87a1a700aa7d15d61c76c018eaab5256f187ade0
Python
4,108
105
# 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...
6b8b74622080bc0f0b71b4df27ce35ea64e640a6e672469d26ee2822cb4cd770
Python
4,108
107
# Copyright 2024 DeepMind Technologies Limited. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # https://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed...
54e06ae0ddac71a9dea7a7bad37d8d4a6de48ea7a9644c10f764f7eb0a243fb1
Python
4,111
131
import argparse from typing import Iterable, Optional, Union import torch import torch.nn as nn import torch.nn.functional as F from tqdm import tqdm from bindsnet.encoding import bernoulli, poisson from bindsnet.environment import GymEnvironment from bindsnet.network import Network from bindsnet.network.nodes import...
be3589834caf4e423cfc078b94560f3b0d19d4add5afb6efefb4f7792f05b8b5
Python
4,114
113
from collections import defaultdict import logging from typing import Dict, List from sklearn.metrics import (accuracy_score, precision_score, precision_recall_curve, recall_score) from .predict import predict from HMSA.data import MoleculeDataLoader, StandardScaler from HMSA.models import HMSAModel from HMSA.utils imp...
5f9b4d9151b567c9fe6157139a48f4b6e35d66989b5cb5728186fdf5e368f3c4
Python
4,115
70
# 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" #...
a3f0e1a90e7a397d62bf540e2b821349ab5909372fde4ac031220b7a44bb8f3d
Python
4,119
117
from collections.abc import Callable, Sequence from langchain_core.agents import AgentAction from langchain_core.language_models import BaseLanguageModel from langchain_core.messages import BaseMessage from langchain_core.prompts.chat import ChatPromptTemplate from langchain_core.runnables import Runnable, RunnablePas...
ede965ca5bdc9e8f2cda0b7d3cb71deccabcea417fdd9155a5a855f08fc49891
Python
4,120
115
import torch import argparse import torch.optim as optim import torch.nn.functional as F import sys sys.path.append("../../") from TCN.adding_problem.model import TCN from TCN.adding_problem.utils import data_generator parser = argparse.ArgumentParser(description='Sequence Modeling - The Adding Problem') parser.add_ar...
7b348729284429679c2db1a7ed5671ff11403bc2532d0b61f65fd725f5e64f5a
Python
4,122
105
import sys import os from matplotlib.pyplot import axis sys.path.insert(1, os.path.join(sys.path[0], '..')) from processing.constants import * from processing.functions import * from os.path import join as pjoin import numpy as np import pickle from sklearn.model_selection import KFold import pathlib pathlib...
6547e5d84ebf85f781ad1dcf3f3b0668e90221cfe003151d6ef41411434c59f8
Python
4,123
129
#################################################################################### # # 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...
ac1ba433da7af1b1da32ba820f49bc54531ec2ade884ae18f649467593118760
Python
4,123
108
# 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...
ee6032da03332ac19a442e892a1fd85a2e1d989d3f090fe07e0233488087f2c7
Python
4,123
127
import types import numpy as np import matplotlib.pyplot as plt from fastweights_numpy import FastWeights, FeedforwardNet from dt_utils import Timer from data_utils import generate_recognition_data from neural_net_utils import Sigmoid, CrossEntropy, plot_W, plot_B, maxabs #%% Generate data d = 50 #len...
074403155a04d5d481d280c60597aeb397269933715b5b456f8375bb477cd9f6
Python
4,124
129
#################################################################################### # # 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...
6b5142d80262e0b5664842f2c6a9635975ff4ba7ebcc7c6250ebb83fa976a579
Python
4,124
107
import os import torch import pickle import collections import math import json import pandas as pd import numpy as np import networkx as nx from rdkit import Chem from rdkit.Chem import Descriptors from rdkit.Chem import AllChem from rdkit import DataStructs from rdkit.Chem.rdMolDescriptors import GetMorganFingerprint...
dbdd0ad59d63aeb5450b3c261af97a14648ebbff78948a2d084ad166d5e683d5
Python
4,126
99
""" Implementation of the reduced Bayesian model learner algorithm as described in Nassar et al. (2012) online methods. """ import numpy as np import scipy.stats P_C = 1 / 10. STD_GEN = 10 / 300. B_0 = 0.5 TAU_0 = 0.5 def run_inference(outcome, p_c=P_C, std_gen=STD_GEN, b_0=B_0, tau_0=TAU_0): """ ...
06304409a09d9e78aa97af9611d294cd225b5d41f43941af3c89228d0c8ab920
Python
4,127
99
import os import glob from PIL import Image help_msg = """ The dataset can be downloaded from https://cityscapes-dataset.com. Please download the datasets [gtFine_trainvaltest.zip] and [leftImg8bit_trainvaltest.zip] and unzip them. gtFine contains the semantics segmentations. Use --gtFine_dir to specify the path to th...
7a6ca0438f1517966799663661c619d9e7646fd13c95df590a8f84fc2a366303
Python
4,130
111
from sklearn.manifold import MDS import mne import mne_rsa import os.path as op import numpy as np import pandas as pd import matplotlib.pyplot as plt from skimage import io, color from config_FaceName import MEG_data_path,group_name,Ids,stim_folder,stimuli_list,MRI_data_path src_fname = MRI_data_path+'/fsaverage/bem/f...
8b64d5a2f71ab2ca637d20525cb095d99053b7cee64e78bdac6c6b91c4ca10fc
Python
4,130
120
"""Define tests for ensemble networks such as Snapshot ensembling.""" import pytest import numpy as np import torch from vulcanai.models.cnn import ConvNet from vulcanai.models.dnn import DenseNet from vulcanai.models.ensemble import SnapshotNet from torch.utils.data import TensorDataset, DataLoader torch.manual_seed(...
923a0d955490fedd5b48bc1442746ba9c3a7d3f82d77823a35a26af78bcd4c25
Python
4,131
107
from collections.abc import Hashable from math import lgamma import numpy as np from scipy.special import gammaln from pgmpy.structure_score._base import BaseStructureScore from pgmpy.utils import encode_columns, get_state_counts_array class BDeu(BaseStructureScore): r""" BDeu structure score for discrete B...
adccdfbbe3f572a62fb15b93b8780273e745beaf1af08ad2550fddf5f74a347f
Python
4,132
114
import uncertainpy as un import numpy as np import matplotlib.pyplot as plt from prettyplot import * import scipy.integrate as integrate import os ### FIGURE8 ### data = un.Data() data.load(filename='../data/simulation_outputs/UQSA_pathological/K_se_5/K_se.h5') K_se_mean = data['K_se']['mean'] K_se_p5 = data['K_se']['...
6e43b810f361e5d57d79465abb5e59edbfd14b81c8452ceeba0c23202e800767
Python
4,133
111
# Training procedure for LeNet-5 CIFAR-100. #Code base from https://github.com/BIGBALLON/cifar-10-cnn/blob/master/1_Lecun_Network/LeNet_dp_da_wd_keras.py import keras import numpy as np from keras import optimizers from keras.datasets import cifar100 from keras.models import Sequential from keras.layers import Conv2D...
fbd65ac1a7874448f391ed194fe543c3b1114fc4e9eddbdcfc66e0e2782257cd
Python
4,133
109
''' Test module for sae models. :Version: 1.0 :Date: 08.02.2016 :Author: Jan Melchior :Contact: JanMelchior@gmx.de :License: Copyright (C) 2016 This program is free software: you can redistribute it and/or modify it under the terms o...
71fea952c5e7b43fda4cd1ac05ac90c9c9564c60f8d05e99635dfb35628f74bc
Python
4,137
123
###################################################################### ###################################################################### # HOW TO USE: # Make sure that llvm-cov is installed (check shell command "llvm-cov --version") # Compile RAYX in DEBUG mode with Clang (Ideally 14) # Run this script from the r...
8ca6192076f646959cf688490805bf3d86244703cf176fee39ccedc36a77b138
Python
4,137
111
# Libraries import numpy as np from tensorflow.keras import backend as K smooth = 1 def jaccard_distance_loss(y_true, y_pred, smooth=100, backend=K): y_true_f = backend.flatten(y_true) y_pred_f = backend.flatten(y_pred) intersection = backend.sum(backend.abs(y_true_f * y_pred_f)) sum_ = backend.sum(b...
582c423840ad9648352c02538993b81ae703dcd84339affd4a96c6b142f05022
Python
4,140
79
%matplotlib qt import mne from config_FaceName import Results_data_path,MRI_data_path,stats_comparisions import matplotlib.pyplot as plt import numpy as np from custom_functions import read_stats_list,print_sig_stats cluster_method='tfce' bands = dict(theta=[4, 7],alpha=[8, 13],beta=[14, 30],gamma=[40, 90]) tfce_p_sig...
d26139d0ea3d3767c072d6e886a08056e87298ec85e9c6109491fedaede3047c
Python
4,145
134
"""Helpers for Materials Project (MP) charge-density benchmarks (GPWNO splits).""" from __future__ import annotations import json import os from pathlib import Path from typing import Iterable # Crystal families in GPWNO / data_splits/mp_splits/ MP_LATTICE_FAMILIES = ( "cubic", "hexagonal", "monoclinic",...
cf54dac9922c3c6b93fa0e26014c482594fe27b8d7f2dcb686df0b43dfa26623
Python
4,148
115
""" Conducts gene term enrichment analysis with GO database for max predictive and redundant subsets from dRFE. """ import numpy as np import pandas as pd import functools, os import collections as cx from pybiomart import Dataset from scipy.stats import fisher_exact from statsmodels.stats.multitest import multipletes...
711a3d6001b772ce04302b25833881b70b97aa700cafbe5954fb633ca7cc1d58
Python
4,149
112
#################################################################################### # # 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...
a28d2f537b4b300440af5a045cbeb3b60bf91cd5f57a0a1888f68e1e833d6d1e
Python
4,149
65
"""Shared figure style for the manuscript (matplotlib, 300 dpi, vector + raster export). Palette: Okabe-Ito (colour-blind safe), validated with the dataviz palette checker (adjacent-pair order chosen to keep the weakest pair, pink/green, non-adjacent). Identity is never colour-alone: datasets also get fixed markers an...
023f62957546664395c7c85e2d389f073edafdedb6746eb7e7d65fd1bdf55c90
Python
4,150
136
"""Shared retry utilities for agent middleware. This module contains common constants, utilities, and logic used by both model and tool retry middleware implementations. """ from __future__ import annotations import random from collections.abc import Callable from typing import Literal from langchain_core.exception...
4eb55fbb65812a9e7128abd720f6ba802542ce3593371c8869bc07636787caad
Python
4,152
109
""" Predict tool usage to weigh the predicted tools """ import os import numpy as np import warnings import csv import collections from sklearn.svm import SVR from sklearn.model_selection import GridSearchCV from sklearn.pipeline import Pipeline from scripts import utils warnings.filterwarnings("ignore") main_path...
f22f47f31e30628027057369a57c753e6ce8f45bc1c1e701ec3bfa68b460faa7
Python
4,153
123
""" Tabulate feature weight data into a single CSV for further analysis using other tools. This produces a CSV with header. The features themselves are not included. Marco Lui, February 2013 """ import argparse, os, csv, sys import numpy as np import bz2, base64 from cPickle import loads from langid.train.common imp...
5404b0d0748d545ed147f0c592a4bad22aff9c4c6a4da989541ac82ad763e0bd
Python
4,155
97
from .utils.collate_fn import BatchMasking, BatchSubstructContext, BatchSubstructContext3D, BatchMaskingGraph, \ BatchDenseMatrix from torch.utils.data import DataLoader class DataLoaderMasking(DataLoader): """Data loader which merges data objects from a :class:`torch_geometric.data.dataset` to a mini-batc...
306bbbc7fa76d6338afd0eec991bf4ef86817ecc6d84efd80c6eac0d4af30a1d
Python
4,157
98
import os from core.loss.contrastive_loss import inter_intra_modality_loss from core.network import network_register, MIGA os.environ["OMP_NUM_THREADS"] = "1" os.environ["MKL_NUM_THREADS"] = "1" import warnings warnings.filterwarnings('ignore') import torch import torch.nn as nn import torch.nn.functional as F fr...
60859eca667aac596235b143b5534a53a43d785800ffcbff422ab4af32cde5fe
Python
4,157
113
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 6 21:13:59 2021 @author: athanasiadis """ import numpy as np from joblib import Parallel, delayed import multiprocessing import mkl def eigendecomposition(cov_mat): """ eigendecomposition ______________________ This is a...
9f4a38de264b06677f00098fc1b562218d7991fa9e2ddbb24bd88011301a119a
Python
4,157
114
""" This file implements a class that uses the weights from a delayedPLIER run to transform gene expression data into LV space """ import random from typing import List import numpy as np import pandas as pd class PlierTransform(): def __init__(self, weight_file: str, lambda_file: str, debug: bool = False): ...
17e901596a7a9a6efffdb66dcec62c9251217c91d504c22ae403cc4b9d446e36
Python
4,159
109
import logging import os import socket import sys from fcest.helpers.inference import run_adam_svwp from fcest.models.wishart_process import SparseVariationalWishartProcess import gpflow from gpflow.ci_utils import ci_niter from configs.configs import get_config_dict from helpers.evaluation import leave_every_other_o...
601bbf0d90d23323883c3da0f9dcada22301a1be38cdf1a0e2a2becf825ee0df
Python
4,160
120
from typing import Any from typing import Callable import torch from torch import nn from torchvision.models import alexnet from torchvision.models import resnet50 from torchvision.models import vgg16 from ..utils.config import load_state_dict_from_model_name __all__ = [ "resnet50_trained_on_sin", "resnet50_...
7640d75a048dabf5c9e14b208b489760004bc12ddabb9449509ff390359dc8e8
Python
4,160
123
# 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...
057bef85bd14d70e61291dae9bbeceacccf90ee5228b81b9d6d4dea712cb418e
Python
4,162
112
# -*- 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...
dfc78ada731c310f54f2ce14fb791aa641ef3db647706a6c9963c24ee04132fd
Python
4,162
133
''' run_function.py - run a function within a python module remotely ================================================================= Purpose ------- This script allows a specificied function from a specified python module to be executed on the cluster with specified parameters. Usage ----- A statement is specifi...
07d2ea67c92bf0bc4b02adf04f0a36a17e08afeebec082e21fbb8a5a9b1f4b99
Python
4,165
112
#################################################################################### # # 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...
396d7903f0836ef067c9b3855eaaac0cb632500b47037e4c99770f4c6a1faeeb
Python
4,165
140
"""Peptide spectrum match dataclass.""" import dataclasses from typing import Iterable, Optional, Tuple import spectrum_utils.proforma @dataclasses.dataclass class PepSpecMatch: """ Peptide Spectrum Match (PSM) dataclass Parameters ---------- sequence : str The amino acid sequence of th...
2a8e739ad69cae9de816e9a8911c634222f0d0c1686b6a8d4174a4a936e1502a
Python
4,169
95
import pytest import os import filecmp def compare_all_but_volume(fname1, fname2,equal=True): n=0 nEqual=0 with open(fname1) as f1: with open(fname2) as f2: for line1, line2 in zip(f1, f2): if("olume" not in line1): if line1==line2: ...
2fc2857501aa262c8c18626389f91a03d8fd3edc90e491bfccf540e3dede549d
Python
4,169
139
"""Compare models.""" # pylint: skip-file import copy import numpy as np from sklearn.linear_model import ( ARDRegression, BayesianRidge, LinearRegression, RidgeCV, LassoCV ) from embanded.embanded_numpy import EMBanded from embanded.embanded_torch import EMBanded as EMBanded_torch from himalaya.ridge import GroupR...
fb1aafceba9741e9997df56e6617635b39e654b59a8234af18a78af52b1a8982
Python
4,176
98
import logging import os import socket import sys import pandas as pd from configs.configs import get_config_dict from helpers.data import load_data from helpers.evaluation import leave_every_other_out_split, get_test_log_likelihood, get_test_location_estimated_covariance_structure if __name__ == "__main__": d...
0bb0661bd22372cb7b34de481f7d43e3a86308109edae2fcda2993bda7bb8011
Python
4,177
113
import pandas as pd import numpy as np import cv2 import torch from torchvision import transforms from torchvision.utils import save_image from torch.utils.data import DataLoader,Dataset from joblib import Parallel,delayed from tqdm import tqdm from engine import utils from constants import LUNG_DIS,PROCESSED_MEL_DIR ...
cf28e75303844d62ab06266d43b0555133900f496cd1ad0555848432c5e43ee0
Python
4,178
88
import copy import warnings warnings.filterwarnings("ignore") class Enrichmentscope(): from .EnrichmentVisualization import dotplot from .EnrichmentVisualization import enrichment_map from .EnrichmentVisualization import enrichment_network from .EnrichmentVisualization import gsea_heatmap from .E...
70c0498dd49c349d6d1f883dd16b32f580d5d4a2111795c5b600e62e2325a2ef
Python
4,181
125
import torch #from plyfile import PlyData from torch_geometric.data import Data, Dataset from torch_geometric.utils import from_networkx from torch_geometric.transforms import FaceToEdge, Cartesian from sklearn.cluster import AgglomerativeClustering from multiprocessing import Pool from rdkit import Chem import pandas...
80567cb5f03757d3d743eb31f4ec25e6e6f916a5ebdfda2088cbc18dda7d4a61
Python
4,181
153
import torch import hienet._keys as KEY class LossDefinition: """ Base class for loss definition weights are defined in outside of the class """ def __init__( self, name=None, unit=None, criterion=None, ref_key=None, pred_key=None ): self.name = name self.unit = unit ...
b6e4eb6ee4a4b773bafabd10009639957d275a014c736e1ffb84bce3664d9997
Python
4,181
128
from __future__ import annotations import json from typing import Any from langchain_core._api import deprecated from langchain_core.callbacks import CallbackManagerForChainRun from langchain_core.language_models import BaseLanguageModel from langchain_core.prompts import BasePromptTemplate from langchain_text_splitt...
0aedf9799cef6f9a458a6f1a5b572c0ae3dd34021d1b7d1b0966c535986c04ea
Python
4,183
129
######################################################################## # Stochastic degradation-diffusion process. # AIMS: to verify if zero order reactions are inserted correctly to the SSA # after bugfix https://github.com/CNS-OIST/HBP_STEPS/pull/146 # Note: # 1. This is not validated against analytical result, ...
3271abc7152d8f3e28ad6ef19e647df7bdb2282dfaf86d45f18842525544ba1e
Python
4,183
127
import os import numpy as np import string import tensorflow as tf # read A3M and convert letters into # integers in the 0..20 range def parse_a3m(filename): seqs = [] table = str.maketrans(dict.fromkeys(string.ascii_lowercase)) # read file line by line for line in open(filename,"r"): # skip l...
034e4b5d950dc8ba7daa1e4cf6f4bbf01419100f37ec1a87127740dfef2b2388
Python
4,185
98
import logging import os import socket import sys from fcest.helpers.array_operations import get_all_lower_triangular_indices_tuples import numpy as np import pandas as pd import pingouin from configs.configs import get_config_dict if __name__ == "__main__": data_split = 'LEOO' # leave-every-other-out da...
8480f6dd47e276e085f09f78ad5e9ec520adfecfebe7b62cab62128f232705a4
Python
4,185
128
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # model settings model = dict( type='MaskRCNN', pretrained=None, backbone=dict( type='ConvNeXt', ...
ee2f7bfd35e33d198a08221d574ef7dd28b8f939e8556a11ad69c1b8fdebb68d
Python
4,185
90
import sys import os import matplotlib.pyplot as plt from matplotlib.lines import Line2D import numpy as np sys.path.insert(1, os.path.join(sys.path[0], '../../../../')) from Articles.Sequential_Learning_Striatum.Figures.FigureSequential import set_blank_axis import Articles.Sequential_Learning_Striatum.Figures.cfg_p...
193eb273404b9a4ad9edf03668b37256a204087c6bc13ba8a68adf8ff530ba20
Python
4,186
160
"""Shared utilities for benchmarks: timing, metadata, and formatting.""" import json import platform import subprocess import time from contextlib import contextmanager from dataclasses import dataclass, field from importlib.resources import as_file, files from pathlib import Path import numpy as np import torch # -...
494cb061e0916a3badde3c7ee0cf46add84fcb26b0b6606a8417443b4fbccab3
Python
4,190
112
""" Componets of the model """ import torch.nn as nn import torch import torch.nn.functional as F def xavier_init(m): if type(m) == nn.Linear: nn.init.xavier_normal_(m.weight) #xavier初始化方法中服从正态分布 if m.bias is not None: m.bias.data.fill_(0.0) class GraphConvolution(nn.Module...
4bd30eb748f3042553f15992adf5a2f466b78b456c8827e4a909a29f2488be63
Python
4,190
114
# -*- coding: utf-8 -*- """ Created on Fri Apr 24 15:38:10 2020 @author: gritti """ import tqdm import os from skimage.io import imread import numpy as np import time # import sys # sys.path.append(os.path.join('..')) from orgseg.DatasetTools import io as ioDT from orgseg.MLModel import io as ioML from orgseg.MLMode...
8116ccf81d7c31613be967c8a607bc584e1e109c3c960bc8494e8e2ce11c8024
Python
4,190
155
import os import numpy as np def onehot_encoding(seqs): residues = ['A', 'R', 'N', 'D', 'C', 'Q', 'E', 'G', 'H', 'I', 'L', 'K', 'M', 'F', 'P', 'S', 'T', 'W', 'Y', 'V'] encoding_map = np.eye(len(residues)) residues_map = {} for i, r in enumerate(residues): residues...
53e85688bb6efa0103455dcef1fa95f11d58ad5124c376b66fbd7cde1180040f
Python
4,192
133
# Utils for getting model layers from collections import OrderedDict from typing import Any from typing import Callable from typing import List from typing import Optional import torch from torch import nn def clip_model(model: nn.Module, layer_name: str) -> nn.Sequential: """ Returns a copy of the model up ...
6b05201fb058f2104c0940fd4aa31068d6cd987de36e1ae00b77b66f9a621174
Python
4,193
134
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from __future__ import division, print_function # import argparse from time import time # import pylab as pl import nibabel as nib import numpy as np from skimage.morphology import erosion, closing # from sklearn.cluster import MiniBatchKMeans import skfuzzy as fuzz ...
de45aa48c6e5d3387c5c88a8f51dc65b0c59d653aedca121a1c4d661f227d9ac
Python
4,193
128
# pylint: skip-file # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup ---------------------------------------------------...
449b29ee4be75619abf5a363ae5981e41904cb44cac29699995e4bcd9bb0385c
Python
4,194
133
from collections import OrderedDict from typing import Optional from typing import Tuple from typing import Union import torch from torch import nn class Flatten(nn.Module): """ Helper module for flattening input tensor to 1-D for the use in Linear modules """ def forward(self, x: torch.Tensor) -> ...
a10db18f365f98f9d9d0c3bc72ee135f9dbaa818b055e5179a69cfa2c3dec486
Python
4,195
110
import os import scanpy as sc import pandas as pd import numpy as np # dictionaries shortening datasets' descriptions shorten_dicts = { 'hepatoblast': {'hepatoblast/hepatocyte': 'h', 'cholangiocyte': 'c',}, 'marrow': {'(Bone_Marrow_Mesenchyme)': ''}, 'thymus': {'(Thymus)': '', 'T cell_': '', 'T cell': '...
b34efd674ab0b01ecbf6b0db5a201bf713ffa7022890b342bdf88ca190c07c45
Python
4,195
79
# 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...
a1bf8571a4ab3955e9f8cb2f3492535730efb689c56686b5f46223334e8323f4
Python
4,196
125
import numpy as np import pandas as pd import pingouin as pg def compute_icc_scores_pingouin(observations: np.array, icc_type: str): """ Computes ICC scores using third-party library. :param observations: :param icc_type: "ICC1", "ICC2", "ICC3" :return: """ icc_df = _get_pingouin_icc_scor...
45a041e332422d83064ec1fde126a3ea62dcdecede8c6838e688d63ad624b354
Python
4,198
141
from math import pi, sqrt, atan # cached constants sqrt_2 = sqrt(2) four_thirds = 4./3. five_thirds_sqrt2 = 5./3. * sqrt_2 # volume of cylinder of height `(b - a) / K` and radius `r` def Vc(r, a, b, one_over_K): return pi * one_over_K * (b - a) * r*r # volume of truncated square pyramid with radii `a` and `b` ...
e3ecf35b4c8857990560306062d0745aff7f10d8b37f3c73f8787bc2888e3e53
Python
4,198
118
"""Unit tests specifically for the model_runner module.""" import pytest import torch from casanovo.config import Config from casanovo.denovo.model_runner import ModelRunner def test_initialize_model(tmp_path): """Test that""" config = Config() config.train_from_scratch = False ModelRunner(config=con...
af12b50868b07ca61b654e9108eaf9febe5da6723119539171690a4593ffff04
Python
4,200
122
# -*- coding: utf-8 -*- """ An PyTorch implementation of the DeepIGeoS paper: Wang, Guotai and Zuluaga, Maria A and Li, Wenqi and Pratt, Rosalind and Patel, Premal A and Aertsen, Michael and Doel, Tom and David, Anna L and Deprest, Jan and Ourselin, S{\'e}bastien and others: DeepIGeoS: a deep interactive geo...
b9b60a9c1f8ea5e47e921cf4750b3da444495cb484bf82d99648aa8b2f4a3a9e
Python
4,200
129
######################################################################## # Stochastic degradation-diffusion process. # AIMS: to verify if zero order reactions are inserted correctly to the SSA # after bugfix https://github.com/CNS-OIST/HBP_STEPS/pull/146 # Note: # 1. This is not validated against analytical result, ...
3d1675fde58fe48b83fc5c315780c5fbc2619124c891f2e562c0a991666ad324
Python
4,201
138
import numpy as np def load_flatmap(file): from voxcell import VoxelData vd = VoxelData.load_nrrd(file) # mask for mapped values fx_msk = vd.raw[:,:,:,0] > -1 fy_msk = vd.raw[:,:,:,1] > -1 assert(np.all(fx_msk == fy_msk)) # must coincide return vd, fx_msk def discretize(pos, fxlen): ...
6ac879c19d9550943fabb6ca7ecbf63cc1d97d6ccc0552e9c172f3941090cea6
Python
4,201
125
# third party modules import numpy as np # pnabind modules from pnabind.structure import StructureData from pnabind.structure import getAtomKDTree from pnabind.structure.data import data from pnabind.structure import mapPointFeaturesToStructure, getResidueDistance def smoothResidueLabels(residues, labels, nc=2, dista...
d10be4b62b1aa35001d2bf2ec5c18bec8629b0aca4d45f9f474d5d0037bb4a34
Python
4,207
86
"""The compatibility check must catch changed morphometry and atlas labels.""" from pathlib import Path import shutil import tempfile import unittest import nibabel as nib import numpy as np import trimesh from postprocessing.core.compare import MORPH, SURFACES, compare class CoreComparisonTests(unittest.TestCase):...
8e836474a7d9c615cd0b96b06312125c90d78a85b754a4790e1f7f702d2f6d1f
Python
4,209
143
import yaml from typing import List from animalai.communicator_objects import ( ArenasConfigurationsProto, ArenaConfigurationProto, ItemToSpawnProto, VectorProto, ) yaml.Dumper.ignore_aliases = lambda *args: True class Vector3(yaml.YAMLObject): yaml_tag = u"!Vector3" def __init__(self, x: f...
3554f1dfbb1dfa28c20bbe2a3cafcffd433d526cdad86f61b9809c645ed30e6d
Python
4,212
112
# This function is used to collect the metadata of the GSV panoramas based on the sample point shapefile # Copyright(C) Xiaojiang Li, Ian Seiferling, Marwa Abdulhai, Senseable City Lab, MIT def GSVpanoMetadataCollector(samplesFeatureClass,num,ouputTextFolder): ''' This function is used to call the Google AP...
ad84cd5bee6b0675004d8eec9aff1c4f7086fe4072fa09ed1345af1f363efbbb
Python
4,212
122
import pytest from langchain_classic.evaluation.string_distance import ( PairwiseStringDistanceEvalChain, StringDistance, StringDistanceEvalChain, ) @pytest.mark.requires("rapidfuzz") @pytest.mark.parametrize("distance", list(StringDistance)) def test_zero_distance(distance: StringDistance) -> None: ...
c1b79a91c1de450618c3ec0442c2a829d20bc44d1b11ba6ea90b8b554a987b27
Python
4,214
94
import numpy as np import scipy as sp import scipy.stats import scipy.spatial import scipy.spatial.distance def relative_entropy_analysis(features_a, features_b, all_data_a, all_data_b, bin_width=None, bin_num=10, verbose=True, override_name_check=False): """ Calculates the Jense...
8481d0560a574ddde6d01d68b75c1e65738486588c36238026258345fcc78a3e
Python
4,215
87
import jsonargparse from torch.utils.data import Dataset from CEL.utils.register import register from CEL.data.datasets import * from torch.utils.data import DataLoader from typing import List, Dict from CEL.data.datasets.meta_dataset import DatasetRegistry # from CEL.data.datasets.pendulum import DampledPendulum, Inte...
214835f263e152530f80c0b85480a6c357c558016439a22b6a7eaa0561a0ac36
Python
4,217
107
import numpy as np import pandas as pd import os, tqdm from scipy.ndimage import map_coordinates from skimage.io import imread from scipy.ndimage import label from skimage import measure, img_as_bool import multiprocessing from itertools import repeat if __name__ == '__main__': import sys sys.path.append(os.pa...