<h1>the Io module<aclass="headerlink"href="#the-io-module"title="Permalink to this headline">¶</a></h1>
<dlclass="function">
<dtid="pNbody.io.checkfile">
<ttclass="descclassname">pNbody.io.</tt><ttclass="descname">checkfile</tt><big>(</big><em>name</em><big>)</big><aclass="headerlink"href="#pNbody.io.checkfile"title="Permalink to this definition">¶</a></dt>
<dd><p>Check if a file exists. An error is generated if the file
File <spanclass="nb">"<stdin>"</span>, line <spanclass="m">1</span>, in <spanclass="n-Identifier"><module></span>
File <spanclass="nb">"/home/epfl/revaz/local/lib64/python2.6/site-packages/pNbody/io.py"</span>, line <spanclass="m">33</span>, in <spanclass="n-Identifier">checkfile</span>
<spanclass="k">raise</span><spanclass="ne">IOError</span><spanclass="p">(</span><spanclass="mi">915</span><spanclass="p">,</span><spanclass="s">'file </span><spanclass="si">%s</span><spanclass="s"> not found ! Pease check the file name.'</span><spanclass="o">%</span><spanclass="p">(</span><spanclass="n">name</span><spanclass="p">))</span>
<spanclass="nc">IOError</span>: <spanclass="n-Identifier">[Errno 915] file nofile not found ! Pease check the file name. </span>
</pre></div>
</div>
</dd></dl>
<dlclass="function">
<dtid="pNbody.io.end_of_file">
<ttclass="descclassname">pNbody.io.</tt><ttclass="descname">end_of_file</tt><big>(</big><em>f</em>, <em>pio='no'</em>, <em>MPI=None</em><big>)</big><aclass="headerlink"href="#pNbody.io.end_of_file"title="Permalink to this definition">¶</a></dt>
<dd><p>Return True if we have reached the end of the file f, False instead</p>
<ttclass="descclassname">pNbody.io.</tt><ttclass="descname">write_array</tt><big>(</big><em>file</em>, <em>vec</em><big>)</big><aclass="headerlink"href="#pNbody.io.write_array"title="Permalink to this definition">¶</a></dt>
<dd><p>Write an array to a file, in a very simple ascii format.</p>
<ttclass="descclassname">pNbody.io.</tt><ttclass="descname">read_ascii</tt><big>(</big><em>file</em>, <em>columns=None</em>, <em>lines=None</em>, <em>dtype=<type 'float'></em>, <em>skipheader=False</em>, <em>cchar='#'</em><big>)</big><aclass="headerlink"href="#pNbody.io.read_ascii"title="Permalink to this definition">¶</a></dt>
<dd><p>Read an ascii file.
The function allows to set the number of columns or line to read.
If it contains a header, the header is used to label all column. In
<trclass="field"><thclass="field-name">Parameters :</th><tdclass="field-body"><pclass="first"><strong>file</strong> : the path to a file or an open file</p>
<p><strong>columns</strong> : list</p>
<blockquote>
<p>the list of the columns to read
if none, all columns are read</p>
</blockquote>
<p><strong>lines</strong> : list</p>
<blockquote>
<p>the list of the lines to read
if none, all lines are read</p>
</blockquote>
<p><strong>dtype</strong> : dtype</p>
<blockquote>
<p>the ndtype of the objects to read</p>
</blockquote>
<p><strong>skipheader</strong> : bool</p>
<blockquote>
<p>if true, do not read the header
if there is one</p>
</blockquote>
<p><strong>cchar</strong> : char</p>
<blockquote>
<p>lines begining with cchar are skiped
the first line is considered as the header</p>
</blockquote>
</td>
</tr>
<trclass="field"><thclass="field-name">Returns :</th><tdclass="field-body"><pclass="first"><strong>data</strong> : Dict or ndarray</p>
<spanclass="gp">>>></span><spanclass="n">f</span><spanclass="o">.</span><spanclass="n">write</span><spanclass="p">(</span><spanclass="s">"# x y"</span><spanclass="p">)</span>