casangi / xradio

Xarray Radio Astronomy Data IO
Other
9 stars 5 forks source link

read_image fails to work for FITS #155

Closed Mark1626 closed 1 month ago

Mark1626 commented 2 months ago

The read_image method seems to fail for FITS images

from xradio.image import read_image
fitsimage = 'MKN6-HIABS.fits'
image = read_image(fitsimage)

Error message

RuntimeError: Unrecognized image format. Supported types are CASA, FITS, and zarr.

image format appears not to be casacore: ('Table MKN6-HIABS.fits does not exist',)
image format appears not to be fits ("_compute_linear_world_values() got an unexpected keyword argument 'cunit'",)
image format appears not to be zarr ('path exists but is not a directory: %r',)

There seems to be a couple of things issues xds_from_fits.py

xds_from_fits

  1. doppler is expected in the meta of all FITS
  2. Variable cunit is in the function call to _get_freq_values
  3. _get_transpose_list does not consider meta FREQ

I'll try to address these points in a PR

Further this method seems to expect a lot of meta data that could be optional in a FITS image. TELESCOP, OBSGEO-X, DATE-OBS, OBSERVER.