source: fact/tools/pyscripts/doc/getting_started.rst@ 13346

Last change on this file since 13346 was 13325, checked in by neise, 13 years ago
removed doubled classes content and added some examples
File size: 4.1 KB
Line 
1===============
2Getting Started
3===============
4
51) Get an account at the FACT data center at ISDC
62) Setup your environment variables
73) Checkout the pyfact software repository
84) Try a few examples
9
101. Important links
11=================================
12
13**FACT data center at ISDC** <http://www.isdc.unige.ch/fact/datacenter>**
14 here you find instructions how to get an account, how to set it up and how to use it
15
16**SVN repository** <https://fact.isdc.unige.ch/svn/fact/>
17 hosts all FACT software (including pyfact)
18
19**FACT run database** <https://www.fact-project.org/run_db/db/fact_runinfo.php>
20 here you find information about all available runs
21
22**eLogbook** <https://www.fact-project.org/logbook/>
23 telescope logbook used since Dec. 1, 2012; for logbook information before this date have a look here: <http://fact.ethz.ch/FACTelog/index.jsp>
24
25**FACT La Palma pages** <https://www.fact-project.org/>
26 plenty of information concerning the telescope in La Palma
27
282. Environment variables
29========================
30set the following env variables depending on the SHELL you are using, for instance in .bashrc or .tcshrc
31
32* **ROOTSYS**: /swdev_nfs/root_v5.28.00
33* **PATH**: add $ROOTSYS/bin
34* **PATH**: add /swdev_nfs/FACT++
35* **LD_LIBRARY_PATH**: $ROOTSYS/lib:/swdev_nfs/FACT++/.libs
36* **PYTHONPATH**: $ROOTSYS/lib
37* **PYTHONPATH**: add all directories where python should search for modules. At least:
38 * pyscripts/pyfact
39 * pyscript/tools
40 * pyscripts/ecamples
41
42the absolute path depends on where you have checked (or will check) out the pyscripts repository
43
443. Check out the repository
45===========================
46svn co https://fact.isdc.unige.ch/svn/fact/tools/pyscripts/
47
484. Create pyfits_h.so library
49=============================
50FACT data are stored in (gzipped) fits files, but the data files are too large to be read by the existing tools:
51
52`pyfits <http://www.stsci.edu/institute/software_hardware/pyfits>` which uses `cfitsio <http://heasarc.gsfc.nasa.gov/fitsio/>`_.
53
54To mitigate this problem a C++ class defined in fits.h [#f1]_ is used. A simple possibility to create an interface of this C++ class is to use ROOT and later to import it using the
55`pyroot <http://root.cern.ch/drupal/category/package-context/pyroot>`_ module.
56
57got to the directory: pyscripts/pyfact
58
59simple::
60
61 [lusterma@isdc-cn02 pyfact]$ root
62 ROOT 5.28/00 (trunk@37585, Dec 14 2010, 15:20:27 on linuxx8664gcc)
63 CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
64 Type ? for help. Commands must be C++ statements.
65 Enclose multiple statements between { }.
66
67 root [0] .L fits.h++
68 Info in <TUnixSystem::ACLiC>: creating shared library /home_nfs/isdc/lusterma/pyscripts/pyfact/./fits_h.so
69 root [1]
70
71This might not work for whatenver reason then it should be done like this::
72
73 $rootcint -f my_dict.C -c fits.h izstream.h
74 $g++ -fPIC -c -I$ROOTSYS/include my_dict.C -o my_dict.o
75 $g++ -o fits_h.so -shared my_dict.o
76
77Now you can check if the reading rawdata is working:
78
79$ ./pyfact.py
80
81this should print some data from a few events
82
835. Run examples
84===============
85
86*datafilepath* and *calibfilepath* should be adjusted in case you are not working
87on the ISDC cluster.
88
89explore class RawData::
90
91 import pyfact
92 datafilepath = '/data00/fact-construction/raw/2012/03/04/20120304_018.fits.gz'
93 calibfilepath = '/data00/fact-construction/raw/2012/03/04/20120304_012.drs.fits.gz'
94 run = pyfact.RawData( datafilepath, calibfilepath, return_dict = True)
95 event = run.next()
96
97 type(event)
98
99 print 70*'*'
100 for key in event:
101 print 'key :', key
102 print 'value:', event[key]
103 print 70*'*'
104
105loop over RawData::
106
107 import pyfact
108 datafilepath = '/data00/fact-construction/raw/2012/03/04/20120304_018.fits.gz'
109 calibfilepath = '/data00/fact-construction/raw/2012/03/04/20120304_012.drs.fits.gz'
110 run = pyfact.RawData( datafilepath, calibfilepath, return_dict = True)
111
112 for event in run:
113 print 'event_id:', event['event_id']
114 # the data can be found in event['acal_data']
115
116.. rubric:: Footnotes
117.. [#f1] fits.h (here named pyfits.h) is part of MARS and was written by T.Bretz, it was added to this repository for convienience
Note: See TracBrowser for help on using the repository browser.