janosch314 / GWFish

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

Let horizon module work without LAL #62

Closed leaprimix closed 6 months ago

leaprimix commented 6 months ago

GWFish should be able to work even without lalsuite, but LAL is unfortunately required when importing the horizon module. To be more specific, I get:

WARNING:root:LAL package is not installed.Only GWFish waveforms available.

which is good, but then I get this

import lal ModuleNotFoundError: No module named 'lal'

thus making horizon module impossible to import and use without LAL.

jacopok commented 6 months ago

I finally got around to fixing this in #70, as soon as that is merged you should be able to use the horizon module (or any other part of the code) without having lalsuite installed. For example, in a local installation without lalsuite, the following script:

from GWFish.modules.horizon import horizon
from GWFish.modules.detection import Detector
from GWFish.modules.waveforms import TaylorF2

params = {
    'mass_1': 0.6, 
    'mass_2': 0.6, 
    'theta_jn': 0,
    'ra': 1,
    'dec': -0.5,
    'psi': 0.,
    'phase': 0.,
    'geocent_time': 1187008882.4,
    'max_frequency_cutoff': 0.2,
}

dist, z = horizon(params, Detector('LGWA'), waveform_class=TaylorF2, waveform_model='TaylorF2')

print(f'Distance: {dist:.1f}Mpc')
print(f'Redshift: z={z:.3f}')

works, with output

WARNING:root:LAL package is not installed.Only GWFish waveforms available.
WARNING:root:LAL package is not installed.Only GWFish waveforms available.
Distance: 36.4Mpc
Redshift: z=0.008