From 63c4495f708958d64968b50f568fcfcd2281b818 Mon Sep 17 00:00:00 2001 From: Vaishak Prasad Date: Tue, 24 Sep 2024 17:03:50 +0530 Subject: [PATCH] 2 --- nrcatalogtools/waveform.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/nrcatalogtools/waveform.py b/nrcatalogtools/waveform.py index bdd7ee6..8edf8eb 100644 --- a/nrcatalogtools/waveform.py +++ b/nrcatalogtools/waveform.py @@ -210,6 +210,10 @@ def metadata(self): """Return the simulation metadata dictionary""" return self.sim_metadata + @property + def modes_with_junk_removed(self): + return self._modes_with_junk_removed + def get_parameters(self, total_mass=1.0): """Return the initial physical parameters for the simulation. Only for quasicircular simulations are supported, orbital eccentricity is ignored @@ -433,12 +437,16 @@ def get_td_waveform( t_ref=t_ref, tol=tol, ) - h = interpolate_in_amp_phase( - self.evaluate([angles["theta"], angles["psi"], angles["alpha"]]), - new_time, - k=k, - kind=kind, - ) * utils.amp_to_physical(total_mass, distance) + + if remove_junk: + self.remove_junk_from_modes() + h = interpolate_in_amp_phase( + self.modes_with_no_junk.evaluate([angles["theta"], angles["psi"], angles["alpha"]]), + new_time, + k=k, + kind=kind, + ) * utils.amp_to_physical(total_mass, distance) + else: h.time *= m_secs # Return conjugated waveform to comply with lal @@ -447,6 +455,7 @@ def get_td_waveform( def remove_junk_from_modes(): """ Remove the portion of data with junk radiation from WaveformModes """ + self._modes_with_no_junk = () return WaveformModesObj