Dendrogram_Stats

class turbustat.statistics.Dendrogram_Stats(data, header=None, min_deltas=None, dendro_params=None)[source] [edit on github]

Bases: turbustat.statistics.base_statistic.BaseStatisticMixIn

Dendrogram statistics as described in Burkhart et al. (2013) Two statistics are contained: * number of leaves + branches vs. $delta$ parameter * statistical moments of the intensity histogram

Parameters:

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

Data to create the dendrogram from.

min_deltas : numpy.ndarray or list

Minimum deltas of leaves in the dendrogram.

dendro_params : dict

Further parameters for the dendrogram algorithm (see www.dendrograms.org for more info).

Attributes Summary

fitvals Log values of delta and number of structures used for the power-law tail fit.
hists Histogram values and bins computed from the peak intensity in all structures.
min_deltas Array of min_delta values to compute the dendrogram.
model Power-law tail fit model.
numfeatures Number of branches and leaves at each value of min_delta
tail_slope Slope of power-law tail.
tail_slope_err 1-sigma error on slope of power-law tail.
values Array of peak intensity values of leaves and branches at all values of min_delta.

Methods Summary

compute_dendro([verbose, save_dendro, ...]) Compute the dendrogram and prune to the minimum deltas.
fit_numfeat([size, verbose]) Fit a line to the power-law tail.
load_dendrogram(hdf5_file[, min_deltas]) Load in a previously saved dendrogram.
load_results(pickle_file) Load in a saved pickle file.
make_hists([min_number]) Creates histograms based on values from the tree.
run([periodic_bounds, verbose, save_name, ...]) Compute dendrograms.
save_results([output_name, keep_data]) Save the results of the dendrogram statistics to avoid re-computing.

Attributes Documentation

fitvals

Log values of delta and number of structures used for the power-law tail fit.

hists

Histogram values and bins computed from the peak intensity in all structures. One set of values and bins are returned for each value of min_deltas

min_deltas

Array of min_delta values to compute the dendrogram.

model

Power-law tail fit model.

numfeatures

Number of branches and leaves at each value of min_delta

tail_slope

Slope of power-law tail.

tail_slope_err

1-sigma error on slope of power-law tail.

values

Array of peak intensity values of leaves and branches at all values of min_delta.

Methods Documentation

compute_dendro(verbose=False, save_dendro=False, dendro_name=None, dendro_obj=None, periodic_bounds=False)[source] [edit on github]

Compute the dendrogram and prune to the minimum deltas. ** min_deltas must be in ascending order! **

Parameters:

verbose : optional, bool

Enables the progress bar in astrodendro.

save_dendro : optional, bool

Saves the dendrogram in HDF5 format. Requires pyHDF5

dendro_name : str, optional

Save name when save_dendro is enabled. ”.hdf5” appended automatically.

dendro_obj : Dendrogram, optional

Input a pre-computed dendrogram object. It is assumed that the dendrogram has already been computed!

periodic_bounds : bool, optional

Enable when the data is periodic in the spatial dimensions.

fit_numfeat(size=5, verbose=False)[source] [edit on github]

Fit a line to the power-law tail. The break is approximated using a moving window, computing the standard deviation. A spike occurs at the break point.

Parameters:

size : int. optional

Size of std. window. Passed to std_window.

verbose : bool, optional

Shows the model summary.

static load_dendrogram(hdf5_file, min_deltas=None)[source] [edit on github]

Load in a previously saved dendrogram. Requires pyHDF5

Parameters:

hdf5_file : str

Name of saved file.

min_deltas : numpy.ndarray or list

Minimum deltas of leaves in the dendrogram.

static load_results(pickle_file)[source] [edit on github]

Load in a saved pickle file.

Parameters:

pickle_file : str

Name of filename to load in.

make_hists(min_number=10, **kwargs)[source] [edit on github]

Creates histograms based on values from the tree. Note: These histograms are remade when calculating the distance to ensure the proper form for the Hellinger distance.

Parameters:

min_number : int, optional

Minimum number of structures needed to create a histogram.

run(periodic_bounds=False, verbose=False, save_name=None, dendro_verbose=False, dendro_obj=None, save_results=False, output_name=None, make_hists=True, **kwargs)[source] [edit on github]

Compute dendrograms. Necessary to maintain the package format.

Parameters:

periodic_bounds : bool or list, optional

Enable when the data is periodic in the spatial dimensions. Passing a two-element list can be used to individually set how the boundaries are treated for the datasets.

verbose : optional, bool

Enable plotting of results.

save_name : str,optional

Save the figure when a file name is given.

dendro_verbose : optional, bool

Prints out updates while making the dendrogram.

dendro_obj : Dendrogram, optional

Pass a pre-computed dendrogram object. MUST have min_delta set at or below the smallest value in`~Dendro_Statistics.min_deltas`.

save_results : bool, optional

Save the statistic results as a pickle file. See save_results.

output_name : str, optional

Filename used when save_results is enabled. Must be given when saving.

make_hists : bool, optional

Enable computing histograms.

kwargs : Passed to make_hists.

save_results(output_name=None, keep_data=False)[source] [edit on github]

Save the results of the dendrogram statistics to avoid re-computing. The pickled file will not include the data cube by default.