Skip to content

Gaussian-ring power spectrum (default), minor bugfixes, and two new user notebooks - #50

Merged
Eralys merged 9 commits into
masterfrom
fix_minor_bugs
Jul 26, 2026
Merged

Gaussian-ring power spectrum (default), minor bugfixes, and two new user notebooks#50
Eralys merged 9 commits into
masterfrom
fix_minor_bugs

Conversation

@Eralys

@Eralys Eralys commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR bundles three pieces of work on the fix_minor_bugs branch:

Minor bugfixes

  • Wavelet kernel dtype cast (Kernel): the wavelet operator's kernel wasn't cast to the
    operator's working precision, causing a dtype mismatch in the convolution depending on
    device (reproducible on CPU when MPS is available). (c21aab6)
  • Dtype mismatch in to_flatten (ST_Statistics.py): mean/var (real-valued) weren't
    promoted to complex before concatenation with the other statistics (S1-S4, PS), breaking
    to_flatten in some configurations. (6af098c)
  • Non-PBC power spectrum crop masks (FFT and Kernel): replaced the hard square (0/1)
    crop with a smooth cosine apodization, avoiding square artifacts in the PS gradient in the
    non-PBC case. (807531e)
  • Dimensionality reduction functions: fixed errors in scale_ft. (98df25f)

Two new user notebooks

  • docs/user_notebook/synthesis_reduced_representation.ipynb: synthesis from a
    compressed/reduced statistical representation, compared against the full representation.
    (98df25f)
  • docs/user_notebook/component_separation_notebook.ipynb: component separation. (2364622)

Power spectrum / cross-spectrum with Gaussian bins, set as default

  • Added a new radial frequency binning method (power_spectrum_method="gaussian_rings"):
    logarithmic Gaussian bands, with configurable bounds via Jmin, first in
    STL_2D_FFT_Torch (b09d7a5), then ported to STL_2D_Kernel_Torch to cover both
    DataClasses symmetrically (5a1ffd7).
  • power_spectrum_method and Jmin are exposed generically through ST_Operator, so
    they're available to any DataClass that implements its own bin-mask logic (not just
    FFT/Kernel).
  • gaussian_rings is now the default method (power_spectrum_method="gaussian_rings"
    in both CS_operator_2D_FFT_torch.__init__ and CS_operator_2D_Kernel_Torch.__init__),
    replacing "legacy". The old method remains available via power_spectrum_method="legacy".
  • PS is computed through the same CS_operator as the cross-spectrum (by only filling the
    diagonal of compute_cross_spectrum_matrix), so this default change applies consistently
    across all entry points (get_ST_op, direct get_CS_op).

SebPierre and others added 9 commits July 16, 2026 11:24
…t, added a user notebook comparing synthesis with full or small representation
Replace hard square crop masks with smooth cosine apodization in the FFT
and Kernel implementations. Preserve per-bin border scales and all-ones
behavior for zero-width borders to avoid square artifacts in PS gradients.
Add logarithmic Gaussian radial bands with configurable Jmin and bin count, expose the estimator choice through ST_Operator, and align periodic and non-periodic PS evaluation with the reference implementation.
…as default

- Port gaussian_rings power_spectrum_method (Jmin, log-Gaussian bins, hard/smooth crop dispatch, einsum) from STL_2D_FFT_Torch to STL_2D_Kernel_Torch
- Set power_spectrum_method='gaussian_rings' as the default in both CS_operator __init__ (was 'legacy')
@Eralys
Eralys merged commit 46a1dc1 into master Jul 26, 2026
4 checks passed
@Eralys
Eralys deleted the fix_minor_bugs branch July 26, 2026 21:53
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.

3 participants