PyWiFeS/pipeline

Mixing Nod and Shuffle with ClassicEqual leads to flux calibration issues

Opened this issue · 0 comments

I recently found an issue with my data that was ultimately caused by an incorrect flux calibration. My science sources were observed with nod and shuffle (n&s) where my observation of the standard star was made with ClassicEqual (CE).

The parameters of the last n&s are still written to the header of the CE exposure. Although other fields correctly reflect a n&s was not used, the pipeline does not check these. When the ns flag is set in the reduce_red/blue_data scripts, the standard star CE exposures are treated as n&s. Since no checks are made to the header, in particular the WIFESOBS field, the EXPTIME is re-calculated using the n&s parameters (see pywifes.py line 1813). Consequently, when extract_wifes_stdstar from wifes_calib.py is executed, it pulls out the EXPTIME based on the n&s parameters and scales the observed flux incorrectly.

The fix I have implemented for my data was to check WIFESOBS in the extract_wifes_stdstar function to ensure that a exposure was n&s before assigning exptime, otherwise it used the exptime from the original header.

See the pull request #12