Tsallis

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

Bases: BaseStatisticMixIn

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

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

2D image.

headerFITS header, optional

The image header. Needed for the pixel scale.

lagsQuantity, 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]).

distanceQuantity, 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([sigma_clip])

Fit the Tsallis distributions.

input_data_header(data, header[, need_copy])

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

load_beam([beam])

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

load_results(pickle_file)

Load in a saved pickle file.

make_tsallis([periodic, num_bins])

Calculate the Tsallis distribution at each lag.

plot_fit([save_name, color, fit_color])

Plot the distributions and fits to the Tsallis function.

plot_parameters([save_name])

Plot the fit parameters as a function of lag.

run([verbose, num_bins, periodic, ...])

Run all steps.

save_results(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(sigma_clip=5)[source]

Fit the Tsallis distributions.

Parameters:
sigma_clipfloat

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

input_data_header(data, header, need_copy=False)

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

load_beam(beam=None)

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

Parameters:
beamBeam, optional

The beam.

static load_results(pickle_file)

Load in a saved pickle file.

Parameters:
pickle_filestr

Name of filename to load in.

Returns:
selfSave statistic class

Statistic instance with saved results.

Examples

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

make_tsallis(periodic=True, num_bins=None)[source]

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:
periodicbool, optional

Use for simulations with periodic boundaries.

num_binsint, 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(save_name=None, color='r', fit_color='k')[source]

Plot the distributions and fits to the Tsallis function.

Parameters:
save_namestr, optional

Save name for the figure. Enables saving the plot.

plot_parameters(save_name=None, **kwargs)[source]

Plot the fit parameters as a function of lag.

Parameters:
save_namestr,optional

Save name for the figure. Enables saving the plot.

kwargspassed to errorbar.
run(verbose=False, num_bins=None, periodic=True, sigma_clip=5, save_name=None)[source]

Run all steps.

Parameters:
verbosebool, optional

Enables plotting.

num_binsint, optional

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

periodicbool, optional

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

sigma_clipfloat

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

save_namestr,optional

Save the figure when a file name is given.

save_results(output_name, keep_data=False)

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

Parameters:
output_namestr

Name of the outputted pickle file.

keep_databool, optional

Save the data cube in the pickle file when enabled.