Background Subtraction

cwitools.analysis.bg_subtract(inputfits, method='polyfit', poly_k=1, median_window=31, zmask=(0, 0), zunit='A')

Subtracts extended continuum emission / scattered light from a cube

Parameters:
  • cubePath (str) – Path to the data cube to be subtracted.
  • method (str) – Which method to use to model background ‘polyfit’: Fits polynomial to the spectrum in each spaxel (default.) ‘median’: Subtract the spatial median of each wavelength layer. ‘medfilt’: Model spectrum in each spaxel by median filtering it. ‘noiseFit’: Model noise in each z-layer and subtract mean.
  • poly_k (int) – The degree of polynomial to use for background modeling.
  • median_window (int) – The filter window size to use if median filtering.
  • zmask (int tuple) – Wavelength region to mask, given as tuple of indices.
  • zunit (str) – If using zmask, indices are given in these units. ‘A’: Angstrom (default) ‘px’: pixels
  • saveModel (bool) – Set to TRUE to save background model cube.
  • fileExt (str) – File extension to use for output (Default: .bs.fits)