Skip to content

Conversation

@lorenzopompili00
Copy link
Contributor

@lorenzopompili00 lorenzopompili00 commented Dec 22, 2025

I was trying to plot some waveform reconstructions using plot_interferometer_waveform_posterior for some eccentric PE runs using the new GWSignalWaveformGenerator, and I realized it is currently not working correctly.

The reason is that the arguments required to instantiate GWSignalWaveformGenerator are not saved in the likelihood metadata, and are not passed to the waveform generator when it is instantiated in plot_interferometer_waveform_posterior here.

A fix is to save and pass these extra arguments whenever the waveform generator is GWSignalWaveformGenerator. I have added this via a waveform_generator_constructor_dict, inspired by this bilby_pipe merge request. Let me know if you have any other preferences for handling this.

@ColmTalbot ColmTalbot force-pushed the add_waveform_generator_constructor_dict_to_result branch from 2e73df8 to d2cefdb Compare January 26, 2026 08:32
Copy link
Collaborator

@ColmTalbot ColmTalbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lorenzopompili00 thanks for opening this PR! I think we should add this functionality, but I'd like to think about whether we can find a more generic way of implementing this.

To be concrete, I'd suggest adding a new property to the WaveformGenerator like

class WaveformGenerator:
    ...
    @property
    def meta_data(self):
        return dict()


class GWSignalWaveformGenerator:
    ...
    @property
    def meta_data(self):
        return dict(
            eccentricity=...
        )

We could also put in the information needed to reconstruct the WaveformGenerator for that class.

I'm interested to get thoughts from a wider group on this.

lal_version=self.lal_version,
lalsimulation_version=self.lalsimulation_version)

if isinstance(self.waveform_generator, GWSignalWaveformGenerator):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should just add a generic meta_data attribute to the waveform generator as for interferometers and then add that here? That would avoid having a special case here.

@mj-will
Copy link
Collaborator

mj-will commented Jan 28, 2026

@lorenzopompili00 thanks for opening this PR! I think we should add this functionality, but I'd like to think about whether we can find a more generic way of implementing this.

To be concrete, I'd suggest adding a new property to the WaveformGenerator like

class WaveformGenerator:
    ...
    @property
    def meta_data(self):
        return dict()


class GWSignalWaveformGenerator:
    ...
    @property
    def meta_data(self):
        return dict(
            eccentricity=...
        )

We could also put in the information needed to reconstruct the WaveformGenerator for that class.

I'm interested to get thoughts from a wider group on this.

I like this suggestion, and would be in favour of adding meta_data to the generators.

@lorenzopompili00
Copy link
Contributor Author

Thanks for taking a look and for the feedback @ColmTalbot @mj-will! I agree your suggestion is cleaner, I have made changes to address it.

Copy link
Collaborator

@ColmTalbot ColmTalbot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for making the changes, I'm happy with this version.

@mj-will mj-will added this pull request to the merge queue Jan 28, 2026
@mj-will mj-will added this to the 2.8.0 milestone Jan 28, 2026
Merged via the queue into bilby-dev:main with commit 7fa35a1 Jan 28, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants