make_optimal_extraction

msaexp.drizzle.make_optimal_extraction(waves, sci2d, wht2d, var2d=None, profile_slice=None, prf_center=None, prf_sigma=1.0, sigma_bounds=(0.5, 2.5), center_limit=4, fix_center=False, fix_sigma=False, trim=0, bkg_offset=6, bkg_parity=[-1, 1], offset_for_chi2=1.0, max_wht_percentile=None, max_med_wht_factor=10, verbose=True, ap_radius=None, ap_center=None, **kwargs)[source]

Optimal extraction from 2D arrays

Parameters
waves1D array

Wavelengths, microns

sci2d2D array

Data array

wht2d2D array

Inverse variance weight array

profile_slicetuple, slice

Slice along wavelength axis where to determine the cross-dispersion profile. If a tuple of floats, interpret as wavelength limits in microns

prf_centerfloat

Profile center, relative to the cross-dispersion center of the array. If None, then try to estimate it from the data

prf_sigmafloat

Width of the extraction profile in pixels

sigma_bounds(float, float)

Parameter bounds for prf_sigma

center_limitfloat

Maximum offset from prf_center allowed

fix_centerbool

Fix the centering in the fit

fix_sigmabool

Fix the width in the fit

trimint

Number of pixels to trim from the edges of the extracted spectrum

bkg_offset, bkg_parityint, list

Parameters for the local background determination (see drizzle_slitlets). The profile is “subtracted” in the same way as the data.

offset_for_chi2float

If specified, compute chi2 of the profile fit offseting the first parameter by +/- this value

max_wht_percentilefloat

Maximum percentile of WHT to consider valid

max_med_wht_factorfloat

Maximum weight value relative to the median nonzero weight to consider valid

verbosebool

Status messages

ap_center, ap_radiusint, int

Center and radius of fixed-width aperture extraction, in pixels. If not specified, then

>>> ap_center = int(np.round(ytrace + fit_center))
>>> ap_radius = np.clip(int(np.round(prof_sigma*2.35/2)), 1, 3)
kwargsdict

Ignored keyword args

Returns
sci2d_outarray

Output 2D sci array

wht2d_outarray

Output 2D wht array

profile2darray

2D optimal extraction profile

specTable

Optimally-extracted 1D spectrum

prof_tabTable

Table of the collapsed 1D profile