crash when generating new sims with mode 'fdw'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 3
- Forks
- 1
- Avg merge
- 1m
- Merged PRs (30d)
- 1
Description
Hi, I try to generate a new noise sim with running this:
config_name = 'act_dr6.01_cmbmask'
noise_model_name = 'fdw'
qids_ = ['pa4a', 'pa4b']
tnm = nm.BaseNoiseModel.from_config(
config_name,
noise_model_name,
*qids_,
)
my_sim = tnm.get_sim(split_num=7, sim_num=200, lmax=5400)
and got the following error
Sim split_num 7, sim_num 200, lmax 5400, alm False not found on-disk, generating instead
90.82 277.07 291.43 Generating observed-pixels mask
2.89 275.60 291.43 Generating sqrt_ivars for qid pa6a
2.71 275.60 291.43 Generating sqrt_ivars for qid pa6b
Building and storing FDWKernels
82.60 310.30 310.73 Generating noise sim for split_num 7, sim_num 200, lmax 5400, alm False
AssertionError Traceback (most recent call last)
Cell In[9], line 1
----> 1 my_sim = tnm.get_sim(split_num=split_i, sim_num=200, lmax=5400)
File /global/u2/m/mgatti/mnms/mnms/noise_models.py:1763, in BaseNoiseModel.get_sim(self, split_num, sim_num, lmax, seed, alm, check_on_disk, generate, keep_model, keep_mask_obs, keep_sqrt_ivar, write, verbose)
1761 # get the sim
1762 with bench.show(f'Generating noise sim for {utils.kwargs_str(split_num=split_num, sim_num=sim_num, lmax=lmax, alm=alm)}'):
-> 1763 sim = self._get_sim(
1764 model_dict, seed, self._iso_filt_method, self._ivar_filt_method,
1765 filter_kwargs, verbose
1766 )
1767 sim *= mask_obs
1768 if alm:
File /global/u2/m/mgatti/mnms/mnms/noise_models.py:2581, in FDWNoiseModel._get_sim(self, model_dict, seed, iso_filt_method, ivar_filt_method, filter_kwargs, verbose)
2578 self._fk_dict[lmax] = self._get_kernels(lmax)
2579 fk = self._fk_dict[lmax]
-> 2581 sim = self.class.get_sim_static(
2582 sqrt_cov_mat, seed, fk, nthread=0, iso_filt_method=iso_filt_method,
2583 ivar_filt_method=ivar_filt_method, filter_kwargs=filter_kwargs,
2584 verbose=verbose
2585 )
2587 # We always want shape (num_arrays, num_splits=1, num_pol, ny, nx).
2588 return sim.reshape(self._num_arrays, 1, -1, *sim.shape[-2:])
File /global/u2/m/mgatti/mnms/mnms/noise_models.py:2636, in FDWNoiseModel.get_sim_static(cls, sqrt_cov_mat, seed, fdw_kernels, nthread, iso_filt_method, ivar_filt_method, filter_kwargs, verbose)
2590 @classmethod
2591 def get_sim_static(cls, sqrt_cov_mat, seed, fdw_kernels, nthread=0,
2592 iso_filt_method=None, ivar_filt_method=None,
2593 filter_kwargs=None, verbose=False):
2594 """Draw a realization from the square-root covariance in the directional
2595 wavelet basis. Allows filtering the output map after the tiling
2596 transform.
(...)
2634 filter_kwargs.
2635 """
-> 2636 sim = fdw_noise.get_fdw_noise_sim(
2637 sqrt_cov_mat, seed, fdw_kernels, nthread=nthread, verbose=verbose
2638 )
2640 sim = cls.filter(
2641 sim, iso_filt_method=iso_filt_method,
2642 ivar_filt_method=ivar_filt_method, filter_kwargs=filter_kwargs,
2643 adjoint=False, verbose=verbose
2644 )
2646 return sim
File /global/u2/m/mgatti/mnms/mnms/fdw_noise.py:1030, in get_fdw_noise_sim(sqrt_cov_wavs, seed, fdw_kernels, nthread, verbose)
1026 wmap_sim = utils.concurrent_einsum(
1027 '...ab, ...b -> ...a', wmap, wmap_sim, nthread=nthread)
1028 wavs_sim[idx] = wmap_sim
-> 1030 kmap = fdw_kernels.wav2k(wavs_sim, nthread=nthread)
1032 return kmap
File /global/u2/m/mgatti/mnms/mnms/fdw_noise.py:178, in FDWKernels.wav2k(self, wavs, nthread)
175 wav = wavs[kern_key]
176 assert wav.shape[:-2] == preshape,
177 f'wav {kern_key} preshape is {wav.shape[:-2]}, expected {preshape}'
--> 178 kmap_wav = kernel.wav2k(wav, nthread=nthread)
179 for sel in kernel._sels:
180 kmap[sel] += kmap_wav[sel]
File /global/u2/m/mgatti/mnms/mnms/fdw_noise.py:386, in Kernel.wav2k(self, wmap, use_kernel_wcs, nthread)
364 def wav2k(self, wmap, use_kernel_wcs=True, nthread=0):
365 """Generate the real DFT of a wavelet map for this kernel. This is
366 achieved by convolving the real DFT of the wavelet map with the
367 complex conjugate of this kernel.
(...)
384 Real DFT of a map to be analyzed.
385 """
--> 386 assert wmap.shape[-2] == self._k_kernel.shape[-2],
387 f'wmap must have same shape[-2] as k_kernel, got\n' +
388 f'{wmap.shape[-2]} and {self._k_kernel.shape[-2]}'
389 assert wmap.shape[-1]//2+1 == self._k_kernel.shape[-1],
390 f'wmap must have same shape[-1]//2+1 as k_kernel, got\n' +
391 f'{wmap.shape[-1]//2+1} and {self._k_kernel.shape[-1]}'
393 kmap = utils.rfft(wmap, normalize='backward', nthread=nthread)
AssertionError: wmap must have same shape[-2] as k_kernel, got
331 and 333
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure through BaseNoiseModel.get_sim in mnms/noise_models.py, then inspect FDWNoiseModel.get_sim_static and FDWKernels.wav2k in mnms/fdw_noise.py. Trace why the wavelet map has height 331 while the kernel expects 333; done means generating the requested fdw simulation without the assertion failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100