Before fitting, you must prepare your observation data in a way
that the program can understand. This involves generating a
.yobs
file which contains spectral information about
one or more sources. Typically this will consist of photometric
observations at a number of pass bands for each of several sources
of interest. Currently the tableobs
task is provided
to convert observations in a table for which each column represents
observations in a given pass band to a .yobs
file.
Suppose that you have photometric observations in a table as follows:
# RA DEC PHOTOZ J J_ERR H H_ERR K K_ERR 119.608 21.410 2.52 11.94 0.022 12.16 0.024 12.57 0.018 53.094 -27.839 3.05 12.33 0.022 12.34 0.026 12.67 0.020 213.870 -46.515 1.65 17.32 0.106 17.57 0.192 17.49 0.176 204.143 -29.089 0.50 15.93 0.041 16.29 0.071 16.48 0.073This represents observations of four objects in each of three photometric bands (J, H and K). The fluxes are here represented as magnitude values, and the flux at each of the bands has an associated error value. The fitting program must identify each of these bands with a region of the model spectrum and determine how close the observation is to the model flux in that region to see how well the observation fits the model. The flux error in each case provides a measure of how large deviations are to be tolerated. An additional column (PHOTOZ) gives the known redshift for each object and the sky position is given by the RA and DEC columns.
The tableobs
task can be used to generate an
observation file from this table, by specifying
which columns give flux values and flux errors for each band pass.
You can also provide expressions which perform numeric value transformations
such as unit conversions if required;
recall that the X (wavelength) and Y (flux)
values in your observation file must be compatible with those you
supply in your model file before the fitting is performed.
To define which columns correspond to which band passes in the table, you must prepare a key file, which lists the flux value and error columns corresponding to each band pass given in the table. For the table above, this file would look something like the following:
# yColName yerrColName x xWidth J J_ERR 12400 5000 H H_ERR 16600 4000 K K_ERR 21600 6000The format of this file is a four-column ASCII table - the column names (and any other lines starting with a '#' character) are ignored. Each line of it must contain four entries in order:
When you run tableobs
you can also specify information about
how the X and Y values should be written out. You can label their
names and units and give an expression for how to calculate them from
the values in the input table. Note the names and units you give are only
annotations and will not cause any conversions to take place apart from
those you specify by providing the expressions. Nevertheless it is
a good idea to provide these in order to document your data files.
You may well wish to convert the X and Y values to more suitable quantities,
since they must be in a form which can be meaningfully fitted against
the model data to be provided. For instance in the above case, you
will probably want to convert the Y values from magnitudes to fluxes.
A flexible expression language, described in Section 6,
is available to perform these conversions;
you will mostly use a few functions such as abToJansky
.
Finally, you can specify redshift value if the input table contains one. This may be necessary to determine how model spectra are to be shifted along the X axis prior to attempting a fit.
Here is an example of a tableobs
command to prepare
a .yobs
file from the input table above.
yafit tableobs in=demo.txt ifmt=ascii key=jhk.key redshift=PHOTOZ xname=Wavelength xunit=Angstrom x=x yname=Flux yunit=Jansky y='abToJansky(y)' out=demo.yobsIn detail, this works as follows:
in=demo.txt ifmt=ascii
key=jhk.key
redshift=PHOTOZ
xname=Wavelength xunit=Angstrom x=x
x=x
is optional, but it means that the
output X values will be equal to those supplied in the .key file.
You could change the units here by writing, for instance,
"xunit=micron x=x*1e-4
".
The X widths are automatically adjusted to the same scale as the
X values (using numerical differentiation).
yname=Flux yunit=Jansky y='abToJansky(y)'
abToJansky()
" function, which converts
from AB magnitudes to Jansky.
The Y errors are automatically adjusted to the same scale as the Y
values (using numerical differentiation).
out=demo.yobs
tableobs
task is given in
Appendix A.6.
Having prepared your .yobs file, you can view it using the
plotobs
command if you wish
before using it for actual fitting.