simonsobs / simonsobs/pspy

Last component of `calc_mcm_spin0and2_pure` always seems to be (practically) zero

Open
#97 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10
Forks
8
PR merge metrics
No merged PRs in 30d

Description

When playing with the routine calc_mcm_spin0and2_pure I noticed something interesting: no matter which power spectra are fed into the function, the fifth output matrix always seems to contain extremely small values. This can be verified with the following script:

import numpy as np

from pspy.mcm_fortran.mcm_fortran import mcm_compute as mcm_fortran

lmax=100
mcm = np.zeros((5, lmax+1, lmax+1))
spec = np.random.normal(size=(4, 2*lmax+1))
mcm_fortran.calc_mcm_spin0and2_pure(spec[0], spec[1], spec[2], spec[3], mcm.T)
for i in range(5):
    print (np.max(np.abs(mcm[i,:,:])))

Is this due to a bug in the function, or is there actually some kind of symmetry in the Wigner 3j symbols which makes this component vanish by construction? If the latter, it might be good to simply skip its calculation, saving some CPU time and memory.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Run the supplied Python reproduction with pspy.mcm_fortran.mcm_fortran.mcm_compute.calc_mcm_spin0and2_pure and inspect how the fifth output matrix is produced. Read the calc_mcm_spin0and2_pure entry point and its Wigner 3j calculations; done means establishing whether the component vanishes by symmetry and, if so, determining whether its calculation can safely be skipped.

Written by the indexing model from the issue text.

Assessment

Tech stack
fortran, python
Domain
data, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.