cta-observatory / ctapipe_io_lst

ctapipe IO plugin for LST prototype data

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Perform gain selection inside of the event source

maxnoe opened this issue · comments

To be compatible with ctapipe 0.8, gain selection needs to happen inside the event source.

For this, a traitlet and member gain_selector needs to be added to the source:

❯ ctapipe-stage1-process --input LST-1.4.Run01834.0000.fits.fz --output LST-1.4.Run01834.0000.dl1.h5INFO [Stage1ProcessorTool] (tool/initialize): ctapipe version 0.8.0.post11+gita62e121
INFO [Stage1ProcessorTool] (tool/run): Starting: ctapipe-stage1-process
ERROR [Stage1ProcessorTool] (tool/run): Caught unexpected exception: Traitlet does not exist: gain_selector
Traceback (most recent call last):
  File "/home/maxnoe/Uni/CTA/ctapipe/ctapipe/core/tool.py", line 215, in run
    self.setup()
  File "/home/maxnoe/Uni/CTA/ctapipe/ctapipe/tools/stage1.py", line 258, in setup
    EventSource.from_config(parent=self, gain_selector=self.gain_selector)
  File "/home/maxnoe/Uni/CTA/ctapipe/ctapipe/io/eventsource.py", line 337, in from_config
    return event_source(config.EventSource.input_url, config=config, **kwargs)
  File "/home/maxnoe/Uni/CTA/ctapipe/ctapipe/io/eventsource.py", line 34, in event_source
    return EventSource.from_url(input_url, **kwargs)
  File "/home/maxnoe/Uni/CTA/ctapipe/ctapipe/io/eventsource.py", line 295, in from_url
    return subcls(input_url=input_url, **kwargs)
  File "/home/maxnoe/Uni/CTA/ctapipe_io_lst/ctapipe_io_lst/__init__.py", line 118, in __init__
    super().__init__(**kwargs)
  File "/home/maxnoe/Uni/CTA/ctapipe/ctapipe/io/eventsource.py", line 142, in __init__
    super().__init__(config=config, parent=parent, input_url=input_url, **kwargs)
  File "/home/maxnoe/Uni/CTA/ctapipe/ctapipe/core/component.py", line 113, in __init__
    raise TraitError(f"Traitlet does not exist: {key}")
traitlets.traitlets.TraitError: Traitlet does not exist: gain_selector
INFO [Stage1ProcessorTool] (tool/run): Output: /home/maxnoe/Uni/CTA/cta-lstchain/data/LST-1.4.Run01834.0000.dl1.h5

Am I understanding correctly that the motivation of having the gain_selector part of the reader is that it provides directly DL0?

R1, yes. I got a bit confused from where the CameraCalibrator starts (and there was an error with the datalevels property of the SimTelEventSource).

But yes, ctapipe expects gain selection to already have happend at the stage where the dl1 tool begins.

In short, what we have to do in the event source is to provide the full r1 container with calibrated waveforms for both gains and and the selected_gain_channels

This means that all the calibration code currently in lstchain should be moved here.

It's a minor comment, but shouldn't ctapipe expect DL0 and not R1?
The volume reduction will ultimately be done before .

It's a minor comment, but shouldn't ctapipe expect DL0 and not R1?
The volume reduction will ultimately be done before .

Yes. I also started this discussion here cta-observatory/ctapipe#1388. I think it should be discussed among us of how to proceed.