Skip to content

Fix inigaus_fbdsm PA - #535

Merged
gmloose merged 5 commits into
lofar-astron:combined-reference-updatesfrom
AlexKurek:Fix-inigaus_fbdsm-PA
Nov 9, 2026
Merged

gmloose merged 5 commits into
lofar-astron:combined-reference-updatesfrom
AlexKurek:Fix-inigaus_fbdsm-PA

Conversation

@AlexKurek

Copy link
Copy Markdown
Contributor

fit_island() converts the beam PA to the convention used by gaus_2d() by adding 90 deg. That beam is passed to get_maxima() and then to mclean(), which adds another 90 deg. The clean model is therefore rotated by 90 deg.

@AlexKurek

Copy link
Copy Markdown
Contributor Author

The difference shows up in w1 because the wavelet decomposition is computed from the base-fit Gaussian residual (img.resid_gaus_arr). The pyrank file is an island rank image, so the difference reflects a different island structure, not a noise level.

@gmloose

gmloose commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

Is this PR somehow related to #505? There seems to be a mixup of how angles are defined. I cannot approve this PR, because (obviously) the CI is failing.

@darafferty, what's your take on this?

@AlexKurek

Copy link
Copy Markdown
Contributor Author

It’s the same class of problem as #505 (mixed +y/+x angle conventions), but a different code path with no overlap.

@darafferty

Copy link
Copy Markdown
Collaborator

The change looks correct I think. The CI seems to fail on a wavelet pyrank image (which shows the islands with the island's id number as its value), which, while not what I would have expected, is OK to ignore I think.

@gmloose
gmloose changed the base branch from master to combined-reference-updates November 9, 2026 13:46
@gmloose
gmloose merged commit 60a0177 into lofar-astron:combined-reference-updates Nov 9, 2026
1 check failed
@AlexKurek
AlexKurek deleted the Fix-inigaus_fbdsm-PA branch November 9, 2026 13:53
gmloose added a commit that referenced this pull request Nov 9, 2026
* Fix `inigaus_fbdsm` PA (#535)

`fit_island()` converts the beam PA to the convention used by `gaus_2d()` by adding 90 deg. That beam is passed to `get_maxima()` and then to `mclean()`, which adds another 90 deg. The clean model is therefore rotated by 90 deg.

* Fix wavelet output files (#548)

**Bugs**
The wavelet module incorrectly generated the `model_wavelets.fits` and `resid_wavelets.fits`. After Gaussian fitting, the residual image is further processed by wavelet Gaussian fitting. However, the implementation did not correctly account for the standard Gaussian model when saving the final outputs.

- `model_wavelets.fits` contained only the additional model contributed by wavelet Gaussian fitting, rather than the complete source model.

- `resid_wavelets.fits` contained the original image with only the wavelet model subtracted. So the standard Gaussian model was still present in this image, meaning it was not the actual residual.

- This also caused incorrect results when wavelet Gaussian fitting was disabled (atrous_bdsm_do = False): the model image was 0 and the residual image was identical to the input image.

**Fixed**
- `model_wavelets.fits` contain the complete model (both standard and wavelet Gaussian components).

- `resid_wavelets.fits` contain the final residual after subtraction of both model components.

**Added**
- `model_wavelets_component.fits` to preserve the wavelet-only model.

Also updated the wavelet image filenames to distinguish wavelet components from remaining scale images when `atrous_sum = True`.

* Update reference outputs and make output comparison stricter (#565)

* Update reference outputs and make output comparison stricter

- Regenerate `test/reference_outputs` with the current master. The old
  ones had drifted: `resid_gaus.fits` differed by 2.9% (close to the CI
  tolerance of 3%), and the wavelet model images by 12.7%.
- `compare_results` now compares all subdirectories recursively (the
  images in `wavelet/model`, `wavelet/residual` and `wavelet/background`,
  and the top-level `ch0_*` images, were not compared), and fails if a file
  is missing in one of the runs (this was only logged).
- `tbdsf_process_image.py` takes the tolerance as `--rtol`, with a default
  of 0.001 for runs on the same kind of system as the one that generated
  the reference outputs (x86-64 Linux). CI and cibuildwheel use 0.03.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Restore reference outputs from master

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

* Update reference outputs

---------

Co-authored-by: Aleksander Kurek <aleksander.kurek@uj.edu.pl>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants