Skip to content

Expected round-trip error? #7

@mcgibbon

Description

@mcgibbon

When I run the test specified in tests/test_harmonic_transform.py, I get RMS: 0.004188947245384965, Max: 0.08884372968086218. Subsequent re-runs give slightly lower values bit still > 0.002, 0.04. These errors seem fairly large to me (especially the maximum error). Are values in this range expected?

I generate random data on the physical grid and round-trip that, errors are quite a lot larger than I expected, given how uniform the healpix grid is. This test gives RMS: 0.8145438432693481, Max: 3.090202808380127:

def test_sht_round_trip_real_space():
    device = get_device()
    nside = 32
    npix = 12 * nside**2

    quad_weights = "ring"
    lmax = 2 * nside + 1
    mmax = lmax

    sht = SHT(nside, lmax=lmax, mmax=mmax, quad_weights=quad_weights)
    isht = iSHT(nside, lmax=lmax, mmax=mmax)

    signal_ori = torch.randn(npix, dtype=torch.float32).to(device)

    signal_back = isht(sht(signal_ori))
    diff = signal_ori - signal_back
    rms = torch.sqrt((diff.abs().pow(2)).mean())
    max_value = torch.max(diff.abs())

    print(f"RMS: {rms}, Max: {max_value}")
    torch.testing.assert_close(signal_ori, signal_back)

Is this also expected? These errors are comparable to what I get with the torch-harmonics SHT on a lat-lon domain, which is extremely oversampled in the poles compared with a healpix grid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions