From 899fb22b39d26baef19779c49c3f65a050e2f8ee Mon Sep 17 00:00:00 2001 From: Yifan Wang Date: Sat, 17 Aug 2024 21:58:35 +0200 Subject: [PATCH] the last commit doesn't work, change the logic --- pycbc/waveform/bank.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pycbc/waveform/bank.py b/pycbc/waveform/bank.py index 8aabb87f694..d02124d9da3 100644 --- a/pycbc/waveform/bank.py +++ b/pycbc/waveform/bank.py @@ -828,14 +828,17 @@ def __getitem__(self, index): ttotal = htilde.length_in_time else: ttotal = None - if hasattr(htilde, 'chirp_length'): + # First try to load template_duration from get_waveform_filter, + # if not exists, check if the template bank file contains template_duration, + # if none of them exists, return None + if hasattr(htilde, 'chirp_length') and htilde.chirp_length is not None: template_duration = htilde.chirp_length self.table[index].template_duration = template_duration elif self.table[index].template_duration > 0: - # The template bank file contains 'template_duration' template_duration = self.table[index].template_duration else: template_duration = None + self.table[index].template_duration = None htilde = htilde.astype(self.dtype) htilde.f_lower = f_low