replace_refpix

jwst.refpix.irs2_subtract_reference.replace_refpix(bad_pix, data, bad_mask, is_irs2, low_limit, high_limit, scipix_n, refpix_r, axis=-2)[source]

Replace a bad reference pixel with its nearest neighboring value.

The nearest reference group above and below the bad pixel are checked for good values in pixels with the same parity as the bad pixel. If both are good, they are averaged to determine the replacement value. If only one is good, it is directly used. If neither are good, but a neighboring readout with opposite parity is good, that value is used. If none of these options are available, the value is set to 0.0 and will be interpolated over during the IRS2 correction.

The data array is modified in place.

Parameters:
bad_pixint

The bad pixel index to replace.

datandarray

The 4-D data array containing reference and science pixels. If in science orientation, axis should be -2. If in detector orientation, axis should be set to -1.

bad_maskndarray

A 1-D boolean mask, where True indicates a bad reference value. Should match the shape of the data along axis.

is_irs2ndarray

A 1-D boolean mask, where True indicates an interleaved reference pixel. Should match the shape of the data along axis.

low_limitint

The lower limit of the data indices along axis to check for replacement values, usually set to the bottom of the amplifier.

high_limitint

The upper limit of the data indices along axis to check for replacement values, usually set to the bottom of the amplifier.

scipix_nint

Number of regular (science) samples before stepping out to collect reference samples.

refpix_rint

Number of reference samples before stepping back in to collect regular samples.

axisint, optional

Indicates the axis containing the reference pixel values. Set to -2 for science orientation, -1 for detector orientation.