Skip to content
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 application of DL1 charge calibration to CameraCalibrator #1160

Merged
merged 16 commits into from
Nov 12, 2019

Conversation

watsonjj
Copy link
Contributor

@watsonjj watsonjj commented Oct 28, 2019

This PR adds the ability to apply the DL1 charge calibration that has been attached to the event in the DL1CameraCalibrationContainer (event.mon.tel[telid].calibration.dl1)

"Coefficients for the relative correction between pixels to achieve a "
"uniform charge response (post absolute calibration) from a "
"uniform illumination."
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For "relative" and "absolute", it may be better to name them "X_gain" or similar to be clear these are multiplicative calibration factors, unlike "pedestal" which is additive (well subtractive, really).

ctapipe/io/containers.py Show resolved Hide resolved
@watsonjj
Copy link
Contributor Author

watsonjj commented Oct 28, 2019

I've added "_factor" to multiplicative coefficients, and "_offset" to additive coefficients

@codecov
Copy link

codecov bot commented Oct 28, 2019

Codecov Report

Merging #1160 into master will increase coverage by 0.07%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1160      +/-   ##
==========================================
+ Coverage    85.9%   85.97%   +0.07%     
==========================================
  Files         182      182              
  Lines       11305    11390      +85     
==========================================
+ Hits         9711     9792      +81     
- Misses       1594     1598       +4
Impacted Files Coverage Δ
ctapipe/calib/camera/tests/test_calibrator.py 100% <100%> (ø) ⬆️
ctapipe/io/containers.py 100% <100%> (ø) ⬆️
ctapipe/calib/camera/calibrator.py 96.19% <100%> (+0.15%) ⬆️
ctapipe/io/simteleventsource.py 97.6% <0%> (-0.92%) ⬇️
ctapipe/io/hessioeventsource.py 92.15% <0%> (-0.65%) ⬇️
ctapipe/core/tests/test_traits.py 100% <0%> (ø) ⬆️
ctapipe/io/tests/test_simteleventsource.py 100% <0%> (ø) ⬆️
ctapipe/core/traits.py 98.03% <0%> (+0.16%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9cb7b96...ca2cd52. Read the comment docs.

@kosack
Copy link
Contributor

kosack commented Oct 29, 2019

what happens currently with monte-carlo data? Are these calibration monitoring containers filled with the values from the MC file?

Also, be clear that "monitoring" is not event-wise, it's time-wise, so if these are intended to be interpolated to an event time (in the case that things like the pedestals), then i'm not sure the monitoring value is the one you want to use.

@watsonjj
Copy link
Contributor Author

what happens currently with monte-carlo data? Are these calibration monitoring containers filled with the values from the MC file?

No. The calibration coefficients depend on the charge extraction technique, and the calibration approach (e.g. converting to photons)

Also, be clear that "monitoring" is not event-wise, it's time-wise, so if these are intended to be interpolated to an event time (in the case that things like the pedestals), then i'm not sure the monitoring value is the one you want to use.

The values used here are intended to be the ones that you apply for an event. It may be that these are loaded once per observation, and don't change. Or it may be that they are interpolated from a table depending on the event time (and could be basically the same for multiple events). Or they may be continuously updated from an on-the-fly calibration. Let me know if this is not the correct place for such coefficients...

@watsonjj
Copy link
Contributor Author

These values are intended to be filled by a Calculator class, which I will implement in a future PR (plus adapt Franca's Calculator classes)

@kosack
Copy link
Contributor

kosack commented Oct 30, 2019

The values used here are intended to be the ones that you apply for an event. It may be that these are loaded once per observation, and don't change. Or it may be that they are interpolated from a table depending on the event time (and could be basically the same for multiple events). Or they may be continuously updated from an on-the-fly calibration. Let me know if this is not the correct place for such coefficients...

If these are the instantaneous values for the event, not the "monitored values" once per second or more, then they really should be in the event, not monitoring container (I know we currently mix the two, but that will be separated at some point). Instantaneous values should be in the "DL1/Event/Telescope" data model (or R1 depending on when they are computed) and are derived generally from monitoring data. Perhaps for now, we just put them in event.calib.tel[x] to remind ourselves that they are the per-event quantities, so that when we remove all MON data from the event structure, we don't confuse the two?

Really, it's only pedestals I'm worried about confusing. Maybe also flatfield, but anything that doesn't change during an observation (DC/PE, etc) ,should eventually leave the event container completely.

@kosack
Copy link
Contributor

kosack commented Oct 30, 2019

I think I need to write down a complete proposal for the full internal and external data model at some point, but that will require some time (should be done and updated before a 1.0 release though!). For now, let's try to put things somewhere that makes it less painful to move them around later. Probably just not calling anything "Monitoring" now is best, since we so far do not really compute any true monitoring quantities (except perhaps the outputs from Franca's pedestal tool, if they are not per-event)

@watsonjj
Copy link
Contributor Author

Really, it's only pedestals I'm worried about confusing. Maybe also flatfield, but anything that doesn't change during an observation (DC/PE, etc) ,should eventually leave the event container completely.

@kosack Does it make sense that it leaves the event container completely? It's important to know the correct value for the current event. As you have said in #1165:

Therefore what is in the event are instantaneous values of those quantities, interpolated to the current event time. Other COmponents that use them do not need to know how they were interpolated (or even if they were computed on-the-fly like with pedestals, perhaps), just that the value in the Container is the right one for this event. Therefore they don't need to distinguish between data coming from a "service" or from an event stream.

@watsonjj
Copy link
Contributor Author

The dl1 calibration coefficients that are applicable for the current event (and should be used in the CameraCalibrator) are now located at event.calibration.tel[telid].dl1

@kosack
Copy link
Contributor

kosack commented Oct 31, 2019

@kosack Does it make sense that it leaves the event container completely? It's important to know the correct value for the current event. As you have said in #1165:

I think we keep the instantaneous values in the event. (just don't call them "mon")

@watsonjj
Copy link
Contributor Author

I think we keep the instantaneous values in the event. (just don't call them "mon")

Yep done

@watsonjj watsonjj requested a review from maxnoe November 7, 2019 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants