janosch314 / GWFish

Simulation of detector networks with Fisher-matrix PE
33 stars 20 forks source link

Do not crash on max_frequency_cutoff higher than the max in the frequencyvector #74

Closed jacopok closed 6 months ago

jacopok commented 6 months ago

Code to reproduce:

import pandas as pd
import numpy as np

param_dict = {
    'mass_1': 1.4, 
    'mass_2': 1.3, 
    'luminosity_distance': 400,
    'theta_jn': 5/6 * np.pi,
    'ra': 3.45,
    'dec': -0.41,
    'psi': 1.6,
    'phase': 0,
    'geocent_time': 1187008882, 
    'max_frequency_cutoff': 0.3,
}
parameters = pd.DataFrame.from_dict({k:v*np.array([1.]) for k, v in param_dict.items()})

from GWFish.modules.detection import Network
from GWFish.modules.fishermatrix import compute_network_errors

network = Network(['LISA'])

detected, snr, errors, sky_localization = compute_network_errors(
   network, 
   parameters, 
   waveform_model='IMRPhenomD_NRTidalv2'
)

This raises an IndexError: index 5000 is out of bounds for axis 0 with size 5000 while it should yield the same results as not giving the cutoff parameter, since the maximum frequency for LISA is 0.3Hz.