Skip to content

Commit

Permalink
Merge pull request #2337 from clara-escanuela/fc_time_unit
Browse files Browse the repository at this point in the history
Peak time units conversion for the FlashCam reconstructor
  • Loading branch information
kosack committed May 22, 2023
2 parents 01962ff + 77f4d27 commit 0834ca5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions ctapipe/image/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1687,6 +1687,7 @@ def __call__(
peak_time = adaptive_centroid(
d_waveforms, peak_index, leading_edge_rel_descend_limit
)
peak_time = peak_time / (self.sampling_rate_ghz[tel_id] * upsampling)

if gain != 0:
charge /= gain
Expand Down
16 changes: 16 additions & 0 deletions ctapipe/image/tests/test_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,22 @@ def test_FC_time(toymodel_mst_fc_time):
assert_allclose(dl1.peak_time[mask], true_time[mask], rtol=0.1)
assert dl1.is_valid == True

extractor = FlashCamExtractor(
subarray=subarray, upsampling=1, leading_edge_timing=True
)
broken_pixels = np.zeros(waveforms.shape[0], dtype=bool)
dl1 = extractor(waveforms, tel_id, selected_gain_channel, broken_pixels)
assert_allclose(dl1.peak_time[mask], true_time[mask], rtol=0.1)
assert dl1.is_valid == True

extractor = FlashCamExtractor(
subarray=subarray, upsampling=1, leading_edge_timing=False
)
broken_pixels = np.zeros(waveforms.shape[0], dtype=bool)
dl1 = extractor(waveforms, tel_id, selected_gain_channel, broken_pixels)
assert_allclose(dl1.peak_time[mask], true_time[mask], rtol=0.1)
assert dl1.is_valid == True

extractor = FlashCamExtractor(subarray=subarray, leading_edge_timing=False)
broken_pixels = np.zeros(waveforms.shape[0], dtype=bool)
dl1 = extractor(waveforms, tel_id, selected_gain_channel, broken_pixels)
Expand Down
1 change: 1 addition & 0 deletions docs/changes/2337.bug.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix peak time units of FlashCamExtractor (See https://github.com/cta-observatory/ctapipe/issues/2336)

0 comments on commit 0834ca5

Please sign in to comment.