StatMoments_Distance

class turbustat.statistics.StatMoments_Distance(image1, image2, radius=5, weights1=None, weights2=None, nbins=None, periodic1=False, periodic2=False, fiducial_model=None)[source] [edit on github]

Bases: object

Compute the distance between two images based on their moments. The distance is calculated for the skewness and kurtosis. The distance values for each for computed using the Hellinger Distance (default), or the Kullback-Leidler Divergence.

Unlike the other distance classes in TurbuStat, the computation of the histograms needed for the distance metric has been split into its own method. However, the change is fairly transparent, since it is called within distance_metric.

Parameters:

image1 : numpy.ndarray or astropy.io.fits.PrimaryHDU or spectral_cube.LowerDimensionalObject

2D Image.

image2 : numpy.ndarray or astropy.io.fits.PrimaryHDU or spectral_cube.LowerDimensionalObject

2D Image.

radius : int, optional

Radius of circle to use when computing moments. This is the pixel size applied to the coarsest grid (if the datasets are not on a common grid). The radius for the finer grid is adjusted so the angular scales match.

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

2D array of weights. Uniform weights are used if none are given.

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

2D array of weights. Uniform weights are used if none are given.

nbins : int, optional

Number of bins to use when constructing histograms.

periodic1 : bool, optional

If image1 is periodic in the spatial boundaries, set to True.

periodic2 : bool, optional

If image2 is periodic in the spatial boundaries, set to True.

fiducial_model : StatMoments

Computed StatMoments object. use to avoid recomputing.

Methods Summary

create_common_histograms([nbins]) Calculate the histograms using a common set of bins.
distance_metric([metric, verbose, nbins, ...]) Compute the distance.

Methods Documentation

create_common_histograms(nbins=None)[source] [edit on github]

Calculate the histograms using a common set of bins. Only histograms of the kurtosis and skewness are calculated, since only they are used in the distance metric.

Parameters:

nbins : int, optional

Bins to use in the histogram calculation.

distance_metric(metric='Hellinger', verbose=False, nbins=None, label1=None, label2=None, save_name=None)[source] [edit on github]

Compute the distance.

Parameters:

metric : ‘Hellinger’ (default) or “KL Divergence”, optional

Set the metric to use compare the histograms.

verbose : bool, optional

Enables plotting.

nbins : int, optional

Bins to use in the histogram calculation.

label1 : str, optional

Object or region name for image1

label2 : str, optional

Object or region name for image2

save_name : str,optional

Save the figure when a file name is given.