simonsobs / simonsobs/mnms

fix to "okmap becomes complex164 if left unattended"

Open Beginner friendly
#29 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
3
Forks
1
Avg merge
1m
Merged PRs (30d)
1

Description

mnms/utils.py, add .astype(okmap.dtype, copy=False) to phase

def fourier_resample(imap, omap=None, shape=None, wcs=None, dtype=None):
    ...
    phase = np.exp(-2j*np.pi*(ky*shift[0] + kx*shift[1]))

    okmap = concurrent_op(np.multiply, okmap, phase)
    okmap = enmap.ndmap(okmap, omap.wcs)

    return irfft(okmap, omap=omap, n=omap.shape[-1], normalize='forward')

to

    phase = np.exp(-2j*np.pi*(ky*shift[0] + kx*shift[1])).astype(okmap.dtype, copy=False)

    okmap = concurrent_op(np.multiply, okmap, phase)
    okmap = enmap.ndmap(okmap, omap.wcs)

    return irfft(okmap, omap=omap, n=omap.shape[-1], normalize='forward')

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

Open mnms/utils.py and locate fourier_resample. Read the phase calculation and the following multiplication with okmap, then apply the requested dtype-preserving change. Done means phase uses okmap.dtype without copying unnecessarily and okmap no longer becomes complex164 when left unattended.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
75/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.