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

Last change on this file since 18752 was 14421, checked in by neise, 12 years ago
changed the testing section
File size: 8.3 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
33* **ROOTSYS**: /swdev_nfs/root_v5.28.00
34* **PATH**: add $ROOTSYS/bin
35* **LD_LIBRARY_PATH**: add $ROOTSYS/lib
36* **PYTHONPATH**: $ROOTSYS/lib
37* **PYTHONPATH**: add all directories where python should search for modules. At least:
38 * pyscripts/pyfact
39* **LD_LIBRARY_PATH**: add the path to pyfits_h.so
40 * pyscripts/pyfact in many cases
41
42the absolute path depends on where you have checked (or will check) out the pyscripts repository
43
44example .bashrc::
45
46 # this is just a convenient shortcut
47 export MY_PYFACT=/home_nfs/isdc/neise/py/pyscripts/pyfact
48
49 # this is needed for ROOT only
50 export ROOTSYS=/swdev_nfs/root_v5.28.00
51 export PATH=$ROOTSYS/bin:$PATH
52 export LD_LIBRARY_PATH=$ROOTSYS/lib:$LD_LIBRARY_PATH
53
54 # this is needed for Python to find the pyfact classes and PyROOT
55 export PYTHONPATH=$MY_PYFACT
56 export PYTHONPATH=$ROOTSYS/lib:$PYTHONPATH
57
58 #this is one of many possible ways, for ROOT to find pyfits_h.so
59 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MY_PYFACT
60
61
623. Check out the repository
63===========================
64svn co https://fact.isdc.unige.ch/svn/fact/tools/pyscripts py
65
66
674. Create the needed *.so libs @ ISDC
68======================================
69
70FACT data are stored in (gzipped) fits files, but the data files are too large to be read by the existing tools:
71
72`pyfits <http://www.stsci.edu/institute/software_hardware/pyfits>` which uses `cfitsio <http://heasarc.gsfc.nasa.gov/fitsio/>`_.
73
74To 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
75`pyroot <http://root.cern.ch/drupal/category/package-context/pyroot>`_ module.
76
77example::
78
79 neise@isdc-viewer00:~/py/pyfact$ root -l -q makelibs.C
80 root [0]
81 Processing makelibs.C...
82 Info in <TUnixSystem::ACLiC>: creating shared library /home_nfs/isdc/neise/test_py/pyfact/./izstream_h.so
83 Info in <TUnixSystem::ACLiC>: creating shared library /home_nfs/isdc/neise/test_py/pyfact/./factfits_h.so
84 [... quite some warnings ...]
85
86 neise@isdc-viewer00:~/py/pyfact$ ls *.so
87 calfactfits_h.so factfits_h.so izstream_h.so
88
895. Test if everything is running
90=================================
91
92each module in pyfact should have some test methods implemented.
93In case one would like to test the module *pyfact*, one can simple execute
94the module source file.
95
96Just test if everything is running like this::
97
98 neise@isdc-viewer00:~/py/pyfact$ pyfact.py
99 showing test of iterator of RawData class
100 in order to test the SlowData classe please use: ./pyfact.py fits-file-name
101 ev 1 data[0,0] = -7.68806196438 start_cell[0] = 426 trigger type = 416
102 ev 2 data[0,0] = 0.792280672486 start_cell[0] = 437 trigger type = 416
103 ev 3 data[0,0] = 54.9490855517 start_cell[0] = 449 trigger type = 416
104 ev 4 data[0,0] = 3.9482592671 start_cell[0] = 461 trigger type = 416
105 ev 5 data[0,0] = -66.4329317281 start_cell[0] = 474 trigger type = 416
106 ev 6 data[0,0] = 8.2917625181 start_cell[0] = 485 trigger type = 416
107 ev 7 data[0,0] = -41.6565116079 start_cell[0] = 498 trigger type = 416
108 ev 8 data[0,0] = 33.4668984163 start_cell[0] = 509 trigger type = 416
109 ev 9 data[0,0] = -28.520090549 start_cell[0] = 522 trigger type = 416
110 ev 10 data[0,0] = -20.4925692795 start_cell[0] = 533 trigger type = 416
111
112This should work at ISDC only, but if it does not work, please ask somebody for help.
113
114
1156. Old way of creating the so files
116===================================
117
118-----------This is a depricated section---------------
119
120FACT data are stored in (gzipped) fits files, but the data files are too large to be read by the existing tools:
121
122`pyfits <http://www.stsci.edu/institute/software_hardware/pyfits>` which uses `cfitsio <http://heasarc.gsfc.nasa.gov/fitsio/>`_.
123
124To 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
125`pyroot <http://root.cern.ch/drupal/category/package-context/pyroot>`_ module.
126
127example::
128
129 neise@isdc-viewer00:~/py/pyscripts/pyfact$ root
130 ROOT 5.28/00 (trunk@37585, Dec 14 2010, 15:20:27 on linuxx8664gcc)
131 CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
132 Type ? for help. Commands must be C++ statements.
133 Enclose multiple statements between { }.
134 root [0] .L pyfits.h++
135 Info in <TUnixSystem::ACLiC>: creating shared library /home_nfs/isdc/neise/py/pyscripts/pyfact/./pyfits_h.so
136 In file included from /home_nfs/isdc/neise/py/pyscripts/pyfact/pyfits_h_ACLiC_dict.h:34,
137 from /home_nfs/isdc/neise/py/pyscripts/pyfact/pyfits_h_ACLiC_dict.cxx:17:
138 /home_nfs/isdc/neise/py/pyscripts/pyfact/./pyfits.h: In member function »size_t std::fits::Table::GetN(const std::string&) const«:
139 /home_nfs/isdc/neise/py/pyscripts/pyfact/./pyfits.h:442: Warnung: Deklaration von »it« überdeckt einen vorhergehenden lokalen Bezeichner
140 /home_nfs/isdc/neise/py/pyscripts/pyfact/./pyfits.h:437: Warnung: Verdeckte Deklaration ist hier
141 root [1] .q
142
143check if it worked::
144
145 neise@isdc-viewer00:~/py/pyscripts/pyfact$ ls pyfits*
146 pyfits.h pyfits_h.d pyfits_h.so
147
148
149This might not work for whatenver reason then you can try this::
150
151 $rootcint -f my_dict.C -c pyfits.h izstream.h
152 $g++ -fPIC -c -I$ROOTSYS/include my_dict.C -o my_dict.o
153 $g++ -o pyfits_h.so -shared my_dict.o
154
155
156In case one uses root 5.32 instead of root 5.28, one should do::
157
158 neise@isdc-viewer00:~/py/pyscripts/pyfact$ root -b
159 *******************************************
160 * *
161 * W E L C O M E to R O O T *
162 * *
163 * Version 5.32/00 2 December 2011 *
164 * *
165 * You are welcome to visit our Web site *
166 * http://root.cern.ch *
167 * *
168 *******************************************
169
170 ROOT 5.32/00 (tags/v5-32-00@42375, Dec 02 2011, 12:42:25 on linuxx8664gcc)
171
172 CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
173 Type ? for help. Commands must be C++ statements.
174 Enclose multiple statements between { }.
175 root [0] gSystem->Load("/usr/lib64/libz.so")
176 (int)0
177 root [1] .L pyfits.h++
178 Info in <TUnixSystem::ACLiC>: creating shared library /home_nfs/isdc/neise/py/pyscripts/pyfact/./pyfits_h.so
179 In file included from /home_nfs/isdc/neise/py/pyscripts/pyfact/pyfits_h_ACLiC_dict.h:34,
180 from /home_nfs/isdc/neise/py/pyscripts/pyfact/pyfits_h_ACLiC_dict.cxx:17:
181 /home_nfs/isdc/neise/py/pyscripts/pyfact/./pyfits.h: In member function »size_t std::fits::Table::GetN(const std::string&) const«:
182 /home_nfs/isdc/neise/py/pyscripts/pyfact/./pyfits.h:442: Warnung: Deklaration von »it« überdeckt einen vorhergehenden lokalen Bezeichner
183 /home_nfs/isdc/neise/py/pyscripts/pyfact/./pyfits.h:437: Warnung: Verdeckte Deklaration ist hier
184 root [2] .q
185 neise@isdc-viewer00:~/py/pyscripts/pyfact$ ls pyfits*
186 pyfits.h pyfits_h.d pyfits_h.so
187
188
189.. rubric:: Footnotes
190.. [#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.