cwitools.extraction.psf_sub

cwitools.extraction.psf_sub(inputfits, pos, r_fit=1.5, r_sub=5.0, wl_window=200, wmasks=None, recenter=True, var=None, maskpsf=False, use_model=None)

Models and subtracts a single point-source in a 3D data cube.

Parameters:
  • inputfits (astrop FITS object) – Input data cube/FITS.
  • r_fit (float) – Inner radius, in arcsec, used for fitting PSF.
  • r_sub (float) – Outer radius, in arcsec, used to subtract PSF.
  • pos (float tuple) – Position of the source to subtract in image coords.
  • recenter (bool) – Recenter (x, y) using the centroid within a radius of 2’‘.
  • wl_window (int) – Size of white-light window (in Angstrom) to use. This is the window used to form a white-light image centered on each wavelength layer. Default: 200A.
  • wmasks (list) – List of wavelength tuples to exclude when making white-light images. Use to exclude nebular emission or sky lines.
  • var (numpy.ndarray) – Variance cube associated with input. Optional. Method returns propagated variance if given.
  • use_model (str) – Set to ‘moffat’ or ‘gauss’ to replace the empirical PSF model with a 2D Moffat or 2D Gaussian estimate instead. Default is None (i.e. standard empirical PSF model is used). This takes significantly longer, but can help when subtracting blended sources.
Returns:

PSF-subtracted data cube numpy.ndarray: PSF model cube numpy.ndarray: (if var_cube given) Propagated variance cube

Return type:

numpy.ndarray