Skip to content

Commit 09b87e2

Browse files
tibaldojlenain
andauthored
Fix bug in ChargeDistributionFilter for pedestal maker (#213)
* Only fill charges container if waveforms are available * Cleanup commented stuff from some previous PR * Pin `persistent` (dependency for `ZODB`) version to fix CI --------- Co-authored-by: Jean-Philippe Lenain <[email protected]>
1 parent 1e95f07 commit 09b87e2

File tree

4 files changed

+28
-26
lines changed

4 files changed

+28
-26
lines changed

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ dependencies:
2424
- pip:
2525
- zeo
2626
- zodb
27+
- persistent<6.2
2728
- mechanize
2829
- browser-cookie3
2930
- pyqtgraph

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dependencies = [
2626
"iminuit",
2727
"matplotlib",
2828
"pandas",
29+
"persistent<6.2",
2930
"scipy",
3031
"zodb",
3132
"zeo",

src/nectarchain/dqm/bokeh_app/tests/test_app_hooks.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import numpy as np
2-
from bokeh.io import output_file, save
32

43
# bokeh imports
4+
from bokeh.io import output_file, save
55
from bokeh.layouts import layout
66
from bokeh.models import Select
77
from bokeh.plotting import curdoc
8+
9+
# ctapipe imports
810
from ctapipe.coordinates import EngineeringCameraFrame
911
from ctapipe.instrument import CameraGeometry
1012
from ZODB import DB

src/nectarchain/makers/component/pedestal_component.py

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -496,31 +496,6 @@ def finish(self, *args, **kwargs):
496496
self._waveformsContainers = waveformsContainers.containers[
497497
EventType.SKY_PEDESTAL
498498
]
499-
# log.info('JPL: waveformsContainers=',waveformsContainers.containers[
500-
# EventType.SKY_PEDESTAL].nsamples)
501-
502-
# If we want to filter based on charges distribution
503-
# make sure that the charge distribution container is filled
504-
if (
505-
self.filter_method == "ChargeDistributionFilter"
506-
and self._chargesContainers is None
507-
):
508-
log.debug("Compute charges from waveforms")
509-
chargesComponent_kwargs = {}
510-
chargesComponent_configurable_traits = (
511-
ComponentUtils.get_configurable_traits(ChargesComponent)
512-
)
513-
for key in kwargs.keys():
514-
if key in chargesComponent_configurable_traits.keys():
515-
chargesComponent_kwargs[key] = kwargs[key]
516-
self._chargesContainers = ChargesComponent.create_from_waveforms(
517-
waveformsContainer=self._waveformsContainers,
518-
subarray=self.subarray,
519-
config=self.config,
520-
parent=self.parent,
521-
*args,
522-
**chargesComponent_kwargs,
523-
)
524499

525500
# Check if waveforms container is empty
526501
if self._waveformsContainers is None:
@@ -535,6 +510,29 @@ def finish(self, *args, **kwargs):
535510
# container with no results
536511
return None
537512
else:
513+
# If we want to filter based on charges distribution
514+
# make sure that the charge distribution container is filled
515+
if (
516+
self.filter_method == "ChargeDistributionFilter"
517+
and self._chargesContainers is None
518+
):
519+
log.debug("Compute charges from waveforms")
520+
chargesComponent_kwargs = {}
521+
chargesComponent_configurable_traits = (
522+
ComponentUtils.get_configurable_traits(ChargesComponent)
523+
)
524+
for key in kwargs.keys():
525+
if key in chargesComponent_configurable_traits.keys():
526+
chargesComponent_kwargs[key] = kwargs[key]
527+
self._chargesContainers = ChargesComponent.create_from_waveforms(
528+
waveformsContainer=self._waveformsContainers,
529+
subarray=self.subarray,
530+
config=self.config,
531+
parent=self.parent,
532+
*args,
533+
**chargesComponent_kwargs,
534+
)
535+
538536
# Build mask to filter the waveforms
539537
# Mask based on the high gain channel that is most sensitive to signals
540538
# Initialize empty mask

0 commit comments

Comments
 (0)