cwitools.imaging.get_pseudo_nb¶
-
cwitools.imaging.get_pseudo_nb(fits, wav_center, wav_width, wl_sub=True, pos=None, cwing=50, fit_rad=2, sub_rad=None, smooth=None, smoothtype='box', var=[], medsub=True, mask_psf=False, fg_mask=[])¶ Create a pseudo-Narrow-Band (pNB) image from a data cube.
- Args:
fits (astropy.io.fits.HDUList): The input FITS file. wav_center (float): The central wavelength of the narrow-band in Angstrom. wav_width (float): The width of the narrow-band image in Angstrom. wl_sub (bool): Set to TRUE to scale and subtract a white-light image. pos (float tuple): The location the continuum source in x,y to subtract.
Leave empty to skip white-light subtraction.fit_rad (float): The radius around the source to use for scaling the PSF. sub_rad (float): The radius around the soruce to use when subtracting. smooth (float): Size of smoothing kernel to use prior to subtraction. smoothtype (string): Type of smoothing kernel to use:
‘box’: 2D Boxcar kernel (size=width) ‘gaussian’: 2D Gaussian Kernel (size=full-width at half-max)- var (NumPy.ndarray): Variance cube associated with input cube, required
- to output associated variance images.
- medsub (bool): Set to TRUE to median subtract WL image and NB (happens
- before scaling of WL image, if performing subtraction.)
mask_psf (bool): Set to TRUE to mask the spaxels used for fitting. fg_mask (numpy.ndarray): Binary mask of continuum sources to mask
and exclude during median subtraction.- Returns:
- numpy.ndarray: The pseudo-NB image (WL-subtracted if requested.) numpy.ndarray: The white-light (WL) image. numpy.ndarray: (If var given as input) The variance on the pNB image. numpy.ndarray: (If var given as input) The variance on the WL image
Examples:
Note that this algorithm assumes input a cube with units of erg/s/cm2/Angstrom, and header wavelength units of Angstrom.
To obtain a simple pseudo-Narrowband (and white-light image) with no subtraction or variance estimation:
>>> from cwitools import imaging >>> from astropy.io import fits >>> myfits = fits.open("cube.fits") >>> pNB, WL = imaging.get_pseudo_nb(myfits, 4500, 25)
If there is a QSO in the image at (x, y) = (40, 50) - then we can obtain the continuum subtracted version with:
>>> pNB_sub, WL = imaging.get_pseudo_nb(myfits, 4500, 25, pos=(40, 50))
Finally, if we want variance estimates on the output, we must provide a variance cube:
>>> myvar = fits.getdata("varcube.fits") >>> r = imaging.get_pseudo_nb(myfits, 4500, 25, pos=(40, 50), var=myvar) >>> NB, WL, NB_var, WL_var = r //Unpack the output in this order