# Spin-aligned waveforms IMRPhenomXHM and SEOBNRv4HM\_ROM unable to recover injected parameters

**URL:** <https://ask.igwn.org/t/spin-aligned-waveforms-imrphenomxhm-and-seobnrv4hm-rom-unable-to-recover-injected-parameters/1139>\
**Category:** Data Analysis\
**Created:** [November 11, 2024, 4:06pm UTC](https://ask.igwn.org/t/spin-aligned-waveforms-imrphenomxhm-and-seobnrv4hm-rom-unable-to-recover-injected-parameters/1139 "2024-11-11T16:06:01Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![CalTNG](https://avatars.discourse-cdn.com/v4/letter/c/59ef9b/32.png) [@CalTNG](https://ask.igwn.org/u/CalTNG)\
**Post date:** [November 11, 2024, 4:06pm UTC](https://ask.igwn.org/t/spin-aligned-waveforms-imrphenomxhm-and-seobnrv4hm-rom-unable-to-recover-injected-parameters/1139/1 "2024-11-11T16:06:01Z")

</div>

Hello,  
I am studying EOB waveforms SEOBNRv4HM\_ROM, but I’ve found something weird. I injected a GW190521-like signal and used Bilby to perform parameter estimation. I only estimated four parameters: **chirp mass, mass ratio, luminosity distance, and theta\_jn** , while all other parameters are fixed to the injected values. Specifically, I generated and injected signal using **IMRPhenomXPHM, IMRPhenomXHM, and SEOBNRv4HM\_ROM, and then conducted estimation using the same templates**. However, while IMRPhenomXPHM successfully recovered the signal, the **other two waveforms failed to do so**. The posterior distribution of IMRPhenomXHM displayed **discrete peaks** , while SEOBNRv4HM\_ROM **deviated from the injected parameters** at all, with its posterior seems “sticking to the edges of the prior range”.

The following figures are the results of these three analyses.

 ![fast_tutorial_corner](https://canada1.discourse-cdn.com/flex031/uploads/gwosc/original/1X/8b9c5afa8aef0f80d0af081b718897015f715c2e.jpeg)  
Fig.1 The result of IMRPhenomXHM  
 ![fast_tutorial_corner](https://canada1.discourse-cdn.com/flex031/uploads/gwosc/original/1X/af2337045f41b2160cfc54b61253cf6a3632f7f3.png)  
Fig.2 The result of IMRPhenomXPHM  
 ![fast_tutorial_corner](https://canada1.discourse-cdn.com/flex031/uploads/gwosc/original/1X/f80739b6ab4f660707234f54775fc1a339739f2a.png)  
Fig.3 The result of SEOBNRv4HM\_ROM  
 ![fast_tutorial_H1_waveform](https://canada1.discourse-cdn.com/flex031/uploads/gwosc/original/1X/ee8119a039656581471abbac1d1cfb5cae8794ec.jpeg)  
Fig.4 The reconstructed waveform of SEOBNRv4HM\_ROM at H1  
One can find that it didn’t manage to recover the injected waveform

The following is my Python script for **SEOBNRv4HM\_ROM** and its **priors**. I generally followed the fast tutorial.

```auto
import bilby
import numpy as np

duration = 8.0
sampling_frequency = 1024.0

outdir = "outdir2"
label = "fast_tutorial"
bilby.core.utils.setup_logger(outdir=outdir, label=label)
trigger_time = 1242442967.459473

np.random.seed(88170235)

injection_parameters = dict(
    chirp_mass = 63.0,
    mass_ratio = 0.63,
    chi_1 = -0.37,
    chi_2 = 0.19,
    theta_jn = 1.13,
    luminosity_distance = 2000.0, 
    phase = 3.78,
    psi = 2.38,
    ra = 3.6,
    dec = -0.7,
    geocent_time = 1242442967.459473,
)

waveform_arguments = dict(
    waveform_approximant="SEOBNRv4HM_ROM",
    reference_frequency=10.0,
    minimum_frequency=10.0,
)

waveform_generator = bilby.gw.WaveformGenerator(
    duration=duration,
    sampling_frequency=sampling_frequency,
    frequency_domain_source_model=bilby.gw.source.lal_binary_black_hole,
    parameter_conversion=bilby.gw.conversion.convert_to_lal_binary_black_hole_parameters,
    waveform_arguments=waveform_arguments,
)

ifos = bilby.gw.detector.InterferometerList(["H1", "L1","V1"])
ifos.set_strain_data_from_power_spectral_densities(
    sampling_frequency=sampling_frequency,
    duration=duration,
    start_time=injection_parameters["geocent_time"] - 6,
)

ifos.inject_signal(
    waveform_generator=waveform_generator, parameters=injection_parameters
)

priors = bilby.gw.prior.BBHPriorDict("fast_aligned_spins_bbh.prior")

likelihood = bilby.gw.GravitationalWaveTransient(
    interferometers=ifos,
    waveform_generator=waveform_generator,
)

result = bilby.run_sampler(
    likelihood=likelihood,
    priors=priors,
    sampler="dynesty",
    nlive=1000,
    maxmcmc=5000,
    check_point_delta_t = 1800,
    injection_parameters=injection_parameters,
    outdir=outdir,
    label=label,
    result_class=bilby.gw.result.CBCResult,
)

# Plot the inferred waveform superposed on the actual data.
result.plot_waveform_posterior(n_samples=1000)

# Make a corner plot.
result.plot_corner(save=True)

####THE PRIOR####
### I mixed them into one box ###

mass_1 = Constraint(name='mass_1', minimum=5, maximum=100)
mass_2 = Constraint(name='mass_2', minimum=5, maximum=100)
mass_ratio = bilby.gw.prior.UniformInComponentsMassRatio(name='mass_ratio', minimum=0.125, maximum=1)
chirp_mass = bilby.gw.prior.UniformInComponentsChirpMass(name='chirp_mass', minimum=25, maximum=100)
luminosity_distance = bilby.gw.prior.UniformSourceFrame(name='luminosity_distance', minimum=1e2, maximum=5e3)
dec = 0.7
ra = 3.6
theta_jn = Sine(name='theta_jn')
psi = 2.38
phase = 3.78
chi_1 = -0.37
chi_2 = 0.19
geocent_time = 1242442967.459473

```

The following is my Python script for IMRPhenomXPHM (and IMRPhenomXHM, I used the same script)

```auto
import bilby

duration = 8.0
sampling_frequency = 1024.0
minimum_frequency = 10

outdir = "outdir3"
label = "fast_tutorial"
bilby.core.utils.setup_logger(outdir=outdir, label=label)

bilby.core.utils.random.seed(88170235)

injection_parameters = dict(
    chirp_mass=63,
    mass_ratio=0.63,
    a_1 = 0.79,
    a_2 = 0.63,
    tilt_1 = 2.06,
    tilt_2 = 1.26,
    phi_12 = 3.41,
    phi_jl = 2.85,
    luminosity_distance=4300.0,
    theta_jn=1.13,
    psi=2.38,
    phase=3.78,
    geocent_time=1242442967.459473,
    ra=3.6,
    dec=-0.7,
)

waveform_arguments = dict(
    waveform_approximant="IMRPhenomXPHM",
    reference_frequency=10.0,
    minimum_frequency=minimum_frequency,
)

waveform_generator = bilby.gw.WaveformGenerator(
    duration=duration,
    sampling_frequency=sampling_frequency,
    frequency_domain_source_model=bilby.gw.source.lal_binary_black_hole,
    parameter_conversion=bilby.gw.conversion.convert_to_lal_binary_black_hole_parameters,
    waveform_arguments=waveform_arguments,
)

ifos = bilby.gw.detector.InterferometerList(["H1", "L1"])
ifos.set_strain_data_from_power_spectral_densities(
    sampling_frequency=sampling_frequency,
    duration=duration,
    start_time=injection_parameters["geocent_time"] - 6,
)
ifos.inject_signal(
    waveform_generator=waveform_generator, parameters=injection_parameters
)

priors = bilby.gw.prior.BBHPriorDict(aligned_spin=False) # True for IMRPhenomXHM
for key in [
    "a_1",
    "a_2",
    "tilt_1",
    "tilt_2",
    "phi_12",
    "phi_jl",
    "psi",
    "ra",
    "dec",
    "geocent_time",
    "phase",
]:
    priors[key] = injection_parameters[key]

priors.validate_prior(duration, minimum_frequency)

likelihood = bilby.gw.GravitationalWaveTransient(
    interferometers=ifos, waveform_generator=waveform_generator
)

result = bilby.run_sampler(
    likelihood=likelihood,
    priors=priors,
    sampler="dynesty",
    npoints=1000,
    maxmcmc=5000,
    injection_parameters=injection_parameters,
    outdir=outdir,
    label=label,
    result_class=bilby.gw.result.CBCResult,
)

result.plot_waveform_posterior(n_samples=1000)

result.plot_corner(save=True)

```

In my analyses, spin-aligned waveforms seem to perform worse and are not capable enough to recover injected waveforms. I suppose I missed something important when performing spin-aligned injection analysis, but I have no idea what they are. =(

Besides, I tried the example `eccentric_inspiral.py` and failed to recover the injected parameters as well. Therefore I suppose it is a problem related to spin-aligned waveform rather than merely IMRPhenomXHM and SEOBNRv4HM\_ROM

Thanks!
