repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
DDoS | DDoS-master/train_DDoS.py | import argparse
import logging
import math
import os
import random
import statistics
import sys
import numpy as np
import torch
import torch.autograd.profiler as profiler
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
import torchio as tio
from torch.cuda.amp import GradScaler, autoc... | 26,365 | 53.929167 | 230 | py |
DDoS | DDoS-master/models/unet3DMSS.py | # Adapted from https://discuss.pytorch.org/t/unet-implementation/426
import torch
from torch import nn
import torch.nn.functional as F
import torchcomplex.nn.functional as cF
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany... | 7,232 | 38.961326 | 128 | py |
DDoS | DDoS-master/models/SRCNN3Dv3.py | import numpy as np
import torch
import torch.nn as nn
__author__ = "Soumick Chatterjee, Geetha Doddapaneni Gopinath"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee", "Geetha Doddapaneni Gopinath"]
__license__ = "GPL"
__v... | 5,034 | 53.728261 | 165 | py |
DDoS | DDoS-master/models/densenet.py | # Source: https://github.com/kenshohara/3D-ResNets-PyTorch/blob/master/models/densenet.py
# Paper Ref: https://arxiv.org/abs/2004.04968
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.functional as F
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of ... | 7,339 | 37.631579 | 114 | py |
DDoS | DDoS-master/models/SRCNN3D.py | import numpy as np
import torch
import torch.nn as nn
__author__ = "Soumick Chatterjee, Geetha Doddapaneni Gopinath"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee", "Geetha Doddapaneni Gopinath"]
__license__ = "GPL"
__v... | 4,427 | 56.506494 | 125 | py |
DDoS | DDoS-master/models/brokenconv.py | import numpy as np
import torch
import torch.nn as nn
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "Soumick Chatterjee"
__e... | 2,300 | 37.35 | 111 | py |
DDoS | DDoS-master/models/SRCNN3Dv2.py | import numpy as np
import torch
import torch.nn as nn
__author__ = "Soumick Chatterjee, Geetha Doddapaneni Gopinath"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee", "Geetha Doddapaneni Gopinath"]
__license__ = "GPL"
__v... | 4,709 | 51.921348 | 135 | py |
DDoS | DDoS-master/models/__init__.py | from models.unet3D import UNet
from models.unet3DMSS import UNetMSS
from models.SRCNN3D import SRCNN3D
from models.SRCNN3Dv2 import SRCNN3Dv2
from models.SRCNN3Dv3 import SRCNN3Dv3
from models.unet3DvSeg_DeepSup import U_Net_DeepSup as UNetVSeg
from models.densenet import generate_model as DenseNet
from models.ThisNewN... | 425 | 41.6 | 63 | py |
DDoS | DDoS-master/models/unet3D_DeepSup.py | # from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.utils.data
__author__ = "Kartik Prabhu, Mahantesh Pattadkal, and Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Kartik P... | 5,263 | 29.783626 | 110 | py |
DDoS | DDoS-master/models/ThisNewNet.py | import math
import torch.nn as nn
from models import *
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "Soumick Chatterjee"
__... | 2,283 | 46.583333 | 218 | py |
DDoS | DDoS-master/models/unet3D.py | # Adapted from https://discuss.pytorch.org/t/unet-implementation/426
import torch
from torch import nn
import torch.nn.functional as F
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee", "... | 5,245 | 38.443609 | 128 | py |
DDoS | DDoS-master/models/ReconResNet.py | #!/usr/bin/env python
import torch.nn as nn
from tricorder.torch.transforms import Interpolator
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Soumick Chatterjee & OvGU:ESF:MEMoRIAL"
__credits__ = ["Soumick Chatterjee"]
__license__ = "GPL"
__version__ = "1.0.0"
__email__ = "soumick.chatterjee@ovg... | 9,909 | 36.537879 | 257 | py |
DDoS | DDoS-master/models/unet3DvSeg_DeepSup.py | # from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.utils.data
__author__ = "Kartik Prabhu, Mahantesh Pattadkal, and Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Kartik P... | 5,263 | 29.783626 | 110 | py |
DDoS | DDoS-master/models/srVAE/srVAE.py | from functools import partial
import numpy as np
import torch
import torch.nn as nn
from torchvision import transforms
from .backbone.densenet16x32 import *
from .priors.realnvp import RealNVP
# --------- Utility functions ---------
def get_shape(z_dim):
""" Given the dimentionality of the latent space,
... | 6,789 | 29.3125 | 122 | py |
DDoS | DDoS-master/models/srVAE/__init__.py | from .srVAE import srVAE
| 25 | 12 | 24 | py |
DDoS | DDoS-master/models/srVAE/backbone/densenet16x32.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from src.modules.nn_layers import *
from src.modules.distributions import n_embenddings
from src.utils.args import args
class q_u(nn.Module):
""" Encoder q(u|y)
"""
def __init__(self, output_shape, input_shape):
super().__init__()... | 4,289 | 23.94186 | 85 | py |
DDoS | DDoS-master/models/srVAE/priors/mog.py | import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from .prior import Prior
from src.modules.nn_layers import *
from src.modules.distributions import *
from src.utils import args
# Modified vertion of: https://github.com/divymurli/VAEs
class MixtureOfGaussians(Prior):
de... | 3,267 | 32.010101 | 94 | py |
DDoS | DDoS-master/models/srVAE/priors/prior.py | import torch
import torch.nn as nn
class Prior(nn.Module):
def __init__(self):
super().__init__()
def sample(self, **kwargs):
raise NotImplementedError
def log_p(self, input, **kwargs):
return self.forward(z)
def forward(self, input, **kwargs):
raise NotImplementedEr... | 420 | 16.541667 | 39 | py |
DDoS | DDoS-master/models/srVAE/priors/__init__.py | from .prior import Prior
from .realnvp import RealNVP
from .mog import MixtureOfGaussians
from .standard_normal import StandardNormal
| 134 | 26 | 43 | py |
DDoS | DDoS-master/models/srVAE/priors/standard_normal.py | import math
import torch
class StandardNormal:
def __init__(self, z_shape):
self.z_shape = z_shape
def sample(self, n_samples=1, **kwargs):
return torch.randn((n_samples, *self.z_shape))
def log_p(self, z, **kwargs):
return self.forward(z)
def forward(self, z, **kwargs):
... | 681 | 21 | 67 | py |
DDoS | DDoS-master/models/srVAE/priors/realnvp/__init__.py | from .model import RealNVP
| 27 | 13 | 26 | py |
DDoS | DDoS-master/models/srVAE/priors/realnvp/distributions/mog.py | import numpy as np
import torch
import torch.nn as nn
from torch.autograd import Variable
from src.modules.nn_layers import *
from src.modules.distributions import *
from src.utils import args
class MixtureOfGaussians(nn.Module):
def __init__(self, z_shape, num_mixtures=10):
super().__init__()
s... | 3,185 | 32.536842 | 94 | py |
DDoS | DDoS-master/models/srVAE/priors/realnvp/distributions/__init__.py | from .mog import MixtureOfGaussians
from .standard_normal import StandardNormal
| 80 | 26 | 43 | py |
DDoS | DDoS-master/models/srVAE/priors/realnvp/distributions/standard_normal.py | import math
import torch
import torch.nn as nn
class StandardNormal:
"""
Isotropic Standard Normal distribution.
"""
def __init__(self, z_shape):
self.z_shape = z_shape
def sample(self, n_samples=1, **kwargs):
return torch.randn((n_samples, *self.z_shape))
def log_p(self, z,... | 764 | 20.857143 | 67 | py |
DDoS | DDoS-master/models/srVAE/priors/realnvp/util/array_util.py | import torch
import torch.nn.functional as F
def squeeze_2x2(x, reverse=False, alt_order=False):
"""For each spatial position, a sub-volume of shape `1x1x(N^2 * C)`,
reshape into a sub-volume of shape `NxNxC`, where `N = block_size`.
Adapted from:
https://github.com/tensorflow/models/blob/master/... | 4,369 | 40.226415 | 103 | py |
DDoS | DDoS-master/models/srVAE/priors/realnvp/util/norm_util.py | import functools
import torch
import torch.nn as nn
def get_norm_layer(norm_type='instance'):
if norm_type == 'batch':
return functools.partial(nn.BatchNorm2d, affine=True)
elif norm_type == 'instance':
return functools.partial(nn.InstanceNorm2d, affine=False)
else:
raise NotImplem... | 4,052 | 37.971154 | 96 | py |
DDoS | DDoS-master/models/srVAE/priors/realnvp/util/__init__.py | from .array_util import squeeze_2x2, checkerboard_mask
from .norm_util import get_norm_layer, get_param_groups, WNConv2d
| 121 | 39.666667 | 65 | py |
DDoS | DDoS-master/models/srVAE/priors/realnvp/model/real_nvp.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from .coupling_layer import CouplingLayer, MaskType
from ..util import squeeze_2x2
from ..distributions import StandardNormal
# Modified vertion of: https://github.com/chrischute/real-nvp
class RealNVP(nn.Module):
"""RealNVP Mo... | 5,949 | 37.636364 | 120 | py |
DDoS | DDoS-master/models/srVAE/priors/realnvp/model/coupling_layer.py | import torch
import torch.nn as nn
from enum import IntEnum
from ..util import checkerboard_mask
from src.modules.nn_layers import *
class MaskType(IntEnum):
CHECKERBOARD = 0
CHANNEL_WISE = 1
class CouplingLayer(nn.Module):
"""Coupling layer in RealNVP.
Args:
in_channels (int): Number of... | 4,031 | 32.04918 | 91 | py |
DDoS | DDoS-master/models/srVAE/priors/realnvp/model/__init__.py | from .real_nvp import RealNVP
| 30 | 14.5 | 29 | py |
DDoS | DDoS-master/models/ShuffleUNet/icnr.py | import torch
import torch.nn as nn
def ICNR(tensor, upscale_factor=2, inizializer=nn.init.kaiming_normal_):
new_shape = [int(tensor.shape[0] / (upscale_factor ** 2))] + list(tensor.shape[1:])
subkernel = torch.zeros(new_shape)
subkernel = inizializer(subkernel)
subkernel = subkernel.transpose(0, 1)
... | 708 | 31.227273 | 87 | py |
DDoS | DDoS-master/models/ShuffleUNet/pixel_shuffle.py | import torch.nn as nn
from . import icnr
def _pixel_shuffle(input, upscale_factor):
r"""Rearranges elements in a Tensor of shape :math:`(N, C, d_{1}, d_{2}, ..., d_{n})` to a
tensor of shape :math:`(N, C/(r^n), d_{1}*r, d_{2}*r, ..., d_{n}*r)`.
Where :math:`n` is the dimensionality of the data.
See :... | 2,276 | 35.142857 | 111 | py |
DDoS | DDoS-master/models/ShuffleUNet/net.py | import sys
import torch
import torch.nn as nn
from . import pixel_shuffle, pixel_unshuffle
# -------------------------------------------------------------------------------------------------------------------------------------------------##
class _double_conv(nn.Module):
"""
Double Convolution Block
"""
... | 5,659 | 36.733333 | 151 | py |
DDoS | DDoS-master/models/ShuffleUNet/pixel_unshuffle.py | import torch.nn as nn
from . import icnr
class _double_conv_3d(nn.Module):
"""
Convolution Block
"""
def __init__(self, in_channels, out_channels, k_size, stride, bias=True):
super(_double_conv_3d, self).__init__()
self.conv = nn.Sequential(
nn.Conv3d(in_channels=in_chann... | 4,185 | 37.054545 | 111 | py |
DDoS | DDoS-master/models/ShuffleUNet/__init__.py | 0 | 0 | 0 | py | |
DDoS | DDoS-master/visualisation/num4trilinear.py | from glob import glob
import torch
from tqdm import tqdm
import os
import nibabel as nib
import numpy as np
import pandas as pd
import torch.nn.functional as F
from utils.utilities import calc_metircs
fully_root = "/mnt/MEMoRIAL/MEMoRIAL_SharedStorage_M1.2+4+7/Chompunuch/PhD/Data/3DDynTest/MickAbdomen3DDyn/DynProtoco... | 1,754 | 38 | 158 | py |
DDoS | DDoS-master/visualisation/num4zpad.py | from glob import glob
from tqdm import tqdm
import os
import nibabel as nib
import numpy as np
import pandas as pd
from utils.utilities import calc_metircs
fully_root = "/mnt/MEMoRIAL/MEMoRIAL_SharedStorage_M1.2+4+7/Chompunuch/PhD/Data/3DDynTest/MarioAbdomen3DDyn/DynProtocol1/Filtered/hrTestDynConST"
zpad_root = "/mn... | 1,504 | 36.625 | 145 | py |
DDoS | DDoS-master/visualisation/generate_plots.py | #!/usr/bin/env python
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
sns.set_theme(style="darkgrid")
#Step 4 (actual) of 4
def convertInp2Out(df, method_name):
df = df[df.columns.drop(list(df.filter(regex='Out')))]
df.columns = df.c... | 9,370 | 51.646067 | 226 | py |
DDoS | DDoS-master/visualisation/consolidate.py | import numpy as np
import pandas as pd
from glob import glob
from tqdm import tqdm
import os
import nibabel as nib
def MinMax(data):
return (data-data.min())/(data.max()-data.min())
#Step 1 (actual) of 4
results_root = "/mnt/MEMoRIAL/MEMoRIAL_SharedStorage_M1.2+4+7/Chompunuch/PhD/Results/DDoS_Paper1/dynDualChn/D... | 2,781 | 36.594595 | 200 | py |
DDoS | DDoS-master/visualisation/merge.py | import pandas as pd
total = "/mnt/MEMoRIAL/MEMoRIAL_SharedStorage_M1.2+4+7/Chompunuch/PhD/Results/DDoS_Paper1/dynDualChn/DDoS-UNet/FullVol/Results/consolidated_wrong_diffSDZeroPad.csv"
zero = "/mnt/MEMoRIAL/MEMoRIAL_SharedStorage_M1.2+4+7/Chompunuch/PhD/Results/DDoS_Paper1/dynDualChn/DDoS-UNet/FullVol/Results/consolid... | 663 | 40.5 | 164 | py |
DDoS | DDoS-master/visualisation/calc_time.py | nPE = 264
nSlice = 44
TR = 2.31
overPE = 0.10
overSlice = 0.00
resPE = 0.50
resSlice = 0.64
actualPE = round(nPE * (1+overPE) * resPE)
totalTR = actualPE * TR
actualSlice = round(nSlice * resSlice)
totalTime = totalTR * actualSlice
print(actualPE)
print(round(totalTime / 1000, 2)) | 287 | 15 | 42 | py |
DDoS | DDoS-master/visualisation/merge_csvs.py | import pandas as pd
from glob import glob
import os
#Step 2 (actual) of 4
csv_root = "/mnt/MEMoRIAL/MEMoRIAL_SharedStorage_M1.2+4+7/Chompunuch/PhD/Results/DDoS_Paper1/dynDualChn/DDoS-UNet/FullVol/woZPad/Results/QuantitativeAnalysis/CSVs"
dfDL = pd.read_csv(f"{csv_root}/RAWs/DL_Results.csv")
dfDL.drop(dfDL[dfDL.model... | 1,213 | 32.722222 | 163 | py |
DDoS | DDoS-master/visualisation/get_numbers.py | import pandas as pd
from glob import glob
from tqdm import tqdm
import os
from scipy.stats import mannwhitneyu
#Step 3 of 4
ignore_antipasto = True
consolidated_csv = "/mnt/MEMoRIAL/MEMoRIAL_SharedStorage_M1.2+4+7/Chompunuch/PhD/Results/DDoS_Paper1/dynDualChn/DDoS-UNet/FullVol/woZPad/Results/QuantitativeAnalysis/Sour... | 4,880 | 45.485714 | 191 | py |
DDoS | DDoS-master/visualisation/consolidate_diffnorm.py | import numpy as np
import pandas as pd
from glob import glob
from tqdm import tqdm
import os
import nibabel as nib
def MinMax(data):
return (data-data.min())/(data.max()-data.min())
#Step 1 (alternative) of 3
results_root = "/mnt/MEMoRIAL/MEMoRIAL_SharedStorage_M1.2+4+7/Chompunuch/PhD/Results/DDoS_Paper1/dynDual... | 2,592 | 35.521127 | 200 | py |
DDoS | DDoS-master/utils/elastic_transform.py | #!/usr/bin/env python
'''
Purpose :
'''
from numbers import Number
from typing import Optional, Tuple, Union
import numpy as np
import torch
import torch as th
import torch.nn as nn
import torch.nn.functional as F
from torch.nn.parameter import Parameter
__author__ = "Kartik Prabhu, Mahantesh Pattadkal, and Soum... | 9,147 | 40.022422 | 163 | py |
DDoS | DDoS-master/utils/datasets_dyn.py | # from __future__ import self.logger.debug_function, division
import fnmatch
import glob
import os
import sys
from random import randint, random, seed
import nibabel
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torchvision.tr... | 24,444 | 54.938215 | 300 | py |
DDoS | DDoS-master/utils/data.py | import fnmatch
import os
import random
from glob import glob
import numpy as np
import torch
import torchio as tio
from torchio.data.io import read_image
from .motion import MotionCorrupter
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Ma... | 7,985 | 38.93 | 118 | py |
DDoS | DDoS-master/utils/interpnorm_vols.py | import os
import random
from glob import glob
import nibabel as nib
import numpy as np
import torch
import torch.nn.functional as F
from tqdm import tqdm
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Sou... | 1,778 | 35.306122 | 110 | py |
DDoS | DDoS-master/utils/utilities.py | import os
from copy import deepcopy
from statistics import median
import random
import nibabel as nib
import numpy as np
import torch
import torch.nn.functional as F
import torchcomplex.nn.functional as cF
import torchio as tio
import torchvision.utils as vutils
from scipy import ndimage
import wandb
from pynufft impo... | 13,876 | 38.991354 | 184 | py |
DDoS | DDoS-master/utils/datasets.py | # from __future__ import self.logger.debug_function, division
import glob
import os
import sys
from random import randint, random, seed
import nibabel
import numpy as np
import pandas as pd
import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.utils.data
import torchvision.transforms as tra... | 19,535 | 53.266667 | 261 | py |
DDoS | DDoS-master/utils/customutils.py | import numpy as np
import scipy.io as sio
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee", "Chompunuch Sarasaen"]
__license__ = "GPL"
__version__ = "1.0.0"
__maintainer__ = "Soumick Chat... | 3,761 | 36.247525 | 121 | py |
DDoS | DDoS-master/utils/__init__.py | 0 | 0 | 0 | py | |
DDoS | DDoS-master/utils/motion.py | import math
import multiprocessing.dummy as multiprocessing
import random
from collections import defaultdict
from typing import List
import numpy as np
import SimpleITK as sitk
import torch
import torchio as tio
from scipy.ndimage import affine_transform
from torchio.transforms import Motion, RandomMotion
from torchi... | 8,325 | 44.497268 | 183 | py |
DDoS | DDoS-master/utils/padding.py | #parital source: https://github.com/c22n/unet-pytorch
from typing import Tuple, Union
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Function, Variable
from torch.nn.modules.utils import _ntuple
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Soumick ... | 3,703 | 36.04 | 80 | py |
DDoS | DDoS-master/utils/pLoss/Resnet2D.py | #!/usr/bin/env python
"""
Original file Resnet2Dv2b14 of NCC1701
"""
import torch
import torch.nn as nn
import torch.nn.functional as F
#from utils.TorchAct.pelu import PELU_oneparam as PELU
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2018, Soumick Chatterjee & OvGU:ESF:MEMoRIAL"
__credits__ = ["So... | 3,150 | 31.484536 | 294 | py |
DDoS | DDoS-master/utils/pLoss/__init__.py | 0 | 0 | 0 | py | |
DDoS | DDoS-master/utils/pLoss/VesselSeg_UNet3d_DeepSup.py | # -*- coding: utf-8 -*-
"""
"""
# from __future__ import print_function, division
import torch
import torch.nn as nn
import torch.utils.data
#from Utils.wta import KWinnersTakeAll
__author__ = "Kartik Prabhu, Mahantesh Pattadkal, and Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science,... | 13,151 | 29.09611 | 110 | py |
DDoS | DDoS-master/utils/pLoss/perceptual_loss.py | import math
import torch
import torch.nn as nn
import torchvision
# from utils.utils import *
# from pytorch_msssim import SSIM
from .Resnet2D import ResNet
from .simpleunet import UNet
from .VesselSeg_UNet3d_DeepSup import U_Net_DeepSup
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of C... | 8,538 | 42.345178 | 154 | py |
DDoS | DDoS-master/utils/pLoss/simpleunet.py | import torch
import torch.nn.functional as F
from torch import nn
__author__ = "Soumick Chatterjee"
__copyright__ = "Copyright 2022, Faculty of Computer Science, Otto von Guericke University Magdeburg, Germany"
__credits__ = ["Soumick Chatterjee", "Chompunuch Sarasaen"]
__license__ = "GPL"
__version__ = "1.0.0"
__main... | 7,121 | 39.237288 | 160 | py |
hrv-analysis | hrv-analysis-master/setup.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
""" This script provides setup requirements to install hrvanalysis via pip"""
import setuptools
# Get long description in READ.md file
with open("README.md", "r") as fh:
LONG_DESCRIPTION = fh.read()
setuptools.setup(
name="hrv-analysis",
version="1.0.4",
... | 1,049 | 27.378378 | 84 | py |
hrv-analysis | hrv-analysis-master/sphinx-docs/source/conf.py | # -*- 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 ------------------------------------------------------------... | 5,578 | 28.363158 | 79 | py |
hrv-analysis | hrv-analysis-master/tests/tests_plot_methods.py | #!/usr/bin/env python
"""This script provides methods to test extract_features methods."""
import os
import unittest
from hrvanalysis.plot import (plot_timeseries, plot_distrib, plot_poincare, plot_psd)
TEST_DATA_FILENAME = os.path.join(os.path.dirname(__file__), 'test_nn_intervals.txt')
def load_test_data(path):
... | 1,456 | 33.690476 | 85 | py |
hrv-analysis | hrv-analysis-master/tests/tests_preprocessing_methods.py | #!/usr/bin/env python
"""This script provides methods to test clean_outliers methods."""
import unittest
import numpy as np
from hrvanalysis.preprocessing import (remove_outliers, interpolate_nan_values,
remove_ectopic_beats, get_nn_intervals)
class CleanOutliersTestCase(unitte... | 3,986 | 51.460526 | 105 | py |
hrv-analysis | hrv-analysis-master/tests/tests_extract_features_methods.py | #!/usr/bin/env python
"""This script provides methods to test extract_features methods."""
import os
import unittest
import numpy as np
import pandas as pd
from hrvanalysis.extract_features import (get_time_domain_features, get_geometrical_features,
_create_interpolated_timest... | 7,004 | 51.276119 | 114 | py |
hrv-analysis | hrv-analysis-master/hrvanalysis/preprocessing.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This script provides several methods to clean abnormal and ectopic RR-intervals."""
from typing import Tuple
from typing import List
import pandas as pd
import numpy as np
# Static name for methods params
MALIK_RULE = "malik"
KARLSSON_RULE = "karlsson"
KAMATH_RULE = "... | 13,724 | 35.6 | 110 | py |
hrv-analysis | hrv-analysis-master/hrvanalysis/extract_features.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This script provides several methods to extract features from Normal to Normal Intervals
for heart rate variability analysis."""
from typing import List, Tuple
from collections import namedtuple
import numpy as np
import nolds
from scipy import interpolate
from scipy i... | 20,410 | 34.37435 | 111 | py |
hrv-analysis | hrv-analysis-master/hrvanalysis/plot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This script provides several methods to plot RR / NN-intervals."""
from typing import List
import matplotlib.pyplot as plt
from matplotlib import style
from matplotlib.patches import Ellipse
from hrvanalysis.extract_features import _get_freq_psd_from_nn_intervals
from ... | 7,596 | 36.240196 | 111 | py |
hrv-analysis | hrv-analysis-master/hrvanalysis/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""This script allow user to import directly the most useful functions."""
__version__ = "1.0.3"
from hrvanalysis.extract_features import (get_time_domain_features, get_frequency_domain_features,
get_geometrical_features, get_csi... | 664 | 40.5625 | 101 | py |
panphon | panphon-master/setup.py | from setuptools import setup
setup(name='panphon',
version='0.20.0',
description='Tools for using the International Phonetic Alphabet with phonological features',
url='https://github.com/dmort27/panphon',
download_url='https://github.com/dmort27/panphon/archive/0.19.1.tar.gz',
long_descri... | 1,405 | 41.606061 | 99 | py |
panphon | panphon-master/panphon/collapse.py | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os.path
import pkg_resources
import yaml
from panphon import _panphon
from panphon import permissive
class Collapser(object):
def __init__(self, tablename='dogolpolsky_prime.yml', feature_set='sp... | 1,270 | 31.589744 | 102 | py |
panphon | panphon-master/panphon/_panphon.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, unicode_literals
from os import stat
import unicodedata
import os.path
from functools import reduce
import numpy
import pkg_resources
import regex as re
import unicodecsv as csv
from panphon import featuretable
from . import xsampa
fr... | 18,322 | 32.620183 | 91 | py |
panphon | panphon-master/panphon/featuretable.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os.path
import unicodedata
import collections
import numpy
import pkg_resources
import regex as re
import unicodecsv as csv
from . import xsampa
from .segment import Segment
f... | 16,647 | 35.831858 | 113 | py |
panphon | panphon-master/panphon/errors.py | # -*- coding: utf-8 -*-
class SegmentError(Exception):
pass
| 66 | 10.166667 | 30 | py |
panphon | panphon-master/panphon/segment.py | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function,
unicode_literals)
import regex as re
class Segment(object):
"""Models a phonological segment as a vector of features."""
def __init__(self, names, features={}, ftstr='', weights=None):
... | 7,126 | 32.460094 | 82 | py |
panphon | panphon-master/panphon/sonority.py | from __future__ import print_function, absolute_import, unicode_literals
from . import _panphon
from . import permissive
from ._panphon import FeatureTable, fts
class BoolTree(object):
"""Simple decision tree specialized for sonority classes"""
def __init__(self, test=None, t_node=None, f_node=None):
... | 2,874 | 32.430233 | 76 | py |
panphon | panphon-master/panphon/permissive.py | from __future__ import absolute_import, print_function, unicode_literals
import codecs
import copy
import os.path
import pkg_resources
import yaml
import regex as re
import unicodecsv as csv
from . import _panphon, xsampa
def flip(s):
return [(b, a) for (a, b) in s]
def update_ft_set(seg, dia):
seg = di... | 7,279 | 34.512195 | 132 | py |
panphon | panphon-master/panphon/__init__.py | from __future__ import absolute_import
from panphon.featuretable import FeatureTable
from panphon._panphon import pat
| 118 | 28.75 | 45 | py |
panphon | panphon-master/panphon/xsampa.py | from __future__ import absolute_import, print_function, unicode_literals
import regex as re
import unicodecsv as csv
import os.path
import pkg_resources
class XSampa(object):
def __init__(self, delimiter=' '):
self.delimiter = delimiter
self.xs_regex, self.xs2ipa = self.read_xsampa_table()
d... | 1,224 | 33.027778 | 74 | py |
panphon | panphon-master/panphon/distance.py | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os.path
from functools import partial
import editdistance
import numpy as np
import regex as re
import pkg_resources
import yaml
from . import _panphon, permissive, featuretable, xsampa
def zerodivisz... | 34,379 | 40.026253 | 115 | py |
panphon | panphon-master/panphon/bin/validate_ipa.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import unicode_literals
import panphon
import regex as re
import sys
class Validator(object):
def __init__(self, infile=sys.stdin):
"""Validate Unicode IPA from file relative to panphon database.
... | 1,637 | 28.781818 | 88 | py |
panphon | panphon-master/panphon/bin/align_wordlists.py | #!/usr/bin/env python
from __future__ import print_function
import unicodecsv as csv
import argparse
import panphon
import Levenshtein
import munkres
import panphon.distance
from functools import partial
def levenshtein_dist(_, a, b):
return Levenshtein.distance(a, b)
def dogol_leven_dist(_, a, b):
return ... | 2,458 | 32.22973 | 110 | py |
panphon | panphon-master/panphon/bin/generate_ipa_all.py | #!/usr/bin/env python
from __future__ import print_function, unicode_literals
import argparse
import codecs
import copy
import yaml
import unicodecsv as csv
class Segment(object):
"""Class modeling phonological segment."""
def __init__(self, form, features):
"""Construct Segment objectself.
... | 6,485 | 34.442623 | 123 | py |
panphon | panphon-master/panphon/test/test_distance.py | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division, absolute_import
import unittest
import panphon
from panphon import distance
feature_model = 'segment'
dim = 24
class TestLevenshtein(unittest.TestCase):
def setUp(self):
self.dist = distance.Distance(feature_model... | 5,453 | 37.408451 | 124 | py |
panphon | panphon-master/panphon/test/test_permissive_methods.py | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division, absolute_import
import unittest
from panphon import permissive
dim = 24
class TestFeatureTableAPI(unittest.TestCase):
def setUp(self):
self.ft = permissive.PermissiveFeatureTable()
def test_fts(self):
... | 2,690 | 31.421687 | 84 | py |
panphon | panphon-master/panphon/test/test_panphon_methods.py | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division, absolute_import
import unittest
import panphon._panphon as panphon
dim = 24
class TestFeatureTableAPI(unittest.TestCase):
def setUp(self):
self.ft = panphon.FeatureTable()
def test_fts(self):
self.ass... | 2,675 | 31.240964 | 84 | py |
panphon | panphon-master/panphon/test/test_featuretable.py | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division, absolute_import
import unittest
import panphon.featuretable
class TestFeatureTable(unittest.TestCase):
LONG_IPA_STRING = 'tɐʉmɐtɐ.ɸɐkɐtɐŋihɐŋɐ.koːɐʉɐʉ.ɔ.tɐmɐtɛɐ.tʉɾi.pʉkɐkɐ.piki.mɐʉŋɐ.hɔɾɔ.nʉkʉ.pɔkɐi.ɸɛnʉɐ.ki.tɐnɐ.tɐhʉ'
... | 3,326 | 34.774194 | 120 | py |
panphon | panphon-master/panphon/test/test_sonority.py | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division, absolute_import
import unittest
from panphon import sonority
class TestSonority(unittest.TestCase):
def setUp(self):
self.son = sonority.Sonority(feature_model='permissive')
def test_sonority_nine(self):
... | 1,803 | 30.649123 | 82 | py |
panphon | panphon-master/panphon/test/test_panphon.py | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division, absolute_import
import unittest
from panphon import _panphon
class TestFeatureTable(unittest.TestCase):
def setUp(self):
self.ft = _panphon.FeatureTable()
def test_fts_contrast2(self):
inv = 'p t k b ... | 2,836 | 33.597561 | 85 | py |
panphon | panphon-master/panphon/test/test_xsampa.py | # -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals, division, absolute_import
import unittest
import panphon
import panphon.xsampa
class TestXSampa(unittest.TestCase):
def setUp(self):
self.ft = panphon.FeatureTable()
self.xs = panphon.xsampa.XSampa()
def test_i... | 621 | 27.272727 | 82 | py |
HIBPool | HIBPool-main/GIB.py | #!/usr/bin/env python
# coding: utf-8
# In[ ]:
from __future__ import print_function
import numpy as np
import pprint as pp
from copy import deepcopy
import pickle
from numbers import Number
from collections import OrderedDict
import itertools
import torch
import torch.nn as nn
from torch.autograd import Variable
fr... | 208,307 | 46.428962 | 300 | py |
theedhum-nandrum | theedhum-nandrum-master/src/__init__.py | """ Package Initialization file. """
import os
import logging
from logging import StreamHandler
from logging.handlers import RotatingFileHandler
# Create the Handler for logging data to a file
logger_handler = RotatingFileHandler(os.path.join(os.path.dirname(__file__), '../logs/tn.log'), maxBytes=1024, backupCount=5)
... | 892 | 33.346154 | 125 | py |
theedhum-nandrum | theedhum-nandrum-master/src/playground/classify.py | # Load and prepare the dataset
import nltk
from nltk.corpus import movie_reviews
from nltk.util import ngrams
import random
import sys
import re
from emoji import UNICODE_EMOJI
from bisect import bisect_left
import math
from sklearn.metrics import classification_report
from nltk.classify.scikitlearn import SklearnClass... | 9,391 | 38.79661 | 147 | py |
theedhum-nandrum | theedhum-nandrum-master/src/playground/emoji_sentiment.py | import linecache
import sys
import emoji
import re
import csv
from collections import Counter
# Appeding our src directory to sys path so that we can import modules.
sys.path.append('../..')
from src.tn.lib.sentimoji import get_emoji_sentiment_rank
def extract_emojis(s):
return [c for c in s if c in emoji.UNICO... | 2,049 | 36.962963 | 170 | py |
theedhum-nandrum | theedhum-nandrum-master/src/playground/collect_emojis.py | '''
@author mojosaurus
This script scrapes all the files under ../resources/data/*.tsv, collects emojis and checks which of these emojis do we
have sentimant analysis for by src.tn.lib.sentimoji.
Output of the script is two files - ../../resources/data/matched_emojis.txt and ../../resources/data/unmatched_emojis.txt
'... | 1,963 | 37.509804 | 121 | py |
theedhum-nandrum | theedhum-nandrum-master/src/playground/test_cld2.py | import cld2
import linecache
import sys
fileName = "resources/data/tamil_train.tsv"
lineNum = 11106 # Russian
lineNum = 11046 # tamil
lineNum = 8423 # telugu
lineNum = 7922 # tamil
#lineNum = 7787 # telugu
#lineNum = 7607 # telugu
lineNum = 570 # kannada
lineNum = 611 # kannada
line = linecache.getline(fileName, lineN... | 910 | 25.794118 | 84 | py |
theedhum-nandrum | theedhum-nandrum-master/src/playground/plot_document_classification.py | #!/usr/bin/env python
# coding: utf-8
# Adapted the original for our requirement.
#
# # Classification of text documents using sparse features
#
#
# This is an example showing how scikit-learn can be used to classify documents
# by topics using a bag-of-words approach. This example uses a scipy.sparse
# matrix to ... | 10,396 | 31.28882 | 79 | py |
theedhum-nandrum | theedhum-nandrum-master/src/tn/sentiment_classifier.py | """
@author sanjeethr, oligoglot
Implements SGDClassifier using FeatureUnions for Sentiment Classification of text
It also has code to experiment with hyper tuning parameters of the classifier
"""
from __future__ import print_function
import numpy as np
import pickle
import json
from pprint import pprint
from time im... | 16,938 | 43.459318 | 165 | py |
theedhum-nandrum | theedhum-nandrum-master/src/tn/__init__.py | """ Package Initialization file. """ | 36 | 36 | 36 | py |
theedhum-nandrum | theedhum-nandrum-master/src/tn/multiclassrnnclassifier.py | """
@author sanjeethr, oligoglot
Thanks to Susan Li for this step by step guide: https://towardsdatascience.com/multi-class-text-classification-with-lstm-1590bee1bd17
"""
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import sys, os
from keras.preprocessing.text import Tokenizer
from keras.prep... | 6,528 | 38.331325 | 172 | py |
theedhum-nandrum | theedhum-nandrum-master/src/tn/document/document.py | '''
@author mojosaurus
This OM represents that document that will be passed around in the docproc pipeline
'''
import json
# Inputs to this class class be various, but it always returns a JSON object.
class Document:
js = {}
def __init__(self, text : str =""):
self.js["original"] = text # Keep the ori... | 947 | 30.6 | 83 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.