Message Boards Message Boards

1
|
4887 Views
|
3 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Import FITS images with identical results in MMA 11.3 and 12.0?

Posted 5 years ago

I have been using Mathematica 11.3 to analyze experimental data in the form of FITS format images. In 11.3, Import[filename] evauated to an image. In 12.0, it seems to evaluate to an association: enter image description here

So this has broken my previous notebooks, and also means that my collaborators will all need to upgrade to V12 if we are to conveniently share code.

Am I right about this? Does anyone have an insight as to why this has happened?

POSTED BY: David Keith
3 Replies
Posted 5 years ago

There is a further problem with this. In version 12 importing an "Image" from a FITS file imports an invalid image. To import a valid image, one needs to use

Image/@Import["Fiber005.fits", {"Data", 1}];

Essentially importing the data and making an image out of it.

POSTED BY: David Keith
Posted 5 years ago

Thank you. That is a big help. I will update notebooks using this syntax, and they can be used with 11.3 or 12. I looked up the docs on this. The FITS files can contain multiple items called HDUs; not all are images. I agree with your assessment. This is likely for consistency, and is probably justified.

POSTED BY: David Keith

I managed to construct an Import syntax that produces identical results in 11.3 and 12.0. I hope this helps.

Import["http://exampledata.wolfram.com/messier61.fits.gz", {"FITS", "Image", 1}]

I do not know the reason for changing this, but 11.3 already returned an association for a "multi-HDU file" (whatever that means). I guess it was done for consistency: it is useful to have the same result format regardless of file type.

POSTED BY: Szabolcs Horvát
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract