Skip to content

Commit

Permalink
Merge pull request #879 from AlecThomson/fix_beams
Browse files Browse the repository at this point in the history
Find the real CASA beamtable
  • Loading branch information
e-koch authored Aug 5, 2023
2 parents 3d9ab27 + aecd8bc commit 8d58513
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
python-version: 3.9
name: Py3.9 all dev
toxenv: py39-test-viz-noviz-docs-dev
- os: ubuntu-18.04
- os: ubuntu-latest
python-version: 3.8
name: Py3.8 mindeps and CASA
toxenv: py38-test-casa
Expand Down
2 changes: 1 addition & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
0.6.3.dev (unreleased)
----------------------
- none yet
- Find beam table from EXT name and CI fix #879

0.6.2 (2023-06-23)
------------------
Expand Down
8 changes: 4 additions & 4 deletions spectral_cube/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def prepare_4_beams():
beams['BPA'] = [0,45,60,30] # degrees
beams['CHAN'] = [0,1,2,3]
beams['POL'] = [0,0,0,0]
beams = fits.BinTableHDU(beams)
beams = fits.BinTableHDU(beams, name='BEAMS')

beams.header['TTYPE1'] = 'BMAJ'
beams.header['TUNIT1'] = 'arcsec'
Expand Down Expand Up @@ -100,7 +100,7 @@ def prepare_4_beams_withfullpol():

beams['POL'] = pol_codes

beams = fits.BinTableHDU(beams)
beams = fits.BinTableHDU(beams, name='BEAMS')

beams.header['TTYPE1'] = 'BMAJ'
beams.header['TUNIT1'] = 'arcsec'
Expand Down Expand Up @@ -490,7 +490,7 @@ def prepare_5_beams():
beams['BPA'] = [0,45,60,30,0] # degrees
beams['CHAN'] = [0,1,2,3,4]
beams['POL'] = [0,0,0,0,0]
beams = fits.BinTableHDU(beams)
beams = fits.BinTableHDU(beams, name='BEAMS')
beams.header['TTYPE1'] = 'BMAJ'
beams.header['TUNIT1'] = 'arcsec'
beams.header['TTYPE2'] = 'BMIN'
Expand Down Expand Up @@ -576,7 +576,7 @@ def prepare_5_beams_with_pixscale(pixel_scale):
beams['BPA'] = [0,45,60,30,0] # degrees
beams['CHAN'] = [0,1,2,3,4]
beams['POL'] = [0,0,0,0,0]
beams = fits.BinTableHDU(beams)
beams = fits.BinTableHDU(beams, name='BEAMS')

beams.header['TTYPE1'] = 'BMAJ'
beams.header['TUNIT1'] = 'arcsec'
Expand Down
3 changes: 2 additions & 1 deletion spectral_cube/io/fits.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ def read_data_fits(input, hdu=None, mode='denywrite', **kwargs):
if isinstance(hdu_item, (fits.PrimaryHDU, fits.ImageHDU)):
arrays[ihdu] = hdu_item
elif isinstance(hdu_item, fits.BinTableHDU):
if 'BPA' in hdu_item.data.names:
# Check for CASA-standard beam table
if hdu_item.header.get('EXTNAME') == 'BEAMS':
beam_table = hdu_item.data

# Check that the table has the expected form for beam units:
Expand Down

0 comments on commit 8d58513

Please sign in to comment.