drizzle_slitlets

msaexp.drizzle.drizzle_slitlets(id, wildcard='*phot', files=None, output=None, verbose=True, drizzle_params={'blendheaders': True, 'fillval': 0, 'good_bits': 0, 'kernel': 'square', 'output': None, 'pixfrac': 1.0, 'pscale': None, 'pscale_ratio': 1.0, 'single': True, 'wht_type': 'ivm'}, master_bkg=None, wave_arrays={}, wave_sample=1, log_step=True, force_nypix=31, center_on_source=False, center_phase=-0.5, fix_slope=None, outlier_threshold=5, sn_threshold=3, bar_threshold=-0.7, err_threshold=1000, bkg_offset=5, bkg_parity=[1, -1], mask_padded=False, show_drizzled=True, show_slits=True, imshow_kws={'aspect': 'auto', 'cmap': 'cubehelix_r', 'interpolation': 'nearest', 'origin': 'lower', 'vmax': None, 'vmin': -0.1}, get_quick_data=False, max_sn_threshold=20, reopen=True, **kwargs)[source]

Implementing more direct drizzling of multiple 2D slitlets

Parameters
id, wildcardobject, str

Values to search for extracted slitlet files:

files = glob.glob(f'{wildcard}*_{id}.fits')
fileslist

Explicit list of either slitlet filenames or jwst.datamodels.SlitModel objects.

outputstr

Optional rootname of output figures and FITS data

verbosebool

Verbose messaging

drizzle_paramsdict

Drizzle parameters passed to msaexp.utils.drizzle_slits_2d

master_bkgarray-like, int

Master background to replace local background derived from the drizzled product

wave_arraysdict

Explicit target wavelength arrays with keys for {grating}-{filter} combinations

wave_sample, log_stepfloat, bool

If waves not specified, generate with msaexp.utils.get_standard_wavelength_grid

force_nypix, center_on_source, center_phase, fix_slopeint, bool, float

Parameters of msaexp.drizzle.center_wcs

outlier_thresholdint

Outlier threshold in drizzle combination

sn_thresholdfloat

Mask pixels in slitlets where data/err < sn_threshold. For the prism, essentially all pixels should have S/N > 5 from the background, so this mask can help identify and mask stuck-closed slitlets

bar_thresholdfloat

Mask pixels in slitlets where barshadow < bar_threshold

err_thresholdfloat

Mask pixels in slitlets where err > err_threshold*median(err). There are some strange pixels with very large uncertainties in the pipeline products.

bkg_offset, bkg_parityint, list

Offset in pixels for defining the local background of the drizzled product, which is derived by rolling the data array by bkg_offset*bkg_parity pixels. The standard three-shutter nod pattern corresponds to about 5 pixels. An optimal combination seems to be fix_slope=0.2, bkg_offset=6.

If bkg_offset < 0, then don’t do shifted offset.

mask_paddedbool

Mask pixels of slitlets that had been padded around the nominal MSA slitlets

show_drizzledbool

Make a figure with msaexp.drizzle.show_drizzled_product showing the drizzled combined arrays. If output specified, save to {output}-{id}-[grating].d2d.png.

show_slitsbool

Make a figure with msaexp.drizzle.show_drizzled_slits showing the individual drizzled slitlets. If output specified, save to {output}-{id}-[grating].slit2d.png.

imshow_kwsdict

Keyword arguments for matplotlib.pyplot.imshow in show_drizzled and show_slits figures.

get_quick_databool

Just return waves, slits, and the drizzled sci and err data arrays before doing any outlier rejection, etc.

max_sn_thresholdfloat

S/N threshold for initial rejection of the maximum pixel in the set

reopenbool

Re-initialize jwst.datamodels.SlitModel before drizzling to fix apparent memory leak issue

Returns
figsdict

Any figures that were created, keys are separated by grating+filter here and below

datadict

HDUList FITS data for the drizzled output

wavedatadict

Wavelength arrays

all_slitsdict

SlitModel objects for the input slitlets

drz_datadict

3D sci and wht arrays of the drizzled slitlets that were combined into the drizzled stack