1.147. fitsReader

Full Name: herschel.ia.toolbox.util.FitsReaderTask
Alias: fitsReader
Type: Java Task - Java Task
Import: from herschel.ia.toolbox.util import FitsReaderTask



Task to read and import arbitrary products in FITS files into HIPE.

Creates a "suitable" product (or dataset) from a FITS file, not necessarily from Herschel (it is capable of importing external complex products).

Currently it deals with images, (wave based) spectra, cubes and spectral cubes.

It supports compressed (zip and gzip) fits files.


Example 1: Import (or read) guessing the product stored in a FITS file
filepath = "path_to_file/filename"
Example 2: Import (or read) the image stored in a FITS file
filepath = "path_to_file/filename"
product=fitsReader(file=filepath, fitsType=FitsReaderTask.FitsType.IMAGE)
Example 3: Same as above but using strings for the fitsType
filepath = "path_to_file/filename"
product=fitsReader(file=filepath, fitsType="image")


  • There is no importer for Spectra, thus this task can only import a small subset of.

API details


String file [INPUT, MANDATORY, default=no default value]

The path of the FITS file to be read (can be gzipped or zipped).

Object fitsType [INPUT, OPTIONAL, default="guess"]

The type of object the fits file contains (default is unknown).

Possible values (either FitsType or String):

  • FitsReaderTask.FitsType.UNKNOWN or "guess": (default) try to guess the type of object

  • FitsReaderTask.FitsType.IMAGE or "image": import as an Image

  • FitsReaderTask.FitsType.SPECTRUM or "spectrum": import as a Spectrum

  • FitsReaderTask.FitsType.CUBE or "cube" : import as a Cube

  • FitsReaderTask.FitsType.SPECTRAL_CUBE or "spectral cube" : import as an Spectral Cube

Object data [OUTPUT, MANDATORY, default=null]

The Product (or dataset for spectra) read from the FITS file.

See also


  • 2009-09-04 - JDS: initial release (only images can be displayed, graphical editors fail to show)
  • 2009-10-22 - JDS: release complete (no general solution for Spectra in Herschel)
  • 2010-08-11 - JDS: extended to compressed files (via streams)
  • 2012-07-20 - JDS: replaces SimpleFitsReader,