Skip to content

hack for injection test

Avi Vajpeyi requested to merge avi.vajpeyi/bilby_pipe:injection_test_fix into master

The test_injections in tests.data_generation_test.TestDataGenerationInput was failing due to the following import issue:

waveform_approximant = 'IMRPhenomPv2'

    def lalsim_GetApproximantFromString(waveform_approximant):
        if isinstance(waveform_approximant, str):
>           return lalsim.GetApproximantFromString(waveform_approximant)
E           NameError: name 'lalsim' is not defined

/opt/conda/lib/python3.6/site-packages/bilby/gw/utils.py:675: NameError

Came up with a hacky fix by checking

if "lalsimulation" in sys.modules

is true, and only then executing the portion of the injection test with the lalsimulation import.

Edited by Avi Vajpeyi

Merge request reports

Loading