By design, Specviz2D only supports data that can be parsed as ~specutils.Spectrum1D
objects, as that allows the Python-level interface and parsing tools to be defined in specutils
instead of being duplicated in Jdaviz. ~specutils.Spectrum1D
objects are very flexible in their capabilities, however, and hence should address most astronomical spectrum use cases.
- Reading from a File
Specutils documentation on loading data as
~specutils.Spectrum1D
objects.
Specviz2D can either take both a 2D and 1D spectrum as input, or can automatically extract a 1D spectrum if only a 2D spectrum is provided. To view the extraction parameters and override the extraction, see the spectral extraction plugin <specviz2d-spectral-extraction>
.
You can load your data into the Specviz2D application through the command line (NOTE: this currently only supports passing a 2D spectrum object and will automatically extract the 1D spectrum):
jdaviz specviz2d /my/directory/spectrum.fits
You can load your data into the Specviz2D application by clicking the Import Data
button at the top left of the application's user interface. This opens a dialogue where the user can select a file that can be parsed as a ~specutils.Spectrum1D
.
After clicking Import
, the data file will be parsed and loaded into the application.
Alternatively, users who work in a coding environment like a Jupyter notebook can access the Specviz2D helper class API. Using this API, users can load data into the application through code with the ~jdaviz.configs.specviz2d.helper.Specviz2d.load_data
method, which takes as input a ~specutils.Spectrum1D
object or filename for the 2D spectrum and (optionally) the 1D spectrum.
By default, extension 1 of the 2D file is loaded, but you can specify another extension by providing an integer to the ext
keyword. In case you want to load an uncalibrated spectrum that is dispersed vertically, you can also set the transpose
keyword to flip the spectrum to be horizontal:
specviz2d.load_data(fn, ext=7, transpose=True)