Best practices for writing spectra files

Hey folks,

I’m working with an inhomogeneous spectral data set – a hodge-podge of IRAF, IDL, and ASCII files. I figure since I have to go through and figure out how to read each one, I have an opportunity to save the files in a more consistent manner. I have two questions:

  1. Are there any best practices for saving spectra files? I’m just thinking I would use spec1d.write(‘spec.fits’). Are there other methods I should consider?

  2. It doesn’t look like spec1d.write currently supports including a FITS headers. Does anyone know if that’s deliberate? Should I use other to add a header to the file. Or maybe I should be using the meta attribute?

Thanks for your thoughts and insights!

1 Like

From my experience working with the diversity of spectra formats that Data Central hosts, adding as much contextual data is a must (as spectra get reanalysed and important information is dropped). I’ve noticed that not storing everything in one extension helps with that (e.g. an extension for flux, an extension for the uncertainty, an extension for the sky). I think spec1d.write('spec.fits') doesn’t include that metadata, it’d be nice to have a writer which did. Data Central wrote a custom writer targeted at giving a simplified version of the spectra to be used with splat/topcat and SSA (which does lose much of that contextual metadata, but we add all the obscore information into the header for provenance), but we also serve out the originals (and have upstreamed the specutils loaders for those formats).

1 Like