glue-viz / glue-astronomy

Plugin to add astronomy-specific functionality to glue
https://glue-astronomy.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
11 stars 13 forks source link

Support CASA image format #1

Closed keflavich closed 4 years ago

keflavich commented 5 years ago

spectral-cube supports reading casa's image format as of https://github.com/radio-astro-tools/spectral-cube/pull/541. Glue should support reading these files.

Note that CASA images do not have a fixed extension, so the user needs to specify how these files are to be read. That might require using the "Import Data" dialogue, or creating some other sort of popup dialogue.

keflavich commented 5 years ago

@astrofrog - should I be posting this here or back in main glue?

Also, this: https://github.com/glue-viz/glue/issues/1351 is probably not related despite the title being approximately the same

astrofrog commented 5 years ago

@keflavich - here makes sense, and I agree it would be great to support the CASA image format. I think if we can get the .ms reader to work it could go here too.

astrofrog commented 5 years ago

I'd like to avoid duplication of code, so it might make sense to simply delegate to spectral-cube here - however, will the spectral-cube reader fail for 2d images?

keflavich commented 5 years ago

I agree, delegate to spectral cube. It works fine on 2d images.

On Wed, Aug 21, 2019, 04:24 Thomas Robitaille notifications@github.com wrote:

I'd like to avoid duplication of code, so it might make sense to simply delegate to spectral-cube here - however, will the spectral-cube reader fail for 2d images?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/glue-viz/glue-astronomy/issues/1?email_source=notifications&email_token=AABDCY6UTPQRRXILIHNI3M3QFT3T7A5CNFSM4IN7U6DKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4Y3VRI#issuecomment-523352773, or mute the thread https://github.com/notifications/unsubscribe-auth/AABDCY7MSEHT7KARIXAZEKLQFT3T7ANCNFSM4IN7U6DA .

keflavich commented 5 years ago

In the meantime, what's the fastest way to load something in glue via spectral-cube? If I do:

cube = SpectralCube.read('cube.image', format='casa_image')
cube.to_glue()

it actually spins up a new instance of glue on top of the existing one, which isn't what I want (and probably means we should change something about the to_glue implementation).

astrofrog commented 5 years ago

Try going to 'Import Data' in glue and select 'FITS Spectral Cube' for the type, as I think it won't actually check the file is a FITS file (is_spectral_cube does check if a file is FITS, but that's only used if trying to auto-guess the format).

astrofrog commented 4 years ago

This is now done and works with the latest developer version of glue and glue-astronomy. Docs being added in #6