[CXC logo]
Skip to the navigation links
Last modified: 26 Sept 2011

URL: http://cxc.harvard.edu/iris/v1.0/threads/analysis/thread.html

Analyzing SED Data in Iris

Iris Threads


Overview

Synopsis:

In this thread we step through a detailed sample analysis of a Spectral Energy Distribution (SED) of object 3c273 using Iris, to represent the typical path one would take through the tool in order to build, analyze, and save a SED to file. We string together the components of the Iris How-to Guide in order to integrate the individual features and capabilities of Iris into one, big picture.

Last Update: 26 Sep 2011 - updated for Iris 1.0


Contents


Loading SED Data into Iris

In order to visualize a SED of an astronomical object across a wide range of wavelengths, multiple SED segments from various locations must be gathered and coplotted; Iris features multiple entry points for SED data to facilitate this process. You can load data files in supported formats from your local disk into Iris, or import SED data directly from the photometry archives of the NASA Extragalactic Database (NED) upon startup of the application from the Unix command line. Independent of how each data set is loaded and from where, Iris can simultaneously plot multiple SED segments together in the main display.

Uploading SED Data from File

The SED data file for an object of interest can be downloaded from an astronomical database such as NED or SIMBAD; converted to a supported FITS or VOTable format, if necessary, using the SED Importer tool bundled with Iris; and then loaded into Iris by starting the application and selecting the Read from file option in the File menu. We consider the example ASCII data files 3c273.hut.ascii and 3c273.wuppe.ascii, which contain tables of ultraviolet photometric data observed by the Hopkins Ultraviolet Telescope and Wisconsin Ultraviolet Polarimeter Experiment, respectively.

Iris supports IVOA-compliant VOTable and FITS format SED input files, in addition to files downloaded from the NED photometry archive (e.g., in XML format). If you have a SED file in an unsupported format which you would like to import into Iris - e.g., CSV or ASCII - you may do so by first converting the file to a supported format via the SED Importer tool. The SED Importer tool accepts as 'non-standard' any binary or text-based file that does not conform to the IVOA SED, Spectrum and Photometry Data Model; these include FITS and VOTable files which do not conform to the IVOA standards. The full list of SED Importer features is documented in the Converting SED Data to a Supported Format section of the Iris How-to Guide.


Converting SED Data to a Supported Format

Since we would like to analyze in Iris two photometric data segments which we have stored in ASCII format files, we must convert them to FITS or VOTable format files in order to load them into Iris. This involves starting the SED Importer GUI, which runs separately from the main Iris GUI in the current release; loading one or both of the ASCII data files into the tool; entering configuration information so that the tool can convert from the unsupported to a supported format; and then saving the converted data to FITS or VOTable format file(s). The individual files to be converted may be saved to separate files, or you may build an aggregate SED from multiple segments and save to one converted file.

We begin by launching the SED Importer GUI from the Unix command line:

% <basedir>/iris-1.0-<plat>-<arch>/SedImporter &
[Iris GUI snapshot]

Next, we upload the file 3c273.hut.ascii into the tool by clicking the "New Segment" button, and then browsing our local disk for the file.

[Iris GUI snapshot]

This brings us to the Import Setup Frame window, where we are required to specify which columns in the input ASCII table correspond to the X axis, Y axis, and Y axis error arrays. (The other, optional fields may also be filled in; refer to the "Converting SED Data to a Supported Format" section of the Iris How-to Guide for details and instruction.)

[Iris GUI snapshot]

Before selecting the "Add Segment to SED" option - in order to be brought back to the SED builder window where we may save our converted data to a FITS or VOTable format file - we first save this conversion configuration to a so-called 'setup' file by selecting the "Save Setup" option; we name the file ascii_setup.ini. The purpose of the setup file is to allow you to convert many data files in the same unsupported format from the command line, non-interactively; i.e., so that you do not have to re-create the same conversion setup within the GUI for each file. (This works in our example, because our two data sets have the same format; if they were different, we would have to create a separate setup for the second data file within the GUI, repeating the process outlined above).

Having entered and saved our conversion configuration, we are now ready to save the converted data to file; we do this by selecting "Add Segment to SED" in the setup window, and then clicking "Save SED" in the SED builder window. In this example, we choose to serialize the data in VOTable format.

[Iris GUI snapshot]

Since we saved our ASCII conversion configuration to a setup file in the SED Importer interactive session, we may now run the tool non-interactively from the Unix command line in order to convert our second data file, 3c273.wuppe.ascii, using the same setup.

First, we must edit the 'fileLocation' field in the setup file to point to the correct data file:

% more ascii_setup.ini 
[Segment0]
XAxisColumnNumber = 0
XAxisQuantity = WAVELENGTH
XAxisUnit = ANGSTROM
YAxisColumnNumber = 1
YAxisQuantity = SPVFLUXDENSITY
YAxisUnit = FLUXDENSITYWL0
errorType = SymmetricColumn
fileLocation = file:/home/user/science/3c273.wuppe.ascii
formatName = ASCIITABLE
lowerErrorColumnNumber = 0
lowerErrorParameter = INVALID
publisher = STScI MAST
symmetricErrorColumnNumber = 2
symmetricErrorParameter = INVALID
targetDec = 2.052406321
targetName = 3c273
targetRa = 187.277896334
upperErrorColumnNumber = 0
upperErrorParameter = INVALID

Then, we perform the conversion using the following command, where we specify the setup file to use to make the conversion, the name of the output converted file, and finally, the format to use for the output file:

% <basedir>/iris-1.0-<plat>-<arch>/SedImporter ascii_setup.ini 3c273.wuppe.vot vot

We now have two IVOA-compliant, VOTable format files containing ultraviolet photometric data for source 3c273, which may be uploaded into Iris for analysis.


Visualizing SED Data

The Iris GUI is an adaptation of the Specview spectral visualization and analysis GUI, and as a result offers many of the data display preferences of Specview. Multiple SED data segments or photometric points may be plotted simultaneously in the Iris main display - together in one window or separately in tiled windows - and the attributes of many components of the display may be customized, such as the plot axes scale and preferred units, and data point size and color.

Coplotting Multiple SED Segments

In order to coplot the two separate SED data segments of 3c273 in the Iris display, we load each file into the application using the "File -> Read from File" menu option, and then select the Coplot menu option. This opens the "Spectrograms from Memory" window, where we select both SED segments for plotting, using the Shift or Control key to highlight both:

[Iris GUI snapshot]

The Iris Coplot menu allows you to select multiple SED data segments from the tool's memory buffer for simultaneous display in Iris, in order to add and delete segments at will throughout the Iris session.

The Pan option at the bottom of the Iris main display allows you to view the full spectral range covered by all SED data which has been read into the session, beyond the edges of the data segment(s) which is currently displayed.

[Iris GUI snapshot]

It is important to note that the coplotting process does not involve combining, coadding, or splicing the spectral data in memory in any way (the Coplot->Process option is unavailable); the raw data from the multiple input spectrograms is completely preserved in the resulting combination, which is why the two spectrograms of 3c273 show in the figure above are offset in the y-direction (flux density) at the same x value (wavelength).

Finally, note that one of the loaded data segments displays in magenta-colored symbols; this indicates that the data have associated zero-value errors. Data points with zero-value errors are ignored in the model fitting in Iris (see the Iris FAQs for details).


Accessing SED Metadata

By right-clicking on one of the 3c273 SED data segments or points in the Iris display, we can view the metadata for that particular segment or point, including information on the segment type, e.g., "SPECTRUM" or "Photometry Point"; data identification, e.g., the instrument used to obtain the data, in which observing mode, and the bandpass covered by the data; curation information such as the publisher of the data, e.g., "NASA Extragalactic Database", and the rights to the data, whether "PUBLIC" or not; among other details.

[Iris GUI snapshot]

In addition to metdata, right-clicking on a data segment also shows the x and y data values comprising that segment, e.g., "SpectralAxis" versus "FluxAxis". The values returned are those which were imported into Iris from NED, or uploaded from a file on your hard disk; i.e., not what is currently plotted in the Iris display in the event that you changed the units of the display.

[Iris GUI snapshot]

To simultaneously display the metadata and data values for multiple photometric points, select the Coplot menu option, and then right-click on the appropriate file(s) in the Spectrograms in Memory window which opens).


Modeling and Fitting SED Data

Having loaded our desired 3c273 SED data, set our display preferences, and checked the available metadata, we are ready to define a model expression and fit the model to the data. The resulting best-fit values for the SED model parameters, and confidence limits on them, are physically meaningful quantities which we will use in our analysis of 3c273. We initiate the fitting process by selecting the Fit option in the main Iris display.

[Iris GUI snapshot]

The Iris Fit feature allows you to define a single or multi-component model expression, set starting model parameter values and ranges, and choose from among a list of robust fit statistics and methods. It also allows you to calculate the specified percent/sigma confidence intervals on best-fit model parameters, to assess the quality of the fit (e.g., entering "1.6" for 1.6-sigma, 90% confidence).

In the current beta release of Iris, it is not possible to edit SED data before the fitting process, e.g., to mask any data points which have been flagged as 'bad', or scale, trim, and join multiple data segments into a seamless, wide-band SED to be fit. However, Iris does support a simultaneous fit of multiple, separate SED segments.

Choosing the Data Range to be Fit

For our analysis we choose to fit only a subset of one of our loaded segments of 3c273, the ~1370-1830 Angstroms range within the HUT segment (recalling that the WUPPE segment has zero-value errors, and therefore would not be included in the fit had we left it in the fitting range). We set this as the range of data to be fit by selecting the Define Range option in the Fit window. This prompts us to click on the data display twice, once to define the lower endpoint of the data range, and once for the upper endpoint.

[Iris GUI snapshot]

Defining Model Expressions

We decide to fit our chosen subset of data with a multi-component, 1-D source model consisting of the sum of one polynomial and two Gaussians, to model the observed continuum emission and two emission lines, respectively.

Before defining our model expression, we delete the default power-law component which is automatically added to the list of model components in the Fit window, since we do not wish to include this component in our model expression for fitting (it is not required that we delete this component if we do not wish to fit with it; it may simply be ignored when defining the model expression). Then, we select "Add" to browse the full list of optical and X-ray models available, to find a 1-D polynomial and Gaussian model. From this list, we make three selections: "polynomial1d" once, and "gauss1d" twice, in order to define these as the components with which to build our full model expression. The components will appear with identifiers "c1", "c2", and "c3" in the Fit window.

[Iris GUI snapshot]

Having selected our model components, we combine them into the appropriate arithmetic expression in the "Model Expression" field: "c1+c2+c3"; this is the composite model which will be used to fit our specified data range of the HUT SED of 3c273.

[Iris GUI snapshot]

Setting Model Parameter Values

Next, we set some starting model parameter values for the fit by selecting the desired model component in the Fit window, and then "Edit". Parameter values may be set in the fields of the editing window which opens, by entering the desired number and then selecting "Return" on your computer keyboard.

[Iris GUI snapshot]

For our analysis, we choose to allow all model parameters to vary in the fit except the position (in Angstroms) of the two Gaussian models. Wet set this preference by keeping the "Fit" box checked in the parameter editing window for all model parameters but the 'pos' gauss1d model parameters. Finally, we measure the position (in Angstroms) of each emission line in the Iris main display - aligning the crosshairs of the mouse cursor with the center of each line and reading the associated X-axis value - and set these values in the parameter editing window.


Choosing Fit Statistic and Method

Our final step in the preparation for fitting involves choosing a fit statistic and optimization method appropriate for our analysis. Selecting "Fit" in the Fit window launches a new "Fitted" window containing our statistic and method options.

[Iris GUI snapshot]

We see that the fit can be done with a least-squares statistic, or chi-squared (with various methods for estimating the variances used by chi-squared), or with either of two maximum likelihood statistics that are useful when the data have low numbers of counts. We choose to fit with the Least-squares statistic and an optimization method we know to be very robust, Nelder-Mead.


Fitting

We are now ready to fit the data using our defined data range and model expression, initial model parameters values, and chosen fit statistic and method. Selecing "Start" in the "Fitted" window starts the fitting process.

[Iris GUI snapshot]

When the fit completes, we see the fitted model overlaid on the SED data in the Iris main display; a data-to-model residuals plot in dex units ( log10(data/model)); and the following fit statistics returned in the "Fitted" window: the final fit statistic value, the number of data points used in the fit, and the number of degrees of freedom in the fit (the null hypothesis probability value of the fit, and the reduced statistic, are not calculated with least-squares).

[Iris GUI snapshot]

Changing the statistic to Cash and switching over to the Confidence tab in the "Fitted" window, we enter "1.6" in the "sigma" field and click "Start" to calculate and display the 90% confidence limits on the best-fit model parameter values resulting from the fit.

[Iris GUI snapshot]

Not completely satisfied with this initial fit - as many parameter bounds have been found to lie outside their hard limit boundaries - we adjust the model parameter values to better match the data, thaw the Gaussian position parameters, experiment with different chi-squared fit statistics, and then re-fit. We continue on in this fashion, iterating through the fit - adding or deleting models from the model expression; changing parameter values or ranges; extending or shrinking the fitted data range - until we find a satisfactory model that best describes our 3c273 SED segment. Finally, we opt to write our custom model expression and best-fit parameters to file via the "Save" option in the Iris Fit window, in order to resurrect this particular fit in a future Iris analysis session.


Saving the Session

During a SED analysis session in Iris, it is possible to write to file our SED data arrays, the entire Iris main display, as well as our customized fitting session. These various output files may then be imported back into Iris for future analysis.

Saving SED Data to File

Iris provides many file format options for output, saved SED data; these are: XML (.xml), VOTable (.vot), FITS (.fits), and various image formats (.jpg, .png,. gif,. bmp, .wbmp). To save our 3c273 SED data currently in the Iris main display (excluding model data values) to a FITS format file, for example, we would select the File->Save as FITS menu option, to create file "3c273_hut_wuppe.fits". We can then access our saved SED data in a future session of Iris simply by selecting the File->Read from File option.

When writing output data to a file in Iris, the metadata from the input SED file is copied to the output file. When multiple SED data segments are coplotted in Iris, the output file contains the merged metadata from all input files together.


Saving Fitted Models

Our Iris fitting session may be saved separately by being sure to select the "Save" option in the Iris Fit window after we have finalized our fit, and prior to exiting the fitting session with the "Dismiss" button in the Fit window.

[Iris GUI snapshot]

This is equivalent to selecting the File->Write to file option, which saves the model to a CDB format file which can be read back into Iris at a later time to restore the fitting session; the File->Read from File menu option may be used for this purpose.

We may also use the File -> Write to text file options to save the spectral model to file in a human-readable text format, either all model components, or only those active in the fit. Example output is shown below:

Mon Sep 26 15:05:15 EDT 2011  Iris 1.0

TARGNAME: 3c273

Fit parameters:
        Final fit statistic:      0.0092142304415961159
        Reduced statistic:        nan
        Probability [Q-value]:    nan
        Degrees of freedom:       884.0
        Data points:              889
        Last function evaluation: 613

Component 1: polynomial
       c0     = 0.01804294 (0.009438135 -0.5074261)                       
   F   c1     = 0.0                                                       
   F   c2     = 0.0                                                       
   F   c3     = 0.0                                                       
   F   c4     = 0.0                                                       
   F   c5     = 0.0                                                       
   F   offset = 0.0                                                       

Component 2: gauss1d
       fwhm = 23.697289   (NaN NaN)                                       
   F   pos  = 1408.0                                                      
       ampl = 0.042726856 (NaN -39918.703)                                

Component 3: gauss1d
       fwhm = 28.892221   (NaN NaN)                                       
   F   pos  = 1788.0                                                      
       ampl = 0.016649174 (NaN NaN) 

History

08 Aug 2011 updated for Iris Beta 2.5
26 Sep 2011 updated for Iris 1.0

Return to Threads Page: Top | All | Intro

Last modified: 26 Sept 2011
[CXC logo] [Smithsonian Institute]
[VAO] [NED] [STScI]
[NSF] [NASA] AUI AURA
Copyright 2011-2014 VAO, LCC
Copyright 2015 Smithsonian Astrophysical Observatory