jacopok / mlgw_bns

Accelerating gravitational wave template generation with machine learning.
GNU General Public License v3.0
4 stars 2 forks source link

Frequency bounds fail with reasonable input in version 0.8.2 #15

Closed jacopok closed 2 years ago

jacopok commented 2 years ago

Steps to reproduce:

from mlgw_bns import *
m = Model.default()
params = ParametersWithExtrinsic(
            mass_ratio=1.0,
            lambda_1=500.0,
            lambda_2=50.0,
            chi_1=0.1,
            chi_2=-0.1,
            distance_mpc=1.0,
            inclination=0.0,
            total_mass=3.5,
)
import numpy as np
freqs = np.linspace(23, 2048)
m.predict(freqs, params)

which yields

AssertionError                            Traceback (most recent call last)
<ipython-input-9-86adee412842> in <module>
----> 1 m.predict(freqs, params)

~/.pyenv/versions/3.9.9/envs/scripting-env-3.9/lib/python3.9/site-packages/mlgw_bns/model.py in predict(self, frequencies, params)
    670 
    671         assert rescaled_frequencies[0] >= self.dataset.initial_frequency_hz
--> 672         assert rescaled_frequencies[-1] <= self.dataset.srate_hz / 2.0
    673 
    674         intrinsic_params = params.intrinsic(self.dataset)

AssertionError: 
jacopok commented 2 years ago

This was addressed in https://github.com/jacopok/mlgw_bns/commit/74b97d67f3c2ad86094ed4e294a580612cc7666e and https://github.com/jacopok/mlgw_bns/commit/e4e149a53a575f02face21f4c8931105413631ac; also https://github.com/jacopok/mlgw_bns/commit/e648ccee7775e7c92c1120e791f83708dc380b4e includes tests to check that it always works.

That raised more problems since the high-frequency regime is difficult to deal with, but this issue itself is closed.