next up previous contents
Next: tcloutr Up: Control Commands Previous: syscall

tclout: create tcl variables from current state

Write internal xspec data to a tcl variable. This facility allows the manipulation of xspec data by tcl scripts, so that one can, for example, extract data from xspec runs and store in output files, format xspec output data as desired, use independent plotting software, etc.

Syntax:        tclout <option> [<par1>] [<par2>] [<par3>]>

tclout creates the tcl variable $xspec_tclout, which can then of course be set to any named variable. The allowed values of <option> are :

?

Show the valid options. Does not set $xspec_tclout.

areascal n <s|b>

Writes a string of blank separated values giving the AREASCAL values for spectrum n.  If no second argument is given or it is “s” then the values are from the source file, if “b” from the background file.

arf n

The auxiliary response filename(s) for spectrum n.

backgrnd n

Background filename for spectrum n

backscal n <s|b>

Same as areascal option but for BACKSCAL value.

chatter

Current xspec chatter level.

compinfo [<mod>:]n [<groupn>]

Name, 1st parameter number and number of parameters of model component n, belonging to model w/ optional name <mod> and optional datagroup <groupn>.

cosmo

Writes a blank separated string containing the Hubble constant (H0), the deceleration parameter (q0), and the cosmological constant (Lambda0).  Note that if Lambda0 is non-zero the Universe is assumed to be flat and the value of q0 should be ignored.

covariance [m, n]

Element (m,n) from the covariance matrix of the most recent fit.  If no indices are specified, then entire covariance matrix is retrieved.

datagrp [n]

Data group number for spectrum n.  If no n is given, outputs the total number of data groups.

datasets

Number of datasets.

dof

Degrees of freedom in fit, and the number of channels.

energies [n]

Writes a string of blank separated values giving the energies for spectrum n on which the model is calculated.  If n is not specified or is 0, it will output the energies of the default dummy response matrix.

eqwidth n

Last equivalent width calculated for spectrum n.

error [<mod>:]n

Writes last confidence region calculated for parameter n of model with optional name <mod>, and a string listing any errors that occurred during the calculation.  The string comprises nine letters, the letter is T or F depending on whether or not an error occurred.  The 9 possible errors are:

1.  new minimum found

2.  non-monotonicity detected

3.  minimization may have run into problem

4.  hit hard lower limit

5.  hit hard upper limit

6.  parameter was frozen

7.  search failed in –ve direction

8.  search failed in +ve direction

9.  reduced chi-squared too high

expos n <s|b>

Same as areascal option but for EXPOSURE value.

filename n

Filename corresponding to spectrum n.

flux [n]

Last model flux or luminosity calculated for spectrum n.  Writes a string of 6 values: val errLow errHigh (in ergs/cm2) val errLow errHigh (in photons).  Error values are .0 if flux was not run with “err” option.

ftest

The result of the last ftest command.

idline e d

Possible line IDs within the range [e-d, e+d].

lumin [n]

Last model luminosity calculated for spectrum n.  Same output format as flux option.

model

Description of current model(s).

modcomp [<mod>]

Number of components in model (with optional model name).

modpar [<mod>]

Number of model parameters (with optional model name).

modval [<specNum>[<mod]]

Write to Tcl the last calculated model values for the specified spectrum and optional model name.  Writes a string of blank separated numbers.  Note that the output is in units of photons/cm^2/s/bin.

noticed [<n>]

Range (low,high) of noticed channels for spectrum n.

noticed energy [<n>]

The noticed energies for spectrum n.

param [<mod>:]n

(value,delta,min,low,high,max) for model parameter n.

peakrsid n [lo, hi]

Energies and strengths of the peak residuals (+ve and –ve) for the spectrum n. Optional arguments lo, hi specify an energy range in which to search.

pinfo [<mod>:]n

Parameter name and unit for parameter n of model with optional name.

plink [<mod>:]n

Information on parameter linking for parameter n. This is in the form true/false (T or F) for linked/not linked, followed by the multiplicative factor and additive constants if linked.

plot <option> <array>     [<plot group n>]

Write a string of blank separated values for the array.  <option> is one of the valid arguments for the plot or iplot commands.  <array> is one of x, xerr, y, yerr, or model.  xerr and yerr output the 1-sigma error bars generated for plots with errors.  The model array is for the convolved model in data and ldata plots.  For contour plots this command just dumps the steppar results.  The command does not work for genetic plot options.

plotgrp

Number of plot groups.

query

The setting of the query option.

rate <n | all>

Count rate, uncertainty and the model rate for the specified spectrum n, or for the sum over all spectra.

response n

Response filename(s) for the spectrum n.

simpars

Creates a list of parameter values by drawing from a multivariate Normal distribution based on the covariance matrix from the last fit.  This is the same mechanism that is used to get the errors on fluxes and luminosities, and to run the goodness command.

solab

Solar abundance table values.

stat

Value of statistic.

statmethod

The name of the stat method currently in use.

steppar  statistic|[<modName>:]<parNum>

Steppar statistic returns the statistics column from the most recent steppar run.  Otherwise, the parameter column indicated by <parNum> is returned.  Note that for multi-dimensional steppars the returned parameter column will contain duplicate values, in the same order as they originally appeared on the screen during the steppar run.

varpar

Number of variable fit parameters.

weight

Name of the current weighting function.

xflt n

XFLT#### keywords for spectrum n.

Examples:

 

XSPEC12>data file1

XSPEC12> model pha(po)

...

XSPEC12> fit

...

XSPEC12>tclout stat

XSPEC12>scan $xspec_tclout “%f” chistat

XSPEC12>tclout param 1

XSPEC12>scan $xspec_tclout “%f”par2

XSPEC12>tclout param 2

XSPEC12>scan $xspec_tclout “%f”par3

XSPEC12>tclout param 3

 

In this example, scan is a tcl command that does a formatted read of the variable $xspec_tclout. It reads the first floating point number into the variable given by the last argument on the line.This sequence creates a simple model, fits it, and then writes thechi_square statistic and the three parameters to tcl variables $chistat, $par1, $par2, and $par3. These can now be manipulated in any way permitted by tcl.


 

next up previous contents
Next: tcloutr Up: Control Commands Previous: syscall