Add dingo_generate_multibanded_domain script#369
Conversation
…n based on a uniform frequency domain waveform settings file.
Add optional token_size to the multibanded-domain generator so it can produce domains for the Dingo-T1 transformer, whose tokenizer requires each band to span a whole number of token_size-bin tokens. - get_band_nodes_for_adaptive_decimation: new min_mfd_bins_per_band argument; bands advance by dec_factor * min_mfd_bins_per_band and are asserted to be integer multiples of it. Default 1 reproduces the previous NPE banding exactly. - Thread token_size through _build_mfd_for_threshold and generate_multibanded_domain_settings, exposed as --token_size (use 16 for T1). - Honour the waveform_generator new_interface flag instead of hardcoding the new interface, matching generate_dataset.py (standard WaveformGenerator is the default used by IMRPhenomXPHM / Dingo-T1). - MultibandedFrequencyDomain.frequency_mask now returns a boolean array so it can be used directly for index selection. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
build_extreme_prior pinned chirp_mass to a scalar, which bilby turns into a DeltaFunction. Sampling such a prior together with the mass_1/mass_2 Constraint priors (which forces constrained sampling) raised "non-broadcastable output operand with shape ()" in PriorDict.sample, so the generator could not run on any mass-constrained prior (independent of the chirp-mass value). Pin chirp_mass with a negligibly narrow Uniform at the minimum instead; it samples cleanly while keeping every draw at the minimum chirp mass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
| The 1x ASD is obtained by taking every other sample of the 2x ASD, so only | ||
| ``ufd_2x`` is needed. A spectral artefact (bump) in the frequency range 477–483 Hz | ||
| is suppressed by replacing those values with the ASD value at 477 Hz, preventing it | ||
| from artificially inflating the waveform difference in that band. |
There was a problem hiding this comment.
I guess this feature is specific to the ASD aLIGO_ZERO_DET_high_P_asd.txt that is used by default, but would not be the case for other ASDs which will in general have other features at different frequencies (e.g., violin modes) and _get_asd_file can in principle return a user-supplied ASD. Would it be possible to check that the procedure is robust when using some different ASD, for example, something from a real event which has more features than a synthetic ASD?
|
|
||
| CLI usage:: | ||
|
|
||
| python -m dingo.gw.dataset.generate_multibanded_domain \\ |
There was a problem hiding this comment.
This could also mention the entry point dingo_generate_multibanded_domain?
| "from a waveform dataset settings file with a UniformFrequencyDomain.", | ||
| ) | ||
| parser.add_argument( | ||
| "--settings_file", |
There was a problem hiding this comment.
The arguments here use underscores, but the CLI usage at the top of the file uses hyphens, this should be made consistent.
Overall most of the DINGO code uses hyphens, but generate_dataset.pyuses underscores, so maybe it's best to keep this file consistent with that one, and update the CLI usage at the top?
| ) | ||
|
|
||
| print("Computing waveform differences per decimation factor...") | ||
| diffs, freqs = compute_waveform_difference_per_decimation_factor( |
There was a problem hiding this comment.
Could this have the option of passing difference_over_full_window? Otherwise that option isn't really used.
| frequencies_per_decimation_factor, | ||
| diffs_per_decimation_factor, | ||
| ): | ||
| f_max = f[np.argmax(diff < threshold)] |
There was a problem hiding this comment.
Maybe this could be something like
below_threshold = np.where(diff < threshold)[0]
if len(below_threshold) == 0:
break
f_max = f[below_threshold[0]]If the threshold is very small and the decimation factor error is never below the threshold, this would otherwise return f_max = f[0] and give the maximum decimation, while we want the opposite.
Summary
This PR adds a new CLI script to automatically generate a MultibandedFrequencyDomain (MFD) waveform dataset settings file from an existing UniformFrequencyDomain (UFD) settings file.
Previously, determining the MFD band nodes required manual tuning in a notebook. The new script automates this by:
_ufdreplaced by_mfdin the filename.Waveforms are generated only once and reused across all search iterations, keeping the computational cost minimal.
Changes
dingo/gw/dataset/generate_multibanded_domain.py— new script (replaces manual notebook workflow)dingo/gw/dataset/evaluate_multibanded_domain.py— refactored to use shared utilitiesdingo/gw/dataset/_multibanded_domain_utils.py— new internal module shared by both scripts, providingbuild_extreme_priorandrint_mismatch_statstests/gw/test_multibanded_domain_generation.py— unit tests for all new functionspyproject.toml— registereddingo_generate_multibanded_domainentry pointUsage
Command:
Example output: