Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • This is a presentation of the code for the code review (MIND: slide 7 and 8 are OUTDATED!)
  • Description of the old code (here)
  • ft2Util_2 in cvs (here)
  • Expected accuracy for position interpolation precision (here)

Why a new code

The old code (ft2Util), written by Andrea Tramacere, has performed very well during the first 3 years of the mission. But it has been patched a lot of times under the pressure of time, and it is now quite difficult to understand and to maintain. Thus we decided to rewrite it, taking into account all the things we learned during these 3 years.

...

Code Block
#This file contains the configuration for the ft2Util_2 package            
#Every line beginning with "#" is a comment.                               
#Every blank line is ignored                                               

#Package info

packageVersion             = v0r0p0
packageName                = ft2Util_2
packageAuthor              = G.Vianello
packageAuthorEmail         = giacomov@slac.stanford.edu

#The Julian date of the start of the mission
JulianDateMissionStart     = 211845067200.0 

#If the difference between two time stamps is less than NULL_TIME_DIFFERENCE
#the two time stamps are considered to be the same (in MET, that is, in seconds)
NULL_TIME_DIFFERENCE       = 1E-6                                               

#This is the number of ticks occurring between the closing of the window
#for physics events and the issue of the sweep event, at the end of a run
sweepEventsDelayEnd        = 20000                                       

#This is the number of ticks needed to complete a single command in the
#flight software                                                       
ticksPerCommand            = 196                                       

#This is the roll over number for the onboard clock
RollOver                   = 33554432.0            

#This is the nominal conversion factor from ticks to second for the 
#onboard clock                                                      
nominalTicksToSecond       = 5E-8                                   

#The following three numbers are the angles (in arcsec) for the default boresight                                                                                 
#correction, which is the rotation which translates the spacecraft pointing into 
#the LAT pointing                                                                
Rx                         = -170
Ry                         = -173
Rz                         = -491

#When the Magic 7 file covers more than the time requested in the command line,
#all the messages referring to more than magic7ReadPadding seconds
#before and after the requested interval will be ignored. The others are kept
#to allow a safe extrapolation for the position and attitude, if needed.
magic7ReadPadding          = 30

#This flag enable/disable the check for gaps in the Digi and Merit files
#(turn this to "no" to speed up the process, if you already know the files are ok.
#You can also use a command line option to do this)
verify                     = yes

#When there is one or more missing events either in the Digi either in the Merit,
#the code produces a bad time interval going from t1+deadPad to t2-deadPad,
#where t1 and t2 are respectively the time stamp of the event before the gap
#and the time stamp of the event after the gap. So deadPad is a padding to avoid
#the loosing of the events before and after the gap because of the GTI filtering
#(in micro seconds)
deadPad                    =  1

Interpolation and extrapolation

The Magic 7 file can sometimes contain gaps, that is, time interval inside a run where no position or attitude information are available. In this case the code will interpolate (or extrapolate, if the gaps are at the beginning or at the end of a run) the known information. The attitude interpolation/extrapolation is obtained by performing a SLERP between the closest known quaternion, which basically means to assume a constant rotational velocity for the spacecraft between the two known attitudes. Regarding the position, the interpolation are performed using the same algorithm already implemented in gtbary (you can find a description here). Position extrapolation is instead performing by fitting the closest known position before and after the gap with a quadratic polynomial, and using the fit to extrapolate forward or backward. Mind that the extrapolation should be very rare, since the Magic 7 file usually covers much more than the run interval.

How to use

Code Block
makeFT2.exe

makeFT2.exe : produce the FT2 file for the Fermi mission.

(See http://fermi.gsfc.nasa.gov/ssc/data/analysis/documentation/Cicerone/Cicerone_Data/LAT_Data_Columns.html#SpacecraftFile)                                      

Usage: 

-Produce the 'fake' FT2 file (without livetime):

makeFT2.exe -ft2start [start time] -ft2stop [stop time]
            -m7file [Magic 7 file] -ft2file [output FT2 file]
            [-clobber ['yes' or 'no'] ]                      

-Produce a regular FT2 file (with livetime):

makeFT2.exe -ft2start [start time] -ft2stop [stop time]
            -m7file [Magic 7 file] -ft2file [output FT2 file]
            -digifile [Digi file] -meritfile [Merit file]    
            -gapfile [Digi gap file]
            [-clobber ['yes' or 'no'] -verify ['yes' or 'no']
             -dataquality [DQ flag] -latconfig [LAT config value]
             -templateFT2 [FT2 template] -version [version number] ]

Parameters:

 -ft2start         Start time for the output FT2 file (MET)
 -ft2stop          Stop time for the output FT2 file (MET)
 -m7file           Input Magic 7 file
 -ft2file          Name for the output FT2 file
 -digifile         Input Digi file
 -meritfile        Input Merit file
 -gapfile          Input Digi gap file
 -clobber          (yes|no) Overwrite an existing output? (default = no)
 -dataquality      Data Quality flag to set (default = 2)
 -latconfig        LAT configuration status (default = 1)
 -templateFT2      Override the default template file for the output FT2
 -version          Version number for the file (integer,default=1)
 -configFile       User-provided configuration file path
 -verify           (yes|no) Verify Merit and Digi for gaps (default=yes)
 -help             Prints this help

...