roman-corgi / corgidrp

Data Reduction Pipeline for the Roman Coronagraph Instrument
BSD 3-Clause "New" or "Revised" License
5 stars 4 forks source link

Cosmics kgain #211

Closed JuergenSchreiber closed 1 month ago

JuergenSchreiber commented 2 months ago

Added KGain calibration file as mandatory input parameter in detect_cosmic_rays

Type of change

Reference any relevant issues (don't forget the #)

203

Checklist before requesting a review

JuergenSchreiber commented 2 months ago

I guess I still have to update all the e2e tests with a kgain caldb entry where detect_cosmic_rays is used...

semaphoreP commented 2 months ago

Can this be an optional calibration? since detect cosmic rays is a L2a level step, while Kgain is a L2b level calibration product

kjl0025 commented 2 months ago

Thanks for this, Juergen, but now that I think about this, to Jason's point, we do have an issue (#202 ) about enhancing the k gain and nonlin code to take into account flagged cosmics to improve k gain and nonlinearity calibration. (The II&T code did not account for cosmic rays, but ideally, that should be done.) So the recipe for making the k gain and nonlin calibrations will eventually use detect_cosmic_rays, which would be circular. So I'm sorry to say this given all your work on this, Juergen, but I think we should actually cancel this PR and leave the code as it is (drawing k gain from DetectorParams), and we would just update the DetectorParams default k gain value whenever a new k gain calibration is done. Jason can chime in if he has other thoughts.

maxwellmb commented 2 months ago

Do I understand correctly that detect_cosmic_rays needs a KGain value, and its just that right now we're pulling it from DetectorParams, rather than a KGain file?

semaphoreP commented 2 months ago

Can we handle it like how we handle Bias offset subtraction with NoiseMaps in prescan_biassub? We leave it as an optional keyword (it needs to be the first keyword for this to work), and the recipe species Kgain to be "AUTOMATIC,OPTIONAL". Basically, the walker will pass in a Kgain if we have one, or pass in None. If None gets passed in, let's just use the Kgain in the DetectorParams.

kjl0025 commented 2 months ago

Do I understand correctly that detect_cosmic_rays needs a KGain value, and its just that right now we're pulling it from DetectorParams, rather than a KGain file?

Yes, that is correct.

And I agree with Jason's proposal. That's probably better than having to update DetectorParams after a calibration.

maxwellmb commented 2 months ago

I don't think I understand why we have a KGain in DetectorParams. What is its relation to the KGain calibration. A backup?

kjl0025 commented 2 months ago

I think we put it in there initially, before we had started on the calibration script for k gain.

JuergenSchreiber commented 1 month ago

@maxwellmb: yes, kgain in detetor_params works like a backup if I implement it like desired.

JuergenSchreiber commented 1 month ago

To make this work as first parameter, I have to specify detector_params also as an optional parameter