tuskitoo.SpectralExtraction.Expectra2D_new module

class Expectra2D(object, center_cut=None, size_cut=None, distances=None, verbose=False, header=None, apply_cut=True, **kwargs)[source]

Bases: object

Main class to handle 2D spectra and extract the spectra

get_header_keys(distances=None)[source]

Retrieve and store a subset of header keys relevant for further processing.

Parameters:

distancesoptional

If provided as a dictionary, it may be used for additional processing related to distances.

Notes:

If no header is available, a warning is issued.

static cut_2d_image(image, center=None, size=None, verbose=False)[source]

Cut a 2D image to the specified region.

Parameters:

imagearray-like

The input 2D image to be cut.

centerint or None, optional, default=None

The center position for cutting the 2D image. If None, the center will be estimated.

sizeint or None, optional, default=None

The size of the cut-out region. If None, a default size of 70 will be used.

verbosebool, optional, default=False

If True, print additional information during processing.

Returns:

array-like

The cut-out 2D image.

plot_cut_out(trace=None, sep=None)[source]

Plot the 2D cut-out image and the stacked median profile.

save_fit_keywords_as_pickle(filename)[source]

Save the dictionary of fitting keywords (parameters used in the fit) to a pickle file.

Parameters:

filenamestr

The base filename for saving (without extension).

save_spectra_as_pickle(save=None, band=None)[source]

_summary_

Parameters:
  • save (_type_, optional) – _description_. Defaults to None.

  • band (_type_, optional) – _description_. Defaults to None.

Returns:

_description_

Return type:

_type_

save_to_fits(filename, person='F. Avila-Vera')[source]

Save the extracted spectra (results) to a FITS file.

Parameters:

filenamestr

The base filename for the FITS file.

personstr, optional, default=”F. Avila-Vera”

Name of the person responsible for the extraction; stored in the FITS header.

Raises:

AttributeError:

If the results have not been computed (i.e., ‘array_to_pandas’ has not been run).