optimal_extraction

optimal_extraction#

excalibuhr.utils.optimal_extraction(D_full, V_full, bpm_full, obj_cen, aper_half=20, filter_mode='poly', badpix_clip=5, filter_width=121, max_iter=30, extr_level=0.9, remove_bkg=False, etol=1e-20, gain=2.0, NDIT=1.0, debug=False)[source]#

Optimal extraction based on Horne(1986).

Parameters:
  • D_full (array) – cropped image of one order

  • V_full (array) – Variance of the input image accounting for background and readout noise

  • bpm_full (array) – bad pixel map corresponding to the input image

  • obj_cen (float) – location of the target on slit in fraction between [0,1]

  • aper_half (int) – half of extraction aperture in pixels

  • badpix_clip (int) – sigma of bad pixel clipping

  • max_iter (int) – maximum number of iterations for bad pixel or cosmic ray rejection

  • gain (float) – detector gain

  • NDIT (int) – number of DIT exposure coadded

  • etol (float) – The tolerance parameter to avoid division by 0

Returns:

  • f_opt, f_err (array) – the extracted fluxes and their uncertainties

  • D, chi2_r (array) – modeled slit function and reduced chi2 of the model (for plotting)