-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support to calwf3 for Full Well Saturation Maps (SATUFILE) #558
Comments
Sent note to Jennifer and Sylvia regarding a timeframe for their creation of the new saturation image. |
A test version of the UVIS satufile for calwf3 development may be found here: |
@mackjenn Thanks. I got the test version of the satufile. Are there binned WFC3 images? |
@mackjenn Ooops. I finally read your email regarding eventually making files for binned images. I have my answer! |
@mdlpstsci Hopefully you can use the same calwf3 logic for the binned SATUFILE as for the binned FLSHFILE
See IHB Section 5.4: The maximum full well depth of the pixels on the WFC3/UVIS chips is ~72500 e– (see IHB Figure 5.6). For the default gain ~1.5 e–/DN, this corresponds to ~48000 DN, well below the ADC limit of 65,535 DN. If the pixels are binned 2×2 or 3×3, the binned pixels could reach flux levels of 4 or 9 times 48,000 DN, respectively, which would be truncated to 65,535 DN (*1.5= ~98,300 e–) during readout. |
@mackjenn I have done testing with the modified algorithm on full-frame data, as well as subarrays(Amps A, B, C, D, and A straddle - I could not seem to find an Amp C staddle dataset). I modified some of the data to force high signal values for testing. Finally, all datasets for comparison have been manually reprocessed by me. I do see differences in the datasets when comparing data processed with the new code and without the new code. Some differences are expected as the full-well saturation flags are applied in different places in the calibration code, as well as pixels formerly having DQ values of both 256 and 2048 will now only have a DQ value with 2048. However, INS will have to judge if any differences seen in SCI and ERR are appropriate. I am contacting you at this time to find out if you have a 2x2 and 3x3 calibration file for testing. |
The following datasets (1x1 binning) have been used thus far to test the new algorithm: Filename FF/Sub Amp BiaslevelA BiaslevelB BiaslevelC BiaslevelD CCDGain When comparing newly processed data using the current software and the new software, there were the expected differences in the DQ arrays. In addition, some files had differences in some keyword values: Primary: cal_ver SCI and ERR: goodmax, goodmean, goodmin, ngoodpix, snrmax, snrmean, snrmin Only dataset iaaua1leq had differences in SCI and ERR in addition to the DQ differences. |
@mdlpstsci We've created 3 new reffiles here, which correspond to the different UVIS binning options: /grp/hst/wfc3k/mack/satufile_uvis/
These have a suffix 'verbose' since their headers were copied from FLSHFILEs but not stripped of extraneous header keywords. I believe they will work okay with the code, but please let me know if the 1x1 binned file gives any differences with respect to your prior test using 'wfc3_uvis_sat.fits'. (I think it won't). From your comments above, it looks like you were able to find amp C data. We are happy to provide you dataset names for various test cases, if needed. (There are fewer binned images, so we may not have all amps for those.) |
@mackjenn I do not have permission to access below /grp/hst. |
@mdlpstsci Oops! I copied them here: /user/mack/uvis_satufile/ |
@mackjenn
These are all the comments/questions I have at this time. |
Michele, Thanks for these detailed notes. This is super helpful and we will work to address the issues with the FITS files. Regarding the gain, I'll need to think about this and get back to you. -Jennifer |
@mackjenn I have crossed out some incorrect comment that I made in the text above for Item 2 while looking up information for our conversation. The WFC3 *blv/blc_tmp.fits files are still in counts! The Given the above information, the application of a saturation image in DN does not have to happen after BIASCORR and BLEVCORR. This correction could happen in doDQI or in a function right after doDQI. |
@mdlpstsci Thanks for the helpful discussion today. To summarize, we will:
As we discussed, you will update wfc3tools.readthedocs to better describe the actual behavior of calwf3 (e.g. the gain is not applied in wf3ccd as stated in several places). Also, the SINK pixel flagging happens after BIASCORR when DQICORR is invoked for a second time. Finally, the units of the certain reference files applied in wf3ccd are in electrons, so calwf3 applies the gain to these. It would be good to mention this in the documentation. We'll be happy to look this over once you have an initial draft. Thanks again!! |
@mackjenn To clarify, the saturation map was applied in the Please note I have also explicitly confirmed WVFC3 UVIS data is converted to electrons during the FLATCORR step. |
@mdlpstsci The new files for testing in units of electrons are here: Can you verify that the precise gain value applied by calwf3 is 1.56 e/DN, as written in the trailer files? Thanks for opening a separate ticket regarding the documentation. I have acquired a copy of the calwf3 flowchart diagram and will modify accordingly and upload a new version to that ticket once approved by the branch. |
|
Oops! I keep sending the wrong directory. They are here: |
@mackjenn |
Hi @mdlpstsci , I believe the amp-dependent gain is incorporated as part of the flat field science array. As a validation, when I look at the saturation map (in electrons) derived from calibrated FLT data, there are no quadrant boundaries. Thus, I think you can just use the mean gain value. However, you may be right that we need to account for this. In that case, we can adjust our SATUFILE map by the amp-dependent gain and validate through testing. A question for you... Does calwf3 process data with non-default gain values? I'm not sure if there is archival data with Gain=1.0, 2.0, or 4.0 that needs corresponding SATUFILEs. |
@mackjenn |
Searching the on-line cache was not working out. I asked Matt who has access to a database to find out for me about WFC3 gains. I forgot to tell him only for UVIS as the gain=2.5 looks like IR. It looks like IR can have commanded gains of 2.0, 2.5, 3.0, and 4.0. +-------------+-------+ |
@mdlpstsci Are you sure the amp-dependent gain is applied after FLATCORR? Can you do a quick check with values of 1.0 in each amp and see what happens? While the CCDTAB lists gain values for each amp, both Sylvia and I were under the impression that only the average gain value is used and that the flats account for the amp-dependent ratios. For now, lets just stick with a single gain when converting the SATUFILE from electrons to DN. We can test this later with photometry. Also for now, lets ignore non-default gain and we can add later if needed. |
(1) The gain is applied during the FLATCORR step. As of 2009/2010, the mean gain of all amps is used when applying the gain correction during FLATCORR. If you and Sylvia think something different happens, please let me know so that I can verify. (2) I have processed data with the new code using a mean gain value of 1.0. As expected there are differences in the output files from the nominal gain in use of 1.56. Is there something specific you want me to check? (3) I have implemented the use of the mean_gain for converting the SATUFILE back into DN for its application to the data. (4) As for images with non-default gain values... I am not sure in detail how this works, but I imagine this process is dependent upon how you set up the rules with CRDS for selection of the new SATUFILE to populate the headers of the RAW files. The SATUFILE file chosen will be based upon whatever criteria has been set up for selection. As long as the gain is in the CCDTAB file, then the mean gain will be used to convert the SATUFILE values into DN for application. |
@mackjenn Background
|
Oops, didn't mean to close this. |
@mackjenn Responses to your latest questions, please see my comments above from two days ago. The first comment contains my responses and a question. My second comment has to do with the saturation file construction. I wish the comments were dated rather than relative (e.g., n days ago). |
@mackjenn I am just checking to make sure this is what you want. |
Thanks for your careful checks and for uncovering these errors. Below are comments on several topics: Empty rows: Thanks for pointing out the new issue with the rows near the chip gap. It turns out bias files are empty from rows 2049-2070, whereas the flashfile is only empty from 2052-2070. (I've asked the team why this might be... ). In the meantime we will fix this in the SATUFILE. Holes: We didn't realize they were here and will fix this too. Thanks. Gain: I may have misunderstood what you said about the CCDTAB reading and applying amp-dependent values. To avoid further confusion, we'll just agree that calwf3 will apply a constant gain value for all amps when converting the SATUFILE to DN. If needed, we will incorporate gain-offsets in the SATUFILE, if needed, to achieve the optimal DQ flagging in flat fielded stellar observations. Binning: Can you point us to a binned science image so we can match the dimensions of the 2x2 and 3x3 science arrays? Again, we copied the BIASFILEs which were missing 3 rows of data for each chip, so it makes sense that we still have issues with the overscan. Thanks for your patience as we work through these items. :) |
@mackjenn Empty rows: There are three empty rows for both Chip 1 and Chip 2. I only discussed Chip 2. Holes: I did not think you wanted these. Gain: Yes, I am just using the mean_gain for all the amps. Binning: Here are some binned datasets. |
@mackjenn Since there is no "SATCORR" calibration step switch, the saturation image is currently applied if and only if both BIASCORR and BLEVCORR are set to PERFORM. This is how the ACS folks wanted the logic set up. However, WFC3 does not have the ACS restrictions. Do you want the new saturation flagging to be done regardless of any other calibration step switches? I should add that I am going on vacation next week, so I do not want to be the bottleneck in your being able to test. |
@mdlpstsci The ACS logic for the masking sounds good. Thanks for offering to share the calwf3 executable. We'll make those fixes to the reference files and then run some tests while you're away to verify that we've got it working. |
@mackjenn |
Similar to changes recently implemented for calacs (acsccd), the WFC3 branch would like to update calwf3 (wf3ccd) to flag Full-well saturation (currently part of DQICORR) using an image rather than a single scalar value.
For reference see the hstcal issue and associated pull request:
#453
#539
The CCDTAB uses a single value of full-well saturation for data quality flagging for ALL amplifiers, whereas studies have shown that the full-well spatially varies across each amplifier region. The new reference file SATUFILE is 2D full-well saturation image and will be used to detect and flag pixels versus using the simple scalar value defined in the CCDTAB.
This check would happen at the end of BIASCORR, where the SATUFILE reference file will be in units of electrons and will have calibrated image dimensions after overscan trimming has occurred. The WFC3 Branch will work with CRDS/ReDCaT on implementing the new reference file.
The goal is to implement initial functionality by the end of FY2021 Q2 (March 2021) if possible, but the timeline is flexible depending on the availability of @mdlpstsci .
The text was updated successfully, but these errors were encountered: