Allow mixed precision input for compression - #5397
Open
ahnitz wants to merge 3 commits into
Open
Conversation
Commit 7f183b8 ("allow no psd in waveform compression") dropped the psd[:len(htilde)] slice when adding the psd-is-None branch. htilde is truncated earlier in this function to kmax = min(len(htilde), len(hdecomp)), which can be shorter than the original psd whenever sample_points/fmax covers less than the full waveform band (compressing over a subset of the frequency range, a supported use of this function). Without the slice, that combination crashes with a length-mismatch ValueError; reproduced directly by compressing a TaylorF2 waveform over half its band with a full-band PSD.
GarethCabournDavies
approved these changes
Aug 6, 2026
GarethCabournDavies
left a comment
Contributor
There was a problem hiding this comment.
This looks sensible I think.
It does force a real datatype - i.e if the out.precision is complex (so not in _real_dtypes), I think this will break. The if out is None branch above will create a complex type out (I can't see what happens with amp and phase there actually), so its a little confusing
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.
This is a minor feature change that does type promotion rather than raising an error if mixed precisions are given for the compression code.
The main reason for this to make it easier to use the pycbc_bank_fir code, introduced in #5395 with precalculated compressed waveforms internally. These can be stored at inconsistent resolutions with the internal testing. It's easier to add here rather than add a few places where we do the typo promotion elsewhere.