source: sasview/sansdataloader/docs/sphinx/html/api/readers/cansas_reader.html @ 70ecd530

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalccostrafo411magnetic_scattrelease-4.1.1release-4.1.2release-4.2.2release_4.0.1ticket-1009ticket-1094-headlessticket-1242-2d-resolutionticket-1243ticket-1249ticket885unittest-saveload
Last change on this file since 70ecd530 was 7247844, checked in by Gervaise Alina <gervyh@…>, 13 years ago

updates docs

  • Property mode set to 100644
File size: 16.6 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
7<html xmlns="http://www.w3.org/1999/xhtml">
8  <head>
9    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
10   
11    <title>cansas_reader &mdash; DataLoader 0.1.0 documentation</title>
12   
13    <link rel="stylesheet" href="../../_static/default.css" type="text/css" />
14    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
15   
16    <script type="text/javascript">
17      var DOCUMENTATION_OPTIONS = {
18        URL_ROOT:    '../../',
19        VERSION:     '0.1.0',
20        COLLAPSE_INDEX: false,
21        FILE_SUFFIX: '.html',
22        HAS_SOURCE:  true
23      };
24    </script>
25    <script type="text/javascript" src="../../_static/jquery.js"></script>
26    <script type="text/javascript" src="../../_static/underscore.js"></script>
27    <script type="text/javascript" src="../../_static/doctools.js"></script>
28    <link rel="top" title="DataLoader 0.1.0 documentation" href="../../index.html" />
29    <link rel="up" title="Readers" href="index.html" />
30    <link rel="next" title="danse_reader" href="danse_reader.html" />
31    <link rel="prev" title="associations" href="associations.html" /> 
32  </head>
33  <body>
34    <div class="related">
35      <h3>Navigation</h3>
36      <ul>
37        <li class="right" style="margin-right: 10px">
38          <a href="../../genindex.html" title="General Index"
39             accesskey="I">index</a></li>
40        <li class="right" >
41          <a href="../../py-modindex.html" title="Python Module Index"
42             >modules</a> |</li>
43        <li class="right" >
44          <a href="danse_reader.html" title="danse_reader"
45             accesskey="N">next</a> |</li>
46        <li class="right" >
47          <a href="associations.html" title="associations"
48             accesskey="P">previous</a> |</li>
49        <li><a href="../../index.html">DataLoader 0.1.0 documentation</a> &raquo;</li>
50          <li><a href="index.html" accesskey="U">Readers</a> &raquo;</li> 
51      </ul>
52    </div> 
53
54    <div class="document">
55      <div class="documentwrapper">
56        <div class="bodywrapper">
57          <div class="body">
58           
59  <div class="section" id="cansas-reader">
60<h1>cansas_reader<a class="headerlink" href="#cansas-reader" title="Permalink to this headline">¶</a></h1>
61<div class="section" id="sans-dataloader-readers-cansas-reader">
62<h2><a class="reference internal" href="#module-sans.dataloader.readers.cansas_reader" title="sans.dataloader.readers.cansas_reader"><tt class="xref py py-mod docutils literal"><span class="pre">sans.dataloader.readers.cansas_reader</span></tt></a><a class="headerlink" href="#sans-dataloader-readers-cansas-reader" title="Permalink to this headline">¶</a></h2>
63<span class="target" id="module-sans.dataloader.readers.cansas_reader"></span><dl class="class">
64<dt id="sans.dataloader.readers.cansas_reader.Reader">
65<em class="property">class </em><tt class="descclassname">sans.dataloader.readers.cansas_reader.</tt><tt class="descname">Reader</tt><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader" title="Permalink to this definition">¶</a></dt>
66<dd><p>Class to load cansas 1D XML files</p>
67<table class="docutils field-list" frame="void" rules="none">
68<col class="field-name" />
69<col class="field-body" />
70<tbody valign="top">
71<tr class="field-odd field"><th class="field-name">Dependencies :</th><td class="field-body">The CanSas reader requires PyXML 0.8.4 or later.</td>
72</tr>
73</tbody>
74</table>
75<dl class="method">
76<dt id="sans.dataloader.readers.cansas_reader.Reader.__init__">
77<tt class="descname">__init__</tt><big>(</big><big>)</big><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader.__init__" title="Permalink to this definition">¶</a></dt>
78<dd></dd></dl>
79
80<dl class="attribute">
81<dt id="sans.dataloader.readers.cansas_reader.Reader.__module__">
82<tt class="descname">__module__</tt><em class="property"> = 'sans.dataloader.readers.cansas_reader'</em><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader.__module__" title="Permalink to this definition">¶</a></dt>
83<dd></dd></dl>
84
85<dl class="method">
86<dt id="sans.dataloader.readers.cansas_reader.Reader._parse_entry">
87<tt class="descname">_parse_entry</tt><big>(</big><big>)</big><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader._parse_entry" title="Permalink to this definition">¶</a></dt>
88<dd><p>Parse a SASentry</p>
89<table class="docutils field-list" frame="void" rules="none">
90<col class="field-name" />
91<col class="field-body" />
92<tbody valign="top">
93<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>node</strong> &#8211; SASentry node</td>
94</tr>
95<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body">Data1D object</td>
96</tr>
97</tbody>
98</table>
99</dd></dl>
100
101<dl class="method">
102<dt id="sans.dataloader.readers.cansas_reader.Reader._store_content">
103<tt class="descname">_store_content</tt><big>(</big><big>)</big><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader._store_content" title="Permalink to this definition">¶</a></dt>
104<dd><p>Get the content of a xpath location and store
105the result. The value is treated as a string.</p>
106<p>The xpath location might or might not exist.
107If it does not exist, nothing is done</p>
108<table class="docutils field-list" frame="void" rules="none">
109<col class="field-name" />
110<col class="field-body" />
111<tbody valign="top">
112<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
113<li><strong>location</strong> &#8211; xpath location to fetch</li>
114<li><strong>node</strong> &#8211; node to read the data from</li>
115<li><strong>variable</strong> &#8211; name of the data member to store it in [string]</li>
116<li><strong>storage</strong> &#8211; data object that has the &#8216;variable&#8217; data member</li>
117</ul>
118</td>
119</tr>
120<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">return a list of errors</p>
121</td>
122</tr>
123</tbody>
124</table>
125</dd></dl>
126
127<dl class="method">
128<dt id="sans.dataloader.readers.cansas_reader.Reader._store_float">
129<tt class="descname">_store_float</tt><big>(</big><big>)</big><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader._store_float" title="Permalink to this definition">¶</a></dt>
130<dd><p>Get the content of a xpath location and store
131the result. Check that the units are compatible
132with the destination. The value is expected to
133be a float.</p>
134<p>The xpath location might or might not exist.
135If it does not exist, nothing is done</p>
136<table class="docutils field-list" frame="void" rules="none">
137<col class="field-name" />
138<col class="field-body" />
139<tbody valign="top">
140<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
141<li><strong>location</strong> &#8211; xpath location to fetch</li>
142<li><strong>node</strong> &#8211; node to read the data from</li>
143<li><strong>variable</strong> &#8211; name of the data member to store it in [string]</li>
144<li><strong>storage</strong> &#8211; data object that has the &#8216;variable&#8217; data member</li>
145<li><strong>optional</strong> &#8211; if True, no exception will be raised
146if unit conversion can&#8217;t be done</li>
147</ul>
148</td>
149</tr>
150<tr class="field-even field"><th class="field-name" colspan="2">Raises ValueError:</th></tr>
151<tr class="field-even field"><td>&nbsp;</td><td class="field-body"><p class="first last">raised when the units are not recognized</p>
152</td>
153</tr>
154</tbody>
155</table>
156</dd></dl>
157
158<dl class="method">
159<dt id="sans.dataloader.readers.cansas_reader.Reader._to_xml_doc">
160<tt class="descname">_to_xml_doc</tt><big>(</big><big>)</big><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader._to_xml_doc" title="Permalink to this definition">¶</a></dt>
161<dd><p>Create an XML document to contain the content of a Data1D</p>
162<table class="docutils field-list" frame="void" rules="none">
163<col class="field-name" />
164<col class="field-body" />
165<tbody valign="top">
166<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>datainfo</strong> &#8211; Data1D object</td>
167</tr>
168</tbody>
169</table>
170</dd></dl>
171
172<dl class="attribute">
173<dt id="sans.dataloader.readers.cansas_reader.Reader.ext">
174<tt class="descname">ext</tt><em class="property"> = ['.xml', '.XML', '.avex', '.AVEx', '.absx', 'ABSx']</em><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader.ext" title="Permalink to this definition">¶</a></dt>
175<dd></dd></dl>
176
177<dl class="method">
178<dt id="sans.dataloader.readers.cansas_reader.Reader.read">
179<tt class="descname">read</tt><big>(</big><big>)</big><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader.read" title="Permalink to this definition">¶</a></dt>
180<dd><p>Load data file</p>
181<table class="docutils field-list" frame="void" rules="none">
182<col class="field-name" />
183<col class="field-body" />
184<tbody valign="top">
185<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>path</strong> &#8211; file path</p>
186</td>
187</tr>
188<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first">Data1D object if a single SASentry was found,
189or a list of Data1D objects if multiple entries were found,
190or None of nothing was found</p>
191</td>
192</tr>
193<tr class="field-odd field"><th class="field-name">Raises:</th><td class="field-body"><ul class="first last simple">
194<li><strong>RuntimeError</strong> &#8211; when the file can&#8217;t be opened</li>
195<li><strong>ValueError</strong> &#8211; when the length of the data vectors are inconsistent</li>
196</ul>
197</td>
198</tr>
199</tbody>
200</table>
201</dd></dl>
202
203<dl class="attribute">
204<dt id="sans.dataloader.readers.cansas_reader.Reader.type">
205<tt class="descname">type</tt><em class="property"> = ['CanSAS 1D files (*.xml)|*.xml', 'CanSAS 1D AVE files (*.AVEx)|*.AVEx', 'CanSAS 1D AVE files (*.ABSx)|*.ABSx']</em><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader.type" title="Permalink to this definition">¶</a></dt>
206<dd></dd></dl>
207
208<dl class="attribute">
209<dt id="sans.dataloader.readers.cansas_reader.Reader.type_name">
210<tt class="descname">type_name</tt><em class="property"> = 'CanSAS 1D'</em><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader.type_name" title="Permalink to this definition">¶</a></dt>
211<dd></dd></dl>
212
213<dl class="attribute">
214<dt id="sans.dataloader.readers.cansas_reader.Reader.version">
215<tt class="descname">version</tt><em class="property"> = '1.0'</em><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader.version" title="Permalink to this definition">¶</a></dt>
216<dd></dd></dl>
217
218<dl class="method">
219<dt id="sans.dataloader.readers.cansas_reader.Reader.write">
220<tt class="descname">write</tt><big>(</big><big>)</big><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.Reader.write" title="Permalink to this definition">¶</a></dt>
221<dd><p>Write the content of a Data1D as a CanSAS XML file</p>
222<table class="docutils field-list" frame="void" rules="none">
223<col class="field-name" />
224<col class="field-body" />
225<tbody valign="top">
226<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
227<li><strong>filename</strong> &#8211; name of the file to write</li>
228<li><strong>datainfo</strong> &#8211; Data1D object</li>
229</ul>
230</td>
231</tr>
232</tbody>
233</table>
234</dd></dl>
235
236</dd></dl>
237
238<dl class="function">
239<dt id="sans.dataloader.readers.cansas_reader.get_content">
240<tt class="descclassname">sans.dataloader.readers.cansas_reader.</tt><tt class="descname">get_content</tt><big>(</big><big>)</big><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.get_content" title="Permalink to this definition">¶</a></dt>
241<dd><p>Get the first instance of the content of a xpath location.</p>
242<table class="docutils field-list" frame="void" rules="none">
243<col class="field-name" />
244<col class="field-body" />
245<tbody valign="top">
246<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
247<li><strong>location</strong> &#8211; xpath location</li>
248<li><strong>node</strong> &#8211; node to start at</li>
249</ul>
250</td>
251</tr>
252<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">Element, or None</p>
253</td>
254</tr>
255</tbody>
256</table>
257</dd></dl>
258
259<dl class="function">
260<dt id="sans.dataloader.readers.cansas_reader.get_float">
261<tt class="descclassname">sans.dataloader.readers.cansas_reader.</tt><tt class="descname">get_float</tt><big>(</big><big>)</big><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.get_float" title="Permalink to this definition">¶</a></dt>
262<dd><p>Get the content of a node as a float</p>
263<table class="docutils field-list" frame="void" rules="none">
264<col class="field-name" />
265<col class="field-body" />
266<tbody valign="top">
267<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
268<li><strong>location</strong> &#8211; xpath location</li>
269<li><strong>node</strong> &#8211; node to start at</li>
270</ul>
271</td>
272</tr>
273</tbody>
274</table>
275</dd></dl>
276
277<dl class="function">
278<dt id="sans.dataloader.readers.cansas_reader.write_node">
279<tt class="descclassname">sans.dataloader.readers.cansas_reader.</tt><tt class="descname">write_node</tt><big>(</big><big>)</big><a class="headerlink" href="#sans.dataloader.readers.cansas_reader.write_node" title="Permalink to this definition">¶</a></dt>
280<dd><table class="docutils field-list" frame="void" rules="none">
281<col class="field-name" />
282<col class="field-body" />
283<tbody valign="top">
284<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
285<li><strong>doc</strong> &#8211; document DOM</li>
286<li><strong>parent</strong> &#8211; parent node</li>
287<li><strong>name</strong> &#8211; tag of the element</li>
288<li><strong>value</strong> &#8211; value of the child text node</li>
289<li><strong>attr</strong> &#8211; attribute dictionary</li>
290</ul>
291</td>
292</tr>
293<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">True if something was appended, otherwise False</p>
294</td>
295</tr>
296</tbody>
297</table>
298</dd></dl>
299
300</div>
301</div>
302
303
304          </div>
305        </div>
306      </div>
307      <div class="sphinxsidebar">
308        <div class="sphinxsidebarwrapper">
309  <h3><a href="../../index.html">Table Of Contents</a></h3>
310  <ul>
311<li><a class="reference internal" href="#">cansas_reader</a><ul>
312<li><a class="reference internal" href="#sans-dataloader-readers-cansas-reader"><tt class="docutils literal"><span class="pre">sans.dataloader.readers.cansas_reader</span></tt></a></li>
313</ul>
314</li>
315</ul>
316
317  <h4>Previous topic</h4>
318  <p class="topless"><a href="associations.html"
319                        title="previous chapter">associations</a></p>
320  <h4>Next topic</h4>
321  <p class="topless"><a href="danse_reader.html"
322                        title="next chapter">danse_reader</a></p>
323  <h3>This Page</h3>
324  <ul class="this-page-menu">
325    <li><a href="../../_sources/api/readers/cansas_reader.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" />
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="../../py-modindex.html" title="Python Module Index"
353             >modules</a> |</li>
354        <li class="right" >
355          <a href="danse_reader.html" title="danse_reader"
356             >next</a> |</li>
357        <li class="right" >
358          <a href="associations.html" title="associations"
359             >previous</a> |</li>
360        <li><a href="../../index.html">DataLoader 0.1.0 documentation</a> &raquo;</li>
361          <li><a href="index.html" >Readers</a> &raquo;</li> 
362      </ul>
363    </div>
364    <div class="footer">
365        &copy; Copyright 2010, sans group.
366      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.
367    </div>
368  </body>
369</html>
Note: See TracBrowser for help on using the repository browser.