[CXC logo]
Skip to the navigation links
Last modified: 11 July 2012

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

Analyzing SED Data in Iris

Iris Threads


Overview

Synopsis:

In this thread we step through an example Iris session in which a Spectral Energy Distribution (SED) of object 3c273 is analyzed, 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: 11 Jul 2012 - updated for Iris 1.1


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 from your local disk into Iris, or import SED data directly from the photometry archives of the NASA Extragalactic Database (NED). 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

An SED data file for an object of interest can be loaded into Iris simply by starting the application and selecting the Load File icon on the Iris dekstop. If the file comes in a format which is not natively supported by Iris - so, neither of IVOA-compliant FITS or VOTable, or the XML/CSV format of files downloaded from NED - then it must first be converted to a supported format in the SED Builder interface before it can be displayed in the Iris Visualizer.

The SED Builder 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. You can learn more about the file formats recognized by the SED Builder on the Iris Supported File Formats page, and refer to the Building and Managing SEDs section of the Iris How-to Guide to learn how to use the SED Builder to convert data for display in Iris.

In this thread 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. The first column in each file contains wavelength values in Angstrom units, and the second column the flux density values in ergs/s/cm2/Angstrom.


Importing SED Data from NED

As an alternative to loading data from file on disk, we could choose to import SED data directly from NED via the Get an SED from the NED Service option in the Iris Load File window. This feature allows you to search the NED photometry database by object name and/or position, to return the available SED data for that object.

For example, to access SED data for object 3c273 using this option, we would enter the identifier "3c273" in the Target Name field, and then click Import NED SED to automatically display the SED available for this object in the Iris Visualizer.

[Iris GUI snapshot]

Converting SED Data to a Supported Format

Since we would like to analyze in Iris two photometric data segments which we have stored in a format not natively supported by Iris (ASCII table), we must enter the conversion configuration for the files into the Iris SED Builder interface after loading them into the application, before they may be displayed in the Iris Visualizer for analysis. This involves starting Iris and loading the ASCII data files into the tool; entering various pieces of information about the file format so that the tool can convert from the unsupported to a supported format; and then saving the converted data as new SED segments in the SED Builder, where they may also be saved to file. The individual converted segments may be saved to separate files, or you may build an aggregate SED from the multiple converted segments and save to one file.

We begin by launching Iris from the Unix command line:

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

Next, we upload the file 3c273.hut.ascii into the tool by clicking the "Load File" icon on the Iris desktop, browsing our local disk for the file, selecting "ASCII Table" from the menu of file format options, and then clicking "Load Spectrum/SED".

[Iris GUI snapshot]

Since the input file is in ASCII format, instead of being automatically diplayed in the Iris Visualizer at this point, we are brought to the Import Setup Frame window of the SED Builder in order 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 "Building and Managing SEDs" section of the Iris How-to Guide for details and instruction.)

[Iris GUI snapshot]

Here, we have 'told' Iris that the first column in our input data file corresponds to the spectral coordinate axis and contains wavelength values in Angstrom units; and likewise, that the second column contains flux density values in ergs/s/cm2/Angstrom units. Finally, we specify that the errors on the flux density values are contained in the third column of our input file (as opposed to being unknown, or of a constant value).

Before selecting the "Add Segment to SED" option - in order to be brought back to the SED Builder window where we may manage (and save to file) our converted data - 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.

% 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.hut.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

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 ASCII table 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 ASCII conversion configuration, we may now display the converted SED in the Iris Visualizer, as well as save it to a file in the SED Builder. We do this by selecting "Add Segment to SED" in the setup window (at which point the converted SED will appear in the SED Builder window and Iris main display), and then clicking "Save" at the top of 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 Builder interactive session, we may now run the tool non-interactively from the Unix command line in order to convert our second ASCII 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, as well as the 'errorType' and 'symmetricErrorColumnNumber' fields to reflect the Y-error configuration for the file we are converting. The new values for these fields are shown below.

fileLocation = file:/home/user/science/3c273.wuppe.ascii
errorType = Unknown
symmetricErrorColumnNumber = 0     

The changes to the Y-error fields are necessary because the file used to create the setup in the GUI, 3c273.hut.ascii, contains a column of Y errors, whereas the file we are converting on the command line, 3c273.wuppe.ascii, does not. The edited setup file for converting 3c273.wuppe.ascii to a VOTable format file, is shown below.

% 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

Finally, 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 the format to use for the output file:

% <basedir>/iris-1.1-<plat>-<arch>/Iris builder ascii_setup.ini 3c273.wuppe.vot vot

Building segments...


Building SED...

Writing SED to /home/nina/science/3c273.wuppe.vot...

DONE.

We now have two IVOA-compliant, VOTable format files containing ultraviolet photometric data for source 3c273, which we may use to upload the data into Iris, bypassing the conversion configuration step outlined above. The second data segment, contained in newly crated file 3c273.wuppe.vot in the supported VOTable format, may be loaded into Iris via the "Segments -> Load File" option in the SED Builder window and automatically displayed.


Visualizing SED Data

The Iris Visualizer is an adaptation of the Specview spectral visualization and analysis GUI, and as a result offers several of the data display preferences of Specview. Multiple SED data segments or photometric points may be plotted simultaneously in the Iris main display, tables of metadata and data arrays may be accessed and filtered, and the attributes of several components of the display may be customized to suit your preferences.

Plotting Multi-segment SEDs

In order to view both of the SED data segments of 3c273 simultaneously in the Iris display, we simply load and configure both segments in the SED Builder, as outlined above; multiple segments of an aggregate SED (those listed in the "Segments" field of the SED Builder) always display together.

[Iris GUI snapshot]

Separate SEDs may also be maintained in a given Iris session, where only one is displayed at a time, by loading each new SED via the the "New" button at the top of the SED Builder window, as opposed to adding new segments in the "Segments" area (see the "Building and Managing SEDs" section of the Iris How-to Guide for details).

It is important to note that when multiple SED data segments are plotted together, the spectral data from each segment is not combined, coadded, or spliced in memory in any way. The raw data from the multiple input spectra is completely preserved in the resulting combination, which is why the two spectra of 3c273 shown 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

Clicking the "Metadata" button in the upper-right corner of the Iris display opens a window containing two separate tabs of information, one displaying the metadata associated with each SED data point in the plot, and the second the independent and dependent data arrays defining the plot.

[Iris GUI snapshot] [Iris      GUI snapshot]

When available, the Metadata tab includes many useful pieces of information about the data points currently displayed. When a SED is imported from NED, for example, the metadata includes such things as the bibliographic reference code for each data point, the spectral range covered by instrument used to obtain data point, data point uncertainty and flux values as they are published, data point significance values, among others (find the full list of metadata items returned in the "Visualizing SED Data" section of the Iris How-to Guide). For our input data, only the data point ID is returned since our data files were loaded without associated metadata.

The Data tab shows the X (Spectral Axis) and Y (Flux Axis)coordinate values of each SED data point in the Iris display, reflecting the values as they were imported into Iris from NED or uploaded from a file on your hard disk - not what is currently plotted in the Iris display (in the event that you changed the units of the data plot within the display). For example, if the data were uploaded in Jansky flux units versus frequency in Hertz, but then you change the display units to ergs/s/cm2/Angstrom versus Angstrom, the data point values returned will be in Jansky flux units and Hertz.


Filtering SED Data

The Metadata function in the Iris main display also allows us to filter the current SED so that selected (or unselected) points appear suppressed or 'grayed out'. This can be done by selecting the rows corresponding to these points in the Metadata tab, and then clicking "View un-selected" at the bottom of that window. In the display, the points selected in the Metadata window will appear fainter than the unselected points.

[Iris GUI snapshot]

Here, we have truncated one of our data segments by suppressing the data points at one end, using this option.

Selected data points may even be extracted into a whole new SED by clicking "Extract" after making the desired row selections in the Metadata window. This will open a new SED in the SED Builder window named "FilterSED" - an ID which you can change - which will display in the Iris Visualizer.

[Iris GUI snapshot]

Modeling and Fitting SED Data

Having loaded our desired 3c273 SED data and set our data display preferences, 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 "Fitting Tool" icon on the Iris desktop.

[Iris GUI snapshot]

The Iris Fitting Tool 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 release of Iris, it is not possible to edit SED data for the fitting process, e.g., to mask any data points which have been flagged as 'bad' and have them left out of the fit; 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


New in Iris v1.1: the new Custom Model Manager interface allows you to import into Iris your custom table, template, and Python user models, for use with the Iris Fitting Tool. Refer to the "Modeling and Fitting SED Data" section of the Iris How-to Guide to learn how to load your own models into Iris and use them to fit SED data in Iris.

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 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. Selecting "Start" in the window displaying the fit statistics, initiates 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: 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 window displaying fit statistics, 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 the SED data arrays, as well as the customized fitting session. These output files may then be imported back into Iris for future analysis.

Saving SED Data to File

The SED data open in an Iris session may be written to one or multiple FITS (.fits) or VOTable (.vot) format files (you can save each segment to a separate file, or save the multi-segment SED to one file). For example, to save our 3c273 multi-segment SED to a FITS format file, excluding model data values, we would select the "Save" option at the top of the Iris SED Builder window, to create file 3c273_hut_wuppe.fits. We could then access our saved SED data in a future session of Iris simply by selecting the "Load File" icon on the Iris desktop, and browsing our disk for file 3c273_hut_wuppe.fits.

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:

File: Sed0

Thu Jul 12 23:30:18 EDT 2012  Iris 1.1 

TARGNAME: 3c273

Fit parameters:
        Final fit statistic:      0.0090508836113682416
        Reduced statistic:        nan
        Probability [Q-value]:    nan
        Degrees of freedom:       904.0
        Data points:              911
        Last function evaluation: 648

Component 1: polynomial
       c0     = 0.018123535                                               
   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.508135                                                   
       pos  = 1407.886                                                    
       ampl = 0.04278606                                                  

Component 3: gauss1d
       fwhm = 27.478205   
       pos  = 1790.7229                                                   
       ampl = 0.017182805 



History

08 Aug 2011 updated for Iris Beta 2.5
26 Sep 2011 updated for Iris 1.0
11 Jul 2012 updated for Iris 1.1

Return to Threads Page: Top | All | Intro

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