set the following env variables depending on the SHELL you are using, for instance in .bashrc or .tcshrc
ROOTSYS: /swdev_nfs/root_v5.28.00
PATH: add $ROOTSYS/bin
PATH: add /swdev_nfs/FACT++
LD_LIBRARY_PATH: $ROOTSYS/lib:/swdev_nfs/FACT++/.libs
PYTHONPATH: $ROOTSYS/lib
the absolute path depends on where you have checked (or will check) out the pyscripts repository
FACT data are stored in (gzipped) fits files, but the data files are too large to be read by the existing tools:
pyfits <http://www.stsci.edu/institute/software_hardware/pyfits> which uses cfitsio.
To mitigate this problem a C++ class defined in fits.h [1] is used. A simple possibility to create an interface of this C++ class is to use ROOT and later to import it using the pyroot module.
got to the directory: pyscripts/pyfact
simple:
[lusterma@isdc-cn02 pyfact]$ root
ROOT 5.28/00 (trunk@37585, Dec 14 2010, 15:20:27 on linuxx8664gcc)
CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .L fits.h++
Info in <TUnixSystem::ACLiC>: creating shared library /home_nfs/isdc/lusterma/pyscripts/pyfact/./fits_h.so
root [1]
This might not work for whatenver reason then it should be done like this:
$rootcint -f my_dict.C -c fits.h izstream.h
$g++ -fPIC -c -I$ROOTSYS/include my_dict.C -o my_dict.o
$g++ -o fits_h.so -shared my_dict.o
Now you can check if the reading rawdata is working:
$ pyfact.py
this should print some data from a few events
raw data access and calibration
initialize object
open data file and calibration data file get basic information about the data in data_file_name allocate buffers for data access
data_file_name : fits or fits.gz file of the data including the path calib_file_name : fits or fits.gz file containing DRS calibration data baseline_file_name : npy file containing the baseline values
subtract baseline from the data
open ROOT file with baseline histogram and read baseline values file name of the root file bsl_hist path to the histogram containing the basline values
time when the FAD was triggered, in some strange units...
drs calibration file
perform the drs amplitude calibration of the event data
1D array with raw data
data file (fits object)
print run information
number of events in the data run
used by __iter__
load the next event from disk and calibrate it
number of pixels (should be 1440)
region of interest (number of DRS slices read)
slice where drs readout started
organize file names of a FACT data run
rpath : directory path for the results; YYYYMMDD will be appended to rpath zipped : use zipped (True) or unzipped (Data)
print complete filenames
create (make) the filenames
names : dictionary of filenames, tags { ‘data’, ‘drscal’, ‘results’ } data : name of the data file drscal : name of the drs calibration file results : radikal of file name(s) for results (to be completed by suffixes)
Footnotes
[1] | fits.h (here named pyfits.h) is part of MARS and was written by T.Bretz, it was added to this repository for convienience |