IO

If you want to store the constructed images you can save them as FITS files. This way you can open them in any code/program you want to make plots later.

Saving

To save an image and the relevant fields from the mappingParameters struct you can use the function write_fits_image:

SPHtoGrid.write_fits_imageFunction
write_fits_image(filename::String, image::Array{<:Real}, 
                        par::mappingParameters; 
                        units::String="[i.u.]",
                        snap::Integer=0)

Writes a mapped image to a FITS file and stored the essential mapping parameters in the header.

source
write_fits_image(filename::String, image::Array{<:Real};
                units::String = "[i.u.]",
                snap::Integer = 0)

Writes a mapped allsky image to a FITS file and stored units and snapshot number in the header.

source

The keyword arguments units and snap are optional and are used to store a unit string and the snapshot number for the image, respectively.

Reading

To read a mapped image from a FITS file you can use read_fits_image:

SPHtoGrid.read_fits_imageFunction
read_fits_image(filename::String)

Read a FITS file and return the image, mappingParameters and the snapshot number.

Returns

  • image: A 2D array with the image pixels
  • par: mappingParameters used for the image
  • snap: Number of the mapped snapshot
  • units: A unit string of the image

Example

image, par, snapnr, unitstring = readfitsimage(filename)

source