next up previous contents
Next: Stage-I programs Up: Stage-I scripts Previous: w_plot

w_clean

FUNCTION
	Clean and select from level 0 processed FOT files according
	selection criteria.  The resulting files are level 1 processed 
	fits files and will be of the form Wprefix_*1.fits'.
	Additionally the attitude data is processed and analyzed to
	produce information on camera pointings and earth occultations.  
	Stage-2 processing can take place on level 1 procesing or higher.	
	   Convert to physical values the housekeeping information and 
	make selections for Good Time Intervals (GTIs) based on these 
	values indicating correct instrument behaviour. (program whkproc)
	  Calculate deadtime correction factors from the science rate 
	meters (program whkproc)
	  Make list of detected rate-peaks [under construction still]
	(program whkproc)
	  Make selections for Good Time Intervals (GTIs) based on values 
	that indicating correct instrument behaviour. (program wmakgti)
 	  Clean the event data by filtering out unwanted data like pseudo-
	events, events from IFCs. (program wgtiflt)
	  Analyze the Ephemeris and Attitude date to calculate earth 
	occultation data (program wattproc)
	  Process the attitude data to provide the actual instrument
	pointing information and analyze possible attitude anomalies 
	by establishing Nominal Pointings (program wattana) 
  	  Calculate the gain correction factors per time
	(program wgain)
  

USAGE

	w_clean -f prefix [-specifier [argument]] ..... [-specifier [argument]]

        Where a specifier can be a switch or option followed by an argument. 
	Common practice is taking for the FOTID the Observation Period 
	number preceded by 'OP' 

	Before being able to use the w_proc at least the
	following shell environment variables must be set:
		
		WFC_TOP		e.g. /home/xrayman/wfc
		WFC_ETC		e.g. $WFC_TOP/etc
		WFC_BIN		e.g. $WFC_TOP/bin
		path 		e.g. ( $WFC_ETC $WFC_BIN $path )
		
	As in some instances use is made of ftools utilities 
	also the following environment variable must be set
		
		FTOOLDIR	e.g. /home/library/ftools
			
	To store the parameter files In addition a directory in
	your home directory must exist with the following name:
		
		$HOME/pfiles/release
			
	The names of these directories may be site dependent, 
	so when in doubt ask your local ftools manager.
			
	It is advisable to create a single shell source file
	for setting these variables plus others to be used 
	with stage-2 processing.


DESCRIPTION 
    Of each program a short description plus the dataflow and 
    filenaming is shown

	whkproc:
  	  - reads housekeeping files and discards invalid records
	  - converts temperature monitors to physical values
 	  - converts voltage monitors to physical values
 	  - Does a burstpeak hunt on science ratemeters
 	  - Produces deadtime values per second from science ratemeters

	    *w#@hi0* --->|
	    *w#@hs0* --->|
			 V
		      -------
		      whkproc
		      -------
			 |
			 |---> *w#@hi1* [cleaned + converted Ins-HK data]
			 |---> *w#@hs1* [cleaned Sci-HK data]
			 |---> *w#@dt1* [deadtime data]
			 |---> *w#@pk1* [ratepeak data]
			 -

	wgtiflt:
	  - removes pseudo-events
	  - extracts events belonging to the In-Flight Calibration 
	    sources (IFC) from Normal Mode events.
	  - optionally filters events files according the GTI file

	    *w#@rn0* ------>|
	    *w#@rh0* ------>|
			    V
		         -------
		         wgtiflt
		         -------
			    |
			    |---> *w#@rn1*  [filtered Normal Rate events]
			    |---> *w#@rc1*  [IFC events]
			    |---> *w#@rh1*  [filtered High Rate events]
			    -

	watproc:
	  - Make separate attitude file for each camera
	  - Add Earth Centre in WFC coordinates (x,y,z) and rim_angle
	  - Add observation mode information to attitude data

	    *__att0* --->|
	    *__eph0* --->|
	    *__obs0* --->|
			 V
		      -------
		      watproc
		      -------
			 |
			 |---> *w1att1*  [augmented attitude data]
			 |---> *w2att1*  [augmented attitude data]
			 -

	wattana:
	  - Analyzes one or more attitude files
	  - Produce one list of nominal-pointing sets (NP) from actual 
	    pointings

	    *w#att1* --->|
			 V
		      -------
		      wattana
		      --------
			 |
			 |---> *__pnt1*  [pointings table]
			 -

	wgain:
	  - Compute

	    *w#@rc1* --->|
	    *w#@rn1.gti->|
			 V
		      -------
		      watproc
		      -------
			 |
			 |---> *w#@gn2*  [augmented attitude data]
			 -


		 
		
OPTION SPECIFIERS
  
    The order of actions or options is not fixed.  An option can 
    be either a switch or a keyword followed by one or more arguments.
    At least one of the following actions must be selected:  
		 
 
-h	
	Display a concise help on the available switches and recognized
	environment settings.  It will not show the switches of possible 
	subsequently invoked scripts however.

-f [string]
	The argument specifies the FOT identifier.  TFor resulting files
	this will become the prefix of all names.  Only when processing 
	directly from tape with the '-fot' action can this switch be omitted,  
	in which case the FOTID is taken from the FOT directory.  But also
	in this case it will be overruled by giving the -f FOT_ID switch.
	
-or [string]
	Set the root prefix of the output files.  By default it is
	the same is that of the input: FOTIF ade preceeded by the
	character 'W" and followed by an underscoore '_'
	NOT ISED WITH STANDRD PRACTICES
	
-t [string]
	Specify (top-)directory where input (link)files are located.
	By default the current directory is taken.  This default
	can be overruled by setting environment variable $WFC_OBS
 	  Only in case of '-fot' action this will be the destination 
	directory where the FOT files from tape will be placed to be 
	used as input for level 0 (-fits) processing.
	It will overrle the value of enveironment variable FOT_TOP.
	
-d [string]
	Force result files under destination top-dir.
	By default this will be the input directory.
	Already existing result files will be overwritten.

-vv [integer]
	Argument value regulates the output verbosity volume.  When 0 a 
	minimal (silent) output will occur.  The default is 1 where it 
	will show the programs that were active and some info on files 
	produced.  A larger value will produce more diagnostic info.
	This switch will be passed on to subsequently invoked scripts.
	
-w1
-w2
	Only process the data of one (-w1 or -w2) camera.

-save
	Option to save all inetermadeiate resultfiles.  By default
	thses files like most zere level (*0.fits) files will be
	discarded.
	
-n  [integer]
-n1 [integer]
-n2 [integer]
	Indicates the number (-n) or number range (-n1 and -n2) 
	of observations to be processed.  By default n1 = 1 and 
	n2 = 999.

-c1 [string]
-c2 [string]
        The name of the input FITS file that contains the 
	coefficients to calculate the physical values of 
	temperatures and voltages from digitally coded 
	analog value.   By default they are $WFC_CAL/wfc1.det
	and $WFC_CAL/wfc1.det respectively.  The defaults can
	be fixed by setting environment variables W_INSCAL1
	and W_INSCAL2 respectively.

-blockio
	Allow writing and reading data files in fast block I/O.  
	This may introduce a non-standerd FITS format that cannot
	be used across different computer systems and will not work 
	with systems using VAX byte order.  Presently by default 
	the blockio option is disabled for OSF1 unix systems and 
	enabled for all other systems like HPUX.

-swap
-noswap
	Specify whether the data is organized according to VAX
	definition and bytes of words and double-words must be
	swapped.  This will be normally the case if FOT's were
	produced by the Science Data Centre.
	Presently by default the swap option is disabled for OSF1 
	unix systems and enabled for all other systems like HPUX.
  
-fi [string]
	Name of the file containing expression for making the
	Good Times Intervals from each Instrument Housekeeping file
	It overrules the default file $WFC_ETC/etc/wfc_sel_ins or an
	alternative file prescribed in setting environment variable 
	W_SELINS.
		
-fs [string]
	Name of the file containing expression for making the
	Good Times Intervals from each Science Housekeeping file
	It overrules the default file $WFC_ETC/etc/wfc_sel_sci or an
	alternative file prescribed in setting environment variable 
	W_SELSCI.

-fe [string]
	Name of the file containing expression for making the
	Good Times Intervals from the Ephemeris file.
	It overrules the default file $WFC_ETC/etc/wfc_sel_eph or an
	alternative file prescribed in setting environment variable 
	W_SELEPH.

-gainbin [real]
	Specifies the timebin in seconds for which each gain value
	has to be computed.
	 
-slew
	Option to process also slew data

-filtonly
	Option to filter only and skip attitude analysing and gain
	calculations


RECOGNIZED ENVIRONMENT VARIABLES
  
    In addition default values for switches and installed settings 
    can be overruled by the following  shell environment variables.

	WFC_TOP The top directory of the WFC software distribution 
		No default as it is site dependent
 
	WFC_ETC Place where scripts and general selection files are located
		if not present default to $WFC_TOP/etc

	WFC_BIN Place where the program executable binaries are located 
		if not present default to $WFC_TOP/bin

	WFC_CAL Place where calibration and instrument definition files.
		if not present default to $WFC_TOP/cal
		(see also switches '-c1' and '-c2')
		
	WFC_FITSORIG  String to be used for the ORIGIN keyword in produced
		Fitsfiles (default: `hostname` )
		
	FOT_TOP	The directory where the FOT files are resided.
		This is the input directory for all actions except for  
		the '-fot' option where it will be the directory in 
		which the FOT files are loaded. (default: `pwd` )
  
	W_INSCAL1
		if not present default to $WFC_CAL/wfc1.det
		(see also switch '-c1')
		
	W_INSCAL2
		if not present default to $WFC_CAL/wfc2.det 
		(see also switch '-c2')
		
	W_EPHFILE
		if not present default to "-"
		(see also switch '-eph')
		
	W_ATTFILE
		if not present default to "-"
		(see also switch '-att')
		
	W_OBTFILE
		if not present default to "-"
		(see also switch '-obt')

	W_SELEPH 
		if not present default to $WFC_ETC/wfc_sel_eph
		(see also switch '-fe')
		
	W_SELINS 
		if not present default to $WFC_ETC/wfc_sel_ins
		(see also switch '-fi')
		
	W_SELSCI 
		if not present default to $WFC_ETC/wfc_sel_sci
		(see also switch '-fs')
		
	PLT_MET1  Meter name of upper graph to be plotted
		if not present default to RATE_EVENT
		
	PLT_MET2  Meter name of middle graph to be plotted
		if not present default to RATE_PROC
		
	PLT_MET3  Meter name of lower graph to be plotted
		if not present default to RATE_GUARD 

	
EXAMPLES:

Process a complete FIT with standard options, put resulting  files in
the current directory and save the commentary output in a logfile:

  >  w_clean -f OP1234 -t /FITSDIR > logfile

To re-process all observation of camera 2 only and store the results 
in a different destination directory and save original data for
a future rerun:

  >  setenv W_SELSCI user_sel_sci
  >  w_clean  -f OP1234 -w2 -filtonly -save -t FITSDIR -d /DESTDIR
  
	or alternatively

  >  w_clean  -f OP1234 -w2 -fs user_sel_sci -filtonly -save -t FITSDIR -d /DESTDIR


NOTES
  
    - The destination directory will be created if not present.
	  
    - The detector calibration files are created during
      the installment of Stage-2 software package.
      
    - For each observation a separate GTI file is produced.  
      All these GTI files are per camera accumulatively merged into
      one GTI file for a complete observation
	  

SEE ALSO
	w_proc, whkproc, watproc, wattana, wmakgti, wmrggti, wgtiflt, wgain



Mark Savenije
Sat Jan 18 15:04:49 MET 1997