<span id="the-pyfits-module"></span><h1>the pyfits module<a class="headerlink" href="#module-pNbody.pyfits" title="Permalink to this headline">¶</a></h1>
<p>A module for reading and writing FITS files and manipulating their contents.</p>
<p>A module for reading and writing Flexible Image Transport System
(FITS) files. This file format was endorsed by the International
Astronomical Union in 1999 and mandated by NASA as the standard format
for storing high energy astrophysics data. For details of the FITS
standard, see the NASA/Science Office of Standards and Technology
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">BinTableHDU</tt><big>(</big><em>data=None</em>, <em>header=None</em>, <em>name=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.BinTableHDU" title="Permalink to this definition">¶</a></dt>
<dd><p>Binary table HDU class.</p>
<p class="rubric">Methods</p>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.CardList">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">CardList</tt><big>(</big><em>cards=</em><span class="optional">[</span><span class="optional">]</span>, <em>keylist=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.CardList" title="Permalink to this definition">¶</a></dt>
<dd><p>FITS header card list class.</p>
<p class="rubric">Methods</p>
<dl class="method">
<dt id="pNbody.pyfits.CardList.append">
<tt class="descname">append</tt><big>(</big><em>card</em>, <em>useblanks=1</em>, <em>bottom=0</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.CardList.append" title="Permalink to this definition">¶</a></dt>
<dd><p>Append a Card to the CardList.</p>
<p>card: The Card to be appended.
useblanks: Use any <em>extra</em> blank cards? default=1.</p>
<blockquote>
If useblanks != 0, and if there are blank cards directly
before END, it will use this space first, instead of
appending after these blank cards, so the total space
will not increase (default). When useblanks == 0, the
card will be appended at the end, even if there are
blank cards in front of END.</blockquote>
<dl class="docutils">
<dt>bottom: If =0 (default) the card will be appended after the last</dt>
<dd>non-commentary card. If =1, the card will be appended
after the last non-blank card.</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.CardList.copy">
<tt class="descname">copy</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.CardList.copy" title="Permalink to this definition">¶</a></dt>
<dd><p>Make a (deep)copy of the CardList.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.CardList.count_blanks">
<tt class="descname">count_blanks</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.CardList.count_blanks" title="Permalink to this definition">¶</a></dt>
<dd><p>Find out how many blank cards are <em>directly</em> before the END card.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.CardList.index_of">
<tt class="descname">index_of</tt><big>(</big><em>key</em>, <em>backward=0</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.CardList.index_of" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the index of a keyword in the CardList.</p>
<p>key: the keyword name (a string) or the index (an integer).
backward: search the index from the END, i.e. backward? default=0.</p>
<blockquote>
If backward = 1, search from the end.</blockquote>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.CardList.insert">
<tt class="descname">insert</tt><big>(</big><em>pos</em>, <em>card</em>, <em>useblanks=1</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.CardList.insert" title="Permalink to this definition">¶</a></dt>
<dd><p>Insert a Card to the CardList.</p>
<dl class="docutils">
<dt>pos: The position (index, keyword name will not be allowed) to</dt>
<dd>insert. The new card will be inserted before it.</dd>
</dl>
<p>card: The Card to be inserted.
useblanks: Use any <em>extra</em> blank cards? default=1.</p>
<blockquote>
If useblanks != 0, and if there are blank cards directly
before END, it will use this space first, instead of
appending after these blank cards, so the total space
will not increase (default). When useblanks == 0, the
card will be appended at the end, even if there are
blank cards in front of END.</blockquote>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.CardList.keys">
<tt class="descname">keys</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.CardList.keys" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of all keywords from the CardList.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.ColDefs">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">ColDefs</tt><big>(</big><em>input</em>, <em>tbtype='BinTableHDU'</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.ColDefs" title="Permalink to this definition">¶</a></dt>
<dd><p>Column definitions class. It has attributes corresponding to the
Column attributes (e.g. ColDefs has the attribute .names while Column
has .name), Each attribute in ColDefs is a list of corresponding
attribute values from all Columns.</p>
<p class="rubric">Methods</p>
<dl class="method">
<dt id="pNbody.pyfits.ColDefs.add_col">
<tt class="descname">add_col</tt><big>(</big><em>column</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.ColDefs.add_col" title="Permalink to this definition">¶</a></dt>
<dd><p>Append one Column to the column definition.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.ColDefs.change_attrib">
<tt class="descname">change_attrib</tt><big>(</big><em>col_name</em>, <em>attrib</em>, <em>new_value</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.ColDefs.change_attrib" title="Permalink to this definition">¶</a></dt>
<dd><p>Change an attribute (in the commonName list) of a Column.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.ColDefs.change_name">
<tt class="descname">change_name</tt><big>(</big><em>col_name</em>, <em>new_name</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.ColDefs.change_name" title="Permalink to this definition">¶</a></dt>
<dd><p>Change a Column’s name.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.ColDefs.change_unit">
<tt class="descname">change_unit</tt><big>(</big><em>col_name</em>, <em>new_unit</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.ColDefs.change_unit" title="Permalink to this definition">¶</a></dt>
<dd><p>Change a Column’s unit.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.ColDefs.del_col">
<tt class="descname">del_col</tt><big>(</big><em>col_name</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.ColDefs.del_col" title="Permalink to this definition">¶</a></dt>
<dd><p>Delete (the definition of) one Column.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.ColDefs.info">
<tt class="descname">info</tt><big>(</big><em>attrib='all'</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.ColDefs.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Get attribute(s) information of the column definition.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.Column">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">Column</tt><big>(</big><em>name=None</em>, <em>format=None</em>, <em>unit=None</em>, <em>null=None</em>, <em>bscale=None</em>, <em>bzero=None</em>, <em>disp=None</em>, <em>start=None</em>, <em>dim=None</em>, <em>array=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.Column" title="Permalink to this definition">¶</a></dt>
<dd><p>Column class which contains the definition of one column, e.g.
ttype, tform, etc. and the array. Does not support theap yet.</p>
<p class="rubric">Methods</p>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.Delayed">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">Delayed</tt><big>(</big><em>hdu=None</em>, <em>field=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.Delayed" title="Permalink to this definition">¶</a></dt>
<dd><p>Delayed file-reading data.</p>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.ErrorURLopener">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">ErrorURLopener</tt><big>(</big><em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.ErrorURLopener" title="Permalink to this definition">¶</a></dt>
<dd><p>A class to use with urlretrieve to allow IOError exceptions to be
raised when a file specified by a URL cannot be accessed</p>
<p class="rubric">Methods</p>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.FITS_rec">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">FITS_rec</tt><a class="headerlink" href="#pNbody.pyfits.FITS_rec" title="Permalink to this definition">¶</a></dt>
<dd><p>FITS record array class. FITS record array is the data part of a
table HDU’s data part. This is a layer over the recarray, so we
can deal with scaled columns.</p>
<p class="rubric">Methods</p>
<dl class="method">
<dt id="pNbody.pyfits.FITS_rec.field">
<tt class="descname">field</tt><big>(</big><em>key</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.FITS_rec.field" title="Permalink to this definition">¶</a></dt>
<dd><p>A view of a Column’s data as an array.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.FITS_record">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">FITS_record</tt><big>(</big><em>input</em>, <em>row=0</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.FITS_record" title="Permalink to this definition">¶</a></dt>
<dd><p>FITS record class. FITS record class is used to access records of
the FITS_rec object. This will allow us to deal with scaled columns.
The FITS_record class expects a FITS_rec object as input</p>
<p class="rubric">Methods</p>
<dl class="method">
<dt id="pNbody.pyfits.FITS_record.field">
<tt class="descname">field</tt><big>(</big><em>fieldName</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.FITS_record.field" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the field data of the record.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.FITS_record.setfield">
<tt class="descname">setfield</tt><big>(</big><em>fieldName</em>, <em>value</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.FITS_record.setfield" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the field data of the record.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.GroupData">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">GroupData</tt><a class="headerlink" href="#pNbody.pyfits.GroupData" title="Permalink to this definition">¶</a></dt>
<dd><p>Random groups data object.</p>
<p>Allows structured access to FITS Group data in a manner analogous to tables</p>
<p class="rubric">Methods</p>
<dl class="method">
<dt id="pNbody.pyfits.GroupData.par">
<tt class="descname">par</tt><big>(</big><em>parName</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.GroupData.par" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the group parameter values.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.GroupData.setpar">
<tt class="descname">setpar</tt><big>(</big><em>parName</em>, <em>value</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.GroupData.setpar" title="Permalink to this definition">¶</a></dt>
<dd><p>Set the group parameter values.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.GroupsHDU">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">GroupsHDU</tt><big>(</big><em>data=None</em>, <em>header=None</em>, <em>name=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.GroupsHDU" title="Permalink to this definition">¶</a></dt>
<dd><p>FITS Random Groups HDU class.</p>
<p class="rubric">Methods</p>
<dl class="method">
<dt id="pNbody.pyfits.GroupsHDU.size">
<tt class="descname">size</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.GroupsHDU.size" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the size (in bytes) of the HDU’s data part.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.HDUList">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">HDUList</tt><big>(</big><em>hdus=</em><span class="optional">[</span><span class="optional">]</span>, <em>file=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.HDUList" title="Permalink to this definition">¶</a></dt>
<dd><p>HDU list class. This is the top-level FITS object. When a FITS
file is opened, a HDUList object is returned.</p>
<p class="rubric">Methods</p>
<dl class="method">
<dt id="pNbody.pyfits.HDUList.append">
<tt class="descname">append</tt><big>(</big><em>hdu</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.HDUList.append" title="Permalink to this definition">¶</a></dt>
<dd><p>Append a new HDU to the HDUList.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.HDUList.close">
<tt class="descname">close</tt><big>(</big><em>output_verify='exception'</em>, <em>verbose=0</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.HDUList.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Close the associated FITS file and memmap object, if any.</p>
verbose: print out verbose messages? default = 0.</p>
<p>This simply calls the close method of the _File class. It has this
two-tier calls because _File has ts own private attribute __file.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.HDUList.flush">
<tt class="descname">flush</tt><big>(</big><em>output_verify='exception'</em>, <em>verbose=0</em>, <em>classExtensions={}</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.HDUList.flush" title="Permalink to this definition">¶</a></dt>
<dd><p>Force a write of the HDUList back to the file (for append and
classExtensions: A dictionary that maps pyfits classes to extensions</p>
<blockquote>
of those classes. When present in the dictionary,
the extension class will be constructed in place of
the pyfits class.</blockquote>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.HDUList.index_of">
<tt class="descname">index_of</tt><big>(</big><em>key</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.HDUList.index_of" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the index of an HDU from the HDUList. The key can be an
integer, a string, or a tuple of (string, integer).</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.HDUList.info">
<tt class="descname">info</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.HDUList.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Summarize the info of the HDU’s in this HDUList.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.HDUList.readall">
<tt class="descname">readall</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.HDUList.readall" title="Permalink to this definition">¶</a></dt>
<dd><p>Read data of all HDU’s into memory.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.HDUList.update_extend">
<tt class="descname">update_extend</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.HDUList.update_extend" title="Permalink to this definition">¶</a></dt>
<dd><p>Make sure if the primary header needs the keyword EXTEND or if
it has the proper value.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.HDUList.update_tbhdu">
<tt class="descname">update_tbhdu</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.HDUList.update_tbhdu" title="Permalink to this definition">¶</a></dt>
<dd><p>Update all table HDU’s for scaled fields.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.HDUList.writeto">
<tt class="descname">writeto</tt><big>(</big><em>name</em>, <em>output_verify='exception'</em>, <em>clobber=False</em>, <em>classExtensions={}</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.HDUList.writeto" title="Permalink to this definition">¶</a></dt>
clobber: Overwrite the output file if exists, default = False.
classExtensions: A dictionary that maps pyfits classes to extensions</p>
<blockquote>
of those classes. When present in the dictionary,
the extension class will be constructed in place of
the pyfits class.</blockquote>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.Header">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">Header</tt><big>(</big><em>cards=</em><span class="optional">[</span><span class="optional">]</span><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header" title="Permalink to this definition">¶</a></dt>
<dd><p>FITS header class.</p>
<p class="rubric">Methods</p>
<dl class="method">
<dt id="pNbody.pyfits.Header.add_blank">
<tt class="descname">add_blank</tt><big>(</big><em>value=''</em>, <em>before=None</em>, <em>after=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.add_blank" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a blank card.</p>
<p>value: Text to be added.
before: [same as in update()]
after: [same as in update()]</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.add_comment">
<tt class="descname">add_comment</tt><big>(</big><em>value</em>, <em>before=None</em>, <em>after=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.add_comment" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a COMMENT card.</p>
<p>value: Comment text to be added.
before: [same as in update()]
after: [same as in update()]</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.add_history">
<tt class="descname">add_history</tt><big>(</big><em>value</em>, <em>before=None</em>, <em>after=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.add_history" title="Permalink to this definition">¶</a></dt>
<dd><p>Add a HISTORY card.</p>
<p>value: History text to be added.
before: [same as in update()]
after: [same as in update()]</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.ascardlist">
<tt class="descname">ascardlist</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.ascardlist" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns a CardList.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.copy">
<tt class="descname">copy</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.copy" title="Permalink to this definition">¶</a></dt>
<dd><p>Make a copy of the Header.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.get">
<tt class="descname">get</tt><big>(</big><em>key</em>, <em>default=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.get" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a keyword value from the CardList.
If no keyword is found, return the default value.</p>
<p>key: keyword name or index
default: if no keyword is found, the value to be returned.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.get_comment">
<tt class="descname">get_comment</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.get_comment" title="Permalink to this definition">¶</a></dt>
<dd><p>Get all comments as a list of string texts.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.get_history">
<tt class="descname">get_history</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.get_history" title="Permalink to this definition">¶</a></dt>
<dd><p>Get all histories as a list of string texts.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.has_key">
<tt class="descname">has_key</tt><big>(</big><em>key</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.has_key" title="Permalink to this definition">¶</a></dt>
<dd><p>Check for existence of a keyword. Returns 1 if found, otherwise, 0.</p>
<p>key: keyword name. If given an index, always returns 0.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.items">
<tt class="descname">items</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.items" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of all keyword-value pairs from the CardList.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.rename_key">
<tt class="descname">rename_key</tt><big>(</big><em>oldkey</em>, <em>newkey</em>, <em>force=0</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.rename_key" title="Permalink to this definition">¶</a></dt>
<dd><p>Rename a card’s keyword in the header.</p>
<p>oldkey: old keyword, can be a name or index.
newkey: new keyword, must be a string.
force: if new key name already exist, force to have duplicate name.</p>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.Header.update">
<tt class="descname">update</tt><big>(</big><em>key</em>, <em>value</em>, <em>comment=None</em>, <em>before=None</em>, <em>after=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.Header.update" title="Permalink to this definition">¶</a></dt>
<dd><p>Update one header card.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.ImageHDU">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">ImageHDU</tt><big>(</big><em>data=None</em>, <em>header=None</em>, <em>name=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.ImageHDU" title="Permalink to this definition">¶</a></dt>
<dd><p>FITS image extension HDU class.</p>
<p class="rubric">Methods</p>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.PrimaryHDU">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">PrimaryHDU</tt><big>(</big><em>data=None</em>, <em>header=None</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.PrimaryHDU" title="Permalink to this definition">¶</a></dt>
<dd><p>FITS primary HDU class.</p>
<p class="rubric">Methods</p>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.Section">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">Section</tt><big>(</big><em>hdu</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.Section" title="Permalink to this definition">¶</a></dt>
<dd><p>Image section.</p>
</dd></dl>
<dl class="class">
<dt id="pNbody.pyfits.StreamingHDU">
<em class="property">class </em><tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">StreamingHDU</tt><big>(</big><em>name</em>, <em>header</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.StreamingHDU" title="Permalink to this definition">¶</a></dt>
<dd><p>A class that provides the capability to stream data to a FITS file
instead of requiring data to all be written at once.</p>
<p>The following psudo code illustrates its use:</p>
<p>header = pyfits.Header()</p>
<dl class="docutils">
<dt>for all the cards you need in the header:</dt>
<tt class="descname">close</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.StreamingHDU.close" title="Permalink to this definition">¶</a></dt>
<dd><p>Close the ‘physical’ FITS file.</p>
<tt class="descname">size</tt><big>(</big><big>)</big><a class="headerlink" href="#pNbody.pyfits.StreamingHDU.size" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the size (in bytes) of the data portion of the HDU.</p>
<dd><p class="first last">The number of bytes of data required to fill the stream
per the header provided in the constructor.</p>
</dd>
</dl>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="method">
<dt id="pNbody.pyfits.StreamingHDU.write">
<tt class="descname">write</tt><big>(</big><em>data</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.StreamingHDU.write" title="Permalink to this definition">¶</a></dt>
<p>@return: an array, record array (i.e. table), or groups data object
depending on the type of the extension being referenced
If the optional keyword ‘header’ is set to True, this function will
return a (data, header) tuple.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.pyfits.getheader">
<tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">getheader</tt><big>(</big><em>filename</em>, <em>*ext</em>, <em>**extkeys</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.getheader" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the header from an extension of a FITS file.</p>
<p>@param filename: input FITS file name
@type: string
@keyword classExtensions: (optional) A dictionary that maps pyfits</p>
<blockquote>
classes to extensions of those classes. When present in the
dictionary, the extension class will be constructed in place
of the pyfits class.</blockquote>
<dl class="docutils">
<dt>@param ext: The rest of the arguments are for extension specification.</dt>
<dd>See L{getdata} for explanations/examples.</dd>
</dl>
<p>@rtype: L{Header} object
@return: header</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.pyfits.getval">
<tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">getval</tt><big>(</big><em>filename</em>, <em>key</em>, <em>*ext</em>, <em>**extkeys</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.getval" title="Permalink to this definition">¶</a></dt>
<dd><p>Get a keyword’s value from a header in a FITS file.</p>
<p>@type filename: string
@param filename: input FITS file name
@type key: string
@param key: keyword name
@keyword classExtensions: (optional) A dictionary that maps pyfits</p>
<blockquote>
classes to extensions of those classes. When present in the
dictionary, the extension class will be constructed in place
of the pyfits class.</blockquote>
<dl class="docutils">
<dt>@param ext: The rest of the arguments are for extension specification.</dt>
<dd>See L{getdata} for explanations/examples.</dd>
</dl>
<p>@return: keyword value
@rtype: string, integer, or float</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.pyfits.info">
<tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">info</tt><big>(</big><em>filename</em>, <em>classExtensions={}</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.info" title="Permalink to this definition">¶</a></dt>
<dd><p>Print the summary information on a FITS file.</p>
<p>This includes the name, type, length of header, data shape and type
for each extension.</p>
<p>@type filename: string
@param filename: input FITS file name
@type classExtensions: dictionary
@param classExtensions: A dictionary that maps pyfits classes to</p>
<blockquote>
extensions of those classes. When present in
the dictionary, the extension class will be
constructed in place of the pyfits class.</blockquote>
</dd></dl>
<dl class="function">
<dt id="pNbody.pyfits.new_table">
<tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">new_table</tt><big>(</big><em>input</em>, <em>header=None</em>, <em>nrows=0</em>, <em>fill=0</em>, <em>tbtype='BinTableHDU'</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.new_table" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a new table from the input column definitions.</p>
</dd></dl>
<dl class="function">
<dt id="pNbody.pyfits.open">
<tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">open</tt><big>(</big><em>name</em>, <em>mode='copyonwrite'</em>, <em>memmap=0</em>, <em>classExtensions={}</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.open" title="Permalink to this definition">¶</a></dt>
<dd><p>Factory function to open a FITS file and return an HDUList object.</p>
<p>name: Name of the FITS file to be opened or already opened file object.
mode: Open mode, ‘readonly’ (default), ‘update’, or ‘append’.
memmap: Is memmory mapping to be used? default=0.
classExtensions: A dictionary that maps pyfits classes to extensions of</p>
<blockquote>
those classes. When present in the dictionary, the
extension class will be constructed in place of the
pyfits class.</blockquote>
</dd></dl>
<dl class="function">
<dt id="pNbody.pyfits.update">
<tt class="descclassname">pNbody.pyfits.</tt><tt class="descname">update</tt><big>(</big><em>filename</em>, <em>data</em>, <em>*ext</em>, <em>**extkeys</em><big>)</big><a class="headerlink" href="#pNbody.pyfits.update" title="Permalink to this definition">¶</a></dt>
<dd><p>Update the specified extension with the input data/header.</p>
<p>@type filename: string
@param filename: name of the file to be updated
data: the new data used for updating
@keyword classExtensions: (optional) A dictionary that maps pyfits</p>
<blockquote>
classes to extensions of those classes. When present in the
dictionary, the extension class will be constructed in place
of the pyfits class.</blockquote>
<p>The rest of the arguments are flexible:
the 3rd argument can be the header associated with the data.
If the 3rd argument is not a header, it (and other positional
arguments) are assumed to be the extension specification(s).
Header and extension specs can also be keyword arguments.