box_profile

jwst.extract_1d.extract.box_profile(shape, extract_params, wl_array, coefficients='src_coeff', label='aperture', return_limits=False)[source]

Create a spatial profile for box extraction.

The output profile is an image matching the input data shape, containing weights for each pixel in the image. Pixels to be fully included in an extraction aperture are set to 1.0. Pixels partially included are set to values between 0 and 1, depending on the overlap with the aperture limits. Pixels not included in the aperture are set to 0.0.

Upper and lower limits for the aperture are determined from the extract_params, in this priority order:

  1. src_coeff upper and lower limits (or bkg_coeff, for a background profile)

  2. trace +/- extraction width / 2

  3. center of start/stop values +/- extraction width / 2

  4. cross-dispersion start/stop values

  5. array limits.

Left and right limits are set from start/stop values only.

Only a single aperture is supported at this time. The ‘src_coeff’ and ‘bkg_coeff’ specifications allow multiple regions to be specified, but all regions are considered part of the same aperture and are added to the same profile, to be extracted at once.

Parameters:
shapetuple of int

Data shape for the output profile, to match the spectral image.

extract_paramsdict

Extraction parameters, as returned from get_extract_parameters.

wl_arrayndarray

Array of wavelength values, matching shape, for each pixel in the array.

coefficients{‘src_coeff’, ‘bkg_coeff’}, optional

The polynomial coefficients to look for in the extract_params dictionary. If ‘bkg_coeff’, the output aperture contains background regions; otherwise, it contains target source regions.

labelstr, optional

A label to use for the aperture, while logging limit values.

return_limitsbool, optional

If True, an upper and lower limit value for the aperture are returned along with the spatial profile. These are used for recording the aperture extent in output metadata. For apertures set from polynomial coefficients, the returned values are averages of the true upper and lower limits, which may vary by dispersion element.

Returns:
profilendarray of float

Aperture weights to use in box extraction from a spectral image.

lower_limitfloat, optional

Average lower limit for the aperture. Returned only if return_limits is set.

upper_limitfloat, optional

Average upper limit for the aperture. Returned only if return_limits is set.