PDF_Distance

class turbustat.statistics.PDF_Distance(img1, img2, min_val1=-inf, min_val2=-inf, do_fit=True, normalization_type=None, nbins=None, weights1=None, weights2=None)[source] [edit on github]

Bases: object

Calculate the distance between two arrays using their PDFs.

Parameters:

img1 : numpy.ndarray or astropy.io.fits.PrimaryHDU or spectral_cube.LowerDimensionalObject or SpectralCube

Array (1-3D).

img2 : numpy.ndarray or astropy.io.fits.PrimaryHDU or spectral_cube.LowerDimensionalObject or SpectralCube

Array (1-3D).

min_val1 : float, optional

Minimum value to keep in img1

min_val2 : float, optional

Minimum value to keep in img2

do_fit : bool, optional

Enables fitting a lognormal distribution to each data set.

normalization_type : {“normalize”, “normalize_by_mean”}, optional

See data_normalization.

nbins : int, optional

Manually set the number of bins to use for creating the PDFs.

weights1 : numpy.ndarray or astropy.io.fits.PrimaryHDU or spectral_cube.LowerDimensionalObject or SpectralCube, optional

Weights to be used with img1

weights2 : numpy.ndarray or astropy.io.fits.PrimaryHDU or spectral_cube.LowerDimensionalObject or SpectralCube, optional

Weights to be used with img2

Methods Summary

compute_ad_distance() Compute the distance using the Anderson-Darling Test.
compute_hellinger_distance() Computes the Hellinger Distance between the two PDFs.
compute_ks_distance() Compute the distance using the KS Test.
compute_lognormal_distance() Compute the combined t-statistic for the difference in the widths of a lognormal distribution.
distance_metric([statistic, verbose, ...]) Calculate the distance.

Methods Documentation

compute_ad_distance()[source] [edit on github]

Compute the distance using the Anderson-Darling Test.

compute_hellinger_distance()[source] [edit on github]

Computes the Hellinger Distance between the two PDFs.

compute_ks_distance()[source] [edit on github]

Compute the distance using the KS Test.

compute_lognormal_distance()[source] [edit on github]

Compute the combined t-statistic for the difference in the widths of a lognormal distribution.

distance_metric(statistic='all', verbose=False, label1='Data 1', label2='Data 2', save_name=None)[source] [edit on github]

Calculate the distance. NOTE: The data are standardized before comparing to ensure the distance is calculated on the same scales.

Parameters:

statistic : ‘all’, ‘hellinger’, ‘ks’, ‘lognormal’

Which measure of distance to use.

labels : tuple, optional

Sets the labels in the output plot.

verbose : bool, optional

Enables plotting.

label1 : str, optional

Object or region name for img1

label2 : str, optional

Object or region name for img2

save_name : str,optional

Save the figure when a file name is given.