@@ -176,19 +176,17 @@ def __call__(
176
176
177
177
__image = CtapipeExtractor .get_image_peak_time (
178
178
imageExtractor (
179
- wfs_hg_tmp , self .TEL_ID , constants .HIGH_GAIN , broken_pixels_hg
179
+ np .array ([wfs_hg_tmp , wfs_lg_tmp ]),
180
+ self .TEL_ID ,
181
+ None ,
182
+ np .array ([broken_pixels_hg , broken_pixels_lg ]),
180
183
)
181
184
)
182
- self .__charges_hg [f"{ name } " ].append (__image [0 ])
183
- self .__peak_hg [f"{ name } " ].append (__image [1 ])
185
+ self .__charges_hg [f"{ name } " ].append (__image [0 ][ 0 ] )
186
+ self .__peak_hg [f"{ name } " ].append (__image [1 ][ 0 ] )
184
187
185
- __image = CtapipeExtractor .get_image_peak_time (
186
- imageExtractor (
187
- wfs_lg_tmp , self .TEL_ID , constants .LOW_GAIN , broken_pixels_lg
188
- )
189
- )
190
- self .__charges_lg [f"{ name } " ].append (__image [0 ])
191
- self .__peak_lg [f"{ name } " ].append (__image [1 ])
188
+ self .__charges_lg [f"{ name } " ].append (__image [0 ][1 ])
189
+ self .__peak_lg [f"{ name } " ].append (__image [1 ][1 ])
192
190
193
191
@staticmethod
194
192
def _get_extractor_kwargs_from_method_and_kwargs (method : str , kwargs : dict ):
@@ -568,44 +566,42 @@ def compute_charges(
568
566
imageExtractor = __class__ ._get_imageExtractor (
569
567
method = method , subarray = subarray , ** kwargs
570
568
)
571
- if channel == constants .HIGH_GAIN :
572
- out = np .array (
573
- [
574
- CtapipeExtractor .get_image_peak_time (
575
- imageExtractor (
576
- waveformsContainer .wfs_hg [i ],
577
- tel_id ,
578
- channel ,
579
- waveformsContainer .broken_pixels_hg [i ],
580
- )
569
+ out = np .array (
570
+ [
571
+ CtapipeExtractor .get_image_peak_time (
572
+ imageExtractor (
573
+ waveforms = np .array (
574
+ [waveformsContainer .wfs_hg [i ], waveformsContainer .wfs_lg [i ]]
575
+ ),
576
+ tel_id = tel_id ,
577
+ selected_gain_channel = None ,
578
+ broken_pixels = np .array (
579
+ [
580
+ waveformsContainer .broken_pixels_hg [i ],
581
+ waveformsContainer .broken_pixels_lg [i ],
582
+ ]
583
+ ),
581
584
)
582
- for i in range (len (waveformsContainer .wfs_hg ))
583
- ]
584
- ).transpose (1 , 0 , 2 )
585
- return ChargesContainer .fields ["charges_hg" ].dtype .type (
586
- out [0 ]
587
- ), ChargesContainer .fields ["peak_hg" ].dtype .type (out [1 ])
585
+ )
586
+ for i in range (len (waveformsContainer .wfs_hg ))
587
+ ]
588
+ )
589
+ # by setting selected_gain_channel to None, we can now pass to ctapipe extractor
590
+ # waveforms in (n_ch, n_pix, n_samples)
591
+ # then out hase shape (n_events, 2, n_ch, n_pi)
592
+ if channel == constants .HIGH_GAIN :
593
+ index = 0
594
+ gain_label = "hg"
588
595
elif channel == constants .LOW_GAIN :
589
- out = np .array (
590
- [
591
- CtapipeExtractor .get_image_peak_time (
592
- imageExtractor (
593
- waveformsContainer .wfs_lg [i ],
594
- tel_id ,
595
- channel ,
596
- waveformsContainer .broken_pixels_lg [i ],
597
- )
598
- )
599
- for i in range (len (waveformsContainer .wfs_lg ))
600
- ]
601
- ).transpose (1 , 0 , 2 )
602
- return ChargesContainer .fields ["charges_lg" ].dtype .type (
603
- out [0 ]
604
- ), ChargesContainer .fields ["peak_lg" ].dtype .type (out [1 ])
596
+ index = 1
597
+ gain_label = "lg"
605
598
else :
606
599
raise ArgumentError (
607
600
None , f"channel must be { constants .LOW_GAIN } or { constants .HIGH_GAIN } "
608
601
)
602
+ return ChargesContainer .fields [f"charges_{ gain_label } " ].dtype .type (
603
+ out [:, 0 , index , :]
604
+ ), ChargesContainer .fields [f"peak_{ gain_label } " ].dtype .type (out [:, 1 , index , :])
609
605
610
606
@staticmethod
611
607
def histo_hg (
0 commit comments