Fixes to from_imr_result() workflow#121
Merged
maxisi merged 7 commits intomaxisi:igwnfrom Sep 24, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've fixed a few small bugs that arise in the
rd.Fit.from_imr_result()workflow.utils.pyUpon reading in the PE configs to store
IMRResultattributes, some were stored with either extraneous characters or faulty dict patterns. Inutils.py,get_bilby_dict()was at times not removing all space characters and incorrectly splitting the string for a case like'{ H1:448,L1:448, }'. I added a' 'to the characters to remove, and also conditioned the splitting of each new sub-string fromd.split(',')on there being a':'in the sub-string.fit.pyIn the analysis workflow, we sometimes want to indicate a particular set of PE to load from an event's IMR result dataset, i.e. PE with a desired approximant. In
IMRResult.from_pesummary()there is agroupkeyword argument, but at the abstractedrd.Fit.from_imr_result()level, the user cannot specify a group of the IMR.hdf5file; rather the group defaults to NRSur7dq4 PE or, if unavailable, the first listed group in the dataset keys. I added animr_kwsargument tofrom_imr_result(), which gets propagated to theIMRResultconstructor and further tofrom_pesummary()inimr.py, such that the user can specify thegroupfrom the top level.data.pyFor PSD interpolation, I noticed that
cubicinterpolation does a poor job for especially spiky PSDs (the interpolation tends to reflect the sharp spikes down to orders of magnitude smaller numbers, producing a PSD that is reminiscent of a round-trip PSD with a too large dynamic range). I've switched tolinearinterpolation instead, see a comparison below:cubiclinearIn some cases, the number of points on the uniformly spaced frequency grid,
ninPowerSpectrum.interpolate_to_index()indata.py, was too few; this results in the wrongdelta_t = 1/(2*max(freq)), or the wrong Nyquist frequency according to the highest frequency bin in the interpolated PSD frequency array. I changednto be equal to the same number of points as in the initial frequency array to ensure the correct Nyquist frequency.imr.pyIf PSDs are added as an
IMRResultattribute viaIMRResult.set_psds(), then they are interpolated to a uniform frequency grid by default. However, when anIMRResultobject is instantiated, the PSDs read in from the.hdf5file are not immediately interpolated. I've added default PSD interpolation to the construction of the IMRResult object infrom_pesummary().Additionally, for some GW events, the
reference-frequencyis set to be lower than theminimum-frequencyfor each ifo; in these cases, the waveform generation for signal templates in the detectors breaks becausef_refcannot be less thanf_min. For these events, I've implemented a fix that passes the starting frequency (f_start, or equivalentlywaveformin theminium-frequencydict in the PE config) as thef_lowargument inIMRResult.get_waveforms(), rather than the ifo minimum frequency.Finally, in some cases the
IMRResult.ifoswas storing detectors as["'H1'", "'L1'"], so I modified theifosattribute to remove any spurious quotations.