Skip to content

Conversation

@moralejo
Copy link
Contributor

@moralejo moralejo commented Sep 26, 2025

First version of the component to add noise in MC waveforms, for adapting it to different observation conditions.
It adds at random N instances of waveforms from an NSB-only file to the waveforms of a showers file. It seems to reproduce well the noise distributions produced directly by sim_telarray:

Update: there was a mistake in the plots below (only one telescope was used, multiple times). After correcting this, it turns out that the noise padding produces slightly larger noise than what is produced by sim_telarray itself:

image image

Test function still not ready, I open the draft PR to start discussion.

@moralejo moralejo marked this pull request as ready for review September 26, 2025 16:26
@moralejo moralejo requested a review from maxnoe September 29, 2025 14:35
@moralejo
Copy link
Contributor Author

The failures in the tests seems to be unrelated to this. Any idea of what is going on?

@maxnoe
Copy link
Member

maxnoe commented Sep 29, 2025

The connection timeout is unrelated and should go away be re-running, but this error is in code you added:

src/ctapipe/tests/test_traitlets_configurable.py::test_all_traitlets_configurable - AssertionError: Class ctapipe.image.modifications.WaveformModifier is missing .tag(config=True) for traitlets: {'total_noise'}

@moralejo
Copy link
Contributor Author

The connection timeout is unrelated and should go away be re-running, but this error is in code you added:

src/ctapipe/tests/test_traitlets_configurable.py::test_all_traitlets_configurable - AssertionError: Class ctapipe.image.modifications.WaveformModifier is missing .tag(config=True) for traitlets: {'total_noise'}

Thanks, I had not noticed, because test ran well locally. Anyway it is not something that should be configured, it is something internally, so I just made a normal dict()

…ssible use of real data as source of NSB waveforms.
…tion

using numba. Now this is the default option, but one can choose to shuffle
"full cameras" of noise (like before), which is about 5 times faster.

Implemented other reviewers' suggestions
@maxnoe
Copy link
Member

maxnoe commented Oct 8, 2025

This looks good in general. However, at the moment, it's not usable via ctapipe-process.

I think there are two options:

  • Adding it in ProcessorTool directly as its own step
  • Adding it to it to the CameraCalibrator class in the r1 to dl0 step.

I think this does not really belong into the CameraCalibrator, so I would add it directly to the process tool.

Similar to how the ImageProcessor is using the ImageModifier here:

for tel_id, dl1_camera in event.dl1.tel.items():
if self.apply_image_modifier.tel[tel_id]:
dl1_camera.image = self.modify(tel_id=tel_id, image=dl1_camera.image)

@maxnoe
Copy link
Member

maxnoe commented Oct 8, 2025

This leaves the question when and how to initialize it. Simplest would be adding a new boolean option at the processor level to enable it --add-waveform-noise for example.

The other option would be to always enable it, but make the default behavior a no-op.

I think I prefer the first option as it is more explicit.

@ctao-sonarqube
Copy link

ctao-sonarqube bot commented Nov 5, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants