[Last Change: 15 Feb 2012 (rev 3)]

load_sources

The load_sources function reads an XML formatted file containing source definitions and creates sources based on those definitions.

Usage and Arguments

It is invoked as

load_sources( filename, options )

where filename is an XML file (structure described below) which must have an extension of .xml, and options is a table which may contain the following fields:

name type description default
ra_aimpt angle (default units of degrees) or sexigesimal R.A. of the telescope pointing. Required only if source positions are given in celestial coordinates.  
dec_aimpt angle (default units of degrees) or sexigesimal Declination of the telescope pointing. Required only if source positions are given in celestial coordinates.  

XML File Format

The XML file must contain a single sources element.

sources

The sources element must contain one or more source elements

source

source elements define an individual source. They have
  • an optional name attribute (a string identifying the source)
  • a single extent element
  • an optional position element
  • one or more spectrum elements

extent

extent elements define the physical extent of a source. They have
  • a required type attribute, which may have one of the following values:
  • attributes corresponding to the parameters of the extent function given by the type attribute.
Do not include the position and spectrum parameters as attributes to the extent element. They are elements on their own.

For example,
<extent type="disk" radius="5 arcseconds" />

Notice that unit specifications are included directly in the value. Extent function parameters which take a table are encoded as nested elements:
<extent type="image" file="ell.fits">
  <pixsz x="0.1 arcseconds" y="0.2 arcseconds" />
</extent>

position

position elements define the position of the source and have attributes corresponding to the source specification parameters:
<position theta="20 arcseconds" phi="22 degrees" />

Do not include the ra_aimpt and dec_aimpt parameters for positions in celestial coordinates; those belong in the options table argument to the call to load_sources().

spectrum

spectrum elements define a spectrum for a source. Sources may have more than one spectrum. A spectrum element has

  • a required type attribute, which may have one of the following values:
  • attributes corresponding to the parameters of the spectrum function given by the type attribute.
For example,
<spectrum type="file" scale="0.058685667" format="rdb" file="spec_6.80.rdb" units="photons/s/cm2" />
<spectrum type="mono" energy="1.49" flux="22" />

Example

Here are the source descriptions:

<sources>
  <source type="point" name="noID_000">
    <position dec="-60:36:06.34" ra="7:58:05.584" />
    <spectrum type="file" scale="0.058125971" format="rdb" file="spec_6.80.rdb" units="photons/s/cm2" />
  </source>
  <source  name="noID_001">
    <extent type="disk" radius="5 arcseconds" />
    <position dec="-60:38:51.66" ra="7:58:50.661" />
    <spectrum type="file" scale="0.014434566" format="rdb" file="spec_6.80.rdb" units="photons/s/cm2" />
  </source>
  <source  name="noID_002">
    <extent type="rect" >
     <height>2 arcseconds</height>
     <width>5 arcseconds</width>
    </extent>
    <position dec="-60:51:44.53" ra="7:56:22.778" />
    <spectrum type="file" scale="0.0041246292" format="rdb" file="spec_6.80.rdb" units="photons/s/cm2" />
  </source>
  <source name="noID_003">
    <extent type="image" file="ell.fits">
      <point_idx x="1" y="1" />
      <pixsz x="0.1 arcseconds" y="0.2 arcseconds" />
    </extent>
    <position dec="-60:44:38.03" ra="7:58:32.833" />
    <spectrum type="file" scale="0.058685667" format="rdb" file="spec_6.80.rdb" units="photons/s/cm2" />
  </source>
</sources>

And here's how to load that file:
load_sources( 'sources.xml', { ra_aimpt = "7:58:31.521", dec_aimpt = "-60:46:05.79" } )
If the source positions were in Mirror Spherical Coordinates the aimpoint would not need to be specified.
 
This page is maintained by the CXC Optics Group
CXC logo

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email: cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2013. All rights reserved.