source: sasview/sansdataloader/docs/sphinx/html/api/loader.html @ 440f020

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 440f020 was fc5d49e3, checked in by Jessica Tumarkin <jtumarki@…>, 13 years ago
  • Property mode set to 100644
File size: 15.5 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>loader &mdash; DataLoader v0.1.0 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.0',
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="DataLoader v0.1.0 documentation" href="../index.html" />
26    <link rel="up" title="Reference" href="index.html" />
27    <link rel="next" title="manipulations" href="manipulations.html" />
28    <link rel="prev" title="data_info" href="data_info.html" /> 
29  </head>
30  <body>
31    <div class="related">
32      <h3>Navigation</h3>
33      <ul>
34        <li class="right" style="margin-right: 10px">
35          <a href="../genindex.html" title="General Index"
36             accesskey="I">index</a></li>
37        <li class="right" >
38          <a href="../py-modindex.html" title="Python Module Index"
39             >modules</a> |</li>
40        <li class="right" >
41          <a href="manipulations.html" title="manipulations"
42             accesskey="N">next</a> |</li>
43        <li class="right" >
44          <a href="data_info.html" title="data_info"
45             accesskey="P">previous</a> |</li>
46        <li><a href="../index.html">DataLoader v0.1.0 documentation</a> &raquo;</li>
47          <li><a href="index.html" accesskey="U">Reference</a> &raquo;</li> 
48      </ul>
49    </div> 
50
51    <div class="document">
52      <div class="documentwrapper">
53        <div class="bodywrapper">
54          <div class="body">
55           
56  <div class="section" id="loader">
57<h1>loader<a class="headerlink" href="#loader" title="Permalink to this headline">¶</a></h1>
58<div class="section" id="module-DataLoader.loader">
59<span id="dataloader-loader"></span><h2><a class="reference internal" href="#module-DataLoader.loader" title="DataLoader.loader"><tt class="xref py py-mod docutils literal"><span class="pre">DataLoader.loader</span></tt></a><a class="headerlink" href="#module-DataLoader.loader" title="Permalink to this headline">¶</a></h2>
60<p>File handler to support different file extensions.
61Uses reflectometry&#8217;s registry utility.</p>
62<p>The default readers are found in the &#8216;readers&#8217; sub-module
63and registered by default at initialization time.</p>
64<p>To add a new default reader, one must register it in
65the register_readers method found in readers/__init__.py.</p>
66<p>A utility method (find_plugins) is available to inspect
67a directory (for instance, a user plug-in directory) and
68look for new readers/writers.</p>
69<dl class="class">
70<dt id="DataLoader.loader.Loader">
71<em class="property">class </em><tt class="descclassname">DataLoader.loader.</tt><tt class="descname">Loader</tt><a class="headerlink" href="#DataLoader.loader.Loader" title="Permalink to this definition">¶</a></dt>
72<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
73<p>Utility class to use the Registry as a singleton.</p>
74<dl class="method">
75<dt id="DataLoader.loader.Loader.associate_file_reader">
76<tt class="descname">associate_file_reader</tt><big>(</big><em>ext</em>, <em>loader</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Loader.associate_file_reader" title="Permalink to this definition">¶</a></dt>
77<dd><p>Append a reader object to readers</p>
78<table class="docutils field-list" frame="void" rules="none">
79<col class="field-name" />
80<col class="field-body" />
81<tbody valign="top">
82<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
83<li><strong>ext</strong> &#8211; file extension [string]</li>
84<li><strong>module</strong> &#8211; reader object</li>
85</ul>
86</td>
87</tr>
88</tbody>
89</table>
90</dd></dl>
91
92<dl class="method">
93<dt id="DataLoader.loader.Loader.associate_file_type">
94<tt class="descname">associate_file_type</tt><big>(</big><em>ext</em>, <em>module</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Loader.associate_file_type" title="Permalink to this definition">¶</a></dt>
95<dd><p>Look into a module to find whether it contains a
96Reader class. If so, append it to readers and (potentially)
97to the list of writers for the given extension</p>
98<table class="docutils field-list" frame="void" rules="none">
99<col class="field-name" />
100<col class="field-body" />
101<tbody valign="top">
102<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
103<li><strong>ext</strong> &#8211; file extension [string]</li>
104<li><strong>module</strong> &#8211; module object</li>
105</ul>
106</td>
107</tr>
108</tbody>
109</table>
110</dd></dl>
111
112<dl class="method">
113<dt id="DataLoader.loader.Loader.find_plugins">
114<tt class="descname">find_plugins</tt><big>(</big><em>dir</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Loader.find_plugins" title="Permalink to this definition">¶</a></dt>
115<dd><p>Find plugins in a given directory</p>
116<table class="docutils field-list" frame="void" rules="none">
117<col class="field-name" />
118<col class="field-body" />
119<tbody valign="top">
120<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>dir</strong> &#8211; directory to look into to find new readers/writers</td>
121</tr>
122</tbody>
123</table>
124</dd></dl>
125
126<dl class="method">
127<dt id="DataLoader.loader.Loader.get_wildcards">
128<tt class="descname">get_wildcards</tt><big>(</big><big>)</big><a class="headerlink" href="#DataLoader.loader.Loader.get_wildcards" title="Permalink to this definition">¶</a></dt>
129<dd></dd></dl>
130
131<dl class="method">
132<dt id="DataLoader.loader.Loader.load">
133<tt class="descname">load</tt><big>(</big><em>file</em>, <em>format=None</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Loader.load" title="Permalink to this definition">¶</a></dt>
134<dd><p>Load a file</p>
135<table class="docutils field-list" frame="void" rules="none">
136<col class="field-name" />
137<col class="field-body" />
138<tbody valign="top">
139<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first simple">
140<li><strong>file</strong> &#8211; file name (path)</li>
141<li><strong>format</strong> &#8211; specified format to use (optional)</li>
142</ul>
143</td>
144</tr>
145<tr class="field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last">DataInfo object</p>
146</td>
147</tr>
148</tbody>
149</table>
150</dd></dl>
151
152<dl class="method">
153<dt id="DataLoader.loader.Loader.save">
154<tt class="descname">save</tt><big>(</big><em>file</em>, <em>data</em>, <em>format</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Loader.save" title="Permalink to this definition">¶</a></dt>
155<dd><p>Save a DataInfo object to file
156:param file: file name (path)
157:param data: DataInfo object
158:param format: format to write the data in</p>
159</dd></dl>
160
161</dd></dl>
162
163<dl class="class">
164<dt id="DataLoader.loader.Registry">
165<em class="property">class </em><tt class="descclassname">DataLoader.loader.</tt><tt class="descname">Registry</tt><a class="headerlink" href="#DataLoader.loader.Registry" title="Permalink to this definition">¶</a></dt>
166<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">data_util.registry.ExtensionRegistry</span></tt></p>
167<p>Registry class for file format extensions.
168Readers and writers are supported.</p>
169<dl class="method">
170<dt id="DataLoader.loader.Registry.associate_file_reader">
171<tt class="descname">associate_file_reader</tt><big>(</big><em>ext</em>, <em>loader</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Registry.associate_file_reader" title="Permalink to this definition">¶</a></dt>
172<dd><p>Append a reader object to readers</p>
173<table class="docutils field-list" frame="void" rules="none">
174<col class="field-name" />
175<col class="field-body" />
176<tbody valign="top">
177<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
178<li><strong>ext</strong> &#8211; file extension [string]</li>
179<li><strong>module</strong> &#8211; reader object</li>
180</ul>
181</td>
182</tr>
183</tbody>
184</table>
185</dd></dl>
186
187<dl class="method">
188<dt id="DataLoader.loader.Registry.associate_file_type">
189<tt class="descname">associate_file_type</tt><big>(</big><em>ext</em>, <em>module</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Registry.associate_file_type" title="Permalink to this definition">¶</a></dt>
190<dd><p>Look into a module to find whether it contains a
191Reader class. If so, APPEND it to readers and (potentially)
192to the list of writers for the given extension</p>
193<table class="docutils field-list" frame="void" rules="none">
194<col class="field-name" />
195<col class="field-body" />
196<tbody valign="top">
197<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
198<li><strong>ext</strong> &#8211; file extension [string]</li>
199<li><strong>module</strong> &#8211; module object</li>
200</ul>
201</td>
202</tr>
203</tbody>
204</table>
205</dd></dl>
206
207<dl class="method">
208<dt id="DataLoader.loader.Registry.extensions">
209<tt class="descname">extensions</tt><big>(</big><big>)</big><a class="headerlink" href="#DataLoader.loader.Registry.extensions" title="Permalink to this definition">¶</a></dt>
210<dd><p>Return a sorted list of registered extensions.</p>
211</dd></dl>
212
213<dl class="method">
214<dt id="DataLoader.loader.Registry.find_plugins">
215<tt class="descname">find_plugins</tt><big>(</big><em>dir</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Registry.find_plugins" title="Permalink to this definition">¶</a></dt>
216<dd><p>Find readers in a given directory. This method
217can be used to inspect user plug-in directories to
218find new readers/writers.</p>
219<table class="docutils field-list" frame="void" rules="none">
220<col class="field-name" />
221<col class="field-body" />
222<tbody valign="top">
223<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><strong>dir</strong> &#8211; directory to search into</td>
224</tr>
225<tr class="field"><th class="field-name">Returns:</th><td class="field-body">number of readers found</td>
226</tr>
227</tbody>
228</table>
229</dd></dl>
230
231<dl class="method">
232<dt id="DataLoader.loader.Registry.formats">
233<tt class="descname">formats</tt><big>(</big><big>)</big><a class="headerlink" href="#DataLoader.loader.Registry.formats" title="Permalink to this definition">¶</a></dt>
234<dd><p>Return a sorted list of the registered formats.</p>
235</dd></dl>
236
237<dl class="method">
238<dt id="DataLoader.loader.Registry.load">
239<tt class="descname">load</tt><big>(</big><em>path</em>, <em>format=None</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Registry.load" title="Permalink to this definition">¶</a></dt>
240<dd><p>Call the loader for the file type of path.</p>
241<table class="docutils field-list" frame="void" rules="none">
242<col class="field-name" />
243<col class="field-body" />
244<tbody valign="top">
245<tr class="field"><th class="field-name">Parameters:</th><td class="field-body"><ul class="first last simple">
246<li><strong>path</strong> &#8211; file path</li>
247<li><strong>format</strong> &#8211; explicit extension, to force the use
248of a particular reader</li>
249</ul>
250</td>
251</tr>
252</tbody>
253</table>
254<p>Defaults to the ascii (multi-column) reader
255if no reader was registered for the file&#8217;s
256extension.</p>
257</dd></dl>
258
259<dl class="method">
260<dt id="DataLoader.loader.Registry.lookup">
261<tt class="descname">lookup</tt><big>(</big><em>path</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Registry.lookup" title="Permalink to this definition">¶</a></dt>
262<dd><p>Return the loader associated with the file type of path.</p>
263<p>Raises ValueError if file type is not known.</p>
264</dd></dl>
265
266<dl class="method">
267<dt id="DataLoader.loader.Registry.lookup_writers">
268<tt class="descname">lookup_writers</tt><big>(</big><em>path</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Registry.lookup_writers" title="Permalink to this definition">¶</a></dt>
269<dd><table class="docutils field-list" frame="void" rules="none">
270<col class="field-name" />
271<col class="field-body" />
272<tbody valign="top">
273<tr class="field"><th class="field-name">Returns:</th><td class="field-body">the loader associated with the file type of path.</td>
274</tr>
275<tr class="field"><th class="field-name" colspan="2">Raises ValueError:</th></tr>
276<tr><td>&nbsp;</td><td class="field-body">if file type is not known.</td>
277</tr>
278</tbody>
279</table>
280</dd></dl>
281
282<dl class="method">
283<dt id="DataLoader.loader.Registry.save">
284<tt class="descname">save</tt><big>(</big><em>path</em>, <em>data</em>, <em>format=None</em><big>)</big><a class="headerlink" href="#DataLoader.loader.Registry.save" title="Permalink to this definition">¶</a></dt>
285<dd><p>Call the writer for the file type of path.</p>
286<p>Raises ValueError if no writer is available.
287Raises KeyError if format is not available.</p>
288<p>May raise a writer-defined exception if writer fails.</p>
289</dd></dl>
290
291</dd></dl>
292
293</div>
294</div>
295
296
297          </div>
298        </div>
299      </div>
300      <div class="sphinxsidebar">
301        <div class="sphinxsidebarwrapper">
302  <h3><a href="../index.html">Table Of Contents</a></h3>
303  <ul>
304<li><a class="reference internal" href="#">loader</a><ul>
305<li><a class="reference internal" href="#module-DataLoader.loader"><tt class="docutils literal"><span class="pre">DataLoader.loader</span></tt></a></li>
306</ul>
307</li>
308</ul>
309
310  <h4>Previous topic</h4>
311  <p class="topless"><a href="data_info.html"
312                        title="previous chapter">data_info</a></p>
313  <h4>Next topic</h4>
314  <p class="topless"><a href="manipulations.html"
315                        title="next chapter">manipulations</a></p>
316  <h3>This Page</h3>
317  <ul class="this-page-menu">
318    <li><a href="../_sources/api/loader.txt"
319           rel="nofollow">Show Source</a></li>
320  </ul>
321<div id="searchbox" style="display: none">
322  <h3>Quick search</h3>
323    <form class="search" action="../search.html" method="get">
324      <input type="text" name="q" size="18" />
325      <input type="submit" value="Go" />
326      <input type="hidden" name="check_keywords" value="yes" />
327      <input type="hidden" name="area" value="default" />
328    </form>
329    <p class="searchtip" style="font-size: 90%">
330    Enter search terms or a module, class or function name.
331    </p>
332</div>
333<script type="text/javascript">$('#searchbox').show(0);</script>
334        </div>
335      </div>
336      <div class="clearer"></div>
337    </div>
338    <div class="related">
339      <h3>Navigation</h3>
340      <ul>
341        <li class="right" style="margin-right: 10px">
342          <a href="../genindex.html" title="General Index"
343             >index</a></li>
344        <li class="right" >
345          <a href="../py-modindex.html" title="Python Module Index"
346             >modules</a> |</li>
347        <li class="right" >
348          <a href="manipulations.html" title="manipulations"
349             >next</a> |</li>
350        <li class="right" >
351          <a href="data_info.html" title="data_info"
352             >previous</a> |</li>
353        <li><a href="../index.html">DataLoader v0.1.0 documentation</a> &raquo;</li>
354          <li><a href="index.html" >Reference</a> &raquo;</li> 
355      </ul>
356    </div>
357    <div class="footer">
358        &copy; Copyright 2010, sans group.
359      Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.0.7.
360    </div>
361  </body>
362</html>
Note: See TracBrowser for help on using the repository browser.