Skip to content

Fix wrong number of channels in regrid when combining different datasets#344

Merged
thomaswilliamsastro merged 1 commit into
masterfrom
fix-wrong-nchan
May 19, 2026
Merged

Fix wrong number of channels in regrid when combining different datasets#344
thomaswilliamsastro merged 1 commit into
masterfrom
fix-wrong-nchan

Conversation

@thomaswilliamsastro
Copy link
Copy Markdown
Collaborator

Fixes #248 and #342.

This fixes the occasional wrong number of channels when doing the mstransform regrid call in data staging. The first issue, occasional blank channels at the start/end of cube was due to an error in calculating the number of channels to pad by. There is also a second issue where combining datasets from different programmes can lead to different numbers of channels, and hence wonky coverage in the start/end channels. This is now fixed by ensuring all input datasets have the same number of output channels.

N.B. this may have some effect in shifting cubes so the systemic isn't quite in the cube centre. I'm only seeing this change the total number of channels by 1 so not a big deal, but we might want to keep an eye out

  • Ensure when combining MS's that they all have the same number of output channels
  • Fix wrong number of channels in regrid when combining different datasets
  • Update changelog

@codecov
Copy link
Copy Markdown

codecov Bot commented May 18, 2026

Codecov Report

❌ Patch coverage is 4.76190% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 6.27%. Comparing base (aaa8783) to head (284a7cc).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
phangsPipeline/casaVisRoutines.py 4.76% 20 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           master    #344      +/-   ##
=========================================
- Coverage    6.27%   6.27%   -0.01%     
=========================================
  Files          38      38              
  Lines       15211   15229      +18     
  Branches     3648    3653       +5     
=========================================
+ Hits          954     955       +1     
- Misses      14243   14260      +17     
  Partials       14      14              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

add_chans += total_nchan_unbinned - (nchan + add_chans)

# Cast back to integer
add_chans = int(add_chans)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ceil first seems like it might be safer in the cases where we end up slightly off integer because of the velocity <-> frequency non-linearity. I'm not sure it happens but I always get spooked.

Copy link
Copy Markdown
Collaborator

@low-sky low-sky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No problems but I haven't run all the corner cases.

Fixes #248 and #342.

This fixes the occasional wrong number of channels when doing the mstransform regrid call in data staging. The first issue, occasional blank channels at the start/end of cube was due to an error in calculating the number of channels to pad by. There is also a second issue where combining datasets from different programmes can lead to different numbers of channels, and hence wonky coverage in the start/end channels. This is now fixed by ensuring all input datasets have the same number of output channels.

N.B. this may have some effect in shifting cubes so the systemic isn't quite in the cube centre. I'm only seeing this change the total number of channels by 1 so not a big deal, but we might want to keep an eye out

- Ensure when combining MS's that they all have the same number of output channels
- Fix wrong number of channels in regrid when combining different datasets
- Update changelog
@thomaswilliamsastro thomaswilliamsastro merged commit 9997b7b into master May 19, 2026
5 of 7 checks passed
@thomaswilliamsastro thomaswilliamsastro deleted the fix-wrong-nchan branch May 19, 2026 12:32
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.

Investigate empty channels at start and end of cube

2 participants