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