sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
185124cd2a0eabe00d982dcd6c979d2b461608f85ea69fbcc2ca6fa94cfaf0a3
Python
11,835
366
import math import torch from torch import nn from torch_geometric.nn import MessagePassing import math EPS = 1e-8 class VecLayerNorm(nn.Module): def __init__(self, hidden_channels, trainable, norm_type="max_min"): super().__init__() self.weight = nn.Parameter(torch.empty(hidden_channels), require...
08b74dd129088002395f695222a073ef8834a06230f89c56aaf44affeadd3971
Python
11,837
282
# %% """ ============================================================== Attempt to plot ROC curves from ATM/ImCoh classification from MEG data in the source space =============================================================== """ # Authors: Marie-Constance Corsi <marie.constance.corsi@gmail.com> # # License: BSD (3-c...
8046a50600b264fecec6146fe77d593be1051e93fd3e612229faea5f4cb8c00b
Python
11,840
248
import os import torch import hydra import logging from models import QHNet from torch_geometric.loader import DataLoader from torch_scatter import scatter_sum from datasets import QH9Stable, QH9Dynamic from torch_ema import ExponentialMovingAverage from transformers import get_polynomial_decay_schedule_wi...
f67f1cf1e459e37689eb8e1c641bfacf78028af98823fdbbb079b98f551111e0
Python
11,845
183
qm9_with_h = { 'name': 'qm9', 'atom_encoder': {'H': 0, 'C': 1, 'N': 2, 'O': 3, 'F': 4}, 'atom_decoder': ['H', 'C', 'N', 'O', 'F'], 'n_nodes': {22: 3393, 17: 13025, 23: 4848, 21: 9970, 19: 13832, 20: 9482, 16: 10644, 13: 3060, 15: 7796, 25: 1506, 18: 13364, 12: 1689, 11: 807, 24: 539, 1...
30c59161b7108b240241fb22cf4af376acfd8ef8fe0cbb6bc4e3d5832ca13fe5
Python
11,846
294
"""Combining documents by mapping a chain over them first, then combining results.""" from __future__ import annotations from typing import Any from langchain_core._api import deprecated from langchain_core.callbacks import Callbacks from langchain_core.documents import Document from langchain_core.runnables.config ...
2460c2bf0d5abc990e4f121f09859ce5ae1d9ca39051e0ec68c016aac0b90e9a
Python
11,849
285
from __future__ import division from __future__ import print_function import os import time import h5py import random import argparse import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from copy import deepcopy from torch_geometric.data import Data from models import * def see...
d66da852536dc96922801580ba99535dae67e2a070f9d66ac335f2c1d4fb5689
Python
11,849
424
import itertools from typing import Union import matplotlib.pylab as plt import numpy as np import networkx as nx from . import plotlying, stats def _master_plot( x: np.ndarray, y: np.ndarray, title: str = "", xerr: Union[list, None] = None, yerr: Union[list, None] = None, method_name: str = "...
095ff4103c5d12485920099a38c9c04c5d48811121ade1cb64b0dc91f63fdff5
Python
11,855
283
import pandas as pd import argparse from utils import set_seed import numpy as np import wandb import os import torch import torch.nn as nn from torch.utils.data import DataLoader from torch.nn import functional as F from torch.nn.utils.rnn import pad_sequence from torch.cuda.amp import GradScaler # from transformers i...
85bf6aff639b56e83b185478af348a0cb3f2e1240add56917d251ebe250d7193
Python
11,856
240
import os from copy import deepcopy from collections import OrderedDict from itertools import groupby import warnings import numpy as np import matplotlib.pyplot as plt import matplotlib import matplotlib.font_manager from matplotlib.colors import ListedColormap from matplotlib.cm import get_cmap import scipy.stats as...
829bcccd72f8ff27214ac19a7a26be2fb02b595ea4414d56f7e821295c76e537
Python
11,857
356
# Copyright 2024 DeepMind Technologies Limited # # AlphaFold 3 source code is licensed under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with the # License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
1d038516e4b12dc5b80ee1afb7679beb2a40765da6fdada5cb0ca6d8954587b0
Python
11,858
302
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jul 16 11:53:52 2021 @author: athanasiadis """ import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import attack_foolbox as fool class LinearNet(nn.Module): """ linearnet ______________________ ...
2c4fc2185d6be81a07206bee0775b3b85d8b685fc9085c9515009a1e594de639
Python
11,859
272
""" In this file the functions to evaluate the state, reward are defined and also the action is implemented """ import math import warnings import numpy as np from DSS_Initialize import* # To get the details of switches and their status def switchInfo(DSSCktobj): #Input: DSS Circuit Object #Returns: A list o...
dfda53abd76bd615d982f1d6bf20b335eb528b64d3b2e019cf4aab8b8d02cc5f
Python
11,862
227
import collections import sys import torch import warnings from .solvers import FixedGridODESolver from .misc import _compute_error_ratio, _linf_norm from .rk_common import rk4_alt_step_func _BASHFORTH_COEFFICIENTS = [ [], # order 0 [11], [3, -1], [23, -16, 5], [55, -59, 37, -9], [1901, -2774,...
1a2d5a200ef8fff5c0dcec8d51aa498e47af57ce14ad886068b3b75e46d7910c
Python
11,864
282
""" Prepare the workflow paths to be used by downstream machine learning algorithm. The paths are divided into the test and training sets """ import os import collections import numpy as np import random from scripts import predict_tool_usage from scripts import utils main_path = os.getcwd() class PrepareData: ...
248a77c1d886240ba37d7132e71a417965c98377fac6ba1113d05ef51d76af8e
Python
11,868
355
######################################################################## # 1D diffusion in a finite tube with fully-reflective boundary. # Circular "point source" from one face. # RESTORE # AIMS: to verify checkpointing and restoring of the spatial stochastic # solver 'Tetvesicle' in the context of the Bounded Diff...
b7331015189a3c37241020a4c6bed5e1fda31e94e6efb3714348254f4b0144a8
Python
11,869
195
# 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...
b2632769052490639106309e080d1a85f5a95bb878533fa5cc9e5f2e34477843
Python
11,872
292
# Copyright (c) 2021, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # NVIDIA CORPORATION and its licensors retain all intellectual property # and proprietary rights in and to this software, related documentation # and any modifications thereto. Any use, reproduction, disclosure or # distribution of this sof...
c36249c1721b2ca0ba33c4ba82697a155c3f31e4280940888c5abb7b6d349904
Python
11,877
306
""" This file contains helper functions for building the model and for loading model parameters. These helper functions are built to mirror those in the official TensorFlow implementation. """ import re import math import collections from functools import partial import torch from torch import nn from torch.nn import ...
aa042f7f31f2f3f4fa7aaeee3fa04c0c2e5ea0ef00a2d772966af07714d53cd9
Python
11,904
271
""" In this file the functions to evaluate the state, reward are defined and also the action is implemented """ import math import warnings import numpy as np from Environments.DSSdirect_13bus_loadandswitching.DSS_Initialize import* # To get the details of switches and their status def switchInfo(DSSCktobj): #Inpu...
7be22445837214feee4ae77907829708bbbd1d1c5b545e1e888429374f698c10
Python
11,910
325
"""Methods to evaluate peptide-spectrum predictions.""" import re from typing import Dict, Iterable, List, Tuple import numpy as np from spectrum_utils.utils import mass_diff def aa_match_prefix( peptide1: List[List[str]], peptide2: List[List[str]], aa_dict: Dict[str, float], cum_mass_threshold: flo...
a1a51651d10c5f4cbc3547a384dff6b51b9c6908af93f077082fe0b67cd75ba8
Python
11,915
355
######################################################################## # 1D diffusion in a finite tube with fully-reflective boundary. # Circular "point source" from one face. # RESTORE # AIMS: to verify checkpointing and restoring of the spatial stochastic # solver 'Tetvesicle' in the context of the Bounded Diff...
7c6c26d81d51eec293d6dde280c3cfd65058c7b9c2a2921261bf45e3b280974f
Python
11,917
362
import numpy as np import pandas as pd import cooler import cooltools import bioframe as bf import matplotlib.pyplot as plt import matplotlib.patches as patches from matplotlib.colors import LinearSegmentedColormap, LogNorm from matplotlib import ticker ################################## # Neuronal dots-related func...
ac599b931fcc41a1c66985730cdf8cfe42bd431f00c0ecd009ba0cf791207942
Python
11,920
322
import shlex import subprocess import sys import tempfile from pathlib import Path from time import sleep import pytest from MRdataset import load_mr_dataset from hypothesis import given, settings, assume from mrQA.cli import cli from mrQA.config import DATE_SEPARATOR from mrQA.monitor import cli as monitor_cli from ...
727bd4b939048f86d9a38540f9717a57577e1e8543acd7aa3d930f2ecd90517e
Python
11,954
312
import os import subprocess import slicer import argparse import DICOMScalarVolumePlugin try: import pandas as pd except: slicer.util.pip_install('pandas') import pandas as pd try: from tqdm import tqdm except: slicer.util.pip_install('tqdm') from tqdm import tqdm import numpy as np try: ...
b3f6680bfe70aba9dd3811fb1dbdbcdac7342574a723c8aac574a3cf7f150b5b
Python
11,959
360
""" Cell Deconvolutional Network (scaden) class """ import os import logging import sys import gc import tensorflow as tf import numpy as np import pandas as pd from anndata import read_h5ad import collections from .functions import sample_scaling from rich.progress import Progress, BarColumn logger = logging.getLogge...
82186724b82702857257f59e72ef7e8e1fc7faae9d368f96616775d6725e6dce
Python
11,962
303
import itertools from typing import TYPE_CHECKING import networkx as nx from pgmpy import logger from pgmpy.base._base import _CoreGraph from pgmpy.utils._warnings import _warn_external if TYPE_CHECKING: from pgmpy.base import DAG class PDAG(_CoreGraph): """ Class for representing PDAGs (also known as ...
2922287b4c8e8549348bd2a7d64a38f6cf85331a8baa90fc79601027933bc56c
Python
11,963
299
import os import numpy as np import json import h5py import random from numpy.random import choice from keras import backend as K def read_file(file_path): """ Read a file """ with open(file_path, "r") as json_file: file_content = json.loads(json_file.read()) return file_content def wri...
9fc1fe06ed503cea222178b4f660601226d1a3c8cbcd314c82eead5961e43f71
Python
11,969
375
import logging import os import socket import sys import matplotlib.pyplot as plt import matplotlib.colors 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 def plot_icc_scores_per_edge_joint( config_dict: dic...
1058d2fbc62aa81d1cef9aefd39e1c0f72008111d7926bdea45b0a57a3e2f980
Python
11,977
233
# 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...
aed3690f999469384deedc25382a62c1f7fed5133a7c885f64a589aa6da4d3d6
Python
11,978
297
#################################################################################### # # 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...
c43211c512f534ec44d1b42fd4cdb45e5b2efb8f252386dbb053f8a1d79a6a7d
Python
11,986
328
import torchvision import torch import torch.nn as nn import numpy as np from torch.autograd import Variable """ 医学图像分割已通过 Transformer 模型取得了显著的进步,该模型擅长掌握深远的上下文和全局上下文信息。然而,这些模型的计算需求与 token 数量的平方成正比,限制了它们的深度和分辨率能力。 大多数当前方法都是逐片(称为伪 3D)处理 3D 体积图像数据,缺少关键的切片间信息,从而降低了模型的整体性能。 为了应对这些挑战,我们引入了可变形大核注意力 (D-LKA Attention) 的概念,这是一种...
e163101488b38487c861e548ae09b19da2822776f3b3a16a89a9fb78be7ca5cf
Python
11,989
309
from src.data import get_sim_data import torch import numpy as np import os import matplotlib.pyplot as plt import pandas as pd import seaborn as sns os.environ['KMP_DUPLICATE_LIB_OK'] = 'True' model = torch.load(os.path.join("../model", f"model_sim")) x_seqs, x_statics, y, _, seq_features, static_features = get_sim_d...
5be012d29fcf5123e6856fe0fbd369c7cd019109e40beb6220b04e83f2f29d2a
Python
11,990
326
"""3D CMUNeXt building blocks used throughout DDSurfer. This module houses the lightweight convolutional primitives and attention mechanisms that underpin the volumetric feature extractors used by the dual stream networks. The implementation keeps the original numerical behaviour of the release while providing clearer...
908c69c3383d92fda96bd763cde4929897f1860829de81f9137be3c2d4a3d67f
Python
11,990
290
# 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...
76696ea7866588dfcd3ae424795f0a3a7189fb0fe2f2b349de9009204e63fc9c
Python
11,991
297
# This file is a part of the `allegro` package. Please see LICENSE and README at the root for information on using it. import math import torch from e3nn.o3._irreps import Irreps from e3nn.o3._wigner import wigner_3j from nequip.nn import replace_submodules, model_modifier from nequip.utils.dtype import torch_default_d...
4e7819b6900b487c60da0baf7de48f636175b09991be4df06719b78aa887bcd1
Python
11,993
347
import logging import numpy as np def get_ground_truth_covariance_structure( covs_type: str, num_samples: int, signal_to_noise_ratio, data_set_name: str, ) -> np.array: """ Return full covariance structure of shape (N, D, D). These are the 'synthetic', 'simulated', or 'oracle' covariance...
12b1a3ae112edb2b5121233e7063a99c83bf01ffc1461da72cbdbde6d78a1634
Python
11,994
290
import csv import json import mlflow import numpy as np import itertools import argparse from pathlib import Path def setup_results_dir(exp_name, exp_id): """Create and return path to results directory for this experiment.""" results_dir = Path('results') / f"{exp_name}_{exp_id}" results_dir.mkdir(parents...
b4dbbdabaf53962e09778ccb8e7d4dc86a7a41d7783f984af5b7ba92db7af8c9
Python
12,010
242
import os import glob import numpy as np import matplotlib.pyplot as plt import matplotlib.gridspec as gridspec from utils.constants import ALL_MODELS from scipy.stats import iqr, linregress from paths import TRAINING_DATA_PATH, TEST_DATA_PATH from utils.distribution_distance import compute_jsd, compute_kld baseline_p...
637f9f84f190f39e8ee3245c42c22989febb539987a81897a03ee25057870c97
Python
12,018
332
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import dash_bio as dashbio from .base import * representation_options = [ {"label": "backbone", "value": "backbone"}, {"label": "ball+stick", "value": "ball+stick"}, {"label": "cartoon", "value": "cartoon"}, {"label": "hyperball", "value": "hyperball"}, ...
cc1d5a035133acbe0b05c2000e16784175c904e3c8e02ad6c4058f77ac627c32
Python
12,018
341
import logging import os from pprint import pprint import socket from fcest.helpers.data import to_3d_format import matplotlib.pyplot as plt from nilearn.glm.first_level import FirstLevelModel, make_first_level_design_matrix, run_glm from nilearn.plotting import plot_design_matrix import numpy as np import pandas as p...
9c332311d94e303549c079b1d8bba7ed844c7b2235de369fed249cf5b3d538a6
Python
12,020
368
# coding=utf-8 """Define utilities for all networks.""" from math import ceil, floor import torch import torch.nn as nn import torch.nn.functional as f from torch.utils.data import DataLoader, TensorDataset import numpy as np import math from sklearn.preprocessing import LabelBinarizer from collections import OrderedD...
1ddbed0cb349b3c32d0ddde9e3c7acc2560de4db6cf3a5b748decc6b75ae0bd6
Python
12,023
272
import gc import os import argparse import pandas as pd import matplotlib.pyplot as plt from sklearn.model_selection import KFold from utils.utils import current_time from utils.visualization import draw_roc from node_embed.featurization import load_seqs import numpy as np from train import train from test import inde...
92afd1c25eeaa4d9d1aa89da35bdb4e77c628e0ec81eab81838f695d3ab31479
Python
12,033
291
import os import glob import numpy as np import matplotlib.pyplot as plt from utils.constants import ALL_MODELS from paths import TRAINING_DATA_PATH, TEST_DATA_PATH from utils.distribution_distance import compute_jsd import matplotlib.gridspec as gridspec from matplotlib_scalebar.scalebar import ScaleBar from scipy.ndi...
a92a4b480c338edd8cc9f7c953cfca475019bee15f3ca6860a80e23c26cc22cb
Python
12,041
295
""" Author: Anna M. Puszkarska SPDX-License-Identifier: Apache-2.0 """ import time from pathlib import Path from typing import Tuple, List, Optional import numpy as np from peptide_models.aminoacids import AMINOACIDS from peptide_models.peptide import Peptide from peptide_models.utils_data import fasta2df, get_pepti...
0f3c3ea9db82c5e4b765c20b2647384fb7a03c4171029aa7d378f37f1e78e27b
Python
12,042
302
import matplotlib # matplotlib.use('agg') import matplotlib.pyplot as plt import pandas as pd import numpy as np import sys from scipy.stats import pearsonr from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression from sklearn import svm from sklearn.metrics import roc_cu...
3892ebf785070d0a4c671f34fe74d84a03d59a1fa0c380a2a8c63838b3f807ae
Python
12,046
400
import os import tempfile import numpy as np import pytest from skbase.utils.dependencies import _check_soft_dependencies from pgmpy import config from pgmpy.example_models import load_model from pgmpy.factors.discrete import TabularCPD from pgmpy.models import DiscreteBayesianNetwork from pgmpy.readwrite import NETR...
8c0ec44a630edf0b4e2335922585119b050e42936095d88f2905a64808600537
Python
12,060
353
### ################################################################################# # # 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 deta...
3c039ab98cc6ffbeb8587aa92819905370f17bf3618d8f1b3e7f04536f1a14d0
Python
12,062
310
import os import numpy as np from dival.reconstructors.odl_reconstructors import FBPReconstructor from dliplib.reconstructors.dip import DeepImagePriorReconstructor from dliplib.reconstructors.dip_initial import DeepImagePriorInitialReconstructor from dliplib.reconstructors.fbpunet import FBPUNetReconstructor from dl...
f9531c8e3093e5aa45b26a1629d32a99269d112ecd2dab131d73a1644fc6d2be
Python
12,065
290
# 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...
4c2a58ff58d5e327467877bb5147a2971ea16f6ebe07517dd6a4b13969d65b5e
Python
12,070
283
import argparse import logging import os import random import shutil import sys import time import numpy as np import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tensorboardX import SummaryWriter from torch.nn import B...
c69223dbc8cfc29f7c07a27845df504c3e5b7b0c9891be3db4c3d3a1df622bef
Python
12,071
321
import os, sys try: user_paths = os.environ['PYTHONPATH'].split(os.pathsep) except KeyError: user_paths = [] os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' import re import yaml from pathlib import Path from shutil import copyfile import pandas as pd from random import randint import string import ntpath class Config: ...
4c93e854686e501778e301807bb274bcd8fc17e6b02e49ed5c3e2840e59c4aaa
Python
12,076
351
import numpy as np import math from sklearn.preprocessing import minmax_scale from matplotlib.colors import ListedColormap def mag2db(y): """Convert magnitude response to decibels for a simple array. Args: y (numpy array): Power spectrum, raw magnitude response. Returns: dby (numpy array...
2ec7361249d543c7b99922c24ae6fa7fe19776bbe0e52e5963528ba8b6be65cc
Python
12,090
296
"""Construction tests derived from the examples/ notebooks. Covers building effectors and environments, inspecting their configuration, initial state values after reset, custom subclassing, and policy save/load — none of these tests advance the simulation with step(). """ import json import os import tempfile import ...
f31a7449fb729acf79588b0adb415ba2c1c55ff4e6d51ec60cff412e47185f0c
Python
12,090
378
""" This file contains various stand-alone functions used throughout the correction process. """ import torch from torch import cuda import numpy as np from scipy.io import loadmat import nibabel as nib def load_data(im1, im2=None, phase_encoding_direction=1, n=None, device='cpu', dtype=torch.float64): """ Load or...
1d541c22da517484d96bfc50f788721a6a7ad0710a4603d060c60ac6567ab937
Python
12,093
315
""" Storage layer for perses automated molecular design. TODO ---- * Add write_sampler_state(modname, sampler_state, iteration) * Generalize write_quantity to handle units * Add data access routines for reading to isolate low-level storage layer """ __author__ = 'John D. Chodera' ###################################...
f51689a1707c1ee31a173b8d8c9aaea33d994f4d95a79e6d51fe7369b2247142
Python
12,097
322
"""Structured tool.""" from __future__ import annotations import functools import textwrap from collections.abc import Awaitable, Callable from typing import ( TYPE_CHECKING, Annotated, Any, Literal, ) from pydantic import Field, PlainSerializer, SkipValidation from typing_extensions import override ...
639fd5a330f0d6585f6821228d900dafab85d4f1354ee9cdea38ef92267a442d
Python
12,098
379
import argparse import os from time import time as t import matplotlib.pyplot as plt import numpy as np import torch from torchvision import transforms from tqdm import tqdm from bindsnet import ROOT_DIR from bindsnet.analysis.plotting import ( plot_assignments, plot_input, plot_performance, plot_spik...
ca5e9bf607dea47a530709cad464b3a49b9a615bfce78822ea2a8c2dc9105da4
Python
12,100
377
UNET = { "Unetmod-cond1-v2-64_4_1": { "class_path": "pdearena.models.unet.time_cond_LN.twod_unet_cond_v2.Unet", "init_args": { "hidden_channels": 64, "norm": True, "ch_mults": (2, 2, 2, 2), "is_attn": (False, False, False, False), "...
2717a3ef046d48c01b271ce3ed263c1a7ea3f2997fdffdd28ab644fdba3da8f9
Python
12,110
350
import argparse from pathlib import Path from datetime import datetime import logging import quantities as pq from quantities import Quantity import neo from neo.utils import get_events, cut_segment_by_epoch, add_epoch from elephant.signal_processing import butter from elephant.spectral import welch_psd import nump...
9fbdba0157654d4065f8e02314fd034bca651357332a05a771390370c7101056
Python
12,116
248
import sys import os import random import pandas as pd import numpy as np from einops import rearrange, repeat, reduce import argparse import torch import torch.nn as nn import torch.optim as optim from torch.optim import Adam, SGD, AdamW,RMSprop import torch.utils.data as Data from torch.utils.data import Dataset, Dat...
7fee7fee4823b246c088ed2343734256aea8ce9a69d639825ea151fea3adf039
Python
12,121
386
from uuid import UUID import pytest from langchain_core.language_models import FakeListLLM from langchain_core.tools import Tool from langchain_core.tracers.context import collect_runs from langchain_classic.agents import ( AgentExecutor, AgentExecutorIterator, AgentType, initialize_agent, ) from lang...
926ea4be4dc48c645b07dea651d0f79239a25f018d36429b5da7d8a1f0e940ee
Python
12,130
214
# 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...
3f9d1a8aebff0a77dfa406e83614b1b9d7909c27ca07d2ae1fa68ecd028b49a6
Python
12,139
295
""" Generic interface for nonlinear least-squares minimization. """ from warnings import warn import numbers import torch from .trf import trf from .common import EPS, in_bounds, make_strictly_feasible __all__ = ['least_squares'] TERMINATION_MESSAGES = { -1: "Improper input parameters status returned from `leas...
65f728cd93caabfd549fea5d53895e80c10ecb52d8a7feda004937612336d408
Python
12,146
250
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ POCIF-BAT R2 — H-R2-1 : test de non-commutativité des opérateurs de dégradation. Question réfutable : à dose strictement égale et jeu de conditions identique, l'ORDRE d'application modifie-t-il l'état de santé final au-delà de la variabilité inter-réplicats ? Corpus ...
b6164c6e24f97d8722c3f577d894711538e6a0f3443a543105248cb06a699851
Python
12,147
236
# 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...
463c565e8b53c8e5f7276a028a7d51f62fea8e51c16711d787fbbb14f9f7ba7a
Python
12,153
294
"Create the PICNN model" # pylint: disable=invalid-name import numpy as np from omegaconf import OmegaConf import torch from src.PICNN.layers import ( weight, bias, apply_linear_layer, get_act_func, ) class PICNN( torch.nn.Module ): # pylint: disable=invalid-name,too-many-insta...
81429fb4295fa5857eb99b3184729bb3ad5cb62bea040228ad59e9256578e549
Python
12,156
337
# coding: utf-8 """ MIT License """ ''' Project: Parenchymal Attention Network Authors: Axel Masquelin Description: Image manipulation and visualization function ''' # Libraries # ---------------------------------------------------------------------------- # # from PIL import Image import matplotl...
f22cea1323af76810686e4d8901827b8c277a120994c1a5c6f8cbd7f2c3321ee
Python
12,177
214
"""Tests for raw-DWI inputs, output layout and disposable intermediate cache.""" import json import os from pathlib import Path import subprocess import tempfile import unittest from unittest.mock import patch import nibabel as nib import numpy as np import SimpleITK as sitk from preprocessing.inputs import ensure_re...
f89585619c376b0296ecb51663dff9117a97671afc25bfd13de045f4073f4dc9
Python
12,178
328
from h3xsemble.utils.rigid_utils import Rigid, Rotation import torch import pickle import random def _read_pickle_select( fn, structure_mode, # igfold, immunebuilder, etc... model_index, select_feature_s=["rigidgroups_gt_frames"], use_crystal=True, # check_consistency=False, # select_feat...
9664a19d821368a38dc7c5dbde39a9bb4953d1c9e4922115fce958271642ca06
Python
12,179
325
import numpy as np import pyemma from pyemma.util.contexts import settings import MDAnalysis as mda import matplotlib.pyplot as plt from pensa.preprocessing import sort_coordinates, merge_and_sort_coordinates from .visualization import project_on_eigenvector, sort_traj_along_projection # --- METHODS FOR PRINCIPAL COM...
81628f8af7a64c77cda5a6cfe85902639a390845d5c6d9a9005d1c08d38b95ac
Python
12,183
289
import matplotlib import matplotlib.pyplot as plt from matplotlib.lines import Line2D import numpy as np import pandas as pd import os from scipy import stats from plot_brains import brain_regions, prefixes, prefix_idx from collections import defaultdict import copy import seaborn as sns from statsmodels.stats.multites...
2057eff1fe4f3c86a26a49cf1f21831717e078f72b941a4b498e2794dfff8664
Python
12,186
390
""" Generate R 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 argparse import re import sys from collections import OrderedDict from pathlib import Path import yaml try: ...
a122999af7fb1cebec7736fceb2e1cd0f6103657641ca930eba8d10c0840ee52
Python
12,187
342
# Copyright 2024 DeepMind Technologies Limited # # AlphaFold 3 source code is licensed under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with the # License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
8e210bbf35acb21256312d0e543395860fe215c21bf7520695bd82958125dcae
Python
12,189
362
"""Tests for Google GenAI block translator.""" from copy import deepcopy from typing import Any from langchain_core.messages import AIMessage, AIMessageChunk from langchain_core.messages.block_translators.google_genai import ( translate_grounding_metadata_to_citations, ) from langchain_core.messages.tool import t...
4f873e26e7cc5bf12b6da7e1c7c23fb521926db33bb8378dc462b66dbe9d09c4
Python
12,196
261
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 pstRT_preprocess_func __all__ = ['pstRT_rlddm6'] class PstrtRlddm6(TaskModel): def __init__(self, **kwargs): ...
7d1c2fe52045c89a2c7bfa7623efb3427d480c3ca2fdc49d8b98f2d416893602
Python
12,199
283
import argparse import logging import os import random import shutil import sys import time import numpy as np import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tensorboardX import SummaryWriter from torch.nn import B...
54dc92d381b45027bd7a0ba2c61577c6eac4e1255ba7688faecacd725fdc35d0
Python
12,201
243
""" Optimal Switching Decision taken for network """ import time from timeit import default_timer as timer from gurobipy import * #----------------Constant Values------------------------------ M=100 #large value for optimization Vmax=1.05 # max pu voltage Vmin=0.95 # min pu voltage # Squaring the v...
9a1d827b2265b16fad602ab2e30c7dfd9fcdb5e1a090da3c1fa1299a35424948
Python
12,201
304
import numpy as np import deeptime import matplotlib.pyplot as plt from pensa.preprocessing import merge_and_sort_coordinates from .visualization import project_on_eigenvector_tica, sort_traj_along_projection # --- METHODS FOR TIME-LAGGED INDEPENDENT COMPONENT ANALYSIS --- # https://deeptime-ml.github.io/latest/api/...
f12fdacf7fc769a0427e6d2364dfaad6a4c323799ac92a936c0fd0051c35a54d
Python
12,205
272
def get_data(dataname, suffix='NA'): gt=[] data_dir = '/mnt/data2/aanchal/data/'+dataname+'/' if (dataname=='IMC_T1D'): subfolder_name ='raw_data' # sub-folder containing raw data raw_data_file = pd.read_csv(data_dir+'/'+subfolder_name+'/mgDF.csv', index_col=0) # contains "cells" on rows a...
3d82c0a097b3726106057f4992acee393fa55743dd11d37d8659d3b7678aefec
Python
12,210
282
""" This module provides utility functions for aligning Markov states between different training attempts (different models trained for a same system) and different systems (aligning the ensembles of models for different systems). """ import logging logging.basicConfig(encoding='utf-8', level=logging.INFO) import nump...
9a068ee67feb3526a45d59bd5f7fc59ddf51be6296c340a553c940f61129981b
Python
12,214
399
######################################################################## # Stochastic degradation-diffusion process. # RESTORE # AIMS: to verify checkpointing and restoring of the spatial stochastic # solver 'Tetvesicle' in the context of the Degradation-Diffusion model # (see validation/kisilevich.py) ##########...
3ad95b841cc37a0ca670a69cc0b36f27091790050c1840be137ffab04b2e6e9b
Python
12,223
280
import os import argparse import torch import torch.optim as optim import torch.nn.functional as F import torch_geometric.loader as geom_data import pytorch_lightning as pl from pytorch_lightning.callbacks import ModelCheckpoint from pytorch_lightning.callbacks import EarlyStopping from pytorch_lightning.callba...
be9df77c2b380e5b8d110106d2d4deaef699ab26cc956b78e2408a4d337b79d5
Python
12,226
363
import copy import importlib import ml_collections as mlc def set_inf(c, inf): for k, v in c.items(): if isinstance(v, mlc.ConfigDict): set_inf(v, inf) elif k == "inf": c[k] = inf def enforce_config_constraints(config): def string_to_setting(s): path = s.split...
646c55337a889045114649327d8e6893b27d28c1367b9d55d3e3f5d8c527d868
Python
12,228
216
# 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...
c9c8b51e96b2273a30bd572247e6bfc433880c0bb3c3ba95f6c5790607b698ab
Python
12,231
399
######################################################################## # Stochastic degradation-diffusion process. # RESTORE # AIMS: to verify checkpointing and restoring of the spatial stochastic # solver 'Tetvesicle' in the context of the Degradation-Diffusion model # (see validation/kisilevich.py) ##########...
bf8c7b69060c7b5bdbd1a3393d5419cb5d62d12bc85d23131c962273317b2cd9
Python
12,237
342
import argparse import shutil import time import numpy as np import os from os.path import exists, split, join, splitext import sys import torch import torch.nn as nn import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim import torch.utils.data import torchvision.transforms as transforms im...
d9c6bcd1662e4d242f5fea626e70be665ac1226b737c771d4fe6cb020e0d58ca
Python
12,237
356
# Copyright 2024 DeepMind Technologies Limited # # AlphaFold 3 source code is licensed under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with the # License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by...
fc8d7c878247e348232e7bd87ce52563439541da230618493f7fb670ba0f4aff
Python
12,241
273
# 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...
908d0fa0ac22561a096d43e0d9080d7b1069e473fd64e6aec5bd6ea215bc5a77
Python
12,245
291
from __future__ import division from __future__ import print_function import os import time import h5py import random import argparse import numpy as np import torch import torch.nn.functional as F import torch.optim as optim from copy import deepcopy from torch_geometric.data import Data from models import * def see...
bee8e7d2c129a2392b2b24dfa8383ce39d17c854e3e577fb717bbca9f15c6c7a
Python
12,251
314
from PyQt5.QtWidgets import (QApplication, QComboBox, QGridLayout, QGroupBox, QLabel, QPushButton, QFileDialog, QMessageBox, QWidget, QSizePolicy, QCheckBox, QTableWidget, QVBoxLayout, QTableWidgetItem, QLineEdit) from PyQt5.QtGui import QDoubleValidator, QIntValidator from matplotlib.backends.backend_q...
357142dd195386f375e903f48a6ae059bc16bf1eac6b418fdab1a0791e33c796
Python
12,260
409
""" Polyphen prediction pipeline ============================= :Author: Andreas Heger :Release: $Id: pipeline_snps.py 2870 2010-03-03 10:20:29Z andreas $ :Date: |today| :Tags: Python Purpose ------- Input: Indels in pileup format. Usage ----- Type:: python <script_name>.py --help for command line help. Code...
a5e7e3ed40b5de3a44a5508dc6b3010b3eb158e52f86b014ea808f0015cf6563
Python
12,264
207
import os import pickle import logging import tensorflow as tf import numpy as np import pandas as pd from dipgnn.utils.register import registers from dipgnn.tasks.base_training_task import BaseTrainingTask from dipgnn.utils.regression_metrics import RegressionMetrics @registers.task.register("regression_t...
b1248e4fe226d52605e3bc728a62b3ea540cca89db9c6cba11355e739018ffc6
Python
12,274
277
import argparse import logging import os import random import shutil import sys import time import numpy as np import torch import torch.backends.cudnn as cudnn import torch.nn as nn import torch.nn.functional as F import torch.optim as optim from tensorboardX import SummaryWriter from torch.nn import BCEWithLogitsLos...
85fe4809c480e44d3ad5e33e39aef512a56b9c097c6705f99977ba0d86129fff
Python
12,278
133
"""Tables and the number ledger for protocol P5 (Changan field vehicles). tables/table_field_data.tex field corpus and label model tables/table_p5.tex SOH MAPE under F1 / F3 / P5 by feature set (+ label-noise reference) tables/table_p5_conformal.tex P5 interval quality with twelve laboratory sources a...
f506ebb1dc17a835b6f272c402f97d4bdd881d7d2cf63bcd077e97dfb3b8a96f
Python
12,280
292
from PyQt5.QtWidgets import (QApplication, QComboBox, QGridLayout, QGroupBox, QLabel, QPushButton, QFileDialog, QMessageBox, QWidget, QSizePolicy, QCheckBox, QLineEdit) from matplotlib.backends.backend_qt5agg import FigureCanvas from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationT...
2116d23ac353362f69f963cdc06eba66a15e66f3234ce33da84bd6ff50d93776
Python
12,281
271
import sys import os import matplotlib.pyplot as plt import matplotlib.patches as patches import itertools sys.path.insert(1, os.path.join(sys.path[0], '../../../../')) from Simulator.SimulatorPattern import simulatorPattern, simulatorPatternDual import Articles.Sequential_Learning_Striatum.Figures.cfg_pdf as cfg fr...
dc724f4fc5cb37720e406fe6ac27f500284d6bb9deff5b03f4cc17bcb4954cca
Python
12,283
298
from itertools import chain import numpy as np import openpyxl import pandas as pd import xlrd def load_pathway(): pathway = "c2.cp.kegg.v7.2.symbols.gmt" gene_in_pathways = [] for line in open(pathway): line = line.strip() split_result = line.split('\t') gene_in_pat...
61bff00919940950489d2af5d0ea791f6a31c635a9e5ba3e9262873af1483c8c
Python
12,291
318
from typing import List, Optional import pandas as pd import numpy as np from rdkit import Chem import polyfingerprints as pfp REPEATING_UNIT_COLUMN_PREFIX = "SMILES_repeating_unit" MOLPERCENT_RU_COLUMN_PREFIX = "molpercent_repeating_unit" ADDITIVE_COLUMN_PREFIX = "additive" ADDITIVE_WP_COLUMN_POSTFIX = "_weight_pe...
be1d7b14d13b9ff2d390ecfff36e76d3baa6b9224fa6a18aff7f77c6c55399ba
Python
12,291
250
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 17 21:22:12 2022 @author: Shencong Ni """ ''' Calculate the phase locking value (PLV) between the MUA in area 1 and area 2. Run the onoff_detection.py first before running this script. ''' import matplotlib as mpl mpl.use('Agg') import scipy.stats...
2ded714673b86672634976af12a85b80c44cab15a0d443a1ba7a51632ab982eb
Python
12,294
274
from torch import nn import torch import math class GCL(nn.Module): def __init__(self, input_nf, output_nf, hidden_nf, normalization_factor, aggregation_method, edges_in_d=0, nodes_att_dim=0, act_fn=nn.SiLU(), attention=False): super(GCL, self).__init__() input_edge = input_nf * 2 ...