A walk through WFC basic data analysis

Date of latest modification: January 13 2000

Below a simple analysis procedure is given, which can be performed for any WFC data set. It is a UNIX cshell script, which transforms initial Final Observation Tape (FOT) data to final analysis products such as sky images, source listings and spectra.

The underlying software was written in Fortran-77 and ANSI-C by Gerrit Wiersma and Jaap Schuurmans PhD (SRON, Utrecht, The Netherlands) and was designed to run on UNIX workstations. This set of programmes consists of two packages, i.e., StageI for data conversion and correction, and StageII for the final scientific analysis. This software is available from SDC in Rome by anonymous ftp (see WFC installation instructions).

These programmes are currently running at SDC. Most data products - there are some ascii files as well - are FITS (Flexible Image Transport System) files and comply with the FTOOLS(4.0, not 4.2!) standard, so that the output can be analysed further using well-known tools such as SAOIMAGE, XIMAGE and XSPEC.

For further documentation refer to

  • 1. Web pages from SAX SDC, Rome at /bepposax/software

  • 2. Web pages from SRON at http://www.sron.nl

  • 3. The StageI documents in the distribution of the SRON WFC software,
    which are located in the $WFC_TOP/doc directory, and
  • 4. FTOOLS documentation can be obtained from http://heasarc.gsfc.nasa.gov/docs/software/ftools/ftools_menu.html


    The installation of the following packages is assumed:

  • 1. FTOOLS (version 4.0, NOT 4.2!)

  • 2. PGPLOT

  • 3. SLALIB (can be obtained from eg. http://star-www.rl.ac.uk , see WFC software distribution configure file. However, this library is needed only for program cerr (source position check))

  • 4. SAOIMAGE, and

  • 5. SRON WFC StageI and StageII software

  • Script for WFC elementary data analysis

  • 1. Initialise the environment

  • #!/bin/csh -f

    setenv WFC_FOT /your_fot_file_directory
    setenv WFC_FITS /your_fits_file_directory
    source /../.ftools
    source /../winit

  • 2. Set up a dedicated subdirectory for the selected data set

  • mkdir $WFC_FITS/op_$1
    cd $WFC_FITS/op_$1

    and clean up helpfiles from previous analyses, if any

    rm -f $WFC_FITS/op_$1/$1$2files
    rm -f $WFC_FITS/op_$1/$1$2files

  • 3. Only when using data from disk at SDC or Crab testdata:
    Link *.dat files to construct *.fot files.
    (In other cases: skip 3., but add the switch -fot to the w_proc command in 4.)

  • w_vaxlink -prefix OP$1 -obsper $1 -datdir $WFC_FOT/op_$1

  • 4. Perform a preliminary StageI analysis

  • w_proc -t $WFC_FITS/op_$1 -f OP$1 -d $WFC_FITS/op_$1 -fits -plot -noblockio >> logstageI

  • 5. View housekeeping postscript files to determine a filter criterion from the RATE_EVENT ratemeter in the science housekeeping files. W_viewps belongs to the WFC software distribution and relies on PGPLOT (q to continue, p to print)

    w_viewps $1 pplt

  • 6. Edit the filter criterion file to enable the script w_proc to clean the event files, using the switch -clean below

  • vi $WFC_TOP/selsci.fil

  • 7. Filter eventfiles according to the filter criterion in a final StageI analysis.
  • Input/output files are supposed to reside in the directory $WFC_FITS/op_$1 (-d switch)

    w_proc -f $WFC_FITS/op_$1 -clean -t $WFC_FITS/op_$1 -d $WFC_FITS/op_$1

  • 8. Exclude earth occultation from goodtime interval by requiring that the angular distance from the centre of the field of view - earth > 28 degrees. Furthermore, exclude dubious attitude time intervals with star tracker combinations 0, 2 and 7. Merge the resulting file with the existing goodtime intervalfile and replace this gti file with the new one, while conserving the original one.

  • rm -f octemp WOP$1_0000$2.gti_ori

    w_x wmakgti infile='WOP'$1'_0000'$2'att1.fits' outfile=octemp time=TIME
    expr="(G_RIMANG.GT.28) .AND. (STR_CONF.NE.0) .AND. (STR_CONF.NE.2)
    .AND. (STR_CONF.NE.7)"

    w_x wmrggti "ingtis=WOP$1_0000$2.gti,octemp" outgti=$1_$2_noccult.gti "merge=AND" indates="-"

    mv WOP$1_0000$2.gti WOP$1_0000$2.gti_ori
    mv $1_$2_noccult.gti WOP$1_0000$2.gti

  • 9. Build a list containing the names of filtered eventfiles and display these
  • filenames

    find . -name '*prn0.fits'|grep $2 > $WFC_FITS/op_$1/$1$2files
    echo 'Eventfiles to be processed: '
    cat $WFC_FITS/op_$1/$1$2files

  • 10. Create a detector image in four energy bands (2-5, 5-8, 9-18 and
  • 18-23 keV) and display this image using saoimage

    cdi -p -L$1$2stageII.log -e3-12,13-20,21-27,28-30 -g WOP$1_0000$2.gti $WFC_FITS/op_$1/$1$2files WOP$1_$2
    saoimage -fits WOP$1_$2.exp

  • 11. Perform IROS (iterative removal of sources) on the detector image
  • ,
    show the resulting sky image using saoimage, read a summary of the numerical output on screen, write it to file and compare the positions of the detected sources with their catalog positions.

    (N.B. Useful iros switches:
    no x-ray source catalog used so that all detected sources will be regarded as new unknown sources,
    use the standard catalog but also detect unknown sources,
    subtracted sources are shown in the image, default is the residue image which should be blank after a perfect iros run,
    prevent iros from using the attitude file again, which otherwise may result in wrong exposure times and consequently, in wrong fluxes. Now iros will implicitly stick to the good time interval file WOP$1_0000$2.gti which we prepared above)

    iros -p2 -m4 -d1 -b- -L$1$2stageII.log WOP$1_$2.exp WOP$1_$2_iros

    saoimage -fits WOP$1_$2_iros.res
    wshow -p WOP$1_$2_iros.res
    wshow -p WOP$1_$2_iros.res > WOP$1_$2_iros_sourcelist.txt
    cerr -p WOP$1_$2_iros.res

    In case you used iros without -d1 switch, you can create a sky source image from the iros residue image using:

    eci -p WOP$1_$2_iros.res WOP$1_$2_iros.res.sky

  • 12. Calculate a significance sky image by dividing the sky image by its error plane using wopi

    wopi "WOP$1_$2_iros.skysig=WOP$1_$2_iros.res[,,0:1]/ WOP$1_$2_iros.res[,,1:1]"
    saoimage -fits WOP$1_$2_iros.skysig

  • 13. Create spectral output for each source in the four energy bands selected above.

    By manipulating the ascii outputfiles from wspiros (see below) and using the fitstool ascii2pha, you can create fits spectral .pha files. Together with the response matrices for the WFCs this enables you to fit spectra with, e.g., the XSPEC program. Then you have to rebin these matrices with the fitstool rbnrmf to accomodate the four energybands we have chosen in this example.

    Alternatively, you could run iros for each of the energy channels for the WFCs , use w_show to get ascii flux output, manipulate these files, use fitstool ascii2pha and obtain in this way a complete spectrum in 31 channels.

  • w_x wspiros skyfile=WOP$1_$2.res rootname=WOP$1_$2

  • 14. For comparison: perform a simple correlation
  • (no iterative removal of sources) as well, and show the resulting sky image using saoimage

    correlate -p -L$1$2stageII.log WOP$1_$2.exp WOP$1_$2_cor
    saoimage -fits WOP$1_$2_cor.sky

  • 15. Construct a lightcurve for each of the sources listed by iros, requiring timebins of 100 seconds, with MJD time axis

  • lcv -p2 -L$1$2stageII.log -b100 WOP$1_$2_iros.res WOP$1_$2

    lcv2ogip -p -t MJD WOP$1_$2.lcv

  • 16. Ending

  • exit

  • You can now call the above script "wfc_simple" from a UNIX shell

  • wfc_simple OP_number instrument (e.g., wfc_simple 808 w2)

    Back to main WFC software page

    Questions and comments (even complaints) can be addressed to helpdesk@sax.sdc.asi.it

    This page is maintained by Hans Muller (SAX/SDC - SRON)