write_simspin_FITS: A function for making a mock spectral cube FITS file output

View source: R/write_simspin_FITS.R

write_simspin_FITSR Documentation

A function for making a mock spectral cube FITS file output

Description

The purpose of this function is to write the spectral cube generated using the build_datacube() function to a FITS file. This code will also write the images produced by build_datacube() to a further series of FITS files automatically. Images are either added to subsequent HDU within the same FITS file, or saved seperately to a series of files. The number of FITS HDU or files written is dependent on the input simspin_datacube. Files and HDU will be named suitably to reflect their content automatically.

Usage

write_simspin_FITS(
  output_file,
  simspin_datacube,
  object_name,
  telescope_name,
  instrument_name,
  observer_name,
  input_simspin_file,
  split_save = F,
  mask = NA,
  galaxy_centre = c(0, 0, 0)
)

Arguments

output_file

The path and file name to the location where the FITS file should be written.

simspin_datacube

The list output from build_datacube().

object_name

A string that described the name of the observed object.

telescope_name

A string that describes the name of the telescope used.

instrument_name

A string that describes the used instrument on that telescope.

observer_name

A string that describes the name of the observer.

input_simspin_file

A string describing the original SimSpin file (i.e. the file output from make_simspin_file).

split_save

Boolean describing whether to split the output from build_datacube() into multiple files. If TRUE, several FITS files will be saved with file names that reflect their content (i.e. "_spectral_cube.FITS", "_velocity_image.FITS", "_dispersion_images.FITS", etc.). Default option is FALSE.

mask

(Optional) A binary array describing the masked regions of the cube/images.

galaxy_centre

(Optional) A numeric array (x,y,z) describing the centre of potential of the observed galaxy within it's simulation.

Value

Returns an .FITS file that contains a the generated data and relevant header describing the mock observation.

Examples

## Not run: 
ss_eagle = system.file("extdata", "SimSpin_example_EAGLE.hdf5", package = "SimSpin")
temp_loc = tempdir()
make_simspin_file(ss_eagle, output = paste(temp_loc, "spectra.Rdata", sep=""))
cube = build_datacube(simspin_file = paste(temp_loc, "spectra.Rdata", sep=""),
                     telescope = telescope(type="SAMI", lsf_fwhm = 4, wave_res = 1.6),
                     observing_strategy = observing_strategy())
write_simspin_FITS(output_file = paste(temp_loc, "cube.FITS", sep=""),
                  simspin_datacube = cube, object_name = "SimSpin EAGLE example",
                  telescope_name = "AAO", instrument_name = "SAMI",
                  observer_name = "K.E.Harborne",
                  input_simspin_file = paste(temp_loc, "spectra.Rdata", sep=""))
unlink(paste(temp_loc, "spectra.fst", sep=""))
unlink(paste(temp_loc, "cube.FITS", sep=""))

## End(Not run)


kateharborne/SimSpin documentation built on April 28, 2024, 2 p.m.