Possible memory leak in IMRPhenomD
Hello,
I'm not a member so I can't open an issue...
I just observed growing memory usage when I use the IMRPhenomD approximant, hinting at a memory leak. I didn't investigate it further yet but here is a code example using pyCBC:
import pycbc.waveform, pycbc.noise, pycbc.psd, pycbc.distributions,
pycbc.detector
import numpy as np
from tqdm import tqdm
import h5py
import matplotlib.pyplot as plt
def generate_signal(duration, sample_rate):
# Create detector
detector = pycbc.detector.Detector('H1')
# Init random distributions
skylocation_dist = pycbc.distributions.sky_location.UniformSky()
# Generate source parameters
masses = rng.uniform(10.0, 50.0, 2)
angles = rng.uniform(0.0, 2 * np.pi, 3)
declination, right_ascension = skylocation_dist.rvs()[0]
pol_angle = angles[2]
waveform_kwargs = {}
waveform_kwargs['delta_t'] = 1.0 / sample_rate
waveform_kwargs['f_lower'] = 18.0
waveform_kwargs['approximant'] = 'IMRPhenomD'
waveform_kwargs['mass1'] = max(masses)
waveform_kwargs['mass2'] = min(masses)
waveform_kwargs['coa_phase'] = angles[0]
waveform_kwargs['inclination'] = angles[1]
# Take the injection time randomly in the LIGO O3a era
injection_time = rng.uniform(1238166018, 1253977218)
# Generate the full waveform - VARIABLE LENGTH
waveform = pycbc.waveform.get_td_waveform(**waveform_kwargs)
return waveform
if __name__=='__main__':
rng = np.random.default_rng(12345)
N_signal = 800000
sample_rate = 2048
# Generate signals
#iterable = range(N_signal)
iterable = tqdm(range(N_signal), desc=f"Generating {N_signal}
signal samples")
for i in iterable:
signal = generate_signal(duration=1, sample_rate=sample_rate)
It'd be nice if someone created an issue.
Best,
Pascal Müller