SCF

class turbustat.statistics.SCF(cube, header=None, size=11, roll_lags=None)[source] [edit on github]

Bases: turbustat.statistics.base_statistic.BaseStatisticMixIn

Computes the Spectral Correlation Function of a data cube (Rosolowsky et al, 1999).

Parameters:

cube : numpy.ndarray or astropy.io.fits.PrimaryHDU or SpectralCube

Data cube.

header : FITS header, optional

Header for the cube.

size : int, optional

Total size of the lags used in one dimension.

roll_lags : ndarray, optional

Pass a custom array of lag values. These will be the pixel size of the lags used in each dimension. Ideally, these should have symmetric positive and negative values.

Attributes Summary

lags Values of the lags, in pixels, to compute SCF at
scf_spectrum Azimuthally averaged 1D SCF spectrum
scf_spectrum_stddev Standard deviation of the scf_spectrum
scf_surface SCF correlation array
slope SCF spectrum slope
slope_err 1-sigma error on the SCF spectrum slope

Methods Summary

compute_spectrum([logspacing, return_stddev]) Compute the 1D spectrum as a function of lag.
compute_surface([boundary]) Computes the SCF up to the given lag value.
fit_plaw([xlow, xhigh, verbose]) Fit a power-law to the SCF spectrum.
fitted_model(xvals) Computes the fitted power-law in log-log space using the given x values.
load_results(pickle_file) Load in a saved pickle file.
run([logspacing, return_stddev, boundary, ...]) Computes all SCF outputs.
save_results([output_name, keep_data]) Save the results of the SCF to avoid re-computing.

Attributes Documentation

lags

Values of the lags, in pixels, to compute SCF at

scf_spectrum

Azimuthally averaged 1D SCF spectrum

scf_spectrum_stddev

Standard deviation of the scf_spectrum

scf_surface

SCF correlation array

slope

SCF spectrum slope

slope_err

1-sigma error on the SCF spectrum slope

Methods Documentation

compute_spectrum(logspacing=False, return_stddev=True, **kwargs)[source] [edit on github]

Compute the 1D spectrum as a function of lag. Can optionally use log-spaced bins. kwargs are passed into the pspec function, which provides many options. The default settings are applicable in nearly all use cases.

Parameters:

logspacing : bool, optional

Return logarithmically spaced bins for the lags.

return_stddev : bool, optional

Return the standard deviation in the 1D bins. Default is True.

kwargs : passed to turbustat.statistics.psds.pspec

compute_surface(boundary='continuous')[source] [edit on github]

Computes the SCF up to the given lag value.

Parameters:

boundary : {“continuous”, “cut”}

Treat the boundary as continuous (wrap-around) or cut values beyond the edge (i.e., for most observational data).

fit_plaw(xlow=None, xhigh=None, verbose=False)[source] [edit on github]

Fit a power-law to the SCF spectrum.

Parameters:

xlow : float, optional

Lower lag value limit in log-scale to consider in the fit.

xhigh : float, optional

Upper lag value limit in log-scale to consider in the fit.

verbose : bool, optional

Show fit summary when enabled.

fitted_model(xvals)[source] [edit on github]

Computes the fitted power-law in log-log space using the given x values.

Parameters:

xvals : ndarray

Values of log(lags) to compute the model at (base 10 log).

Returns:

model_values : ndarray

Values of the model at the given values. Equivalent to log values of the SCF spectrum.

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.

Returns:

self : SCF instance

SCF instance with saved results.

Examples

Load saved results. >>> scf = SCF.load_results(“scf_saved.pkl”) # doctest: +SKIP

run(logspacing=False, return_stddev=True, boundary='continuous', xlow=None, xhigh=None, save_results=False, output_name=None, verbose=False, ang_units=False, unit=Unit("deg"), save_name=None)[source] [edit on github]

Computes all SCF outputs.

Parameters:

logspacing : bool, optional

Return logarithmically spaced bins for the lags.

return_stddev : bool, optional

Return the standard deviation in the 1D bins.

boundary : {“continuous”, “cut”}

Treat the boundary as continuous (wrap-around) or cut values beyond the edge (i.e., for most observational data).

xlow : float, optional

See fit_plaw.

xhigh : float, optional

See fit_plaw.

save_results : bool, optional

Pickle the results.

output_name : str, optional

Name of the outputted pickle file.

verbose : bool, optional

Enables plotting.

ang_units : bool, optional

Convert frequencies to angular units using the given header.

unit : u.Unit, optional

Choose the angular unit to convert to when ang_units is enabled.

save_name : str,optional

Save the figure when a file name is given.

save_results(output_name=None, keep_data=False)[source] [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, optional

Name of the outputted pickle file.

keep_data : bool, optional

Save the data cube in the pickle file when enabled.