source: fact/tools/pyscripts/doc/_build/html/getting_started.html@ 13324

Last change on this file since 13324 was 13324, checked in by lusterma, 13 years ago
updated
File size: 17.3 KB
Line 
1
2
3<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
6<html xmlns="http://www.w3.org/1999/xhtml">
7 <head>
8 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
9
10 <title>Getting Started &mdash; pyfact v0.1 documentation</title>
11 <link rel="stylesheet" href="_static/default.css" type="text/css" />
12 <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
13 <script type="text/javascript">
14 var DOCUMENTATION_OPTIONS = {
15 URL_ROOT: '',
16 VERSION: '0.1',
17 COLLAPSE_INDEX: false,
18 FILE_SUFFIX: '.html',
19 HAS_SOURCE: true
20 };
21 </script>
22 <script type="text/javascript" src="_static/jquery.js"></script>
23 <script type="text/javascript" src="_static/underscore.js"></script>
24 <script type="text/javascript" src="_static/doctools.js"></script>
25 <link rel="top" title="pyfact v0.1 documentation" href="index.html" />
26 <link rel="next" title="Classes" href="classes.html" />
27 <link rel="prev" title="Introduction" href="introduction.html" />
28 </head>
29 <body>
30 <div class="related">
31 <h3>Navigation</h3>
32 <ul>
33 <li class="right" style="margin-right: 10px">
34 <a href="genindex.html" title="General Index"
35 accesskey="I">index</a></li>
36 <li class="right" >
37 <a href="classes.html" title="Classes"
38 accesskey="N">next</a> |</li>
39 <li class="right" >
40 <a href="introduction.html" title="Introduction"
41 accesskey="P">previous</a> |</li>
42 <li><a href="index.html">pyfact v0.1 documentation</a> &raquo;</li>
43 </ul>
44 </div>
45
46 <div class="document">
47 <div class="documentwrapper">
48 <div class="bodywrapper">
49 <div class="body">
50
51 <div class="section" id="getting-started">
52<h1>Getting Started<a class="headerlink" href="#getting-started" title="Permalink to this headline">¶</a></h1>
53<ol class="arabic simple">
54<li>Get an account at the FACT data center at ISDC</li>
55<li>Setup your environment variables</li>
56<li>Checkout the pyfact software repository</li>
57<li>Try a few examples</li>
58</ol>
59<div class="section" id="important-links">
60<h2>1. Important links<a class="headerlink" href="#important-links" title="Permalink to this headline">¶</a></h2>
61<dl class="docutils">
62<dt><strong>FACT data center at ISDC</strong> &lt;<a class="reference external" href="http://www.isdc.unige.ch/fact/datacenter">http://www.isdc.unige.ch/fact/datacenter</a>&gt;**</dt>
63<dd>here you find instructions how to get an account, how to set it up and how to use it</dd>
64<dt><strong>SVN repository</strong> &lt;<a class="reference external" href="https://fact.isdc.unige.ch/svn/fact/">https://fact.isdc.unige.ch/svn/fact/</a>&gt;</dt>
65<dd>hosts all FACT software (including pyfact)</dd>
66<dt><strong>FACT run database</strong> &lt;<a class="reference external" href="https://www.fact-project.org/run_db/db/fact_runinfo.php">https://www.fact-project.org/run_db/db/fact_runinfo.php</a>&gt;</dt>
67<dd>here you find information about all available runs</dd>
68<dt><strong>eLogbook</strong> &lt;<a class="reference external" href="https://www.fact-project.org/logbook/">https://www.fact-project.org/logbook/</a>&gt;</dt>
69<dd>telescope logbook used since Dec. 1, 2012; for logbook information before this date have a look here: &lt;<a class="reference external" href="http://fact.ethz.ch/FACTelog/index.jsp">http://fact.ethz.ch/FACTelog/index.jsp</a>&gt;</dd>
70<dt><strong>FACT La Palma pages</strong> &lt;<a class="reference external" href="https://www.fact-project.org/">https://www.fact-project.org/</a>&gt;</dt>
71<dd>plenty of information concerning the telescope in La Palma</dd>
72</dl>
73</div>
74<div class="section" id="environment-variables">
75<h2>2. Environment variables<a class="headerlink" href="#environment-variables" title="Permalink to this headline">¶</a></h2>
76<p>set the following env variables depending on the SHELL you are using, for instance in .bashrc or .tcshrc</p>
77<ul>
78<li><p class="first"><strong>ROOTSYS</strong>: /swdev_nfs/root_v5.28.00</p>
79</li>
80<li><p class="first"><strong>PATH</strong>: add $ROOTSYS/bin</p>
81</li>
82<li><p class="first"><strong>PATH</strong>: add /swdev_nfs/FACT++</p>
83</li>
84<li><p class="first"><strong>LD_LIBRARY_PATH</strong>: $ROOTSYS/lib:/swdev_nfs/FACT++/.libs</p>
85</li>
86<li><p class="first"><strong>PYTHONPATH</strong>: $ROOTSYS/lib</p>
87</li>
88<li><dl class="first docutils">
89<dt><strong>PYTHONPATH</strong>: add all directories where python should search for modules. At least:</dt>
90<dd><ul class="first last simple">
91<li>pyscripts/pyfact</li>
92<li>pyscript/tools</li>
93<li>pyscripts/ecamples</li>
94</ul>
95</dd>
96</dl>
97</li>
98</ul>
99<p>the absolute path depends on where you have checked (or will check) out the pyscripts repository</p>
100</div>
101<div class="section" id="check-out-the-repository">
102<h2>3. Check out the repository<a class="headerlink" href="#check-out-the-repository" title="Permalink to this headline">¶</a></h2>
103<p>svn co <a class="reference external" href="https://fact.isdc.unige.ch/svn/fact/tools/pyscripts/">https://fact.isdc.unige.ch/svn/fact/tools/pyscripts/</a></p>
104</div>
105<div class="section" id="create-pyfits-h-so-library">
106<h2>4. Create pyfits_h.so library<a class="headerlink" href="#create-pyfits-h-so-library" title="Permalink to this headline">¶</a></h2>
107<p>FACT data are stored in (gzipped) fits files, but the data files are too large to be read by the existing tools:</p>
108<p><cite>pyfits &lt;http://www.stsci.edu/institute/software_hardware/pyfits&gt;</cite> which uses <a class="reference external" href="http://heasarc.gsfc.nasa.gov/fitsio/">cfitsio</a>.</p>
109<p>To mitigate this problem a C++ class defined in fits.h <a class="footnote-reference" href="#f1" id="id1">[1]</a> is used. A simple possibility to create an interface of this C++ class is to use ROOT and later to import it using the
110<a class="reference external" href="http://root.cern.ch/drupal/category/package-context/pyroot">pyroot</a> module.</p>
111<p>got to the directory: pyscripts/pyfact</p>
112<p>simple:</p>
113<div class="highlight-python"><pre>[lusterma@isdc-cn02 pyfact]$ root
114ROOT 5.28/00 (trunk@37585, Dec 14 2010, 15:20:27 on linuxx8664gcc)
115CINT/ROOT C/C++ Interpreter version 5.18.00, July 2, 2010
116Type ? for help. Commands must be C++ statements.
117Enclose multiple statements between { }.
118
119root [0] .L fits.h++
120Info in &lt;TUnixSystem::ACLiC&gt;: creating shared library /home_nfs/isdc/lusterma/pyscripts/pyfact/./fits_h.so
121root [1]</pre>
122</div>
123<p>This might not work for whatenver reason then it should be done like this:</p>
124<div class="highlight-python"><pre>$rootcint -f my_dict.C -c fits.h izstream.h
125$g++ -fPIC -c -I$ROOTSYS/include my_dict.C -o my_dict.o
126$g++ -o fits_h.so -shared my_dict.o</pre>
127</div>
128<p>Now you can check if the reading rawdata is working:</p>
129<p>$ pyfact.py</p>
130<p>this should print some data from a few events</p>
131</div>
132<div class="section" id="run-examples">
133<h2>5. Run examples<a class="headerlink" href="#run-examples" title="Permalink to this headline">¶</a></h2>
134</div>
135</div>
136<div class="section" id="classes">
137<h1>Classes<a class="headerlink" href="#classes" title="Permalink to this headline">¶</a></h1>
138<div class="section" id="pyfact-py">
139<h2>pyfact.py<a class="headerlink" href="#pyfact-py" title="Permalink to this headline">¶</a></h2>
140<div class="section" id="rawdata-access">
141<h3>rawdata access<a class="headerlink" href="#rawdata-access" title="Permalink to this headline">¶</a></h3>
142<dl class="class">
143<dt id="pyfact.RawData">
144<em class="property">class </em><tt class="descclassname">pyfact.</tt><tt class="descname">RawData</tt><big>(</big><em>data_file_name</em>, <em>calib_file_name</em>, <em>user_action_calib=&lt;function &lt;lambda&gt; at 0xab028b4&gt;</em>, <em>baseline_file_name=''</em>, <em>return_dict=None</em><big>)</big><a class="headerlink" href="#pyfact.RawData" title="Permalink to this definition">¶</a></dt>
145<dd><p>raw data access and calibration</p>
146<ul class="simple">
147<li>open raw data file and drs calibration file</li>
148<li>performs amplitude calibration</li>
149<li>performs baseline substraction if wanted</li>
150<li>provides all data in an array:
151row = number of pixel
152col = length of region of interest</li>
153</ul>
154<p>initialize object</p>
155<p>open data file and calibration data file
156get basic information about the data in data_file_name
157allocate buffers for data access</p>
158<p>data_file_name : fits or fits.gz file of the data including the path
159calib_file_name : fits or fits.gz file containing DRS calibration data
160baseline_file_name : npy file containing the baseline values</p>
161<dl class="method">
162<dt id="pyfact.RawData.baseline_correct">
163<tt class="descname">baseline_correct</tt><big>(</big><big>)</big><a class="headerlink" href="#pyfact.RawData.baseline_correct" title="Permalink to this definition">¶</a></dt>
164<dd><p>subtract baseline from the data</p>
165</dd></dl>
166
167<dl class="method">
168<dt id="pyfact.RawData.baseline_read_values">
169<tt class="descname">baseline_read_values</tt><big>(</big><em>file</em>, <em>bsl_hist='bsl_sum/hplt_mean'</em><big>)</big><a class="headerlink" href="#pyfact.RawData.baseline_read_values" title="Permalink to this definition">¶</a></dt>
170<dd><p>open ROOT file with baseline histogram and read baseline values
171file name of the root file
172bsl_hist path to the histogram containing the basline values</p>
173</dd></dl>
174
175<dl class="attribute">
176<dt id="pyfact.RawData.board_times">
177<tt class="descname">board_times</tt><a class="headerlink" href="#pyfact.RawData.board_times" title="Permalink to this definition">¶</a></dt>
178<dd><p>time when the FAD was triggered, in some strange units...</p>
179</dd></dl>
180
181<dl class="attribute">
182<dt id="pyfact.RawData.calib_file">
183<tt class="descname">calib_file</tt><a class="headerlink" href="#pyfact.RawData.calib_file" title="Permalink to this definition">¶</a></dt>
184<dd><p>drs calibration file</p>
185</dd></dl>
186
187<dl class="method">
188<dt id="pyfact.RawData.calibrate_drs_amplitude">
189<tt class="descname">calibrate_drs_amplitude</tt><big>(</big><big>)</big><a class="headerlink" href="#pyfact.RawData.calibrate_drs_amplitude" title="Permalink to this definition">¶</a></dt>
190<dd><p>perform the drs amplitude calibration of the event data</p>
191</dd></dl>
192
193<dl class="attribute">
194<dt id="pyfact.RawData.data">
195<tt class="descname">data</tt><a class="headerlink" href="#pyfact.RawData.data" title="Permalink to this definition">¶</a></dt>
196<dd><p>1D array with raw data</p>
197</dd></dl>
198
199<dl class="attribute">
200<dt id="pyfact.RawData.data_file">
201<tt class="descname">data_file</tt><a class="headerlink" href="#pyfact.RawData.data_file" title="Permalink to this definition">¶</a></dt>
202<dd><p>data file (fits object)</p>
203</dd></dl>
204
205<dl class="method">
206<dt id="pyfact.RawData.info">
207<tt class="descname">info</tt><big>(</big><big>)</big><a class="headerlink" href="#pyfact.RawData.info" title="Permalink to this definition">¶</a></dt>
208<dd><p>print run information</p>
209</dd></dl>
210
211<dl class="attribute">
212<dt id="pyfact.RawData.nevents">
213<tt class="descname">nevents</tt><a class="headerlink" href="#pyfact.RawData.nevents" title="Permalink to this definition">¶</a></dt>
214<dd><p>number of events in the data run</p>
215</dd></dl>
216
217<dl class="method">
218<dt id="pyfact.RawData.next">
219<tt class="descname">next</tt><big>(</big><big>)</big><a class="headerlink" href="#pyfact.RawData.next" title="Permalink to this definition">¶</a></dt>
220<dd><p>used by __iter__</p>
221</dd></dl>
222
223<dl class="method">
224<dt id="pyfact.RawData.next_event">
225<tt class="descname">next_event</tt><big>(</big><big>)</big><a class="headerlink" href="#pyfact.RawData.next_event" title="Permalink to this definition">¶</a></dt>
226<dd><p>load the next event from disk and calibrate it</p>
227</dd></dl>
228
229<dl class="attribute">
230<dt id="pyfact.RawData.npix">
231<tt class="descname">npix</tt><a class="headerlink" href="#pyfact.RawData.npix" title="Permalink to this definition">¶</a></dt>
232<dd><p>number of pixels (should be 1440)</p>
233</dd></dl>
234
235<dl class="attribute">
236<dt id="pyfact.RawData.nroi">
237<tt class="descname">nroi</tt><a class="headerlink" href="#pyfact.RawData.nroi" title="Permalink to this definition">¶</a></dt>
238<dd><p>region of interest (number of DRS slices read)</p>
239</dd></dl>
240
241<dl class="attribute">
242<dt id="pyfact.RawData.start_cells">
243<tt class="descname">start_cells</tt><a class="headerlink" href="#pyfact.RawData.start_cells" title="Permalink to this definition">¶</a></dt>
244<dd><p>slice where drs readout started</p>
245</dd></dl>
246
247</dd></dl>
248
249</div>
250<div class="section" id="fnames-of-a-data-run">
251<h3>fnames of a data run<a class="headerlink" href="#fnames-of-a-data-run" title="Permalink to this headline">¶</a></h3>
252<dl class="class">
253<dt id="pyfact.fnames">
254<em class="property">class </em><tt class="descclassname">pyfact.</tt><tt class="descname">fnames</tt><big>(</big><em>specifier=['012', '023', '2011', '11', '24'], rpath='/scratch_nfs/res/bsl/', zipped=True</em><big>)</big><a class="headerlink" href="#pyfact.fnames" title="Permalink to this definition">¶</a></dt>
255<dd><p>organize file names of a FACT data run</p>
256<dl class="docutils">
257<dt>specifier <span class="classifier-delimiter">:</span> <span class="classifier">list of strings defined as:</span></dt>
258<dd>[ &#8216;DRS calibration file&#8217;, &#8216;Data file&#8217;, &#8216;YYYY&#8217;, &#8216;MM&#8217;, &#8216;DD&#8217;]</dd>
259</dl>
260<p>rpath : directory path for the results; YYYYMMDD will be appended to rpath
261zipped : use zipped (True) or unzipped (Data)</p>
262<dl class="method">
263<dt id="pyfact.fnames.info">
264<tt class="descname">info</tt><big>(</big><big>)</big><a class="headerlink" href="#pyfact.fnames.info" title="Permalink to this definition">¶</a></dt>
265<dd><p>print complete filenames</p>
266</dd></dl>
267
268<dl class="method">
269<dt id="pyfact.fnames.make">
270<tt class="descname">make</tt><big>(</big><em>specifier</em>, <em>rpath</em>, <em>zipped</em><big>)</big><a class="headerlink" href="#pyfact.fnames.make" title="Permalink to this definition">¶</a></dt>
271<dd><p>create (make) the filenames</p>
272<p>names : dictionary of filenames, tags { &#8216;data&#8217;, &#8216;drscal&#8217;, &#8216;results&#8217; }
273data : name of the data file
274drscal : name of the drs calibration file
275results : radikal of file name(s) for results (to be completed by suffixes)</p>
276</dd></dl>
277
278</dd></dl>
279
280<p class="rubric">Footnotes</p>
281<table class="docutils footnote" frame="void" id="f1" rules="none">
282<colgroup><col class="label" /><col /></colgroup>
283<tbody valign="top">
284<tr><td class="label"><a class="fn-backref" href="#id1">[1]</a></td><td>fits.h (here named pyfits.h) is part of MARS and was written by T.Bretz, it was added to this repository for convienience</td></tr>
285</tbody>
286</table>
287</div>
288</div>
289</div>
290
291
292 </div>
293 </div>
294 </div>
295 <div class="sphinxsidebar">
296 <div class="sphinxsidebarwrapper">
297 <h3><a href="index.html">Table Of Contents</a></h3>
298 <ul>
299<li><a class="reference internal" href="#">Getting Started</a><ul>
300<li><a class="reference internal" href="#important-links">1. Important links</a></li>
301<li><a class="reference internal" href="#environment-variables">2. Environment variables</a></li>
302<li><a class="reference internal" href="#check-out-the-repository">3. Check out the repository</a></li>
303<li><a class="reference internal" href="#create-pyfits-h-so-library">4. Create pyfits_h.so library</a></li>
304<li><a class="reference internal" href="#run-examples">5. Run examples</a></li>
305</ul>
306</li>
307<li><a class="reference internal" href="#classes">Classes</a><ul>
308<li><a class="reference internal" href="#pyfact-py">pyfact.py</a><ul>
309<li><a class="reference internal" href="#rawdata-access">rawdata access</a></li>
310<li><a class="reference internal" href="#fnames-of-a-data-run">fnames of a data run</a></li>
311</ul>
312</li>
313</ul>
314</li>
315</ul>
316
317 <h4>Previous topic</h4>
318 <p class="topless"><a href="introduction.html"
319 title="previous chapter">Introduction</a></p>
320 <h4>Next topic</h4>
321 <p class="topless"><a href="classes.html"
322 title="next chapter">Classes</a></p>
323 <h3>This Page</h3>
324 <ul class="this-page-menu">
325 <li><a href="_sources/getting_started.txt"
326 rel="nofollow">Show Source</a></li>
327 </ul>
328<div id="searchbox" style="display: none">
329 <h3>Quick search</h3>
330 <form class="search" action="search.html" method="get">
331 <input type="text" name="q" size="18" />
332 <input type="submit" value="Go" />
333 <input type="hidden" name="check_keywords" value="yes" />
334 <input type="hidden" name="area" value="default" />
335 </form>
336 <p class="searchtip" style="font-size: 90%">
337 Enter search terms or a module, class or function name.
338 </p>
339</div>
340<script type="text/javascript">$('#searchbox').show(0);</script>
341 </div>
342 </div>
343 <div class="clearer"></div>
344 </div>
345 <div class="related">
346 <h3>Navigation</h3>
347 <ul>
348 <li class="right" style="margin-right: 10px">
349 <a href="genindex.html" title="General Index"
350 >index</a></li>
351 <li class="right" >
352 <a href="classes.html" title="Classes"
353 >next</a> |</li>
354 <li class="right" >
355 <a href="introduction.html" title="Introduction"
356 >previous</a> |</li>
357 <li><a href="index.html">pyfact v0.1 documentation</a> &raquo;</li>
358 </ul>
359 </div>
360 <div class="footer">
361 &copy; Copyright 2012, Werner Lustermann.
362 Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.4.
363 </div>
364 </body>
365</html>
Note: See TracBrowser for help on using the repository browser.