spacetelescope / hstcal

Calibration for HST/WFC3, HST/ACS, and HST/STIS
BSD 3-Clause "New" or "Revised" License
11 stars 29 forks source link

CALACS: Move bias shift to top of BLEVCORR step #167

Open pllim opened 7 years ago

pllim commented 7 years ago

Future planning mentioned in ACS meeting on July 5, 2017. Wait for official green light before implementation.

Bias shift is an existing algorithm applied as part of BLEVCORR. ACS Team wants to move this to the start of the step, so it can "fix the prescan" before the prescan is used to remove bias level on science region.

As of 2017.2a, bias shift is only applied to post-SM4 WFC fullframe exposures. See #168 for feature request to extend this to new subarrays.

Note from Norman Grogin (2017-07-10)

The idea here is to try moving the signal-dependent bias shift correction ahead of the pre-scan blevcorr, and applying the bias shift correction to the pre-scan as well as to the science region (if it does not, already).

Note from @rjavila (2017-07-10)

Norman asked me to point you to some of the images that have bad bias shift correction due to a saturated star landing on the chip gap. Here’s some of the examples I’ve found:

mdlpstsci commented 6 years ago

I did some testing by (1) changing the number of virtual pixels appended to the end of each row (current default is 146), and/or (2) changing the fill value used for the virtual pixels (current default is the mean value of the magic square aka fat zero). I modified CALACS to read two new keywords, NVIRTGAP and FILLOPT, from a copy of the bias file calibration image, 1541940qj_bia.fits. NVIRTGAP is an integer and defines the number of virtial pixels appended to each row. FILLOPT is an integer with values of 0, 1, and 2 which defines the option associated with the value of the data fill for the virtual pixels (0 = 0.0, 1 = mean of the magic square, 2 = last real pixel value in the current row).

I performed tests and set "PCTECORR = OMIT" to save time, and BIASFILE set to testacsbias.fits.
The testacsbias.fits is a copy of 1541940qj_bia.fits with the additional keywords in the primary header as discussed above. I performed 18 tests with a range of NVIRTGAP: 36, 73, 109, 146 (default), 182, and 218, with each of the three FILLOPT options. The purpose of these tests was to get a sense of how sensitive the results were as I tweaked various parameters.
My base test image was jczgk1ptq_raw.fits, and I examined jczgk1ptq_flt.fits to look for changes. The "by eye" assessment is that NVIRTGAP=73 with a FILLOPT=2 gave the best results.
By this I mean the dark stripe was not as obvious in the resultant image. I also checked an image which did not seem to have any issues, jczgk1p3q, in an effort to make sure the change would not generate bad data where there had been none previously. Clearly, this is an insignificant statistical sample at this time.

Next step is providing the team with the output data and the modified code with instructions (the code/instructions only if they want to test themselves). We will also have a discussion regarding other possibilities.

pllim commented 6 years ago

I wonder if this mean the optimal parameter is time dependent... :thinking: