Skip to content

Add multi-frequency support to HealpixMap and SphericalHarmonics#496

Open
paganol wants to merge 9 commits intomasterfrom
freqs_generation_in_input_sky
Open

Add multi-frequency support to HealpixMap and SphericalHarmonics#496
paganol wants to merge 9 commits intomasterfrom
freqs_generation_in_input_sky

Conversation

@paganol
Copy link
Member

@paganol paganol commented Feb 11, 2026

This PR adds multi-frequency support in maps_and_harmonics.py. In detail:

  • Extends HealpixMap and SphericalHarmonics classes to handle multiple frequencies via new frequencies_ghz and nfreqs attributes.
  • All methods and transforms (convolution, smoothing, interpolation, power spectra, arithmetic) now operate on multi-frequency arrays.
  • Flexible convolution and smoothing: supports per-frequency and per-Stokes parameters.
  • Implements frequency compatibility checks for algebraic operations.
  • Updates the test suite with new multi-frequency tests.
  • Improves documentation for maps_and_harmonics and input_sky modules.

In addition, input_sky now accepts an external array of frequencies, returning maps or shperical harmonics packed in a single instance of HealpixMap or SphericalHarmonics.

@paganol paganol added the enhancement New feature or request label Feb 11, 2026
@paganol paganol requested a review from ziotom78 February 12, 2026 09:30
@paganol
Copy link
Member Author

paganol commented Feb 12, 2026

I think the PR is substantially ready; the only thing left is to decide how to handle write_fits and read_fits in SphericalHarmonics

Copy link
Member

@ziotom78 ziotom78 left a comment

Choose a reason for hiding this comment

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

It seems ok to me! I see you did not touch the I/O code, but this probably deserves some discussion. We might put an error if you try to read or write a multi-frequency object for the time being and address the issue in a separate PR, what do you think? In this way people can start using the feature while we figure out what is the best format (multiple files? one single huge FITS file for all the frequencies?)

Edit: Sorry, I just saw your comment:

I think the PR is substantially ready; the only thing left is to decide how to handle write_fits and read_fits in SphericalHarmonics

from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Literal
from typing import Any, Literal, Sequence
Copy link
Member

Choose a reason for hiding this comment

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

I just learned the existence of Sequence in typing!

Copy link
Member Author

Choose a reason for hiding this comment

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

Same here.. Claude's suggestion..

@paganol
Copy link
Member Author

paganol commented Feb 12, 2026

Hi @ziotom78, I opted for a sort of hybrid solution. The code can save FITS files in the multifrequency case, but you need to specify which frequency you want to save. read_fits is unchanged.

@ziotom78
Copy link
Member

Hi @ziotom78, I opted for a sort of hybrid solution. The code can save FITS files in the multifrequency case, but you need to specify which frequency you want to save. read_fits is unchanged.

Oh, sure, this is the simplest and cleanest solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants