sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
21e42f59b6c0fb20024fa6f6f051be3f66680a88cd6337be7b1cdbeb0ebd9bc5 | Python | 6,700 | 153 | import zmq
import pyqtgraph as pg
import struct
import numpy as np
from PyQt5.QtWidgets import QMainWindow, QFileDialog
from PyQt5.QtCore import pyqtSignal, QThread
from monitoring.vmon.vmon.ui.main_window_ui import Ui_MainWindow
from monitoring.vmon.vmon.settings.defaults import *
from monitorin... |
d893b4ffe8df44bdce2aaf94d8b6e3841dd4abd11d653d097730f689565213ad | Python | 6,700 | 203 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#$ -N density_na
#$ -e proderr.err
#$ -o prodout.out
#$ -l gpu=1
#$ -pe smp 4
#$ -cwd
#$ -R y
#$ -jc long
#$ -mods l_hard m_mem_free 16G
#$ -mods l_hard h_rt 72:00:00
#$ -notify
"""
Created on Fri Sep 23 14:28:27 2022
@author: neil
"""
import os
import sys
sys.path.ap... |
0a2d4b51903ca7c14df3bb5ebf9bd8d89a9788488205fb6735fd289dce54caf5 | Python | 6,703 | 203 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#$ -N density_cam
#$ -e proderr.err
#$ -o prodout.out
#$ -l gpu=1
#$ -pe smp 4
#$ -cwd
#$ -R y
#$ -jc long
#$ -mods l_hard m_mem_free 16G
#$ -mods l_hard h_rt 72:00:00
#$ -notify
"""
Created on Fri Sep 23 14:28:27 2022
@author: neil
"""
import os
import sys
sys.path.a... |
92b208412ea6d755fa48a582a4d0243dad031fc5f9e188b6a1b05c4c02255335 | Python | 6,703 | 183 | # Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
from typing import Optional
import torch
from pytorch_lightning import LightningDataModule
from torch.utils.data import DataLoader
from .registry import DATAPIPE_REGISTRY
from .utils import PDEDataConfig
def collate_fn_cat(batch):
# Assumi... |
147269527b348fd58215fa1378769617d64cdac545890fc91e0b5abefd64f208 | Python | 6,706 | 160 | from .models.gcl import E_GCL, unsorted_segment_sum
import torch
from torch import nn
class E_GCL_mask(E_GCL):
"""Graph Neural Net with global state and fixed number of nodes per graph.
Args:
hidden_dim: Number of hidden units.
num_nodes: Maximum number of nodes (for self-attentive pooling... |
b035afe5cfedf45e2ce931881662ac42be6a9f168f8616140714209d1e6c4190 | Python | 6,706 | 203 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#$ -N density_tip3
#$ -e proderr.err
#$ -o prodout.out
#$ -l gpu=1
#$ -pe smp 4
#$ -cwd
#$ -R y
#$ -jc long
#$ -mods l_hard m_mem_free 16G
#$ -mods l_hard h_rt 72:00:00
#$ -notify
"""
Created on Fri Sep 23 14:28:27 2022
@author: neil
"""
import os
import sys
sys.path.... |
20b4ff4c3a4f34e8f87cc91bb32a111486fe050b84bb922671fa6c8ff3c02b90 | Python | 6,708 | 216 | import torch.nn as nn
import torch.optim as optim
import torch
import torch.optim.lr_scheduler as scheduler
from typing import List, Optional
import math
import warnings
from torch.optim import Optimizer
from torch.optim.lr_scheduler import _LRScheduler
class CosineWarmupLR(_LRScheduler):
"""Cosine learning rate ... |
c11e141873c5ff9d065a5f769fbe2448ee653fe1d1ee12765cf4b3d320662f0b | Python | 6,708 | 214 | import argparse
import os
from time import time as t
import matplotlib.pyplot as plt
import torch
from torchvision import transforms
from tqdm import tqdm
from bindsnet.analysis.plotting import (
plot_conv2d_weights,
plot_input,
plot_spikes,
plot_voltages,
)
from bindsnet.datasets import MNIST
from bi... |
f203320a2600458e25c05d686955f7745780a7e59403a5b683f369a0b66317b3 | Python | 6,709 | 164 | """
Utility functions useful for equilibration.
"""
import logging
from openmm import unit, OpenMMException
# Set up logger
_logger = logging.getLogger(__name__)
def run_gentle_equilibration(topology, positions, system, stages, filename, platform_name='CUDA', save_box_vectors=True):
"""
Run gentle equilibra... |
cf419cf0d063012e4e31321ece543d2d8c19014cf374861d8d3dc7e9395fa612 | Python | 6,710 | 176 | #!/usr/bin/env python
"""
CLI utility to automatically run benchmarks using data from the open force field protein-ligand benchmark at
https://github.com/openforcefield/protein-ligand-benchmark
It requires internet connection to function properly, by connecting to the mentioned repository.
"""
# TODO: Use plbenchmark... |
30baace8dcded10be0127bd62da85ac722f9d316c1f7265b38145d7d79991f0a | Python | 6,712 | 176 | #!/usr/bin/env python
"""
CLI utility to automatically run benchmarks using data from the open force field protein-ligand benchmark at
https://github.com/openforcefield/protein-ligand-benchmark
It requires internet connection to function properly, by connecting to the mentioned repository.
"""
# TODO: Use plbenchmark... |
9c3a85df08a18c095dcd2e3583fc218a19a301f481130390ff42071e89e90722 | Python | 6,713 | 104 | """Locally adaptive shift-matched conformal under P4 (LightGBM backbone).
Scores are normalised by a predicted residual scale sigma(x) (Lei et al. 2018 style):
s_i = |y_i - f(x_i)| / sigma(x_i), interval = f(x) +- q * sigma(x)
sigma is a LightGBM model of log|residual| fitted on the leave-one-source-out (shift-mat... |
64fb222bbb5f6a29d58112478a10d5783a7207b0978f44539ca87e9e6ac0e583 | Python | 6,721 | 171 | # -*- coding: utf-8 -*-
"""
Methods to obtain a timeseries distribution for the atom/ion pockets' occupancies.
Atom pockets are defined as radius 2.5 Angstroms (based off of bond lengths between Na and O, and Ca and O)
centered on the probability density maxima of the atoms.
The methods here are based on the follow... |
c1e6f56ddfdd411f65bdaa41616e38dac4666aabe7eb4c599d632ae9d5183f1c | Python | 6,723 | 220 | """Utilities for calculating all atom representations."""
import torch
from data import residue_constants
from openfold.utils import rigid_utils as ru
from openfold.data import data_transforms
from openfold.utils import feats
Rigid = ru.Rigid
Rotation = ru.Rotation
# Residue Constants from OpenFold/AlphaFold2.
IDEAL... |
1a476e346a9d6e14916251b23c3132a506c432ccd8888727fee60fe3b2dc9a15 | Python | 6,726 | 230 | from typing import Optional
import torch
import torch.nn as nn
import torch.nn.functional as F
class WSConv2d(nn.Conv2d):
def __init__(self, *args, max_norm: Optional[float] = None, **kwargs):
self.max_norm = max_norm
super(WSConv2d, self).__init__(*args, **kwargs)
def forward(self, x):
... |
3e31641b74cc550b8626cdc1ef4b233a7a61b7c62314583a3497be5725914ec4 | Python | 6,727 | 124 | # 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... |
ca57b34b2d234088c04135f806828b68bd384d85bdb8be5a0d266c088bb04b5d | Python | 6,729 | 181 | #!/usr/bin/env python3
import os
import time
import torch
import hydra
import logging
from models import get_model
from torchvision.transforms import Compose
from torch_geometric.loader import DataLoader
from tqdm import tqdm
from ori_dataset import MD17_DFT, random_split, get_mask
logger = logging.getLogger()
def... |
13c8d7e29a821dfe9362bd0086b533238013c367ce0116431350f11991f31a8d | Python | 6,731 | 205 | """Tracers that print to the console."""
import json
from collections.abc import Callable
from typing import Any
from langchain_core.tracers.base import BaseTracer
from langchain_core.tracers.schemas import Run
from langchain_core.utils.input import get_bolded_text, get_colored_text
MILLISECONDS_IN_SECOND = 1000
d... |
9999b143d5dd36496a3424d76c405eefa990fbd7166f760dfbcd6dc960e98311 | Python | 6,731 | 214 | import os
import torch
import numpy as np
import torch.nn as nn
# import matplotlib.pyplot as plt
from skimage import measure
import scipy.ndimage as nd
def recursive_glob(rootdir='.', suffix=''):
"""Performs recursive glob with given suffix and rootdir
:param rootdir is the root directory
:param ... |
c4b3d702650b890fcbd46002a4fbce808bc2a92d4c41c5e1f077cabab74745fa | Python | 6,732 | 158 | import numpy as np
from matplotlib import pylab as plt
import argparse
import os, sys, glob
import pandas as pd
import seaborn as sns
if not os.path.exists('results/final_results/'):
os.makedirs('results/final_results/')
dir_final_res = 'results/final_results/'
def errors_ae_don(latent_dim, method, reps, ... |
303da4552bc1b88d29ae4a301d060e5282cde526a5e620e20c155f12dd2f2a27 | Python | 6,733 | 226 | from typing import Dict, List
import torch
import torch.nn as nn
import torch.nn.functional
from ase.symbols import symbols2numbers
from e3nn.util.jit import compile_mode
import hienet._keys as KEY
from hienet._const import AtomGraphDataType
#from jarvis.core.specie import get_node_attributes, atomic_numbers_to_symbo... |
582d6dff6228d98bf383aaedbe1519c61eb3d21440920f58e0f970db62247fd2 | Python | 6,733 | 182 | # distribution of this software and related documentation without an express
# license agreement from NVIDIA CORPORATION is strictly prohibited.
"""Main API for computing and reporting quality metrics."""
import os
import time
import json
import torch
import dnnlib
from . import metric_utils
from . import frechet_in... |
1812990bc68474c537448b11c56ca2a45bc252d1f919521c6702eb535b6cdf04 | Python | 6,736 | 122 | # 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... |
4a36fe5523598ad98484f2de6e19c1bf4a37538fb8798a082177162f3c074aa3 | Python | 6,738 | 147 | """
In this file the DSS engine is set up.
The objects for circuit, bus, and branch are also set up for further use in the RL environment.
This file also includes function to modify the base DSS circuit with sectionalizing, tie switch, and generator information.
The translation of DSS Circuit into a graph structure is ... |
7a160de3d5e704903b43ef0173170e50991fe175384759182dc7af3b80837a83 | Python | 6,738 | 260 | #!/usr/bin/env python3
"""
Calculate Dice, Jaquard and related stats for inter and intra-observer labeling comparisons
Usage
----
dice.py <labelsA> <labelsB>
dice.py -h
Authors
----
Mike Tyszka, Caltech Brain Imaging Center
Dates
----
2015-07-21 JMT From scratch
License
----
This file is part of atlaskit.
atla... |
a879db575b75519601294eefb761c59a5501554dbe4555e9a452694f91860135 | Python | 6,738 | 124 | # 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... |
0cde5cf93caa740ba5fcda838c132145a101adb393f107e857a1653da5304d99 | Python | 6,743 | 159 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch_scatter import scatter_mean
from torch_geometric.nn import MetaLayer
from torch_geometric.nn import Set2Set
def compute_cluster_batch_index(cluster, batch):
max_prev_batch = 0
for i in range(batch.max().item()+1):
cluster[ba... |
f499263913ba88cf214e87afd9888a26cdcbe2ddbae3d81e3e9a6921b3feae8a | Python | 6,744 | 196 | """
Simulation helpers for the SMdRQA UI.
Provides editable per-system parameter defaults (matching the
``RQA2_simulators`` signatures), a registry of bifurcation-parameter
regimes with suggested chaos thresholds, distribution-based parameter
sampling for regime-labelled batch generation, and a standalone
``simulate_s... |
abf6dc9f8c53c4f55c27da002a87de6a52c0caa1ca12dafc513cb9531a715558 | Python | 6,749 | 191 | from scipy.sparse.csgraph import shortest_path
from .build_pdists import get_all_pdists, get_partial_pdists
from ..utils.utils import *
def build_tree(
container,
sort_mode,
t_ignore,
t_track,
verbose=False):
"""Build frame tree.
Build frame tree with branches according to given sort_mod... |
02773c150a1d252c5c2fb669e7f8966b5cf8b4de09bd53d3152e251f97ecd118 | Python | 6,751 | 204 | import argparse
from pathlib import Path
from datetime import datetime
import logging
import pickle
from collections import defaultdict
import numpy as np
import matplotlib.pyplot as plt
from numpy import mean
from scipy.stats import sem
from alpaca import Provenance, activate, save_provenance, alpaca_setting
from a... |
78c828a415be313fedd3f4ddc514c9685b109f171f06db769e64f40f89e54d7d | Python | 6,752 | 155 | # srun --nodes=1 --ntasks=1 --cpus-per-task=8 --gpus=1 --mem=100g --time=06:00:00 --pty bash -i
# Sconda conda activate ghmc1; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/GhmCN/reviewer_questions/distribution_of_genes_and_distances_activ72B; python
import pandas as pd
import numpy as np... |
d460315fecb062a37fe88db9165069f5dfd393fc6ef2badeba804c048ae10e80 | Python | 6,752 | 201 | from mimic3models import common_utils
import threading
import os
import numpy as np
import random
def preprocess_chunk(data, ts, discretizer, normalizer=None):
data = [discretizer.transform(X, end=t)[0] for (X, t) in zip(data, ts)]
if normalizer is not None:
data = [normalizer.transform(X) for X in da... |
7ee274ecf5540369b5b2bbbb7005485143a54e22b3a692f2bccdb31cea3dcab1 | Python | 6,754 | 181 | # IDaRS (LDH)
import os
import numpy as np
import pandas as pd
from sklearn.metrics import auc, roc_curve, f1_score, precision_recall_curve, average_precision_score
from scipy.stats.mstats import gmean
def cutoff_youdens_j(fpr,tpr,thresholds):
j_scores = tpr-fpr
j_ordered = sorted(zip(j_scores,thresholds))
... |
c59b76b810d7684aa652ebf9b7057b38968fd0a1404183524bbf358c915e11a5 | Python | 6,755 | 154 | import torch.nn.functional as F
import torch
import torch.nn as nn
import math
# ----------------------------------------------------------------------------------------------------------------------
# Baseline FNO: code from https://github.com/neural-operator/fourier_neural_operator (master branch)
# ----------------... |
6155d636902972788975a60930cf8f4072e4ccf9c33b339c62ad81b9184a7918 | Python | 6,757 | 199 | """ functions to sort, compute stats, and compare arrays of eigenmodes"""
import pandas as pd
import numpy as np
from scipy.spatial import distance
from scipy.stats import entropy, spearmanr, pearsonr
def eig_fc_get_standardz(x, y, binary_thresh=0.1, nreps=1000):
"""Permutes both canonical networks and input ei... |
2c7f1ad12e0bcf5ede9603a0b9c258660c46e8305e453648a92e50d1844da7cc | Python | 6,760 | 200 | """Contains all ensemble models."""
from copy import deepcopy
import logging
from datetime import datetime
import pickle
import os
import torch
from torch import nn
from torch.optim.lr_scheduler import CosineAnnealingLR
from .basenetwork import BaseNetwork
logger = logging.getLogger(__name__)
class SnapshotNet(Bas... |
27772ee893dd91f5fa31847f8e9d1403ade45275484dd043fa8db13414e8791d | Python | 6,765 | 225 | import argparse
from mimic3models import parse_utils
import json
import numpy as np
def check_decreasing(a, k, eps):
if k >= len(a):
return False
pos = len(a) - 1
for i in range(k):
if a[pos] > a[pos - 1] + eps:
return False
pos -= 1
return True
def process_single... |
b6111378a78cee198c183f585e04ca7c9e11ccab9a1d28e8b7e2943a65a65037 | Python | 6,765 | 212 | from typing import List
import torch
import torch.nn as nn
import torch.utils.model_zoo as model_zoo
from efficientnet_pytorch import EfficientNet
from efficientnet_pytorch.utils import get_model_params, url_map
class EncoderMixin:
"""Add encoder functionality such as:
- output channels specification of ... |
0937d8f6654f793752f2b1049ff3f1d99046f2a4a7e3cd454580f563c2326b98 | Python | 6,766 | 141 | """CPU checks for the optional one-sided boundary loss."""
from importlib.util import find_spec
from pathlib import Path
import subprocess
import sys
import tempfile
import unittest
import torch
if find_spec('pytorch3d') is not None:
from pytorch3d.structures import Pointclouds
from utils.loss import boundar... |
3b322a11b8d65d20b4181bfddf836c333ff5977d9a869f7fc163feaaf52cb65d | Python | 6,767 | 177 | # -*- coding: utf-8 -*-
import torch
import numpy as np
import torch.nn as nn
from warnings import warn
from copy import deepcopy
from dliplib.reconstructors.base import BaseLearnedReconstructor
from dliplib.utils.models import get_iradonmap_model
class IRadonMapReconstructor(BaseLearnedReconstructor):
HYPER_PA... |
87768730121c158d7fc35ee120db0343306fc298068e1c34f905dad10a327a51 | Python | 6,768 | 144 | from typing import Any
from pytorch_lightning import Callback, LightningModule, Trainer
from pytorch_lightning.utilities.rank_zero import rank_zero_only
from torch.optim import Optimizer
import torch
from time import time
from typing import Mapping
from pdearena.utils.utils import get_logger
logger = get_logger(__name... |
c6636a2b321917b75d6cfdc1afb284de25800e6f3345535161b4d09419bd7044 | Python | 6,773 | 195 | from typing import Callable, Dict
from collections import defaultdict
import shap
import numpy as np
import pandas as pd
from tqdm.auto import tqdm, trange
from sklearn.preprocessing import StandardScaler
from sklearn.model_selection import StratifiedKFold
from sklearn.feature_selection import SelectFromModel
from skl... |
fa05513030f1205f656d243edeb7e9cb31a0bf483962952d01123335b4da9fc9 | Python | 6,776 | 206 | from unittest import TestCase
import pytest
import torch
from chroma.layers.structure.backbone import (
BackboneBuilder,
LossBackboneResidueDistance,
ProteinBackbone,
RigidTransform,
RigidTransformer,
)
class TestProteinBackbone(TestCase):
def test_cuda(self):
if torch.cuda.is_availa... |
1b5e779dda11d7162350b1a192173301c6e406af2d744dff1b49019cb58b9810 | Python | 6,783 | 213 | import logging
import pathlib
import torch
import torch.nn as nn
import torch.multiprocessing
from collections import defaultdict
from pathlib import Path
from typing import DefaultDict
from featurizing import prep_af2_inp
from align_to_modeled import get_fasta_dict, get_new_pdb
##
# from apex.optimizers import FusedA... |
5dc7bc8bf893ddc42e7dbaf5292ae41cbe131effcfcd002aaa9b0376453da089 | Python | 6,783 | 234 | """
XML I/O parser for the SMIRNOFF (SMIRKS Native Open Force Field) format.
.. codeauthor:: John D. Chodera <john.chodera@choderalab.org>
.. codeauthor:: David L. Mobley <dmobley@mobleylab.org>
.. codeauthor:: Peter K. Eastman <peastman@stanford.edu>
"""
__all__ = [
"ParameterIOHandler",
"XMLParameterIOHand... |
2602287f7d492ecc8ec89828dfa25cfc1fce326ef7c2e64453fca266277b4704 | Python | 6,784 | 124 | # 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... |
dc07ca61535a9fdf2c8c21e16fa238e3833b5c0cac252ae4517fc4b56f9a29fd | Python | 6,786 | 180 | import random
from time import time
import numpy as np
import torch
# Number of cues to be used in the experiment.
NUM_CUES = 4
class CueRewardSimulator:
"""
This simulator provides basic cues and rewards according to the
network's choice, as described in the Backpropamine paper:
https://openrev... |
3c62eda3dc259b069527b9f2f7522b96cc6a968a540fc1aac9ffa18dca38d7d7 | Python | 6,787 | 146 | # 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... |
d5ec992137e4ac51a40f7299773b85a5eccf73d0e504e8a0c1d967957fb4cf43 | Python | 6,789 | 171 | import sys
sys.path.append(".")
import os
import argparse
import io
import tarfile
import multiprocessing as mp
from tqdm import tqdm
from contextlib import nullcontext
import torch
from crystallm import (
CIFTokenizer,
GPT,
GPTConfig,
array_split,
)
def progress_listener(queue, n):
pbar = tqdm(... |
02e90965f52ba8083ea15e4a521fc8b0bf89d5636ac36a235b1f0620cf751a23 | Python | 6,790 | 185 | import matplotlib.pyplot as plt
import numpy as np
from scipy.io import loadmat
import pandas as pd
from glob import glob
from pprint import pprint
import matplotlib as mpl
import random
import os
import sys
import math
params = {'font.size': 18, 'font.family': 'serif', 'xtick.major.pad': '1'}
mpl.rcParam... |
dc014e0b7b00615fc64e077f0d33ea3ea19d0f5e62edd870f2030bb124d2537e | Python | 6,790 | 185 | import matplotlib.pyplot as plt
import numpy as np
from scipy.io import loadmat
import pandas as pd
from glob import glob
from pprint import pprint
import matplotlib as mpl
import random
import os
import sys
import math
params = {'font.size': 18, 'font.family': 'serif', 'xtick.major.pad': '1'}
mpl.rcParam... |
07de9574c09b997916b28f0dab0a74453f114718e5f102825f659391d2ce9e3d | Python | 6,794 | 200 | """Chain for question-answering with self-verification."""
from __future__ import annotations
import warnings
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_c... |
59cf09ee1df6364741715308557bacd6e874c7a5dde695161046f48f4da63943 | Python | 6,797 | 211 | """ Utility functions for processing point clouds.
Author: Charles R. Qi, Hao Su
Date: November 2016
"""
import os
import sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
# Draw point cloud
from visualizer.eulerangles import euler2mat
# Point cloud IO
import numpy as np
from visua... |
468d232a3c74dcfa3fac4b69dcf3609185b3ff688533a9287d1568766bbfdb26 | Python | 6,799 | 139 | #! /bin/env python
#
# Michael Gibson 23 April 2015
# Modified Adrian Foy Sep 2018
# Modified JiaaoZ Feb 10 2022
import sys, struct
from .qstring import read_qstring
def read_header(fid, verbose=True):
"""Reads the Intan File Format header from the given file."""
# Check 'magic number' at beginning of file t... |
6b7879c7683b31f6e92de8bb7604b9cad00e5c2ebb3acf220457633be93a2f78 | Python | 6,799 | 187 | import torch
import torch.nn.functional as F
from torch import nn
from typing import List, Tuple, Optional, Callable
from diffusers import DDPMScheduler, DDIMScheduler
from sam.diffusion.common import DiffusionCommon
class Diffusers(DiffusionCommon):
def __init__(self,
eps_model: Callable,
... |
df30c4bf8a2473dc14619e69c6457b30d86b5a45713cc66ec999c8b95670f935 | Python | 6,803 | 170 | # 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... |
5f03c79cd82122aca369069630ca92f9a777d2dc3034032869ed259d9f99df60 | Python | 6,809 | 166 | #!/usr/bin/python
#
# Copyright 2016 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... |
95d83cb04722cf2347bde2f52a7c06502d0b5ef4a35c3ecd41dca063a4be92a3 | Python | 6,809 | 202 | import torch
import torch.nn as nn
import torch.nn.functional as F
import math
from torch.autograd import Variable
from proto_net.utils.blocks import conv_block, Flatten
from proto_net.utils.dist import euclidean_dist, cosine_dist
from sklearn.metrics import confusion_matrix
import numpy as np
class ArcM... |
ca740de64ae0a47c4d177b8f1a3e9fc1101a780cdab2c93f9a97f87845b5143e | Python | 6,812 | 196 | """
Generate morphological/spatial features for MLP (based on HoVer-Net+ output) for OMTscoring.
Usage:
create_features.py [options] [--help] [<args>...]
create_features.py --version
create_features.py (-h | --help)
Options:
-h --help Show this string.
--version Show ve... |
78d8bf4916d4635660cd735dd53f0966404d66fbe697b45c57eac7dd13a644dd | Python | 6,813 | 157 | import numpy as np
from matplotlib import pylab as plt
import argparse
import os, sys, glob
import pandas as pd
import seaborn as sns
if not os.path.exists('results/final_results/'):
os.makedirs('results/final_results/')
dir_final_res = 'results/final_results/'
def errors_ae_don(latent_dim, method, reps, ... |
7760f734a51a682d9d2e6b6138d6bb7e1d85aba426346f23f7057bf74449d2e1 | Python | 6,815 | 197 | """Base classes for LLM-powered router chains."""
from __future__ import annotations
from typing import Any, cast
from langchain_core._api import deprecated
from langchain_core.callbacks import (
AsyncCallbackManagerForChainRun,
CallbackManagerForChainRun,
)
from langchain_core.exceptions import OutputParser... |
4f3c7e0e4129a718e16feccf3f03ae5eaac89d98c789fa9d9fab8a787cfd3472 | Python | 6,818 | 201 | """
:AUTHOR: Jonas Scherer
:ORGANIZATION: Department of Neurobiology, Bielefeld University
:CONTACT: jonas.scherer@uni-bielefeld.de
:SINCE: Tue Dec 13 17:57:00 2022
:VERSION: 0.1
This module contains helper functions for plotting figures used in the virtual forest publication.
"""
import pandas as pd
import numpy as n... |
9fe465f847fca5eba618fbb479558c48d82f4963d2a488fa8ebbae2ee3a720d8 | Python | 6,818 | 191 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Sep 6 17:08:46 2021
@author: athanasiadis
"""
import numpy as np
import foolbox
import torch
def linear(X_train,y_train,model,reason):
"""
linear
______________________
This is a function that uses Foolbox an adversarial attack... |
ccb0a4e5e0fe9298c063efb82126c41e9cb88d5278179a231d310f846ea5a4c6 | Python | 6,820 | 152 | import matplotlib
matplotlib.use('agg')
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import glob, os, sys
from mantis_ml.config_class import Config
class BorutaScoreAggregator:
def __init__(self, cfg, search_dir):
self.cfg = cfg
self.search_dir = search_di... |
6036c470e3d726ae876c6063ce19b8621567d7d5a13535c87cc893f4444ac96b | Python | 6,821 | 162 | from .utils import *
class BoundingBox:
def __init__(self,
imageName,
classId,
x,
y,
w,
h,
typeCoordinates=CoordinatesType.Absolute,
imgSize=None,
bbType=BBType.... |
4cab24145bd824abf67c4f8653a5bf3d3ff313982bb87effac2bc4c5fcb41290 | Python | 6,822 | 226 | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from functools import partial
__all__ = ['ResNeXt', 'resnext50', 'resnext101', 'resnext152']
def conv3x3x3(in_planes, out_planes, stride=1):
# 3x3x3 convolution with padding
return nn.Conv3d(
... |
3577cf914eb94ebb068d67d914ec6101bcdcfec25966e0698c4c021e4a86dafa | Python | 6,823 | 174 | import unittest
from EPI_MRI.Regularizers import *
class TestRegularizers(unittest.TestCase):
def setUp(self):
""" Initialize any common data or setup needed for the tests. """
torch.manual_seed(81) # reproducibility with randomness
self.device = 'cuda' if torch.cuda.is_available() else '... |
8a6004b073222764dfdbb7b0a2365c9a2be8edb497051a854331aa8cc0476081 | Python | 6,825 | 157 | import numpy as np
import uncertainpy as un
from scipy.integrate import solve_ivp
from edNEGmodel.edNEGmodel_params import *
from functions.initial_values import *
import time
def model_setup(t,k, g_Na, g_DR, g_Ca, g_AHP, g_C):
Na_sn, Na_se, Na_sg, Na_dn, Na_de, Na_dg, K_sn, K_se, K_sg, K_dn, K_de, K_dg, Cl_sn... |
259ed470e6d9c0c5ef92fcb72c649aeb3d216359695141cb29263901ddf162e1 | Python | 6,827 | 157 | import os
import pandas as pd
import numpy as np
import torch.nn as nn
import torch
import torch.nn.functional as F
import itertools
import sys
sys.path.append(r'/apps/home/lulab_liuxiaofan/qhsky/project/multi_omics_paper/comparison_methods/P_net/')
from data.reactome import ReactomeNetwork
from model.model_layer impor... |
72cf8ce0f448b748fab1d51c9388ce711a71915178337fb7aec139e78450b9c6 | Python | 6,828 | 157 | import numpy as np
import uncertainpy as un
from scipy.integrate import solve_ivp
from edNEGmodel.edNEGmodel_params import *
from functions.initial_values import *
import time
def model_setup(t,k, g_Na, g_DR, g_Ca, g_AHP, g_C):
Na_sn, Na_se, Na_sg, Na_dn, Na_de, Na_dg, K_sn, K_se, K_sg, K_dn, K_de, K_dg, Cl_sn... |
8966332cbd16d4e5c2ce277fbd0b98d03a9a41aef8d15122ec106928b90fc494 | Python | 6,828 | 153 | # developed by Damir Temir | github.com/dtemir | as a part of the RosettaCommons Summer Internship
import common
import re
def read_resfile(filename):
"""
read a resfile and return a dictionary of constraints for each residue id
the constraints is a dictionary where the keys are residue ids and valu... |
a73dbd2ec89198fa8e31d4aeefd95e6d78f0d46650082b94bc06a53d7997be17 | Python | 6,831 | 176 | import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.metrics import classification_report, confusion_matrix
from sklearn.metrics import roc_curve
from sklearn.metrics import roc_auc_score
from tensorflow.keras.utils import to_categorical
from scipy.stats import zscore
from manti... |
46df9d7cb90086df61157c8324b7af1e29dfba4935c472ad76cd8ae21ccee215 | Python | 6,832 | 188 | import numpy as np
import os
import sys
sys.path.append("../protein_autoencoder/")
import torch
from torch_geometric.utils import from_networkx
from torch_geometric.nn import radius_graph
from torch_geometric.data import Batch
from torch_geometric.loader import DataLoader
import matplotlib.pyplot as plt
impor... |
610280d7c40cde54534745ad8585c000bcd655291464cd8f249c1a216d0fba00 | Python | 6,834 | 146 | import tensorflow as tf
import json
import os
from abc import ABC
class DistalTeacher(tf.keras.Model, ABC):
"""This is a custom ``tensorflow.keras.Model`` object, whose purpose is to enable saving
``motornet.plants`` object configuration when saving the model as well.
In `Tensorflow`, ``tensorflow.keras.... |
c5ac82d8698a52f280a937ec89583064d3fab31512ac0ac8f52a4b4543a2a491 | Python | 6,835 | 192 | """Use a single chain to route an input to one of multiple llm chains."""
from __future__ import annotations
from typing import Any
from langchain_core._api import deprecated
from langchain_core.language_models import BaseLanguageModel
from langchain_core.prompts import PromptTemplate
from typing_extensions import o... |
5f2c882d8067bef529e26358b1b995045a5b5f861e45564e1a16d1c3273b958b | Python | 6,850 | 153 | # srun --nodes=1 --ntasks=1 --cpus-per-task=24 --mem=80g --time=04:00:00 --pty bash -i
# Sconda conda activate TensorFlow_CPU_01; cd /mnt/BioAdHoc/Groups/RaoLab/Edahi/Projects/09.TimeCourse5hmC/ForFerhatGit/FCDNN/code/; python
import matplotlib.pyplot as plt
import numpy as np
import os
import pandas as pd
import pick... |
66645c2930976622a4fe1ae3ffdcf9ee36eceed36a3450eef146c076b20fd70c | Python | 6,850 | 195 | from dliplib.utils.models import get_skip_model
from dliplib.utils.losses import poisson_loss, tv_loss
from dival import IterativeReconstructor
from odl.contrib.torch import OperatorModule
from torch.nn import MSELoss
from torch.optim import Adam
import numpy as np
import torch
import odl
from warnings import warn
fro... |
b8798cf440716612f04dea9d230677a610f12788d574d29ce8ca2acb144dfd5e | Python | 6,850 | 241 | '''test_commandline - test coding style confirmation of cgat code
===========================================================
:Author: Andreas Heger
:Release: $Id$
:Date: |today|
:Tags: Python
Purpose
-------
This script test the command line usage of all scripts in the
cgat code collection.
This script is best run... |
0bbd6b48d5641dcd1054d5a423a6231bcd5fba8274e5447f16a3f55147f9a4f1 | Python | 6,860 | 191 | """Validation utilities for LangChain serialization.
Provides escape-based protection against injection attacks in serialized objects. The
approach uses an allowlist design: only dicts explicitly produced by
`Serializable.to_json()` are treated as LC objects during deserialization.
## How escaping works
During seria... |
dc770a1e6345db5e0f58458fc658e50f4d96dbcd6e0d2973595f646d0bae503f | Python | 6,863 | 181 | # coding=utf-8
"""Defines the DenseNet class."""
import torch
import torch.nn as nn
from .basenetwork import BaseNetwork
from .layers import DenseUnit, FlattenUnit
import logging
from inspect import getfullargspec
from collections import OrderedDict
logger = logging.getLogger(__name__)
class DenseNetConfig:
"... |
f15c444c2d72708811fcaf184dc2123c5e8abdf6503d75b6d642d8a52a338318 | Python | 6,871 | 178 | # coding=utf-8
import os
import sys
sys.path.append('..')
from feature_extractor.for_image_data.backbone import ResNet3D
import torch
from network import img_network
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
from tqdm import tqdm
from sklearn.metrics import confusion_matrix, matthews... |
5a49a37e6e650c8a11eb27433e0f1c27f9bcd6562ca04573569077e302802ba7 | Python | 6,872 | 165 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 1 10:22:38 2021
@author: athanasiadis
"""
import numpy as np
import pickle
from joblib import Parallel, delayed
import multiprocessing
import mkl
num_cores = multiprocessing.cpu_count()
import attack_modelfunctions as md
import attack_neighboorho... |
cfc6c11b037bdb6cdab3964086a1c63ab790c40bb24ea07f4115dccecc4053d6 | Python | 6,873 | 181 | # -- coding: utf-8 --
# @Time : 2022/10/15 16:11
# @Author : Biao Zhang
# @Email : littlebiao@outlook.com
# @File : heco_config.py
import time
from yacs.config import CfgNode as CN
# --------------------------------------------------------------
# Config of model
# ------------------------------------------------------... |
80f9ea5ec041d270cfd5b0c51f2c63f8f1386adf1780ff79886dec9b2d0aa5aa | Python | 6,874 | 223 | # Utilities to visualize images from ND arrays.
#
# Authors: vivekv2@gmail.com, maedeh.seyedolmohadesin@gmail.com
from math import floor
from typing import Tuple, List, Union
import numpy as np
from scipy.ndimage import rotate
from scipy.ndimage.filters import convolve
from .shapes import gaussian
def blur(vol:np.n... |
87599212ae447838aa7247ae59e8c4e02bae0a0be0abad46a6568949ab2481f1 | Python | 6,877 | 199 | import types
import random
import numpy as np
import matplotlib.pyplot as plt
import joblib
from fastweights_numpy import FastWeights, FeedforwardNet
from dt_utils import Timer
from data_utils import generate_recognition_data, augment_data
from neural_net_utils import Sigmoid, Relu, Quadratic, CrossEntropy,... |
302618361afdbc527a8cc89df7414b01946028bc350552d5ff8696855e70a28e | Python | 6,880 | 176 | import numpy as np
import torch
from scipy.spatial.transform import Rotation
import scipy.linalg
# hat map from vector space R^3 to Lie algebra so(3)
def hat(v):
"""
v: [..., 3]
hat_v: [..., 3, 3]
"""
hat_v = torch.zeros([*v.shape[:-1], 3, 3])
hat_v[..., 0, 1], hat_v[..., 0, 2], hat_v[..., 1, 2... |
9bc685c0524c6f6192178e53c972f09a2c2b0b6f321272d192f16e66cf6bc7e0 | Python | 6,881 | 140 | ####################################################################################
#
# 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... |
c70c21d037ec263013292d2d967238049c3f65ab836ac6e6d2e831ec267b0efd | Python | 6,885 | 208 | """Tool that takes in function or coroutine directly."""
from __future__ import annotations
from collections.abc import Awaitable, Callable
from typing import (
TYPE_CHECKING,
Any,
)
from typing_extensions import override
# Cannot move to TYPE_CHECKING as _run/_arun parameter annotations are needed at runti... |
1b2cca80d9bdf4451d8c46df93f24acbda588ca8822a9ea2260cb0f5b7bebde4 | Python | 6,890 | 195 | import numpy as numx
import pydeep.base.numpyextension as numxExt
from pydeep.base.activationfunction import Sigmoid
import pydeep.misc.measuring as MEASURE
import pydeep.misc.visualization as VIS
import pydeep.misc.io as IO
# Set the same seed value for all algorithms
numx.random.seed(42)
# Load Data
data = IO.load_... |
a531af45aa037a7de92e1ed0ad362ce41281dbecf60a53c3d31bcfa9bf17a6dd | Python | 6,891 | 180 | # -*- coding: utf-8 -*-
####################################################################################
#
# 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.
#
# S... |
825eb8d398929c9738bd05ac42f2cee878772300766318f7fcedb79c3b8129d7 | Python | 6,894 | 215 | """Helper function for high-throughput GNN trainings."""
"""Implementation based on the template of ALIGNN."""
import matplotlib.pyplot as plt
# import numpy as np
import time
from matformer.train import train_dgl
# from sklearn.metrics import mean_absolute_error
plt.switch_backend("agg")
def train_prop_model(
... |
ae1684a1b7aa69a76cf24ea39151d6861968266c8b372e83ccce4b9f2520232d | Python | 6,894 | 191 | #!/usr/bin/env python
# coding: utf-8
import numpy as np
import matplotlib.pyplot as plt
from skimage.io import*
from scipy import ndimage as ndi
import napari
from skimage.morphology import*
from skimage.segmentation import*
from skimage.measure import*
import seaborn as sns
from sklearn.linear_mode... |
483db40cccb63bd26708c9161ca2e6ba73180ef9c9a7b4bd0dcb639bd985c499 | Python | 6,900 | 186 | from rdkit import Chem
from eval_follow_edm import dataset
import torch
from eval_follow_edm.bond_analyze import get_bond_order, geom_predictor
from eval_follow_edm.datasets_config import get_dataset_info
import pickle
import os
def compute_qm9_smiles(dataset_name, remove_h):
'''
:param dataset_name: qm9 or ... |
5d6d49a02e07c90b1aaaf136780dc42dcc189d2f23e6ee2ca6dd4ffb8abc4ca6 | Python | 6,900 | 217 | '''
Author: Xiaoxiao Li
Date: 2019/02/24
'''
import os.path as osp
from os import listdir
import os
import glob
import h5py
import torch
import numpy as np
from scipy.io import loadmat
from imports.gdc import GDC
#from torch_geometric_data_hsm import Data
from torch_geometric.data import Data
import networkx as nx... |
0bc7f1ed1e12918a4aa79e3bc74777fa0c7f2111c99b8d9f07d292c2ade42594 | Python | 6,906 | 212 |
""" MIT License """
'''
Project: Parenchymal Attention Network
Authors: Axel Masquelin
Description:
'''
# Libraries and Dependencies
# --------------------------------------------
from sklearn.metrics import roc_curve, auc, confusion_matrix
import torchvision.transforms as transforms
import torch.nn.funct... |
e794e1b68b2453316a34e177a1230c297ff34a50e2e38806a655e88e0e51d0da | Python | 6,906 | 180 | #!/usr/bin/env python
"""
DFfeatureselect.py -
First step in the LD feature selection process, select features based on document
frequency.
Marco Lui January 2013
Copyright 2013 Marco Lui <saffsd@gmail.com>. All rights reserved.
Redistribution and use in source and binary forms, with or without modificati... |
f4a93cf4361d6cd1f13b4b41415f76f5e1aa87cd829f0bbbadaabf3381fa0953 | Python | 6,908 | 184 | import tensorflow as tf
from tensorflow.keras import Model
from tensorflow.keras.layers import Activation, Add, Dense, Dropout, Input, \
Subtract
from typing import Union
from ..layers import get_lrp_layer, DenseLRP, StandardLRPLayer
from ..utils import infer_graph_structure, topo... |
d5893d3ad1a18af0de9c17cc08fbd2d6a06f23ea558bb889a6f5bfed211104bd | Python | 6,912 | 162 | """Data intake for real scRNA-seq benchmarks (AnnData / .h5ad).
Turns an AnnData into the plain ``(X, y, var_names, label_names)`` the DeepMapper
runner consumes, and provides the preprocessing parity helpers the paper cases need:
log-normalization, highly-variable-gene selection (to *measure what filtering costs*),
a... |
8cc9b9e997c9b5ed650062e65f0652ab84b49dd500c40522d8488e8aa7ea4a67 | Python | 6,914 | 137 | #############################################################################
# HYBRID SYSTEM SAMPLERS
#############################################################################
from openmm import unit
from openmmtools.multistate import sams, replicaexchange
from openmmtools.states import CompoundThermodynamicStat... |
5fb4ba7f29c3e92be63e6b4f15f8e07a833fa1097608621db1c1226a15706b31 | Python | 6,919 | 203 | """Forward model simulation: phantom + config → simulated measurement."""
from __future__ import annotations
from torch import Tensor
from waveorder.models import (
isotropic_fluorescent_thick_3d,
phase_thick_3d,
shift_variant_fluorescent_3d,
)
from waveorder.phantoms import Phantom
from waveorder.zernik... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.