mikekatz04 / BBHx

GNU General Public License v3.0
20 stars 16 forks source link

issues with generating low-mass BBH #7

Closed WuShichao closed 7 months ago

WuShichao commented 2 years ago

@mikekatz04 Hello, Michael! Do you know why BBHx can't generate low-mass BBH? Here I post a simple example:

import numpy as np
import matplotlib.pyplot as plt
from bbhx.waveformbuild import BBHWaveformFD
from bbhx.utils.constants import *

np.random.seed(111222)

wave_gen = BBHWaveformFD(amp_phase_kwargs=dict(run_phenomd=False))

# set parameters
f_ref = 0.0  # let phenom codes set f_ref -> fmax = max(f^2A(f))
phi_ref = 0.0 # phase at f_ref
# m1 = 38.9
# m2 = 31.6
m1 = 36
m2 = 29
a1 = 0.0
a2 = 0.0
dist = 18e3  * PC_SI * 1e6 * (410/3000) # 410 Mpc
inc = 0.0
beta = 1.5  # ecliptic latitude
lam = 1.1  # ecliptic longitude
psi = 0.0  # polarization angle
t_ref = 1.0 * YRSID_SI  # t_ref  (in the SSB reference frame)

# frequencies to interpolate to
freq_new = np.logspace(-4, 0, 10000)
modes = [(2,2)]

wave = wave_gen(m1, m2, a1, a2,
                dist, phi_ref, f_ref, inc, lam,
                beta, psi, t_ref, freqs=freq_new,
                modes=modes, direct=False, fill=True, squeeze=True, length=1024)[0]

for i, let in enumerate(["A", "E", "T"]):
    plt.loglog(freq_new, np.abs(wave[i]), label=let)
plt.xlim(0.2,)
plt.legend()
plt.xlabel("Frequency (Hz)")
plt.ylabel(r"$\tilde{h}(f)$ (Hz$^{-1/2}$)")
plt.show()

BBHx can generate TDI waveform for m1 = 38.9, m2 = 31.6, but not for m1 = 36, m2 = 29, it will show:

No CuPy
No CuPy or GPU PhenomHM module.
No CuPy or GPU response available.
No CuPy or GPU interpolation available.
Segmentation fault (core dumped)
mikekatz04 commented 1 year ago

HI Shichao, I am sorry for not answering this for so long. I am not sure if you got it working from any of our other messages. But the issue is probably with the time limits and potentially t_ref. The key to running low mass binaries for LISA if that is what you are trying is setting f_ref to an actual frequency. If you are generating their merges, I would say just make sure you put in 36.0 and 29.0. It may be thinking those are integers which may set fault in the code.

WuShichao commented 1 year ago

@mikekatz04 Thanks! Actually, we found a solution, just force all the input to be float, not int type.