sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
be6cdb7df2280d0eb99801fd6ad4d6411e4f58403f79713d500df922a4aa4552
Python
5,852
167
import numpy as np import os from matplotlib import pyplot as plt from matplotlib.patches import Rectangle from matplotlib import cm from matplotlib.colors import Normalize colors = cm.tab10(np.linspace(0,1,9)) NO_FLUX_BND = False # This is a boolean variable for no_flux or fixed boundary condition. The fixed boun...
f74b8d423fb21facd964186cc41a2e9f4906d6727e54a06347f6e8eb72b205c1
Python
5,855
180
#!/usr/bin/env python import os import sys from argparse import ArgumentParser import glfw from OpenGL.GL import * import numpy import h5py import pyrr # Assure that python can find the deeprank files: deeprank_root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) sys.path.insert(0, deeprank_root) fro...
5a7cc9d7988c56789b0fdc54c9723a0ef58f345506131e417e12ad8b21a50539
Python
5,857
162
import math import torch import torch.nn as nn import torch.nn.functional as F import torchvision.models as models from collections import namedtuple class SSIMLoss(torch.nn.Module): def __init__(self): super(SSIMLoss, self).__init__() self.register_buffer("kernel", self._cal_gaussian_kernel(11, 1....
e047d773b93ae767bf3d8d8f13db087aa7e49b23f9a7b8fbdad2c264a28f1497
Python
5,860
160
''' JHK Python script for conducting bootstraping for AGMT trend ''' import numpy as np from netCDF4 import Dataset #========================================================== # Set main directory #========================================================== hdir = '/home/jhkim/model/deep_detection' #=================...
1500d2716823d2d96567f1016f5a1cd07a1bd73006167d39840a8b78330b586f
Python
5,866
161
''' adapted from https://github.com/all-umass/ManifoldWarping ''' import numpy as np from scipy.cluster.hierarchy import linkage import pandas as pd from sklearn import decomposition, preprocessing import matplotlib # matplotlib.use("tkagg") # from matplotlib import pyplot from matplotlib.backends.backend_pdf import P...
69c7db3a0d4b0bdcc03e9c9c37cc36b9872e65f47d8318771477981f7c2b646a
Python
5,867
200
import functools import numpy from cellprofiler_core.constants.measurement import ( C_PATH_NAME, C_FILE_NAME, C_URL, C_OBJECTS_FILE_NAME, C_OBJECTS_PATH_NAME, C_OBJECTS_URL, COLTYPE_VARCHAR, COLTYPE_FLOAT, COLTYPE_INTEGER, ) def header_to_column(field): """Convert the field n...
9d2e0a2084f19548d4c0f3b84ebc1be509c0209dbf048643d8dbcda7d897a6d5
Python
5,869
152
import os import sys import traceback from ._reader import Reader from ..constants.reader import ALL_READERS, builtin_readers, BAD_READERS, AVAILABLE_READERS import logging from ..preferences import config_read_typed LOGGER = logging.getLogger(__name__) def add_reader(reader_name, check_svn, class_name=None): ...
4c120e898d3584a96ea2d16b0dfcdf38ac5f2096b86b3ad735e2381a0dee7614
Python
5,874
54
from main import run import sys import subprocess import argparse from itertools import cycle parser = argparse.ArgumentParser() parser.add_argument('--cl_mode', type=str, default='domain', help='The CL paradigm (domain or class).', choices=['domain', 'class'...
0abfc964169847344fb71632fda0597e8b51f1182d756fe4d5b191ca1a4edcb9
Python
5,875
160
''' JHK Python script for calculating internal variability range of AGMT trend ''' import numpy as np from netCDF4 import Dataset #========================================================== # Set main directory #========================================================== hdir = '/home/jhkim/model/deep_detection' #===...
35b01d553a07001c15e51bd3275616dfaed54d603b15fe610d536b1b2de9df64
Python
5,876
153
#!/usr/bin/env python import sys from rdkit import Chem from rdkit.Chem import Descriptors, Crippen, Lipinski from rdkit.Chem import PandasTools import pandas as pd from sklearn.linear_model import LinearRegression from collections import namedtuple class ESOLCalculator: def __init__(self): self.aromatic...
2891c8ca76f0296be04b9d060f434a1a62557842e61cd8674e255199270f040b
Python
5,880
201
#!/usr/bin/env python import os import subprocess as sp import h5py import numpy as np import pdb2sql from deeprank.tools import sparse def visualize3Ddata(hdf5=None, mol_name=None, out=None): """This function can be used to generate cube files for the visualization of the mapped data in VMD. Usage ...
b45375c200104cd12aab3b2c900e9b6cce913adc3beab608fc39f2258da32599
Python
5,882
140
from collections import namedtuple from typing import Any, Tuple import os.path as osp import struct import warnings import numpy as np import numpy.typing as npt import six from ptsa.data.readers import BaseRawReader from .params import ParamsReader class BinaryRawReader(BaseRawReader): def __init__(self, **k...
3197996d00d05f253e6baee55d3997373580397710eb35737ae0636e1b95bfca
Python
5,883
207
# -*- coding: utf-8 -*- # # Early stopping""" # pylint: disable= no-member, arguments-differ, invalid-name import datetime import torch import copy __all__ = ['EarlyStopping'] # pylint: disable=C0103 class EarlyStopping(object): """Early stop tracker Save model checkpoint when observing a performance improveme...
0471aa92d0e9e5ac34a296a8455289bff96acd118a0cd18fded7c9df96a28bc2
Python
5,884
54
from main import run import sys import subprocess import argparse from itertools import cycle parser = argparse.ArgumentParser() parser.add_argument('--cl_mode', type=str, default='domain', help='The CL paradigm (domain or class).', choices=['domain', 'class'...
906358dd7ed08e5469e2254a076b27d81aa5e387c443cffc857be95c2cf56a0a
Python
5,888
111
from torch.utils.data import Dataset class WrapperDataset(Dataset): def __init__(self, dataloader_a, dataloader_b, device, dataset_len_to_use=None): self.dataloader_a = dataloader_a self.dataloader_b = dataloader_b self.dataloader_a_iter = iter(self.dataloader_a) self.dataloader_b_...
18215630c21861bc35b65fde4134ce25bd12d7790dde09836e59f5640f6fc2ff
Python
5,913
145
from pathlib import Path from datetime import datetime import torch from pytorch_lightning.trainer import Trainer from pytorch_lightning.callbacks import EarlyStopping, ModelCheckpoint import numpy as np import torchio as tio from breaststudies.data import BreastDataModule, BreastDataModuleLR, BreastDataModule2D...
708e583f626f8307230fde32ffd4a4842040a7ec32953353ebce47bbb5341bb0
Python
5,914
99
"""Model class template This module provides a template for users to implement custom models. You can specify '--model template' to use this model. The class name should be consistent with both the filename and its model option. The filename should be <model>_dataset.py The class name should be <Model>Dataset.py It im...
6e84e083e516507a25eca404ea84117cf1c6cdd43302ce5a93d306adc8893c78
Python
5,915
146
import torch from torch import nn from functools import partial from timm.models import register_model from braincog.base.node.node import * from braincog.base.encoder.encoder import * from braincog.model_zoo.vgg_snn import * from braincog.model_zoo.base_module import BaseModule, BaseConvModule from braincog.datasets i...
3937536dce3cfff5bf3da89e8045b1cfaecf29f32b64fc376637bb44dfe7c5f6
Python
5,917
192
# pyunicorn documentation build configuration file, created by # sphinx-quickstart on Thu Feb 23 19:15:07 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values ...
d97ba0296b066846371e73856cba0b68eb1603f2c54443670431b0a45747c8ab
Python
5,918
152
#!/usr/bin/env python2 # written by Jin Lee, 2016 import os, sys import json import subprocess import collections import argparse import xlwt parser = argparse.ArgumentParser(prog='ENCODE_summary.json parser for ENCODE QC import', \ description='Recursively find ENCODE_summary.jso...
5b5cbaa4e459d4a0b3d6d2ab0743fa92920f0f0308acac75a46c58d439adfd3e
Python
5,922
121
from .modelBase import ModelBase import monai.networks.nets.dynunet as dynunet def get_kernels_strides(sizes, spacings): """ More info: https://github.com/Project-MONAI/tutorials/blob/main/modules/dynunet_pipeline/create_network.py#L19 When refering this method for other tasks, please ensure that the pat...
a2006980bcc7135afbd0c3a03e862716570a3d49ff4fb1d353fa3b4a7bc9359b
Python
5,926
167
""" Created Aug 28 2019 @author: Nikolai M Chapochnikov This file generates the following results that are then for plotting the model behavior on the ORN dataset: NNC-Y_act-all.hdf NNC-Z_act-all.hdf NNC-W_act-all.hdf The following takes a while, since there are many repetitions, in the scale of tens of mins W_NNC-4....
f12b1bc7e3d1a34e1a5d61b943b82c04226ccb2930af8cbf4d931288e283587c
Python
5,926
169
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 5 15:58:38 2021 @author: filtsem """ from pathlib import Path import numpy as np from matplotlib import pyplot import os import mne import pandas as pd import pickle import matplotlib # Configure the matplotlib figure style FONT = 'Helvetica Ne...
dabe2595545a151f3d93dc3d2902b1a5b9315dae0458ac97206a2007637a948d
Python
5,935
189
#!usr/bin/env python # -*- coding: utf-8 -*- import logging import os import argparse import ast from typing import Optional import yaml import click from deprecated import deprecated from GANDLF.entrypoints import append_copyright_to_help from GANDLF.utils import writeTrainingCSV from GANDLF.cli import copyrightMess...
a44f860e101947cebd76d6a1ff77796af387341dcb073af8e049c1bbc3b41ce7
Python
5,941
173
import PyDSTool import numpy as np import pickle import matplotlib.pyplot as plt from matplotlib.ticker import FormatStrFormatter,ScalarFormatter import matplotlib as mpl from matplotlib.lines import Line2D ''' This script runs the ODE model for different membrane potentials and ADP concentrations, and plots the ATP s...
8678b06e4a0221b2656a7358a469bd05cdd59021472a3b1d0ac0d9721f01eec9
Python
5,945
118
""" Distribution-Balanced Loss Paper: `Distribution-Balanced Loss for Multi-Label Classification in Long-Tailed Datasets` - Tong Wu, Qingqiu Huang, Ziwei Liu, Yu Wang, Dahua Lin, ECCV 2020 - https://arxiv.org/abs/2007.09654 Implemented from the paper formulation, numerically matching the DB configuration of the o...
8c7a71227c57fed63cc21f3bde877d8a8e7150c42ff570622106491addadfe08
Python
5,948
158
""" File name: dataset.py Author: Esra Zihni Date created: 21.05.2018 This file contains the ClinicalDataset class object that is used for working with a given dataset. """ import pickle import numpy as np import pandas as pd from sklearn import preprocessing from sklearn.model_selection import train_test_split fr...
e93606668c13f6f1e36a3c6f44dfeab24f415ba9c73896858455cd289cb19b93
Python
5,948
162
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Oct 5 15:58:38 2021 @author: filtsem This script reads accuracies from Eelbrain output files, takes the average overall all brain sources after smoothing, combined them in pd sturcture and writes to a csv file """ from pathlib import Path import nump...
5c3e44c2d7d0c1e986152f266a76b32631167eff22b827c7317b347f87245d16
Python
5,952
188
import logging import warnings from typing import List, Sequence import pytorch_lightning as pl from pytorch_lightning.loggers.base import LightningLoggerBase import rich.syntax import rich.tree from omegaconf import DictConfig, OmegaConf from pytorch_lightning.utilities import rank_zero_only def get_logger(name=__na...
34fd356cdd02b9a258c3a50b382afb1d47978730a10e8f0480571e8832aed20a
Python
5,956
152
import os from tempfile import mkdtemp, mkstemp from shutil import rmtree import h5py import numpy import torch.optim as optim from nose.tools import ok_, eq_ from deeprank.models.variant import PdbVariantSelection, VariantClass from deeprank.generate.DataGenerator import DataGenerator from deeprank.learn.DataSet imp...
fd5b63a0cf892b7d9ecb9c3ec355a0b1775e11179edbb66155bc3d272aa0f997
Python
5,956
172
""" Module for all Dataset and Generator/Discriminator Classes """ import torch import numpy as np import pandas as pd import matplotlib.pyplot as plt import torch.nn as nn from collections import OrderedDict import torch.nn.functional as F from torch.utils.data import DataLoader import torch.optim as optim import sea...
56d7b814fcd4e724dc822b7a3a98e40151093ed0a617f374698bc699dbcffbaa
Python
5,960
190
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Magnetic field computations. """ import numpy as np from multiprocessing import Pool from itertools import repeat def dipfld_sph(Q, rQ, R, r0): """Compute magnetic field of current dipole in a conducting sphere. Implementation of the Sarvas formula. ...
600bd3071c49ec04aa689dfb2d9684b8fd0c90b81cd5218925888ab403461779
Python
5,967
162
""" Optical flow ============ This tutorial offers a short overview of the optical flow routines available in pysteps and it will cover how to compute and plot the motion field from a sequence of radar images. """ from datetime import datetime from pprint import pprint import matplotlib.pyplot as plt impo...
16fe7f344cad11a2543c37b0f076d1fbfefa4e8002fdbe6b51932c35c5624310
Python
5,969
159
#!/usr/bin/python # EquiPPIS: E(3) equivariant graph neural network for PPI site prediction # # Copyright (C) Bhattacharya Laboratory 2022 # # EquiPPIS is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, eit...
43512ab18f21a4817c53c9c8af6a8d9bc72c5e66926ea756dc606a5674f833ea
Python
5,971
181
""" CBAM (sort-of) Attention Experimental impl of CBAM: Convolutional Block Attention Module: https://arxiv.org/abs/1807.06521 WARNING: Results with these attention layers have been mixed. They can significantly reduce performance on some tasks, especially fine-grained it seems. I may end up removing this impl. Hack...
40a655b26723daa6984d303e89b5dbec60f5eadc915ee7130181fbf11d45ab91
Python
5,976
166
""" Tests for csv2nidm -derivative The derivative activity's software agent must be typed rdf:type prov:SoftwareAgent, because Query.GetDerivativesDataForSubject only follows derivative activities associated with such an agent. Both ways of running csv2nidm are covered: writing a new file (-out) and adding to an exist...
69d149e91dceb8c234b9ff4e4208a3aa3bdfd8b022097f5a17dd46b57bfa34b3
Python
5,976
155
import json from scipy.stats import f_oneway, ttest_rel import matplotlib.pyplot as plt import numpy as np from statistics import mean def get_anova_p_value(wd_645_1400, wd_1400_2500, wd_2500_645): anova_result = f_oneway(wd_645_1400, wd_1400_2500, wd_2500_645) return anova_result[1] def get_t_values(wd_645...
907b37751c14e7f1b79b14169dbb995e29be331fb4de50a365c4234d1082c255
Python
5,982
145
import numpy as np import torch from tests.utils import reset_seed, reset_layers, run_forward_pass from networks.dfc_layer import DFCLayer from networks.dfc_network import DFCNetwork eps = 1e-20 torch.set_default_dtype(torch.float64) def reset_layer(layer): layer._weights.data = torch.randn(*layer.weights.shape)...
8154808552130f34e81408d81ba667760afd18e61560cf68dd8db28ab5353df8
Python
5,985
190
import os import re import sys import tempfile from .hdf5_dict import get_top_level_group from .hdf5_dict import VERSION def get_length_from_varchar(x): """Retrieve the length of a varchar column from its coltype def""" m = re.match(r"^varchar\(([0-9]+)\)$", x) if m is None: return None retur...
f9df6de17b6b0a650cdc77efeb66d4d06f84933c83da66f7cdb9f16207e9d2b6
Python
5,991
184
""" Distributed training/validation utils Hacked together by / Copyright 2020 Ross Wightman """ import logging import os from typing import Optional import torch from torch import distributed as dist from .model import unwrap_model _logger = logging.getLogger(__name__) def reduce_tensor(tensor, n): rt = tenso...
44d2bd4b37e02c7cdce39b2f38093a880dff62005d3e8f1c8c600d5c766324bb
Python
5,994
182
import numpy as np from traitlets import Enum, Integer, default, Float, Bool, Unicode, List from mrHARDI.base.application import (mrHARDIConfigurable, convert_enum, ChoiceList) from mrHARDI.base.dwi import Direction, AcquisitionType...
97b7e3240dab64cabeef658ee468ab80bd246e5a268944b372f4cb1b90c27b50
Python
5,995
153
#!/usr/bin/env python3 """ Checkpoint Averaging Script This script averages all model weights for checkpoints in specified path that match the specified filter wildcard. All checkpoints must be from the exact same model. For any hope of decent results, the checkpoints should be from the same or child (via resumes) tr...
c37345a3c8a189cc291223726b80ec7a95fa7aed228bb2f354c7d87fd7cfe489
Python
6,003
147
import gc import numpy as np import torch import torch.nn as nn from BaseModel.basemodel import BaseModel from DCiPatho_config import Config config = Config() class ResidualBlock(nn.Module): def __init__(self, input_dim, hidden_dim): super(ResidualBlock, self).__init__() self.linear1 = nn.Linear...
bc8a12e79da1e5caf9a4e53c8288a2a68df5bcc79257d89f6de6db6bf71ddbea
Python
6,004
155
import json from scipy.stats import f_oneway, ttest_rel import matplotlib.pyplot as plt import numpy as np from statistics import mean def get_anova_p_value(wd_645_1400, wd_1400_2500, wd_2500_645): anova_result = f_oneway(wd_645_1400, wd_1400_2500, wd_2500_645) return anova_result[1] def get_t_values(wd_645...
a2ee5a73cdaf03a9668bdd9b50199ff20e74fd9e86f93827d7ce1d1ec9645a3d
Python
6,005
217
from abc import abstractmethod from traitlets import Float, Integer from traitlets.config import Bool, Enum, List, Unicode, default from mrHARDI.base.application import mrHARDIConfigurable def _format_response_names(responses): return ["{}_response".format(r) for r in responses] class SphericalDeconvAlgorithm...
74e4ae3a710539c0369cf791b94ba7487233eb979aef0fa2bf7553769f04e2c1
Python
6,009
153
import os from typing import Optional import numpy as np import openslide from GANDLF.data.patch_miner.opm.utils import get_patch_size_in_microns, tissue_mask from skimage.transform import resize from torch.utils.data.dataset import Dataset def get_tissue_mask(image: np.ndarray) -> np.ndarray: """ This functi...
156e8c3221201a8164c63c315f19bd7080a5eaf34f0ff94968eb9eb2f935d927
Python
6,015
168
# -*- coding: utf-8 -*- import matplotlib as mpl from matplotlib.testing.compare import compare_images from tempfile import NamedTemporaryFile, TemporaryDirectory import os.path import pygenometracks.plotTracks mpl.use('agg') ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_dat...
70e06298d6c9be1d98bb9cc98825db8a612ba9e526f1e2d6fefec08c4efe7b10
Python
6,022
149
""" Selective Kernel Convolution/Attention Paper: Selective Kernel Networks (https://arxiv.org/abs/1903.06586) Hacked together by / Copyright 2020 Ross Wightman """ from typing import List, Optional, Tuple, Type, Union import torch from torch import nn as nn from .conv_bn_act import ConvNormAct from .helpers import...
3a8f35b2c2f7eb286a3de5854417994d5e472657b080c582a6a617a2b7521d9b
Python
6,032
161
# # coding=utf-8 # #TODO: this file uselss until CellProfiler/CellProfiler#4684 is resolved # """omerologin - dialog box to capture login credentials for Omero # """ # from cellprofiler_core.bioformats import formatreader # import wx # from cellprofiler_core.preferences import ( # get_omero_server, # get_omer...
a6f777a0fff9651f9e42741eb9a4439c0ccdd2088bee825fd63de9e9cc0d6485
Python
6,037
161
# coding=utf-8 # Copyright 2020 The SimCLR Authors. # # 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...
6e71a5f02c137cce01d3668925c69827ed4c1633e68f27c7dc02601ec2f9d914
Python
6,039
220
from matplotlib import pyplot as plt import ray import os import wntr import numpy as np import networkx as nx import pdb import os from DT_for_WDN_leak_localization.generate_data import simulate_WDN from DT_for_WDN_leak_localization.inference.prior import get_prior from DT_for_WDN_leak_localization.network import WDN...
79be7a8c38f9197c480315a80349ce7e1eea1e5662ebbb607acd03f9657afae1
Python
6,039
130
#Created by P-NET https://github.com/marakeby/pnet_prostate_paper #Modified by Yunjie Liu import sys from os.path import join, dirname, realpath current_dir = dirname(realpath(__file__)) sys.path.insert(0, dirname(current_dir)) import os import imp import logging import random import timeit import datetime import numpy...
f34775eaad77f0b816646f5995f606b92efce957af559f86d25dda64ba50b6ee
Python
6,044
157
import json from scipy.stats import f_oneway, ttest_rel import matplotlib.pyplot as plt import numpy as np from statistics import mean def get_anova_p_value(wd_645_1400, wd_1400_2500, wd_2500_645): anova_result = f_oneway(wd_645_1400, wd_1400_2500, wd_2500_645) return anova_result[1] def get_t_values(wd_645...
b79d71ed8f83abaa083e33b4fe371280ffae7490d75082a70e658589842cf79c
Python
6,046
193
"""Tests for the CUDA implementation of multi-target.""" # pylint: disable=too-many-positional-arguments,missing-function-docstring from typing import Any, Callable, Dict, Optional import numpy as np import pytest from hypothesis import given, note, settings, strategies import xgboost as xgb from xgboost import buil...
1d83afaf38cec970becd2237a87b4923c00aa10daab5eb22ce2632227d6c5212
Python
6,047
231
import os import matplotlib as mpl import matplotlib.pyplot as plt import numpy as np import pandas as pd import seaborn as sns from load_transform_results import ( load_idiff_matrices_results, load_transform_results_suppl_8, ) ############################################################################## # C...
5c6803df9aab0199867cd52cdd77b873fa382df7a82afd0ad80d1f0b44c31433
Python
6,064
153
import numpy as np from scipy.stats import halfnorm from configuration import default_priors, default_lower_bounds, default_upper_bounds, default_points_of_jump def sample_scale(alpha=default_priors["scale_alpha"], beta=default_priors["scale_beta"], rng=None): """Generates 3 random draws from a beta prior over th...
d0da25fa5f89a2c2ee07cf3794d4a3823e96ba76a5b9525544fd325e17a13daf
Python
6,067
175
from enum import Enum from traitlets import Integer, Float from traitlets.config import Bool, Instance, default, List from traitlets.config.loader import ConfigError from mrHARDI.base.application import (BoundedInt, DictInstantiatingInstance, ...
70781529bb316b2f65f05ca2aa5c1e4552d64ef3b7a865422d97e41d89ce8a28
Python
6,073
184
import torch import torch.nn as nn from einops import rearrange, repeat from braincog.base.strategy.surrogate import GateGrad class AutoEncoder(nn.Module): def __init__(self, step, spike_output=True): super(AutoEncoder, self).__init__() self.step = step self.spike_output = spike_output ...
793f96f03ea4b522ebab2cc24342b4a26c6e7f7f3b1f27170f5a8a3aab97a411
Python
6,076
158
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
e852a0771f1592876f327335e637f57d0545439b738e12b6815d26db0c4512be
Python
6,076
143
import cv2 import numpy as np import matplotlib.pyplot as plt import torch from torch.utils.data import TensorDataset, DataLoader import pandas as pd import matplotlib.pylab as plt from matplotlib.collections import LineCollection from pytorch_grad_cam import GradCAM from vajiraGAN_original import Pulse2pulseDiscrimi...
993ff5353e5b8208015906dd3f492ff6fc4ec3c0aaf702d26849dd717fd0804c
Python
6,078
172
import matplotlib import matplotlib.backend_bases import matplotlib.backends.backend_wxagg import wx import wx.lib.intctrl from ..constants.figure import NAV_MODE_ZOOM from ..constants.figure import NAV_MODE_MEASURE from ..constants.figure import BMP_MEASURE from ..constants.figure import NAV_MODE_PAN from ..constants...
9a03acd6d1a3157fceea9c984bc452b638062ef87486d0b40feaca0db9b0f0a7
Python
6,078
169
""" This file is subject to the terms and conditions defined in file 'LICENCE', which is part of this source code package. Author: Leo Guignard (leo.guignard...@AT@...univ-amu.fr) """ import json from sc3D import SpatialOmicArray from qtpy.QtWidgets import QWidget, QVBoxLayout, QTabWidget, QPushButton from magicgui im...
aff3a6f0fe1fd641e824e45eeeafd9a75f97c48a75ce7e418e8c150e45dca057
Python
6,080
175
# Copyright (c) OpenMMLab. All rights reserved. import argparse import os import warnings import pickle as pkl from numbers import Number import numpy as np import torch from apis import single_gpu_test from datasets import build_dataloader, build_dataset from models import build_model from utils import (auto_select...
d72f30b08af62fc25b0600e7d2ad0fe616182b073bcc337999f504d5cd275188
Python
6,080
161
import json from scipy.stats import f_oneway, ttest_rel import matplotlib.pyplot as plt import numpy as np from statistics import mean import argparse from utils import timer def get_anova_p_value(wd_645_1400, wd_1400_2500, wd_2500_645): anova_result = f_oneway(wd_645_1400, wd_1400_2500, wd_2500_645) return an...
9b8ed3872131791bf32720dd685a3cc6ed3141e830fa86c8669fc8e576ed7299
Python
6,082
112
"""General-purpose training script for image-to-image translation. This script works for various models (with option '--model': e.g., pix2pix) and different datasets (with option '--dataset_mode': e.g., np_array_aligned, ). You need to specify the dataset ('--dataroot'), experiment name ('--name'), and model ('--model...
9eedfe791e1c4049193fed4a974e91a0536cf756a141cdc5caa190f47ddc565c
Python
6,082
181
import abc import torch from .event_handling import find_event from .misc import _handle_unused_kwargs class AdaptiveStepsizeODESolver(metaclass=abc.ABCMeta): def __init__(self, dtype, y0, norm, **unused_kwargs): _handle_unused_kwargs(self, unused_kwargs) del unused_kwargs self.y0 = y0 ...
1716d8e8bbbd2e3da471b394d86facb9d0d551b8a3d717373a712804f92703be
Python
6,095
160
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
7fb08e03af0333ee3c6ce596978669861b299c8ca4b24d09764e7ff312d8014c
Python
6,096
170
import torch import torch.optim as optim import torch.nn.functional as F from torch.autograd import Variable from model import ADDSTCN import random import pandas as pd import numpy as np import heapq import copy import os import sys def preparedata(file, target): """Reads data from csv file and tran...
950ceadaca62d5e592480549ff7316f18710cd31f6bca2f1bf2df73494e4c366
Python
6,098
134
import tensorflow as tf import tqdm.auto as tqdm from .architecture import neurite_classifier from .data import prepare_dataset def train_wt_vs_cko(train_image_dir='TrainImages', validation_image_dir='ValidationImages'): """This method trains the model to distinguish between wild-type and C-KO images.""" tra...
ac9dfc91d08b4014d1c79f1fba20e6595f7fa1f2931a3a0656f2a1be81f5e33b
Python
6,104
213
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
e6d0ac03127cf2e69f3cf1f3f0d4cfadbc0b7f10852f5e6e885da72771e070fd
Python
6,116
155
import os from pathlib import Path from typing import Optional import pandas as pd import torch from GANDLF.utils import get_unique_timestamp import lightning.pytorch as pl from GANDLF.models.lightning_module import GandlfLightningModule from GANDLF.data.lightning_datamodule import GandlfInferenceDatamodule def Infe...
b094037a918c53184c134afd6fbd845ae9c598e82503b20b02edb46080eb7920
Python
6,121
178
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
f57b3580221e7ab1016ea86ea09026fcf2ec7bf2d4023ba9da203f2e1991e53a
Python
6,132
191
import matplotlib matplotlib.use('Agg') import numpy as np from netCDF4 import Dataset import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap import os #========================================================== # Set main directory #========================================================== hdir = '...
269fa588b7e06f15ced297766288b6f7b6690c20c0592cf3e70b4865bf3bc3fb
Python
6,137
179
"""Run simple cell optimisation""" """ Copyright (c) 2016, EPFL/Blue Brain Project This file is part of BluePyOpt <https://github.com/BlueBrain/BluePyOpt> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License version 3.0 as published by t...
7a55f0420ef87e585bcbace604c3b928c7a5257a276ab8b4e721e89646888787
Python
6,137
189
#!/usr/bin/env python3 import sys from mrHARDI.base.application import mrHARDIBaseApplication def cast_unicode(s): if isinstance(s, bytes): return s.decode(sys.stdin.encoding, 'replace') return s class mrHARDIApplication(mrHARDIBaseApplication): @classmethod def launch_instance(cls, argv=N...
b952ead5e05e2463f2573cb2e59e684289f6ed21842f9f3449f09331c85e10d1
Python
6,141
183
import pickle import sys import nibabel as nib import numpy as np from dipy.segment.mask import crop from scipy.linalg import qr, lu from traitlets import Unicode, Any, Dict from mrHARDI.compute.utils import voxel_to_world, world_to_voxel from mrHARDI.base.application import (mrHARDIBaseApplication, ...
625e9a37b74e205b643f88a05c915988f95a9b1ca4aab30b657291fdf42d7a5f
Python
6,153
123
""" Implements compartmental model of a passive cable. See Neuronal Dynamics `Chapter 3 Section 2 <http://neuronaldynamics.epfl.ch/online/Ch3.S2.html>`_ """ # This file is part of the exercise code repository accompanying # the book: Neuronal Dynamics (see http://neuronaldynamics.epfl.ch) # located at http://github.c...
68f53c3c22513caaaaccd3ba85c4c07d1fb4d0cd4b9ec95e3ffc856f8187df7d
Python
6,156
189
from __future__ import annotations from pathlib import Path from click.testing import CliRunner import pytest from nidm.experiment.tools.nidm_linreg import linear_regression def test_simple_model(brain_vol_files: list[str]) -> None: runner = CliRunner() with runner.isolated_filesystem(): r = runner.in...
a1f71029aed55071b6a25249f16cdf660ebd029c788a07eb1c4b8312ced0b9cf
Python
6,160
121
import tensorflow as tf import numpy as np import tensorflow_probability as tfp from tqdm import tqdm def KL_annealing(step, reset_pos=10000, split=0.5, lower=0.0, upper=1.0, type='linear'): # Fu, Hao, et al. "Cyclical annealing schedule: A simple approach to mitigating kl vanishing." arXiv preprint arXiv:1903.10...
739fcef173fecf7a483a1cd8fdfda227ecdf3ea92f89e4c3fd3d49b181c32a5b
Python
6,164
160
import os import shutil import csv import sys # creates CSV with tidy CNN results def findMax(line): ind = 2 m = 0 for i in range(2, len(line)): if(float(line[i]) > m): ind = i m = float(line[i]) return [ind, m] def findMax_class(class_dict): aa_class_name = "" max_class_freq = 0 # max ...
0196928089d3c9c02b4313923d756eccd66242b0f5ca289c5c3eb102086b6dc0
Python
6,166
146
# -*- coding: utf-8 -*- """Classes for data augmentation of SMILES. Adapted from pysmilesutils """ from abc import abstractmethod from random import shuffle from typing import Any from typing import Iterable from typing import List from typing import Union import numpy as np from rdkit import Chem Mol = Chem.Mol...
3720319155fcd66aaf57433110844f1f58b53c84580ebccf4003a514c4047b5a
Python
6,169
203
import torch import argparse import torch.nn as nn import torch.nn.functional as F from rdkit.Chem import AllChem import pandas as pd from rdkit import Chem from rdkit import DataStructs import numpy as np import matplotlib.pyplot as plt import math import random import os from tqdm import tqdm import sys import numpy...
991161a798af3a633eb27b74d39fb0744c4179123543c9d9cb378344a810d4b4
Python
6,170
124
""" ONNX export script Export PyTorch models as ONNX graphs. This export script originally started as an adaptation of code snippets found at https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html The default parameters work with PyTorch 1.6 and ONNX 1.7 and produce an optimal ONNX graph for h...
a072d92a178215a53e7fe14f47973ade300ba30dacad47661773e04dc637a1bd
Python
6,170
167
from os import listdir from os.path import join, isfile from scipy import misc import numpy as np import random from ipdb import set_trace as st from math import ceil import copy import time from PIL import Image class pet(): def __init__(self): super(pet, self).__init__() def name(self): ...
b39d5cde2e784c57fa26ce7032390b1813b4b8d5290e7a2f3f63c45b529acf9d
Python
6,171
203
import torch import argparse import torch.nn as nn import torch.nn.functional as F from rdkit.Chem import AllChem import pandas as pd from rdkit import Chem from rdkit import DataStructs import numpy as np import matplotlib.pyplot as plt import math import random import os from tqdm import tqdm import sys import numpy...
f0b8615f46447d6b865e9df5c36843e9939305a336a573625c42ca06ac21fd5e
Python
6,172
198
"""Tests related to the `DataIter` interface.""" from typing import Callable, Optional import numpy as np from xgboost import testing as tm from ..compat import import_cudf, import_cupy from ..core import DataIter, DMatrix, ExtMemQuantileDMatrix, QuantileDMatrix from .utils import predictor_equal def run_mixed_sp...
e0dfead09d19afeef70446751fbf2cde0b2308cb176a8e84e80b431ad5798861
Python
6,173
155
import sys import numpy as np import torch import torch.nn as nn from numpy import prod from torch.distributions.beta import Beta import torch.nn.functional as F sys.path.append("..") import utils spike_args = {} class Net(torch.nn.Module): def __init__(self, args, inputsize, taskcla, nlab, nhid=...
3e2ba0daf426783a0a2a11e7c6a00a795ff85f1865c29ddb9a2592fd75bd937e
Python
6,175
197
import logging import os from pathlib import Path from typing import Optional, Sequence, Tuple, Type, Union import numpy as np import pandas as pd from imctools.io.ometiff.ometiffparser import OmeTiffParser logger = logging.getLogger(__name__) def get_metals_from_panel( panel_csv_file: Optional[Union[str, Path...
c3fcad3629425728e83f54eb4f9c1d2dc1144c17b16d7438d9a33283ebf78f70
Python
6,180
152
""" File name: evaluate_models_performance.py Author: Esra Zihni Date created: 21.05.2018 This is the main script to evaluate models performance. It reads the implementation and path options from the config.yml script. It loads the training and test sets, loads the specified trained model(s) and calculates the train...
020c30c9763d770cbf1a0ed44f2ea6ff803473f725ef5d8ca0a1e7adc78058a4
Python
6,181
164
import torch from torch.autograd.functional import vjp from .dopri5 import Dopri5Solver from .bosh3 import Bosh3Solver from .adaptive_heun import AdaptiveHeunSolver from .fehlberg2 import Fehlberg2 from .fixed_grid import Euler, Midpoint, RK4 from .fixed_adams import AdamsBashforth, AdamsBashforthMoulton from .dopri8 i...
93e69998ab7d72ec6a9fa31aa434a512eb83cb0bb225d355733977edd345ab11
Python
6,186
195
''' JHK Python script for generating ED figure 6. ''' import matplotlib matplotlib.use('Agg') import numpy as np from netCDF4 import Dataset import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap import os #========================================================== # Set main directory #=============...
14dc008acd3d33d5cbcdad2ca79e3d98dcea00b8b5781486eaa2ba4359e506c7
Python
6,191
147
from pathlib import Path import pytest import torch from timm.utils.checkpoint_saver import CheckpointSaver # torch < 2.5 (no safe_globals) can't load training checkpoints (floats, argparse.Namespace) with weights_only=True needs_checkpoint_load = pytest.mark.skipif( not hasattr(torch.serialization, 'safe_global...
e2bb889de77af3961ba079ab32c16931359a9f41718d02082090d18f105eae4e
Python
6,196
192
import os import pickle import time import numpy as np import torch from torch.utils.data import Dataset class Gesture_pre(Dataset): def __init__(self, train_or_test, transform=None, target_transform=None): super(Gesture_pre, self).__init__() roots = '../../Dataset/DVSGesture' ...
9a91953d1af1cbb0926a08e0716646b811b4d9a7663f97fed19f185ca24e34fe
Python
6,198
156
#!/usr/bin/env python2 # written by Jin Lee, 2016 import os, sys import json import subprocess import collections import argparse parser = argparse.ArgumentParser(prog='ENCODE_summary.json parser for ENCODE accession', \ description='Recursively find ENCODE_summary.json, parse it ...
06a92834269d23aae292cce8dc2d6755105a22e55eeee85442ee26cbbdd5f0be
Python
6,200
183
import numpy as np import pandas as pd from sklearn.preprocessing import OneHotEncoder, OrdinalEncoder from ..data.hcp_aging_pheno.load import load_hcp_aging_pheno from ..data.hcp_ya_pheno.get_data import load_behavioural_data, load_fd_data def prepare_confound_names(dataset, target): """Name of confounds select...
20fbf0a0181a9e2fc92244a08138b6a7ef8a13987e4b6f3b8ecf63f923676fee
Python
6,201
130
#!/usr/bin/env python """ BIDS Terms -> NIDM-Exp Mappings @author: David Keator <dbkeator@uci.edu> """ from . import Constants # BIDS dataset_description -> NIDM constants mappings dataset_description = { "BIDSVersion": Constants.BIDS["BIDSVersion"], "Name": Constants.NIDM_PROJECT_NAME, "Procedure": Consta...
f8d14cfe4a73924041a12701dda4e32a763dfafaf12ac6da7f336a1733092028
Python
6,201
204
from torch import nn from torch.autograd import Function import torch.nn.functional as F import torch """ Other possible implementations: https://github.com/KrisKorrel/sparsemax-pytorch/blob/master/sparsemax.py https://github.com/msobroza/SparsemaxPytorch/blob/master/mnist/sparsemax.py https://github.com/vene/sparse-...
94baa327d493792785e15b092d9a8ba561b9ce8f8e772f96203387f64016e8a0
Python
6,215
177
import argparse import os import warnings from pathlib import Path import pandas as pd import pytorch_lightning as pl import torch import yaml from torch.utils.data import DataLoader from classifier import ClassifierLightning from data import MILDataset, get_multi_cohort_df from options import Options from utils impo...
8c87f342f536215b49f653fbefcf4ca07247cca6f52a8321ed60254ac761f672
Python
6,221
175
#!/usr/bin/env python3 """ Tries to match the preprocessing described in "Functional connectome fingerprinting: identifying individuals using patterns of brain connectivity". i.e. generates an eroded white matter mask, eroded CSF mask, and calculates mean time courses in the white matter and CSF. May also calulate the...
d21fd8a62a3ce278e535c670b28af0e03d7d8bf45b39be4cb13a4ef010cf2863
Python
6,223
226
from __future__ import division from matplotlib.mlab import find from scipy.stats import * from scikits import bootstrap import seaborn as sns from matplotlib.pylab import * from numpy import * import numpy as np import bz2 set_printoptions(precision=4) sns.set_context("talk", font_scale=1.4) sns.set_style("ticks") ...