sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
e4cd4b64c7c6a36df3b48158a84706fd48b239d84f1a6fe80a1eea68b42f9a55 | Python | 5,503 | 112 | import torch
from e2vid.utils.loading_utils import load_model, get_device
import numpy as np
import argparse
import pandas as pd
from e2vid.utils.event_readers import FixedSizeEventReader, FixedDurationEventReader
from e2vid.utils.inference_utils import events_to_voxel_grid, events_to_voxel_grid_pytorch
from e2vid.util... |
c6f6ee6ee10ea26fdae1e8dcd65665c97b0c31ce5d4b55ec3ecbbb773d32254a | Python | 5,506 | 127 | #!/usr/bin/env python3
"""
ClinicalASL - Clinical Arterial Spin Labeling processing pipeline
Main pipeline script for processing ASL MRI data.
Repository: https://github.com/JSIERO/ClinicalASL
Author: Jeroen Siero
Institution: UMC Utrecht (University Medical Center Utrecht), The Netherlands
Contact: j.c.w.siero@umcut... |
8917d2c6a7cac75580815d25f0e216b1bd9fef176bde0e697e339a9e8e775f64 | Python | 5,511 | 111 | """
DeepLab v3 models based on slim library.
Ref: https://github.com/rishizek/tensorflow-deeplab-v3/blob/master/deeplab_model.py
"""
"""DeepLab v3 models based on slim library."""
import tensorflow as tf
from model.resnet import resnet_v2_50, resnet_v2_101, resnet_arg_scope
from tensorflow.contrib import lay... |
25baa36b0f7d51144534ba2d73c983c8f752ed5c332c9ddcc6e407822d584326 | Python | 5,530 | 128 | import torch
import torch.nn.functional as F
from torchvision import models, transforms
from PIL import Image
from tqdm import tqdm_notebook
import numpy as np
import scipy.stats as st
from utils import load_ground_truth, Normalize
##define TI
def gkern(kernlen=15, nsig=3):
x = np.linspace(-nsig, nsig... |
82800b5e5a3590af9b6eeedf7f97eedf1f298d53860e58ce18c03a7f992bbc75 | Python | 5,530 | 154 | from os import getcwd
from os.path import basename, join
import numpy as np
from traitlets import Bool, Dict, Instance, Unicode, Int
from traitlets.config.loader import ArgumentError, ConfigError
from mrHARDI.base.application import (mrHARDIBaseApplication,
mask_arg,
... |
e83b1c07a2052cb2677a62cd6fcc468f7bd83561990c979497ab2b91301921ec | Python | 5,538 | 135 | #!/usr/bin/python3
def de(dg, dt, dc, bs=0, **ka):
"""Performs differential expression analyses for all genes against all groupings.
Allows multiple options to treat other groupings when testing on one grouping.
Performs parallel computation with multiple processes on the same machine.
Model for differential e... |
6fb788836addd2c26e258370307a3b5f5a3fda57f91370b7ce6d60dc2509b6a5 | Python | 5,541 | 157 | import pytest
from ..redcap2reproschema import process_row
from ..redcap_mappings import REDCAP_COLUMN_MAP
def update_keys(data):
"""Update keys in the dictionary to match the expected keys in the reproschema"""
# Add default value for "Field Label" if it is not present
if "Field Label" not in data:
... |
4e2c2005b52f93982d7b7c4ded56e6d81bd9f27dc4cab2adbac951895d7c7d46 | Python | 5,542 | 141 | import logging
import os
import numpy
from scipy.spatial import distance_matrix
from deeprank.models.pair import Pair
from deeprank.models.atom import Atom
from deeprank.models.residue import Residue
from deeprank.config import logger
_log = logging.getLogger(__name__)
def get_pdb_path(pdb_root, pdb_ac):
for... |
21324083a6b2e267aab3205fef96f1e7b5ef68a5f3aca234927aa8c216d271c4 | Python | 5,545 | 175 | import json
import math
import os
import re
from collections import Counter
import demoji
import textstat
from googletrans import Translator
from nltk.corpus import stopwords
from nltk.sentiment import SentimentIntensityAnalyzer
from textblob import TextBlob
from tqdm import tqdm
demoji.download_codes()
translator = ... |
03169771393c5c874c1e44d2a9c81a7f9e5303b31a821d7f4501d283b867300b | Python | 5,546 | 145 | # -*- coding: utf-8 -*-
from __future__ import division
from . BedGraphTrack import BedGraphTrack
from . GenomeTrack import GenomeTrack
import json
from matplotlib.patches import Rectangle
from matplotlib.collections import PatchCollection
from matplotlib import cm
import numpy as np
class EpilogosTrack(BedGraphTrack... |
57f5b1317de1e3e751b4eb3815694607698ff16c838b60584c5b792fda3aa205 | Python | 5,551 | 191 | """Copyright 2024-2026, XGBoost contributors"""
import json
from pathlib import Path
from typing import Type, Union
import numpy as np
import pytest
import xgboost as xgb
from xgboost.compat import is_dataframe
pl = pytest.importorskip("polars")
def test_type_check() -> None:
df = pl.DataFrame({"a": [1, 2, 3]... |
fd58888e214acb992d21a373d4453a45cab365b6208dd78b930c722f6d86be8f | Python | 5,555 | 163 | # -*- coding: utf-8 -*-
"""
Implementation of Fully Convolutional Network - FCN
"""
import torch.nn.functional as F
import torch
from GANDLF.models.seg_modules.DownsamplingModule import DownsamplingModule
from GANDLF.models.seg_modules.EncodingModule import EncodingModule
from GANDLF.models.seg_modules.FCNUpsamplingMo... |
5c610fe63f36147c6d2529500e79f90990d012b0e491c8cbe817bda64357902d | Python | 5,556 | 175 | import collections
import logging
from cellprofiler_core.constants.measurement import RESERVED_METADATA_KEYS, \
C_MONOCHROME, C_RGB, C_TILE, C_URL, \
C_SERIES, C_C, C_Z, C_T, C_INDEX, C_SERIES_NAME
from cellprofiler_core.pipeline import ImageFile
LOGGER = logging.getLogger(__name__)
class ImagePlane:
""... |
fe5880fb379c5738d3f3c019d9b6277e847e502e356de61c54a31abff6116c69 | Python | 5,566 | 202 |
import os
import pandas as pd
import numpy
import matplotlib.pyplot as plt
import numpy as np
from matplotlib.ticker import FormatStrFormatter
from statistics import mean
import math
import statistics
from sklearn.metrics import r2_score
import argparse
class predict_process():
def __init__(self, loss_df_name)... |
5f1f8823a997d6dd933e933dbff9d09da4e1568e759c95102d888684efa5b777 | Python | 5,568 | 118 | from typing import Iterable
import os
import argparse
import numpy as np
import torch
import matplotlib
from matplotlib import pyplot as plt
matplotlib.use('agg')
from util import InteractionIoHandler, SampleIoHandler, set_args
def get_name_list(args,
sample_io_handler: SampleIoHandler):
if ar... |
0397eafd7d498bd133e421deab2afe9d6424d8d43e6ce1ffa688642bcea2e144 | Python | 5,571 | 190 | # -*- coding: utf-8 -*-
#
# CellProfiler documentation build configuration file, created by
# sphinx-quickstart on Fri Jul 14 15:40:03 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.
... |
fb65db2e6464428b2c3a96425341efbd65ae29b79faba384fc17f61de1e860d9 | Python | 5,571 | 191 | #!usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import ast
import logging
import click
from deprecated import deprecated
from GANDLF.cli import preprocess_and_save, copyrightMessage
from GANDLF.entrypoints import append_copyright_to_help
from GANDLF.utils import logger_setup
def _preprocess(
config... |
294f8fdfa468198e82fb9badb4726e79089bb46e1c654dfd0c8bbea4d137315d | Python | 5,572 | 139 | """Pure-Python time-domain Morlet wavelet generator.
This module is a line-by-line port of the wavelet-construction loop in
``MorletWaveFFT::init`` (in ``ptsa/extensions/morlet/morlet.cpp``).
It exists as an independent reference implementation that PTSA's
FFT-based C++ kernel can be validated against, and as the back... |
6d87ea015877bc011831c9755d1f4ce773884d6130b62f48d48daca4b1a5246b | Python | 5,572 | 178 | #!/usr/bin/env python2.7
# Author: Jason Buenrostro, Stanford University
# The following program will compress daisy chain seq data into singe molecules
##### IMPORT MODULES #####
# import necessary for python
import os
import re
import sys
import gzip
import string
import Levenshtein
from optparse import OptionParse... |
b521e1b89831f1c96c0f4961ef0b0160bfb6fde042bb58c52214449e93b4aa59 | Python | 5,572 | 154 | import logging
from .._setting import Setting
from .._validation_error import ValidationError
LOGGER = logging.getLogger(__name__)
class Range(Setting):
"""A setting representing a range between two values"""
valid_format_text = '"%s" is formatted incorrectly'
def __init__(self, text, value, minval=No... |
cd809d81a4819617296f5f453519115f849d06ca15f2fcb8771060cc8d3e3b63 | Python | 5,573 | 126 | import math
import torch
from torch.utils.data import Sampler
import torch.distributed as dist
class OrderedDistributedSampler(Sampler):
"""Sampler that restricts data loading to a subset of the dataset.
It is especially useful in conjunction with
:class:`torch.nn.parallel.DistributedDataParallel`. In suc... |
0eed88e39255c35481c1169527f5a4932ee24dabe2239d8a62639ff6da768569 | Python | 5,577 | 170 | import torch
from abc import abstractmethod
class Runner:
"""
"""
def __init__(self,):
self._model_name = 'Runner'
@property
def model_name(self) -> str:
"""str: Name of the model, usually the module class name."""
return self._model_name
@property
def rank(self) -... |
3fe12677fae46c0a6393cd90946e91fea884615aa57eacca11acf8ee7af90c73 | Python | 5,579 | 184 | # study: .sqlite3
# neutral_loss: 132.0420
# abs_mz: False True
# PPM: 20.0
# RT_TOL: 0.5
# output: .features
import sys
import time
import bisect
import sqlite3
start_time = time.time()
__version__ = "0.5"
class Thing:
def __getitem__(self, key):
return getattr(self, key)
def __setitem__(self, key... |
33f6bbcbd2ec431eaf7d0f1dd5d0cb97485815ae1b1a73c7557c5662ecab6e8c | Python | 5,582 | 109 | """
Convert weights from https://github.com/google-research/nested-transformer
NOTE: You'll need https://github.com/google/CommonLoopUtils, not included in requirements.txt
"""
import sys
import numpy as np
import torch
from clu import checkpoint
arch_depths = {
'nest_base': [2, 2, 20],
'nest_small': [2, 2... |
7c91ce8a90d08f12e15396d94919a101e0aa4a9823fbf525ba7f393f55c06ae1 | Python | 5,590 | 126 | from __future__ import absolute_import
from __future__ import print_function
__version__ = "$Revision$"
import numpy
import struct
import unittest
import time
import centriole.propagate
from centriole import _propagate
# class Test_Propagate(unittest.TestCase):
# def test_01_01_test_convert_to_ints(self):
# ... |
16d92edb135316320e2b43e064ba6c703cd61ce30d87dfc9205fbfd9dca3d26a | Python | 5,597 | 171 | """
pysteps.feature.shitomasi
=========================
Shi-Tomasi features detection method to detect corners in an image.
.. autosummary::
:toctree: ../generated/
detection
"""
import numpy as np
from numpy.ma.core import MaskedArray
from pysteps.exceptions import MissingOptionalDependency
try:
impo... |
4f6910af5d172ccf97cdbde0295d682b1002ef86460da47de6c05cd446401ddd | Python | 5,597 | 151 | from __future__ import annotations
import json
from pathlib import Path
from typing import Any
import pytest
from datamonger import Registry, _api, cite_data, data_info
from datamonger.errors import UnknownDatasetError, UnsupportedRegistryError
REFERENCES = [
{"citation": "Dataset deposit.", "role": "dataset", ... |
930943e29c9078520c2dc8d886ab3cf03f12fa044f0668ddb2cf521dd2d6dead | Python | 5,601 | 182 | import numpy
import pkg_resources
import os
from pdb2sql import pdb2sql
from nose.tools import ok_
from deeprank.operate.pdb import get_residue_contact_atom_pairs, get_atoms, is_xray
def test_xray():
for path in ["test/data/pdb/101M/101M.pdb", "test/data/pdb/1CRN/1CRN.pdb", "test/data/pdb/1MEY/1MEY.pdb"]:
... |
5a32880474dc859c04b10d0df445f22f9cec40c52f1d640442759935f9800283 | Python | 5,603 | 176 | # -*- 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... |
11837f82daf08855d9b6936d5b0835dc2a46ee449356bd85ba5c487fdb960da9 | Python | 5,604 | 179 | # -*- coding: utf-8 -*-
"""Analyze uncertainty of motion field with increasing lead time. The analyses
are done by comparing initial motion fields to those estimated in the future.
For a description of the method, see :cite:`BPS2006`."""
import argparse
from datetime import datetime, timedelta
import pickle
import num... |
5e30c679487e6e2c538055c75582f3daefcdf4a235a990eaf47ecf70074044d1 | Python | 5,611 | 126 | """
Author: "Keitaro Yamashita, Garib N. Murshudov"
MRC Laboratory of Molecular Biology
This software is released under the
Mozilla Public License, version 2.0; see LICENSE.
"""
from __future__ import absolute_import, division, print_function, generators
import unittest
import numpy
import pandas
import json
impor... |
d938eb0915e2c987565ef2e1c10c5fe5e124672f4a288d7d63b6a9422cb77603 | Python | 5,611 | 151 | import numpy as np
from scipy.signal import find_peaks
import http.client
import json
import pandas as pd
import os
import sys
# Define a threshold [0-1] when events should be detected based on the prediction probability
# Increase min_peak_threshold if ghost events appear
# "Real" IC/FO events should be > 0... |
5bbb7ac588a7b30c222a38c91ef0f5bfad3b4201a3f5a669e7dea8664e3d8c29 | Python | 5,614 | 175 | """
created in 2019
@author: Nikolai M Chapochnikov
Calculating the significance of the relationship between
M and sqrt(W.T*W)
This files doesn't save any data, one should just use the significance values
that are printed in the prompt
"""
#%%
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
... |
e5f3ae53cd0899fa604337daf2c13e6c4a6208e58d1b260db312c42c4eb61b7f | Python | 5,614 | 140 | 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
'''
ANT flux at steady state. This script generates the figure 4b in the paper
08.11.23
GCG
'''
params = {'axes.... |
3472fe436ca6c6ca86abc1a5bdb303dfe496535c2d48146a0b965cdcf9290ab2 | Python | 5,619 | 201 | #!/usr/bin/env python
# coding: utf-8
# # ANOVA over all DBS configurations for a specific walking test
# What we are roughly doing in this notebook:
# ```
# for each paradigm (fast, free,...):
# for each patient:
# for each gait parameter (stride legnt, gait speed, ...):
# if there are significant ... |
1873c60a6c8ac0533c86bf14db79e15e55b66ab351ac9fa6e9f3c0f994fc08e0 | Python | 5,620 | 121 | from pathlib import Path
import rvt.tile
import rvt.vis
import rvt.default
import numpy as np
# pytest rvt.tile.save_rvt_visualization_tile_by_tile
dem_path = Path(r"test_data\TM1_564_146.tif")
default_values = rvt.default.DefaultValues()
default_values.tile_size = (100, 100)
default_values.tile_size_limit = 100*100
... |
357defc42e61683685423416097aeb48ea2bab65772ee8feadaa6e1e2e316ef6 | Python | 5,622 | 185 | from __future__ import annotations
import json
from collections.abc import Iterator
from pathlib import Path
import pytest
from datamonger import (
BUNDLED_REGISTRY,
Registry,
active_registry,
fetch_data,
set_registry,
)
from datamonger.errors import RegistryError, UnknownDatasetError
@pytest.f... |
fa8233ca13868d87961ee914a581479e080a1b6da1d1790a5a0e99d6d13a9996 | Python | 5,625 | 134 | #!/usr/bin/env python3
import os
import sys
import argparse
from concurrent.futures import ThreadPoolExecutor
from SigProfilerMatrixGenerator.scripts import SigProfilerMatrixGeneratorFunc as matGen
from SigProfilerExtractor import sigpro as sig
currentDirectory = os.getcwd()
def parse_arguments():
"""Parse argum... |
aebff808577ba79183a793de599c1d0025164f060df13ce7e3390b1f24289cae | Python | 5,627 | 119 | import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.optim
import torch.utils.data
from torch.utils.data.dataloader import DataLoader
import os
import argparse
from util import (InteractionIoHandler, InteractionLogitIoHandler, set_args,
prepare, seed_torch, get_... |
ab7a1778d542293ff6d149299b4913334df6342d277a44b4fbb6482d035759f8 | Python | 5,631 | 151 | """
Advection correction
====================
This tutorial shows how to use the optical flow routines of pysteps to implement
the advection correction procedure described in Anagnostou and Krajewski (1999).
Advection correction is a temporal interpolation procedure that is often used
when estimating rainfall... |
736bfe1c5997554043fec761db0af30606085b1015d0a41293269cbb4076e943 | Python | 5,635 | 89 | #!/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
import eelbrain
import re
import utils
import os
import pickle
ANOVA_results_path = '/project/3027007.02/Scripts_for_publication/TRFs/Weights_ANOVA/Time_interval/'... |
b75c4cf61335b4ab7a8b01f8aed7fd4a0dc9d42d14d308ca6f718f3fb448613f | Python | 5,636 | 159 | #!/usr/bin/env python3
import unittest
import importlib
import random
from unittest.mock import patch
vis_map = importlib.import_module('ciftify.bin.cifti_vis_map')
class TestUserSettings(unittest.TestCase):
temp = '/tmp/fake_temp_dir'
palette = 'PALETTE-NAME'
def test_snap_set_to_none_when_in_index_mo... |
ae0eefbe1891611cf6e7a96f5ff2dadf2aa98e72a26773b211dedc8a03195d9f | Python | 5,642 | 149 | # -*- 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... |
315fd5d71c324474b8a3bf7a073c006f6773c4bfc2d110a7569c99a68d3c83f2 | Python | 5,645 | 139 | """ PyTorch Conditionally Parameterized Convolution (CondConv)
Paper: CondConv: Conditionally Parameterized Convolutions for Efficient Inference
(https://arxiv.org/abs/1904.04971)
Hacked together by / Copyright 2020 Ross Wightman
"""
import math
from functools import partial
from typing import Union, Tuple
import t... |
3cced8b0906f4d2bcc0b05f5163965a6f9abf399f99cb91707b07ea17266b6d1 | Python | 5,648 | 127 | import abc
from abc import ABC
from typing import Any, Dict, List, Optional, Tuple, Union
import torch
class Scheduler(ABC):
""" Parameter Scheduler Base Class
A scheduler base class that can be used to schedule any optimizer parameter groups.
Unlike the builtin PyTorch schedulers, this is intended to b... |
371ba9788d15eb85ae3113fd8769c4b5e381e17ab930588acea5db55976a0633 | Python | 5,649 | 131 | import torch
from collections import OrderedDict
import numpy as np
from pytorch_grad_cam.utils.svd_on_activations import get_2d_projection
class AblationLayer(torch.nn.Module):
def __init__(self):
super(AblationLayer, self).__init__()
def objectiveness_mask_from_svd(self, activations, threshold=0.01... |
3be1584ff3a38afffa3d5929c6c128b21e02cd0532ecc81518b7bf3d7ac270a0 | Python | 5,649 | 145 | import pytest
from click.testing import CliRunner
from GANDLF.entrypoints.preprocess import new_way, old_way
from . import CliCase, run_test_case, TmpDire, TmpFile, TmpNoEx
# This function is a place where a real logic is executed.
# For tests, we replace it with mock up, and check if this function is called
... |
44e8dad41875e2ca6da6d02c2f75c11d9d92ef937a670b94c443a73bc9484935 | Python | 5,655 | 148 | import os
from time import sleep
from pprint import pformat
from .pycboard import Pycboard
from .pyboard import PyboardError
from com.data_logger_old import Data_logger
import config.config as config
from config.paths import tasks_dir, config_dir
def print_func_factory(n):
# Returns function which prepe... |
47bc51fde729031d51db96358a8ab7de810c16b632538bae9fd211dc35c09f01 | Python | 5,662 | 149 | from contextlib import closing
import logging
import os.path as osp
import warnings
from typing import Any
import numpy as np
import numpy.typing as npt
from ptsa.data.readers import BaseRawReader
from ptsa.extensions.edf import EDFFile
logger = logging.getLogger(__name__)
logger.addHandler(logging.NullHandler())
... |
3a1b1e844d4c8f7b405e4bf4e7721e7859c826505a8f1c1e0745afad6030ae11 | Python | 5,666 | 182 | import sys
from os import path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
import tensorflow as tf
import warnings
from datetime import datetime
from tensorflow.keras.optimizers import Adam, RMSprop
from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau, Tenso... |
82a506bf6a69eb714f7da819a31daa4b5ef5337650e099c31e9bd35b78270e93 | Python | 5,668 | 199 | #!/usr/bin/env python
# Li Xue
# 20-Feb-2019 10:50
"""Split multiple jobs into batches and submit to cartesius.
INPUT: a file that contains all the jobs, for example,
python /projects/0/deeprank/change_BIN_CLASS.py /projects/000_1ACB.hdf5 &
python /projects/0/deeprank/change_BIN_CLASS.py /projects/000_1AK4.h... |
e421fe0c3c5207e50f97fe9ab5dbf406021f6081c03cf6f3bfeaa3e82bda3dbf | Python | 5,668 | 173 | from typing import Iterable
import torch
import numpy as np
from scipy.spatial.distance import cdist
from tqdm import tqdm
import ot
def cost_matrix(
data: np.ndarray, cost: str = 'correlation',
normalize_features: bool = True) -> np.ndarray:
"""Compute an empirical ground cost matrix, i.e. a pairwise distance m... |
78b365a29212a7501f9595bfdc3d75101a613e10308a1a9a110c996e05888930 | Python | 5,670 | 174 | #!/bin/env python
"""
Generation of stochastic noise
==============================
This example script shows how to run the stochastic noise field generators
included in pysteps.
These noise fields are used as perturbation terms during an extrapolation
nowcast in order to represent the uncertainty in the ev... |
0c0ed912c8b35962c96670b10670cd87537203e6f0e688ab3afa1d8996566c89 | Python | 5,675 | 158 | from torch.utils.data import DataLoader
from GANDLF.utils.modelbase import get_modelbase_final_layer
from GANDLF.metrics import surface_distance_ids
def populate_header_in_parameters(parameters: dict, headers: dict) -> dict:
"""
This function populates the parameters with information from the header in a comm... |
a97d2a7dce841ae0247f001dd1637984403fcf0e3a277edec38bc2462e3efbd8 | Python | 5,676 | 165 | import os
import random
from typing import Tuple
import numpy as np
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.utils.data import DataLoader
from torchvision import transforms
import torchvision
import socket
from util.dataset_util import get_dataset_util
from util.model_util import ... |
459d32612a4c7ec6f4f9bac98f7a8c4efae95405664d763672d847518811a829 | Python | 5,687 | 86 | import argparse
import os
from util import util
from ipdb import set_trace as st
class BaseOptions():
def __init__(self):
self.parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
self.initialized = False
def initialize(self):
self.parser.add_argumen... |
e0c381e5d66c6d2d8e7135e0bea0014032ce9ad3950ea4459e46127c40610961 | Python | 5,692 | 138 | import unittest
import torch
import torchdiffeq
from problems import construct_problem, PROBLEMS, DEVICES, METHODS
def max_abs(tensor):
return torch.max(torch.abs(tensor))
class TestGradient(unittest.TestCase):
def test_odeint(self):
for device in DEVICES:
for method in METHODS:
... |
caffe8518f7d6d2fb9b27b2e8176bb0a087fa9843c2d9327a3d7191319ec8fe2 | Python | 5,694 | 143 | import matplotlib.pyplot as plt
import numpy as np
import scipy.signal as signal
class Tasks:
TASKS = ["jawclench", "read", "colour", "wordsearch", "sudoku", "phoneApp", "lyingEC", "lyingEO"]
Fs = 500
def __init__(self,_participant,_task,startsec=False,band_low=False,band_high=False):
'''
... |
8b8cb48684d2224c70fbd86b65bfc418037af042ba0e0dca49eeea98f683d624 | Python | 5,709 | 168 | import cellprofiler_core.utilities.legacy
from ._setting import Setting
class Table(Setting):
"""The Table setting displays a table of values"""
ATTR_ERROR = "Error"
def __init__(
self,
text,
min_size=(400, 300),
max_field_size=30,
use_sash=False,
corner_b... |
8216eea8e22efa332f8479faff2b5947d4e594b46af9b3c6e72e287d5df7d536 | Python | 5,718 | 164 | import random
from torch.utils.data import Dataset, DataLoader
import os
#os.environ["CUDA_VISIBLE_DEVICES"] = "0"
import random
from torch.utils.data import Dataset, DataLoader
import torch
class ChemDataset(Dataset):
def __init__(self, input_data, output_data, tokenizer, max_length=256):
self... |
223045773d90662bd9043302694162e405594574d0327af1772b9b1819be5d68 | Python | 5,719 | 186 | from .beit import *
from .byoanet import *
from .byobnet import *
from .cait import *
from .coat import *
from .convit import *
from .convmixer import *
from .convnext import *
from .cpubone import *
from .crossvit import *
from .csatv2 import *
from .cspnet import *
from .cspnext import *
from .davit import *
from .de... |
b48f287a68eef01d791d5b25e26ce7467ca3b90759c2ea3f52d1552eb3b549c9 | Python | 5,721 | 208 | import pandas as pd
from rdkit import Chem
from rdkit import DataStructs
import matplotlib.pyplot as plt
import molvs as mv
from rdkit.Chem import RDKFingerprint
import numpy as np
from tqdm import tqdm
import os
from multiprocessing import Pool, cpu_count
import math
import time
import itertools
import datetime
from ... |
e31fce32c7209e0cf1100f8e4f9e17ab246e4f936efd84c6227dfa751c2c547a | Python | 5,721 | 151 | """Independent validation of PTSA's Morlet wavelet against a pure-Python
time-domain reimplementation of the formula in
``ptsa/extensions/morlet/morlet.cpp`` (``MorletWaveFFT::init``).
The strategy is:
1. Construct the wavelet directly in the time domain via the Python
port (``python_morlet_wavelet``).
2. Convolve... |
8b43c07ba579b5089159ae8f370840ae3d5a6d913e9116e3d80450f559bb8713 | Python | 5,725 | 172 | 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 pH, and plots the
ATP synthase flux vs ... |
9df9bd9952313cf1ddcb67e349c2e0d59d3988230bada3e725aca27ef0aace1f | Python | 5,728 | 128 | import numpy as np
from torch.utils.data import Dataset, DataLoader, RandomSampler, SequentialSampler
from torchvision import transforms
import torch.optim as optim
from torch.autograd import Variable
import torch.nn.functional as F
import torch.nn as nn
#from torch_plus import additional_samplers
from HiSiNet.HiCDatas... |
9af6cb40ddab53938057a0db8c4c653ba2228d808008da01719b0f59c2699345 | Python | 5,731 | 190 | import sys
import argparse
import numpy as np
import re
from pymatgen.io.cif import CifParser
from sklearn.metrics import mean_squared_error, mean_absolute_error
from pymatgen.analysis.structure_matcher import StructureMatcher as SM
from cifparser import CifParserExpand
parser = argparse.ArgumentParser(
... |
be6b5a5c89ac86d3c0678e5bb671991a4e9b82c10fd9dbe7eae456043b45a2f0 | Python | 5,731 | 155 | """
BlurPool layer inspired by
- Kornia's Max_BlurPool2d
- Making Convolutional Networks Shift-Invariant Again :cite:`zhang2019shiftinvar`
Hacked together by Chris Ha and Ross Wightman
"""
from functools import partial
from math import comb # Python 3.8
from typing import Callable, Optional, Type, Union
import tor... |
3c8ad78020f918c283a5bf322738904b778b4a68e30130e844242c1f865d7237 | Python | 5,736 | 214 | import os
from itertools import combinations, product
from etspredict.data.hcp_ya_pheno.get_data import load_info_targets
from etspredict.job_submission import HTCSubmissionTemplate
def create_submit(
dataset,
target_cat,
sampling_strat,
preprocessing_level,
parcellation,
path_to_venv,
sc... |
71f8774713a3061a76eb8b5680204a249f73b3f3e86f2ad16fccf2c086b5a060 | Python | 5,738 | 121 | import torch
import numpy as np
from models.embeddings import ConvEmbedding
from models.backbones import ResnetBackbone
from models.heads import ClsHead
from models.classifiers import (VGGClassifier, ResNetClassifier, InceptionClassifier,
SqueezeNetClassifier, DenseNetClassifier, SENetCl... |
25f801de17f54e549871acd3b71b846de23b87bf108c181a111e500df2735458 | Python | 5,744 | 148 | from typing import Optional, Union
import torch
import torch.nn as nn
class AsymmetricLossMultiLabel(nn.Module):
"""Asymmetric Loss (ASL) for multi-label classification, https://arxiv.org/abs/2009.14119
Args:
gamma_neg: Focusing parameter for negative targets.
gamma_pos: Focusing parameter f... |
34598a704ca535c866d0b56ac11a03fe220c163dfa22c68ac1508f24f2eec778 | Python | 5,752 | 148 | # -*- coding: utf-8 -*-
"""All Models in GANDLF are to be derived from this base class code."""
import torch.nn as nn
from acsconv.converters import ACSConverter, Conv3dConverter, SoftACSConverter
from GANDLF.utils import get_linear_interpolation_mode
from GANDLF.utils.generic import checkPatchDimensions
from GANDLF... |
c651a35e7d25aeda021e7a2f6deaff4b2636cee2fde681a7e302402f3d2bae01 | Python | 5,754 | 176 | import abc
import uuid
from enum import Enum
from ._validation_error import ValidationError
class Setting(abc.ABC):
"""A module setting which holds a single string value
"""
#
# This should be set to False for UI elements like buttons and dividers
#
save_to_pipeline = True
def __init__... |
a3766d40af412dc4ce65133e4c00ea276921172f8e38e3288b177475e4b8a739 | Python | 5,755 | 161 | #!/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
import eelbrain
import re
import os
import mne
import pandas as pd
from mne.stats import (spatio_temporal_cluster_test, f_threshold_mway_rm, f_mway_rm)
from mne impo... |
1490c3c43ee3ea7352626ae302070c7c3752f23d6dc40d000140c7b19bc075ed | Python | 5,757 | 108 | from wtforms import Form, TextAreaField, FloatField, IntegerField, SelectField, validators
from tensorflow import keras
import numpy as np
import pandas as pd
from Input_Function import eval_model_DNN, define_model
class RDSForm(Form):
value_choices = [('0', 'No'), ('1', 'Yes')]
value_choices1 = [('0... |
5d4c2d8e1b8a8d02b8019041139b859e8b095a1e8539850ee808a0425e859c4e | Python | 5,760 | 189 | # -*- coding: utf-8 -*-
"""
pysteps.tracking.lucaskanade
============================
The Lucas-Kanade (LK) feature tracking module.
This module implements the interface to the local `Lucas-Kanade`_ routine
available in OpenCV_.
.. _OpenCV: https://opencv.org/
.. _`Lucas-Kanade`:\
https://docs.opencv.org/3.4/dc... |
67abdf7e144324d61b96576008f3009ec98259327522ddc62dcbbe3ee14d6b7c | Python | 5,765 | 148 | import os
os.environ["CUDA_VISIBLE_DEVICES"]=""
import tensorflow as tf
import tensorflow_probability as tfp
from tensorflow_probability.python.distributions import kullback_leibler
from sklearn.preprocessing import MinMaxScaler
from scipy import interpolate
import os
import Metrics
from lib.IRNN_Full_Bayes import *... |
bf9bb8e46590e71b44b2030ff3f911a7e847d93fd4b4093d891d4dc4bd5d5e8e | Python | 5,765 | 145 | from glob import glob
import os
from typing import Set
from pdb2sql import pdb2sql
import numpy
from deeprank.config import logger
from deeprank.features.FeatureClass import FeatureClass
from deeprank.config.chemicals import AA_codes, AA_codes_3to1, AA_codes_1to3
from deeprank.operate.pdb import get_residue_contact_a... |
128d938a1ab3ad1b8afb9cf42090249d697876e5514f44d270d54b63d466228e | Python | 5,768 | 173 | from __future__ import division
import os
from math import ceil, floor
from xml.dom.minidom import parse
import numpy as np
from skimage.io import imread
from skimage.transform import rescale
from .dataset import Datasets
from .download import maybe_download_and_extract
URL = 'http://host.robots.ox.ac.uk/pascal/VO... |
599691b2c5a260c2a09080038328cf9c97ab87870893cebfbd93dc9528c15511 | Python | 5,768 | 131 | #!/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
import eelbrain
import re
import utils
import os
ANOVA_results_path = '/project/3027007.02/Scripts_for_publication/TRFs/Weights_ANOVA/Full_model_high_vs_low/'
x_n... |
9e270a406d6dcaae014d8a5e7591d28ec918a12eb214b9b4a2319ab7508ba228 | Python | 5,769 | 132 | #!/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
import eelbrain
import re
import utils
import os
ANOVA_results_path = '/project/3027007.02/Scripts_for_publication/TRFs/Weights_ANOVA/Full_model_high_vs_low/'
x_n... |
9d69c126f658fc36b15755e752209f8c65c9a1f3b09a5b2b3232d50fd1ad206c | Python | 5,771 | 161 | #!/usr/bin/env python3
"""
Runs all posible ciftify functions on some test data
Usage:
run_CNP_recon_all [options] <testing_dir>
Arguments:
<testing_dir> The directory to run the tests inside
Options:
--outputs-dir PATH The directory to write the gerated outputs into
--resample-to-T1w32k Wet... |
e984379b25bcd0fbb868238684d8481317155a10223e39e563b6f5f7b74098cb | Python | 5,771 | 164 | import csv
import math
import os
import sys
#This program takes in multiple sequence alignments and calculates the entropy for each aa position
'''
1) Calculates aa freq (20 values) for each col in alignment
2) Calculates entropy for each col (H)
3) Calculates e^H
4) Records into CSV for each col/site
4) Repeats for a... |
7c55f404c6cdbf8112fe0f7a26a98b522d14bc5751dc707b238ceed3d11c65c2 | Python | 5,782 | 182 | # -*- coding: utf-8 -*-
"""
pysteps.utils.interpolate
=========================
Interpolation routines for pysteps.
.. autosummary::
:toctree: ../generated/
idwinterp2d
rbfinterp2d
"""
import warnings
import numpy as np
from scipy.interpolate import Rbf
from scipy.spatial import cKDTr... |
b80c6b4755f2b0f4793b182a27a1d3cfba7c17a8b2ffb4f773c0de2ffa96651a | Python | 5,784 | 154 | import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import tensorflow as tf
import tensorflow_probability as tfp
import Metrics
from utils import *
from regional_data_builder import *
# Class to evaluate a set of hyper parameters.
# Using a class allows the __call__ function to be used for differe... |
60fef8f6e8e0ea5fec41ed77e54d4cd56c1c6111ebc45cbff35713e3e34f2355 | Python | 5,787 | 161 | from cellprofiler_library.functions.segmentation import convert_dense_to_sparse
from cellprofiler_library.functions.segmentation import convert_sparse_to_dense
from cellprofiler_library.functions.segmentation import indices_from_dense
from cellprofiler_library.functions.segmentation import dense_shape_from_sparse
from ... |
3aee744d0b636e70015bc3fc0786585bdedee5f89fbfe0cd25a88a571dfbbc45 | Python | 5,788 | 88 | import argparse
import time
import sys
import os
sys.path.append(os.path.abspath(os.path.dirname(__file__) + '/..'))
from rgbmatrix import RGBMatrix, RGBMatrixOptions
class SampleBase(object):
def __init__(self, *args, **kwargs):
self.parser = argparse.ArgumentParser()
self.parser.add_argument("... |
332e9c3cf6bbe97118afe341498f1b19a60d844ef63a932718d3288960da1700 | Python | 5,793 | 176 | import re
from pathlib import Path
from typing import Sequence, Union
import numpy as np
import pandas as pd
from imctools.data import Acquisition, Channel
from imctools.data.acquisitiondata import AcquisitionData
from imctools.io.utils import reshape_long_2_cyx
TXT_FILE_EXTENSION = ".txt"
class TxtParser:
"""... |
e4f3571e3c0a5df850fb0ca75407637a980cc9012f103b4ad16d65adcbc58c8d | Python | 5,794 | 147 | ''' adapted from https://github.com/all-umass/ManifoldWarping '''
import alignment
import correspondence
import distance
import dtw
import neighborhood
import numpy
import unittest
import util
from numpy.testing import assert_array_equal, assert_array_almost_equal
from scipy import sparse
# from StringIO import Strin... |
24cee91f19801aa31884431ff29cc495a5bd9d252fcc24d7cc61d9f58abcc97b | Python | 5,799 | 164 | #!/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
import eelbrain
import re
import os
import mne
import pandas as pd
from mne.stats import (spatio_temporal_cluster_test, f_threshold_mway_rm, f_mway_rm)
from mne impo... |
42ab1de76ab21e0d2b966a01fe7bcac4ddcccb84b28fc5ea5ab244a30ebbff28 | Python | 5,803 | 108 | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Tue May 22 13:27:04 2018
@author: saskiad
"""
pop_results['experiment_container_id'] = np.NaN
pop_results['area'] = np.NaN
pop_results['tld1_name'] = np.NaN
pop_results['depth_range'] = np.NaN
pop_results['cre_depth'] = np.NaN
for index,row in pop_results... |
2ac3555595c8a4ed6e9cb63bb5b5d1b3f8f87223fd560b844a2fb311fa48ae0a | Python | 5,813 | 182 | import logging
import os
import re
import sys
from ....module import Module
from ....constants.modules import (
do_not_override,
should_override,
all_modules,
svn_revisions,
pymodules,
badmodules,
builtin_modules,
renamed_modules,
unimplemented_modules,
depricated_modules,
r... |
53f2727682e86efeaceb7a12b540288a219a6e92925abd7f32d2b12934e843f2 | Python | 5,818 | 180 | # -*- coding: utf-8 -*-
"""
pysteps.noise.motion
====================
Methods for generating perturbations of two-dimensional motion fields.
The methods in this module implement the following interface for
initialization::
inizialize_xxx(V, pixelsperkm, timestep, optional arguments)
where V (2,m,n) is the motion ... |
ba006a209ee2f19425919f796a38c65192f0d40f367c0b47e9943aeb77b1901a | Python | 5,819 | 157 | """
@author: Johanna Rahm
Research group Heilemann
Institute for Physical and Theoretical Chemistry, Goethe University Frankfurt a.M.
DeepSTORM2DAddOns:
- Convert Picasso csv file to DeepSTORM2D csv format.
- Split tif movie & corresponding localization file at defined frame.
"""
import numpy as np
import pandas as ... |
13cd975b415909f3823452c1d1b5ccd7f03d25877c23c091f97979496a567c67 | Python | 5,822 | 190 | #!/bin/env python
"""
Ensemble verification
=====================
In this tutorial we perform a verification of a probabilistic extrapolation nowcast
using MeteoSwiss radar data.
"""
from datetime import datetime
import matplotlib.pyplot as plt
import numpy as np
from pprint import pprint
from pysteps import io, now... |
aa24692027e5ff46fb0262613c40d6c3f981cf111267c01f7f7652ed2c15f73c | Python | 5,828 | 166 | # Inheritaed from open-mmlab/mmclassification
# Modified by Hangyu LIN
import copy
import platform
import random
from functools import partial
import numpy as np
import torch
from utils.parallel import get_dist_info
from torch.utils.data import DataLoader
from datasets.transforms import build_transforms
from datase... |
2d1e7a5add76f2ce0e66269fb9a194e66c7a7278addd63b8b8e79d7f6927f0ff | Python | 5,830 | 150 | #!/usr/bin/env python2
# written by Jin Lee, 2016
import os
import sys
import re
import argparse
import json
import subprocess
from collections import OrderedDict
parser = argparse.ArgumentParser(prog='ENCODE_summary.json parser for QC', \
description='Recursively find ENCODE_summ... |
94a5006601bffef9254a10e8da460422389a033e5d766d2631562a0178aa23e0 | Python | 5,834 | 137 | # -*- coding: utf-8 -*-
"""
Created on Sat May 29 18:48:59 2021
@author: Manuel
This code implements the Fully Convolutional DenseNetproposed by
Jegou et al. (2017) in the following publication
https://arxiv.org/abs/1611.09326 using tf.Keras.
The original implementation using Theano and Lasagne was made public on
http... |
ba0a710877dd2dfbf5aff75bafbbc4162a69e9ff4c37efe80450d3c3a9ecb74b | Python | 5,838 | 195 | from netCDF4 import Dataset
import numpy as np
import os, pathlib
#==========================================================
# Set main directory
#==========================================================
hdir = '/home/jhkim/model/deep_detection'
#====================================================================... |
8a369890e054be8decc13ac8c0d1546662e7e3cbdfc81e89ac7966611e1a28c4 | Python | 5,842 | 196 | # -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# -- Path setup ------------------------------------------------------------... |
99f4e85b1cff28d8be01a4b29ec9c908587b11873e5a2aa9566ffedfc25ff1e6 | Python | 5,847 | 151 | import numpy as np
from scipy.ndimage import gaussian_filter
from .dataset import Datasets, Dataset
# CONSTANT WHERE TO FIND THE DATA
from config import SVESSEL_DIR as VESSEL_DIR
import SimpleITK as sitk
import os
import matplotlib.pyplot as plt
from matplotlib.pyplot import Normalize
# import pyqtgraph as pg
import p... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.