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

StereoTrigger does only work when tels_with_trigger is a python list, real sources use numpy arrays #2321

Closed
maxnoe opened this issue Apr 27, 2023 · 2 comments · Fixed by #2320
Labels

Comments

@maxnoe
Copy link
Member

maxnoe commented Apr 27, 2023

Describe the bug

The code assumed and the unit tests made it so that the StereoTrigger works only when tels_with_trigger is a python list,
however the event source implementations provide a np.ndarray with dtype uint16.

To Reproduce
Try processing a prod3 or prod6 divergent pointing file where there might be single LSTs with the stereo trigger set to simulate the LST hardware stereo trigger:

❯ ctapipe-process -i dataset://gamma_divergent_LaPalma_baseline_20Zd_180Az_prod3_test.simtel.gz \
   -o /tmp/divergent.dl1.h5 \
    --progress --overwrite \
   --SimTelEventSource.focal_length_choice=EQUIVALENT \
   --SoftwareTrigger.min_telescopes_of_type="[('type', '*', 0), ('type', 'LST*', 2)]"

/home/mnoethe/.local/conda/envs/cta-dev/lib/python3.9/site-packages/traitlets/traitlets.py:2930: FutureWarning: --SoftwareTrigger.min_telescopes_of_type=[('type', '*', 0), ('type', 'LST*', 2)] for containers is deprecated in traitlets 5.0. You can pass `--SoftwareTrigger.min_telescopes_of_type item` ... multiple times to add items to a list.
  warn(
2023-05-08 12:08:24,527 WARNING [ctapipe.core.telescope_component] (telescope_component.attach_subarray): TelescopeParameter type argument 'SST_1M_*' did not match any known telescope types
SimTelEventSource: 1ev [00:02,  2.17s/ev]
2023-05-08 12:08:26,718 ERROR [ctapipe.ctapipe-process] (tool.run): Caught unexpected exception: 'numpy.ndarray' object has no attribute 'remove'
Traceback (most recent call last):
  File "/home/mnoethe/Uni/CTA/ctapipe/ctapipe/core/tool.py", line 426, in run
    self.start()
  File "/home/mnoethe/Uni/CTA/ctapipe/ctapipe/tools/process.py", line 305, in start
    if not self.software_trigger(event):
  File "/home/mnoethe/Uni/CTA/ctapipe/ctapipe/instrument/trigger.py", line 99, in __call__
    event.trigger.tels_with_trigger.remove(tel_id)
AttributeError: 'numpy.ndarray' object has no attribute 'remove'

Expected behavior

Single LSTs are removed, events with less than 2 telescopes are completely discarded.

Supporting information

Additional context

This is needed for the prod6 divergent processing, since due to an error in the simtel configuration, the LST hardware stereo trigger was not actually already included in the simulation.

@maxnoe maxnoe added the bug label Apr 27, 2023
@maxnoe maxnoe linked a pull request Apr 27, 2023 that will close this issue
@kosack
Copy link
Contributor

kosack commented May 4, 2023

Can you explain how single LST events got through here? Looking at the code, if a numpy array was given, it looks like i should simply raise an exception since np.array.remove() doesn't exist. Maybe I'm missing something. Or is it just that we never had it find an event that needed to be skipped since the stereo trigger was properly simualted?

@maxnoe
Copy link
Member Author

maxnoe commented May 5, 2023

Exactly. In prod5b, the stereo trigger is simulated. Due to a bug in the config, it is missing in the prod6 divergent pointing simulations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants