Skip to content

Commit

Permalink
Compute deconvolution parameters in FlashCamExtractor only as needed
Browse files Browse the repository at this point in the history
  • Loading branch information
maxnoe committed Apr 24, 2024
1 parent d7e67e6 commit e1acb2b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/changes/2545.optimization.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Compute deconvolution parameters in FlashCamExtractor only as needed.
19 changes: 11 additions & 8 deletions src/ctapipe/image/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -1616,14 +1616,18 @@ def __init__(self, subarray, **kwargs):
tel_id: telescope.camera.readout.sampling_rate.to_value("GHz")
for tel_id, telescope in subarray.tel.items()
}
self._deconvolution_pars = {}

def time_profile_pdf_gen(std_dev: float):
if std_dev == 0:
return None
return scipy.stats.norm(0.0, std_dev).pdf
def _get_deconvolution_parameters(self, tel_id):
if tel_id not in self._deconvolution_pars:
tel = self.subarray.tel[tel_id]

self.deconvolution_pars = {
tel_id: deconvolution_parameters(
def time_profile_pdf_gen(std_dev: float):
if std_dev == 0:
return None
return scipy.stats.norm(0.0, std_dev).pdf

self._deconvolution_pars[tel_id] = deconvolution_parameters(
tel.camera,
self.upsampling.tel[tel_id],
self.window_width.tel[tel_id],
Expand All @@ -1632,8 +1636,7 @@ def time_profile_pdf_gen(std_dev: float):
self.leading_edge_rel_descend_limit.tel[tel_id],
time_profile_pdf_gen(self.effective_time_profile_std.tel[tel_id]),
)
for tel_id, tel in subarray.tel.items()
}
return self._deconvolution_pars[tel_id]

@staticmethod
def clip(x, lo=0.0, hi=np.inf):
Expand Down

0 comments on commit e1acb2b

Please sign in to comment.