Tsallis

class turbustat.statistics.Tsallis(img, header=None, lags=None, distance=None)[source] [edit on github]

Bases: turbustat.statistics.base_statistic.BaseStatisticMixIn

The Tsallis Distribution (see Tofflemire et al., 2011)

Parameters:
img : numpy.ndarray or astropy.io.fits.PrimaryHDU or astropy.io.fits.ImageHDU or spectral_cube.Projection or spectral_cube.Slice

2D image.

header : FITS header, optional

The image header. Needed for the pixel scale.

lags : Quantity, optional

Give the spatial lag values to compute the distribution at. The default lag sizes are powers of 2 up to half the image size (so for a 128 by 128 image, the lags will be [1, 2, 4, 8, 16, 32, 64]).

distance : Quantity, optional

Physical distance to the region in the data.

Attributes Summary

data
distance
header
lag_arrays Arrays of the image computed at different lags.
lag_distribs Histogram bins and values compute from lag_arrays.
lags Lag values to calculate the statistics at.
need_header_flag
no_data_flag
tsallis_chisq Reduced chi-squared values for the fit at each lag value.
tsallis_params Parameters of the Tsallis distribution fit at each lag value.
tsallis_stderrs Standard errors of the Tsallis distribution fit at each lag value.
tsallis_table Return the fit parameters, standard error, and chi-squared values as an Table.

Methods Summary

fit_tsallis(self[, sigma_clip]) Fit the Tsallis distributions.
input_data_header(self, data, header[, …]) Check if the header is given separately from the data type.
load_beam(self[, beam]) Try loading the beam from the header or a given object.
load_results(pickle_file) Load in a saved pickle file.
make_tsallis(self[, periodic, num_bins]) Calculate the Tsallis distribution at each lag.
plot_fit(self[, save_name, color, fit_color]) Plot the distributions and fits to the Tsallis function.
plot_parameters(self[, save_name]) Plot the fit parameters as a function of lag.
run(self[, verbose, num_bins, periodic, …]) Run all steps.
save_results(self, output_name[, keep_data]) Save the results of the SCF to avoid re-computing.

Attributes Documentation

data
distance
header
lag_arrays

Arrays of the image computed at different lags.

lag_distribs

Histogram bins and values compute from lag_arrays. The histogram values are in log10.

lags

Lag values to calculate the statistics at.

need_header_flag = True
no_data_flag = False
tsallis_chisq

Reduced chi-squared values for the fit at each lag value.

tsallis_params

Parameters of the Tsallis distribution fit at each lag value.

tsallis_stderrs

Standard errors of the Tsallis distribution fit at each lag value.

tsallis_table

Return the fit parameters, standard error, and chi-squared values as an Table.

Methods Documentation

fit_tsallis(self, sigma_clip=5)[source] [edit on github]

Fit the Tsallis distributions.

Parameters:
sigma_clip : float

Sets the sigma value to clip data at. If None, no clipping is performed on the data. Defaults to 5.

input_data_header(self, data, header, need_copy=False) [edit on github]

Check if the header is given separately from the data type.

load_beam(self, beam=None) [edit on github]

Try loading the beam from the header or a given object.

Parameters:
beam : Beam, optional

The beam.

static load_results(pickle_file) [edit on github]

Load in a saved pickle file.

Parameters:
pickle_file : str

Name of filename to load in.

Returns:
self : Save statistic class

Statistic instance with saved results.

Examples

Load saved results. >>> stat = Statistic.load_results(“stat_saved.pkl”) # doctest: +SKIP

make_tsallis(self, periodic=True, num_bins=None)[source] [edit on github]

Calculate the Tsallis distribution at each lag. We standardize each distribution such that it has a mean of zero and variance of one before fitting.

If the lag values are fractions of a pixel when converted to pixel units, the lag is rounded down to the next smallest integer value.

Parameters:
periodic : bool, optional

Use for simulations with periodic boundaries.

num_bins : int, optional

Number of bins to use in the histograms. Defaults to the square-root of the number of finite points in the image.

plot_fit(self, save_name=None, color='r', fit_color='k')[source] [edit on github]

Plot the distributions and fits to the Tsallis function.

Parameters:
save_name : str, optional

Save name for the figure. Enables saving the plot.

plot_parameters(self, save_name=None, **kwargs)[source] [edit on github]

Plot the fit parameters as a function of lag.

Parameters:
save_name : str,optional

Save name for the figure. Enables saving the plot.

kwargs : passed to errorbar.
run(self, verbose=False, num_bins=None, periodic=True, sigma_clip=5, save_name=None)[source] [edit on github]

Run all steps.

Parameters:
verbose : bool, optional

Enables plotting.

num_bins : int, optional

Sets the number of bins to use in the lag histograms. Passed to make_tsallis.

periodic : bool, optional

Treat periodic boundaries. Passed to make_tsallis. Enabled by default.

sigma_clip : float

Sets the sigma value to clip data at. Passed to fit_tsallis().

save_name : str,optional

Save the figure when a file name is given.

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

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

Parameters:
output_name : str

Name of the outputted pickle file.

keep_data : bool, optional

Save the data cube in the pickle file when enabled.