-
Notifications
You must be signed in to change notification settings - Fork 269
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
PedestalIntegrator does not work due to expected image shapes after #2529 #2631
Comments
Hi @cbadams2 , Thanks for your interest in using the calibration code in ctapipe. Before I answer what you need to do to fix the exception you mentioned, let me say that this part of the code is relatively old, mostly untested and has significantly changed downstream in the only place we know it has been used, the calibration code for LST-1. It is currently being rewritten, and we are making progress in doing so, see recent PRs: #2554, #2604, #2609 and the discussions there-in. The final step of actually computing the calibration coefficients will probably not be in ctapipe itself, at least not for some time, but in the codebase of the CTAO calibpipe, which is under development here: That being said, you encountered a bug that I think stems from recent changes of the expected waveform shape we made in #2529 So I'll transfer this from discussions to issues. |
can it be because the ctapipe/src/ctapipe/io/hdf5eventsource.py Lines 655 to 658 in fa4dac6
@cbadams2, can you provide a short version of your simulation file (a few events) for testing? |
No, that's not the case: In [1]: from ctapipe.io import EventSource
In [2]: s = EventSource("dataset://gamma_prod5.simtel.zst")
In [3]: e = next(iter(s))
In [4]: e.trigger.tels_with_trigger
Out[4]: array([ 9, 14, 104], dtype=int16)
In [5]: e.r1.tel[14].waveform.shape
Out[5]: (1, 1764, 25) |
The issue is that the The solution then as two aspects, which we should probably implement both: a) Perform no gain selection on the a) Is already implemented. The default is to not gain-select calibration events, so if your are only passing calibration events, it should already work. If you really want to pass physics events for some reason to the pedestal calculator, you need to set def test_integrator_simtel():
from ctapipe.io import EventSource
from ctapipe.calib.camera.pedestals import PedestalIntegrator
tel_id = 14
with EventSource("dataset://gamma_prod5.simtel.zst", allowed_tels={tel_id}, select_gain=False) as source:
ped_calculator = PedestalIntegrator(
subarray=source.subarray,
charge_product="FixedWindowSum",
sample_size=10000,
tel_id=tel_id,
)
n_events = 0
for event in source:
ped_calculator.calculate_pedestals(event)
n_events += 1
assert n_events > 0 Could you provide your input file where this fails? |
Here is the example for LST data that contains pedestal events, with a filter for the event type: def test_integrator_simtel():
"""Test the integrator works on actual simulation events"""
from ctapipe.io import EventSource
from ctapipe.calib.camera.pedestals import PedestalIntegrator
# test on actual calibration events from LST
tel_id = 1
input_url = "dataset://lst_prod3_calibration_and_mcphotons.simtel.zst"
with EventSource(input_url, focal_length_choice="EQUIVALENT", skip_calibration_events=False) as source:
ped_calculator = PedestalIntegrator(
subarray=source.subarray,
charge_product="FixedWindowSum",
sample_size=10000,
tel_id=tel_id,
)
n_events = 0
for event in source:
if event.trigger.event_type != EventType.SKY_PEDESTAL:
continue
ped_calculator.calculate_pedestals(event)
n_events += 1
assert n_events > 0 |
Thanks for the additional comments. My test dataset is source = SimTelEventSource(filename, focal_length_choice='EQUIVALENT', max_events=10, select_gain=False, skip_calibration_events=False, allowed_tels={2})
for event in source:
calib = CameraCalibrator(subarray=source.subarray)
calib(event)
ped_calculator.calculate_pedestals(event) I will admit to being quite naive here and not knowing what exactly this this is doing. It's difficult to tell how the pedestal is being extracted from the waveforms, and which pixels it is pulling them from. Will it be contaminated by the signal portion of the waveforms/images? In each event iteration, I see that |
This dataset does not seem to exist on the ctapipe test server. Are you using your own resources repository?
The Then, every Without knowing what kind of file you use, I'd expect it to only contain physics events, which will mean that you compute the charge std including the pixels that contain actual Cherenkov light. |
Discussed in #2630
Originally posted by cbadams2 October 29, 2024
I may be missing something, but I've been struggling to find clear directions for how best to populate the
PedestalContainer
for an event - specifically thecharge_std
field. Of course, this is a population-wise number, so it needs to be generated from a number of samples. My naive attempt was to do:but I immediately encounter an error with the following (truncated) traceback.
This is unsurprising to me, because the shape of the dl1 image I'm working with will be
(11328,)
, so won't have the dimension corresponding to axis=1.Am I doing this at all right? Is this a bug? Any help would be appreciated.
The text was updated successfully, but these errors were encountered: