Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > eebc325dc36bd6e3b09b9b45133e42f8 > files > 990

HippoDraw-devel-docs-1.21.1-10.fc13.i686.rpm

<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>HippoDraw Class Library</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="hippoApp.ico">
</head><body>
<!-- Generated by Doxygen 1.6.2 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="dir_f31ced79fa1bf97bbae7cff793d8fdf1.html">fits</a>
  </div>
</div>
<div class="contents">
<h1>FitsFile.cxx</h1><a href="FitsFile_8cxx.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00012"></a>00012 <span class="preprocessor">#include &quot;<a class="code" href="FitsFile_8h.html" title="hippodraw::FitsFile interface">FitsFile.h</a>&quot;</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="preprocessor">#include &quot;<a class="code" href="string__convert_8h.html" title="The namespace for conversion to string.">pattern/string_convert.h</a>&quot;</span>
<a name="l00015"></a>00015 
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;cstring&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;algorithm&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;stdexcept&gt;</span>
<a name="l00019"></a>00019 
<a name="l00020"></a>00020 <span class="preprocessor">#include &lt;cassert&gt;</span>
<a name="l00021"></a>00021 
<a name="l00022"></a>00022 <span class="keyword">using</span> std::string;
<a name="l00023"></a>00023 <span class="keyword">using</span> std::vector;
<a name="l00024"></a>00024 
<a name="l00025"></a>00025 <span class="keyword">using namespace </span>hippodraw;
<a name="l00026"></a>00026 
<a name="l00027"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a5f5de83a9183d19a19be8a98a35db170">00027</a> FitsFile::FitsFile ( <span class="keyword">const</span> std::string &amp; filename, <span class="keywordtype">bool</span> <a class="code" href="namespacehippodraw_1_1Numeric.html#a339393d88f1319ad9ae63afad77ec304" title="Given the vector it writes it to std stream.">write</a> )
<a name="l00028"></a>00028   : <a class="code" href="classhippodraw_1_1FitsFileBase.html" title="A base class for the concrete classes that wrap the cfitsio library.">FitsFileBase</a> ( filename, write )
<a name="l00029"></a>00029 {
<a name="l00030"></a>00030 }
<a name="l00031"></a>00031 
<a name="l00032"></a>00032 <span class="keywordtype">void</span>
<a name="l00033"></a>00033 <a class="code" href="classhippodraw_1_1FitsFile.html#a106a4fe1d1254143ca8acfad9d90ea23" title="Clears and fills the vector with the HDU names.">FitsFile::</a>
<a name="l00034"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a106a4fe1d1254143ca8acfad9d90ea23">00034</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a106a4fe1d1254143ca8acfad9d90ea23" title="Clears and fills the vector with the HDU names.">fillHDUNames</a> ( std::vector &lt; std::string &gt; &amp; names )
<a name="l00035"></a>00035 {
<a name="l00036"></a>00036   names.clear ();
<a name="l00037"></a>00037   <span class="keywordtype">int</span> number = <a class="code" href="classhippodraw_1_1FitsFileBase.html#addbcf323482d24d5dea44fb6416501ac" title="Returns the number of HDU in the file.">getNumberOfHDU</a> ( );
<a name="l00038"></a>00038 
<a name="l00039"></a>00039   <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; number; i++ ) {
<a name="l00040"></a>00040     <a class="code" href="classhippodraw_1_1FitsFileBase.html#a3c9252f8852a9922f60ae1174f9fb2f0" title="Move to a specified absolute HDU number in the FITS file and return the cfitsio status...">moveToHDU</a> ( i );
<a name="l00041"></a>00041     <span class="keywordtype">string</span> value = <a class="code" href="classhippodraw_1_1FitsFileBase.html#acb542016c8bb427121d07d26704a4805" title="Read a specified keyword value and returns it as a string.">stringValueForKey</a> ( <span class="stringliteral">&quot;EXTNAME&quot;</span> );
<a name="l00042"></a>00042 
<a name="l00043"></a>00043     <span class="keywordflow">if</span> ( value == <span class="stringliteral">&quot;&quot;</span> ) {
<a name="l00044"></a>00044       <span class="keywordflow">if</span> ( i == 0 ) {
<a name="l00045"></a>00045         <span class="keywordtype">int</span> number = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a0df857269fa4528cb218653240efb9d3" title="Read a specified keyword value and returns it as a int.">intValueForKey</a> ( <span class="stringliteral">&quot;NAXIS&quot;</span> );
<a name="l00046"></a>00046         <span class="keywordflow">if</span> ( number == 0 ) {
<a name="l00047"></a>00047           value = <span class="stringliteral">&quot;Empty image&quot;</span>;
<a name="l00048"></a>00048         }
<a name="l00049"></a>00049       }
<a name="l00050"></a>00050     }
<a name="l00051"></a>00051 
<a name="l00052"></a>00052     <span class="keywordflow">if</span> ( value == <span class="stringliteral">&quot;&quot;</span> ) value = <span class="stringliteral">&quot;&lt;no name&gt;&quot;</span>;
<a name="l00053"></a>00053     names.push_back ( value );
<a name="l00054"></a>00054   }
<a name="l00055"></a>00055 }
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="keywordtype">int</span>
<a name="l00058"></a>00058 <a class="code" href="classhippodraw_1_1FitsFile.html#afc54a1da0a703ad834634e38002cd7b0" title="Clears and fills the vector with the column labels of the current HDU table.">FitsFile::</a>
<a name="l00059"></a><a class="code" href="classhippodraw_1_1FitsFile.html#afc54a1da0a703ad834634e38002cd7b0">00059</a> <a class="code" href="classhippodraw_1_1FitsFile.html#afc54a1da0a703ad834634e38002cd7b0" title="Clears and fills the vector with the column labels of the current HDU table.">fillColumnNames</a> ( std::vector &lt; std::string &gt; &amp; labels )
<a name="l00060"></a>00060 {
<a name="l00061"></a>00061   <a class="code" href="classhippodraw_1_1FitsFileBase.html#a09204037a28bb5e9ae491bc1b7b78c96" title="The type of HDU.">HduType</a> <a class="code" href="namespacenum__util.html#af7e893a8c6a5f6a426480fc85cda4fa1">type</a> = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9f0dd5d5948d4d30e9ac2e71dab8279e" title="Returns the type of HDU.">getHduType</a> ();
<a name="l00062"></a>00062   <span class="keywordflow">if</span> ( type == <a class="code" href="classhippodraw_1_1Image.html" title="Displays on the Z axis the values of a single column treated as a matrix of values...">Image</a> ) {
<a name="l00063"></a>00063     <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = <a class="code" href="classhippodraw_1_1FitsFile.html#a7ac9de0c699a9c87df7ee35606078152" title="Clears and fills the vector with the column labels of a image.">fillColumnNamesFromImage</a> ( labels );
<a name="l00064"></a>00064   }
<a name="l00065"></a>00065   <span class="keywordflow">else</span> {
<a name="l00066"></a>00066     <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = <a class="code" href="classhippodraw_1_1FitsFile.html#a20d6c304f6ee8a74ac399037feb6db8f" title="Clears and fills the vector with the column labels of binary or ASCII table.">fillColumnNamesFromTable</a> ( labels );
<a name="l00067"></a>00067   }
<a name="l00068"></a>00068 
<a name="l00069"></a>00069   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a>;
<a name="l00070"></a>00070 }
<a name="l00071"></a>00071 
<a name="l00072"></a>00072 <span class="keywordtype">int</span>
<a name="l00073"></a>00073 <a class="code" href="classhippodraw_1_1FitsFile.html#a20d6c304f6ee8a74ac399037feb6db8f" title="Clears and fills the vector with the column labels of binary or ASCII table.">FitsFile::</a>
<a name="l00074"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a20d6c304f6ee8a74ac399037feb6db8f">00074</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a20d6c304f6ee8a74ac399037feb6db8f" title="Clears and fills the vector with the column labels of binary or ASCII table.">fillColumnNamesFromTable</a> ( std::vector &lt; std::string &gt; &amp; labels )
<a name="l00075"></a>00075 {
<a name="l00076"></a>00076   labels.clear ();
<a name="l00077"></a>00077   <span class="keywordtype">int</span> columns = <a class="code" href="classhippodraw_1_1FitsFileBase.html#ae42967e4d735061505ec6cde5e7b28eb" title="Returns the number of columns in a table.">getNumberOfColumns</a> ();
<a name="l00078"></a>00078 
<a name="l00079"></a>00079   <span class="keywordflow">if</span> ( columns != 0 ) {
<a name="l00080"></a>00080     <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = 0; <span class="comment">// must NOT be reset on each fits call, else matchs</span>
<a name="l00081"></a>00081                   <span class="comment">// same column on each call</span>
<a name="l00082"></a>00082     <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; columns; i++ ) { <span class="comment">// count like Fortran</span>
<a name="l00083"></a>00083       <span class="keywordtype">char</span> colname [ FLEN_VALUE ];
<a name="l00084"></a>00084       <span class="keywordtype">int</span> col;
<a name="l00085"></a>00085       fits_get_colname ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, CASEINSEN, const_cast&lt; char * &gt; (<span class="stringliteral">&quot;*&quot;</span>),
<a name="l00086"></a>00086                          colname, &amp;col, &amp;<a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00087"></a>00087       labels.push_back ( <span class="keywordtype">string</span> ( colname ) );
<a name="l00088"></a>00088     }
<a name="l00089"></a>00089   }
<a name="l00090"></a>00090   <span class="keywordflow">else</span> { <span class="comment">// must be image</span>
<a name="l00091"></a>00091     labels.push_back ( <span class="keywordtype">string</span> ( <span class="stringliteral">&quot;none&quot;</span> ) );
<a name="l00092"></a>00092   }
<a name="l00093"></a>00093 
<a name="l00094"></a>00094   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a>;
<a name="l00095"></a>00095 }
<a name="l00096"></a>00096 
<a name="l00097"></a>00097 <span class="keywordtype">int</span>
<a name="l00098"></a>00098 <a class="code" href="classhippodraw_1_1FitsFile.html#a7ac9de0c699a9c87df7ee35606078152" title="Clears and fills the vector with the column labels of a image.">FitsFile::</a>
<a name="l00099"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a7ac9de0c699a9c87df7ee35606078152">00099</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a7ac9de0c699a9c87df7ee35606078152" title="Clears and fills the vector with the column labels of a image.">fillColumnNamesFromImage</a> ( std::vector &lt; std::string &gt; &amp; labels )
<a name="l00100"></a>00100 {
<a name="l00101"></a>00101   labels.clear ();
<a name="l00102"></a>00102   <span class="keywordtype">int</span> dimension = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a2aa2f714585973dc2d3ec0b6649a0a8a" title="Returns the number of dimensions (axes) of an image.">getImageDimensions</a> ();
<a name="l00103"></a>00103   <span class="keywordflow">if</span> ( dimension == 2 ) {
<a name="l00104"></a>00104     labels.push_back ( <span class="stringliteral">&quot;Values&quot;</span> );
<a name="l00105"></a>00105   }
<a name="l00106"></a>00106   <span class="keywordflow">else</span> <span class="keywordflow">if</span> ( dimension == 3 ) {
<a name="l00107"></a>00107     <span class="keyword">const</span> <span class="keywordtype">char</span> <a class="code" href="namespacenum__util.html#af7e893a8c6a5f6a426480fc85cda4fa1">type</a>[] = <span class="stringliteral">&quot;CTYPE3&quot;</span>;
<a name="l00108"></a>00108     <span class="keywordtype">bool</span> yes = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a85107333ac3fd32889e6a5c2d9cec948" title="Returns true if the keyword key exists, otherwise returns false.">hasKey</a> ( type );
<a name="l00109"></a>00109     <span class="keywordflow">if</span> ( yes ) {
<a name="l00110"></a>00110       <span class="keyword">const</span> <span class="keywordtype">string</span> name = <a class="code" href="classhippodraw_1_1FitsFileBase.html#acb542016c8bb427121d07d26704a4805" title="Read a specified keyword value and returns it as a string.">stringValueForKey</a> ( type );
<a name="l00111"></a>00111       <span class="keywordtype">int</span> number = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a0df857269fa4528cb218653240efb9d3" title="Read a specified keyword value and returns it as a int.">intValueForKey</a> ( <span class="stringliteral">&quot;NAXIS3&quot;</span> );
<a name="l00112"></a>00112       <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; number; i++ ) {
<a name="l00113"></a>00113         <span class="keyword">const</span> <span class="keywordtype">string</span> iv = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a6de66d7d917a1b1335ad6ac23cfe85ca" title="Converts an integer to HduType.">String::convert</a> ( i );
<a name="l00114"></a>00114         labels.push_back ( name + <span class="stringliteral">&quot; &quot;</span> + iv );
<a name="l00115"></a>00115       }
<a name="l00116"></a>00116     }
<a name="l00117"></a>00117   }
<a name="l00118"></a>00118     
<a name="l00119"></a>00119   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a>;
<a name="l00120"></a>00120 }
<a name="l00121"></a>00121 
<a name="l00122"></a>00122 <span class="keywordtype">int</span>
<a name="l00123"></a>00123 <a class="code" href="classhippodraw_1_1FitsFile.html#a17b131b757e3540fbe3cd2a61ba3ca94" title="Read elements from an ASCII or binary table column (in the CDU) and fill the vector...">FitsFile::</a>
<a name="l00124"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a17b131b757e3540fbe3cd2a61ba3ca94">00124</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a17b131b757e3540fbe3cd2a61ba3ca94" title="Read elements from an ASCII or binary table column (in the CDU) and fill the vector...">fillDoubleVectorFromColumn</a> ( std::vector &lt; double &gt; &amp; <a class="codeRef" doxygen="Minuit.tag:http://seal.web.cern.ch/seal/MathLibs/Minuit/html/" href="http://seal.web.cern.ch/seal/MathLibs/Minuit/html/classvec.html">vec</a>,
<a name="l00125"></a>00125                              <span class="keywordtype">int</span> <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a> )
<a name="l00126"></a>00126 {
<a name="l00127"></a>00127   <span class="keywordtype">int</span> retval = 0;
<a name="l00128"></a>00128 
<a name="l00129"></a>00129   <a class="code" href="classhippodraw_1_1FitsFileBase.html#a09204037a28bb5e9ae491bc1b7b78c96" title="The type of HDU.">HduType</a> <a class="code" href="namespacenum__util.html#af7e893a8c6a5f6a426480fc85cda4fa1">type</a> = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9f0dd5d5948d4d30e9ac2e71dab8279e" title="Returns the type of HDU.">getHduType</a> ();
<a name="l00130"></a>00130   <span class="keywordflow">if</span> ( type == <a class="code" href="classhippodraw_1_1FitsFileBase.html#a09204037a28bb5e9ae491bc1b7b78c96a31d79f73ab05b7644e6272a6920b40b6" title="Binary table.">Btable</a> || type == <a class="code" href="classhippodraw_1_1FitsFileBase.html#a09204037a28bb5e9ae491bc1b7b78c96ac13ff13e10de52fac596e8007cc1be56" title="ASCII table.">Atable</a> ) {
<a name="l00131"></a>00131     retval = <a class="code" href="classhippodraw_1_1FitsFile.html#a352148cbfab7917c0c269dc4ecd1c2f7" title="Fills the vector v from a table column.">fillFromTableColumn</a> ( vec, column );
<a name="l00132"></a>00132   }
<a name="l00133"></a>00133   <span class="keywordflow">else</span> {
<a name="l00134"></a>00134     retval = <a class="code" href="classhippodraw_1_1FitsFile.html#a786d481db05fbbf51622060e25ba6dfc" title="Fills the vector vec from an image HDU.">fillFromImage</a> ( vec, column );
<a name="l00135"></a>00135   }
<a name="l00136"></a>00136 
<a name="l00137"></a>00137   <span class="keywordflow">return</span> retval;
<a name="l00138"></a>00138 }
<a name="l00139"></a>00139 
<a name="l00140"></a>00140 <span class="keywordtype">int</span>
<a name="l00141"></a>00141 <a class="code" href="classhippodraw_1_1FitsFile.html#a352148cbfab7917c0c269dc4ecd1c2f7" title="Fills the vector v from a table column.">FitsFile::</a>
<a name="l00142"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a352148cbfab7917c0c269dc4ecd1c2f7">00142</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a352148cbfab7917c0c269dc4ecd1c2f7" title="Fills the vector v from a table column.">fillFromTableColumn</a> ( std::vector &lt; double &gt; &amp; <a class="codeRef" doxygen="Minuit.tag:http://seal.web.cern.ch/seal/MathLibs/Minuit/html/" href="http://seal.web.cern.ch/seal/MathLibs/Minuit/html/classvec.html">vec</a>, <span class="keywordtype">int</span> <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a> )
<a name="l00143"></a>00143 {
<a name="l00144"></a>00144   <span class="keywordtype">int</span> anynul;
<a name="l00145"></a>00145   <span class="keywordtype">double</span> nulval = 0;
<a name="l00146"></a>00146   <span class="keywordtype">long</span> nelements = vec.size();
<a name="l00147"></a>00147   vector&lt;double&gt;::iterator it = vec.begin();
<a name="l00148"></a>00148   <span class="keywordtype">double</span> * ptr = &amp;*it;
<a name="l00149"></a>00149   <span class="comment">// Careful, counting columns like Fortran</span>
<a name="l00150"></a>00150   <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = 0;
<a name="l00151"></a>00151   fits_read_col_dbl( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, column+1, 1, 1, nelements, nulval,
<a name="l00152"></a>00152                      ptr, &amp;anynul, &amp;<a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a>);
<a name="l00153"></a>00153 
<a name="l00154"></a>00154   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a>;
<a name="l00155"></a>00155 }
<a name="l00156"></a>00156 
<a name="l00157"></a>00157 <span class="keywordtype">void</span>
<a name="l00158"></a>00158 <a class="code" href="classhippodraw_1_1FitsFile.html#a43d04e98396c75374162531e5f14065a" title="Fills the vector with the shape of the column.">FitsFile::</a>
<a name="l00159"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a43d04e98396c75374162531e5f14065a">00159</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a43d04e98396c75374162531e5f14065a" title="Fills the vector with the shape of the column.">fillShape</a> ( std::vector &lt; intptr_t &gt; &amp; <a class="code" href="namespacenum__util.html#a8570d9b34e8e9d714823c1b1986764f7">shape</a>, <span class="keywordtype">int</span> <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a> )
<a name="l00160"></a>00160 {
<a name="l00161"></a>00161   <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = 0;  <span class="comment">// must always set</span>
<a name="l00162"></a>00162 
<a name="l00163"></a>00163   <span class="keywordtype">string</span> tdimn ( <span class="stringliteral">&quot;TDIM&quot;</span> );
<a name="l00164"></a>00164   tdimn += <a class="code" href="classhippodraw_1_1FitsFileBase.html#a6de66d7d917a1b1335ad6ac23cfe85ca" title="Converts an integer to HduType.">String::convert</a> ( column+1 ); <span class="comment">// a la Fortran</span>
<a name="l00165"></a>00165   <span class="keywordtype">char</span> value[80]; <span class="comment">// max length of keyword record</span>
<a name="l00166"></a>00166   fits_read_keyword ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>,
<a name="l00167"></a>00167                       const_cast &lt; char * &gt; ( tdimn.c_str() ),
<a name="l00168"></a>00168                       value,
<a name="l00169"></a>00169                       NULL, &amp; <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00170"></a>00170 
<a name="l00171"></a>00171   <span class="keywordtype">long</span> rows = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a66a062407748e4df52a5632d99607719" title="Returns the number of rows in the table.">getNumberOfRows</a> ();
<a name="l00172"></a>00172   <span class="keywordflow">if</span> ( value[0] != 0 ) {
<a name="l00173"></a>00173     <span class="keyword">const</span> <span class="keywordtype">string</span> dims = value;
<a name="l00174"></a>00174     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> count = std::count ( dims.begin(), dims.end(), <span class="charliteral">&#39;,&#39;</span> );
<a name="l00175"></a>00175     count += 1; <span class="comment">// one for simple vector</span>
<a name="l00176"></a>00176     <span class="keywordtype">int</span> icount = 0;
<a name="l00177"></a>00177     vector &lt; long &gt; naxes ( count );
<a name="l00178"></a>00178     fits_read_tdim ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, column+1, count, <span class="comment">// input</span>
<a name="l00179"></a>00179                      &amp;icount,  &amp;naxes[0], &amp; <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> ); <span class="comment">//output</span>
<a name="l00180"></a>00180     shape.resize ( count + 1 );
<a name="l00181"></a>00181     shape [0] = rows;
<a name="l00182"></a>00182     std::copy ( naxes.begin(), naxes.end(), shape.begin() + 1 );
<a name="l00183"></a>00183   }
<a name="l00184"></a>00184   <span class="keywordflow">else</span> { <span class="comment">// no array</span>
<a name="l00185"></a>00185     shape.resize ( 1, rows );
<a name="l00186"></a>00186   }
<a name="l00187"></a>00187 }
<a name="l00188"></a>00188 
<a name="l00189"></a>00189 <span class="keywordtype">int</span>
<a name="l00190"></a>00190 <a class="code" href="classhippodraw_1_1FitsFile.html#af1b4314998e48919a461f779f7608de3" title="Clears and fills the vector vec with the size of each dimension of an image.">FitsFile::</a>
<a name="l00191"></a><a class="code" href="classhippodraw_1_1FitsFile.html#af1b4314998e48919a461f779f7608de3">00191</a> <a class="code" href="classhippodraw_1_1FitsFile.html#af1b4314998e48919a461f779f7608de3" title="Clears and fills the vector vec with the size of each dimension of an image.">fillAxisSizes</a> ( std::vector &lt; long &gt; &amp; <a class="codeRef" doxygen="Minuit.tag:http://seal.web.cern.ch/seal/MathLibs/Minuit/html/" href="http://seal.web.cern.ch/seal/MathLibs/Minuit/html/classvec.html">vec</a> )<span class="keyword"> const</span>
<a name="l00192"></a>00192 <span class="keyword"></span>{
<a name="l00193"></a>00193   vec.clear ();
<a name="l00194"></a>00194   <span class="keywordtype">int</span> naxis = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a2aa2f714585973dc2d3ec0b6649a0a8a" title="Returns the number of dimensions (axes) of an image.">getImageDimensions</a> ();
<a name="l00195"></a>00195   vec.resize ( naxis );
<a name="l00196"></a>00196 
<a name="l00197"></a>00197   vector &lt; long &gt; ::iterator first = vec.begin();
<a name="l00198"></a>00198   <span class="keywordtype">long</span> * ptr = &amp; *first;
<a name="l00199"></a>00199   <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = 0;
<a name="l00200"></a>00200   fits_get_img_size ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, naxis, ptr, &amp; <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00201"></a>00201   assert ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> == 0 );
<a name="l00202"></a>00202 
<a name="l00203"></a>00203   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a>;
<a name="l00204"></a>00204 }
<a name="l00205"></a>00205 
<a name="l00206"></a>00206 <span class="keywordtype">void</span>
<a name="l00207"></a>00207 <a class="code" href="classhippodraw_1_1FitsFile.html#a86a0d45b3169ca9c06d5bb0c359ecffb" title="Clears and fills the vector with the delta values of an image.">FitsFile::</a>
<a name="l00208"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a86a0d45b3169ca9c06d5bb0c359ecffb">00208</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a86a0d45b3169ca9c06d5bb0c359ecffb" title="Clears and fills the vector with the delta values of an image.">fillImageDeltas</a> ( std::vector &lt; double &gt; &amp; deltas )<span class="keyword"> const</span>
<a name="l00209"></a>00209 <span class="keyword"></span>{
<a name="l00210"></a>00210   deltas.clear ();
<a name="l00211"></a>00211   <span class="keywordtype">int</span> naxis = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a2aa2f714585973dc2d3ec0b6649a0a8a" title="Returns the number of dimensions (axes) of an image.">getImageDimensions</a> ();
<a name="l00212"></a>00212   deltas.reserve ( naxis );
<a name="l00213"></a>00213 
<a name="l00214"></a>00214   <span class="keywordtype">char</span> key [ FLEN_KEYWORD];
<a name="l00215"></a>00215   <span class="keywordtype">char</span> * keyroot = const_cast &lt; <span class="keywordtype">char</span> * &gt; (<span class="stringliteral">&quot;CDELT&quot;</span>);
<a name="l00216"></a>00216   <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; naxis; i++ ) {
<a name="l00217"></a>00217     <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = 0;
<a name="l00218"></a>00218     fits_make_keyn ( keyroot, i+1, key, &amp; <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00219"></a>00219     <span class="keywordtype">bool</span> yes = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a85107333ac3fd32889e6a5c2d9cec948" title="Returns true if the keyword key exists, otherwise returns false.">hasKey</a> ( key );
<a name="l00220"></a>00220 
<a name="l00221"></a>00221     <span class="keywordflow">if</span> ( yes ) {
<a name="l00222"></a>00222       <span class="keywordtype">double</span> value = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a5406f5a1c59dc990c83811b138c61623" title="Read a specified keyword value and return it as a double.">doubleValueForKey</a> ( key );
<a name="l00223"></a>00223       deltas.push_back ( value );
<a name="l00224"></a>00224     }
<a name="l00225"></a>00225     <span class="keywordflow">else</span> { <span class="comment">// no key, take default</span>
<a name="l00226"></a>00226       deltas.push_back ( 1.0 );
<a name="l00227"></a>00227     }
<a name="l00228"></a>00228   }
<a name="l00229"></a>00229 }
<a name="l00230"></a>00230 
<a name="l00231"></a>00231 <span class="keywordtype">void</span>
<a name="l00232"></a>00232 <a class="code" href="classhippodraw_1_1FitsFile.html#a8ebf43586ceea7791630f4ca1dbdc432" title="Clears and fills the vector with the reference pixel&amp;#39;s indexes.">FitsFile::</a>
<a name="l00233"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a8ebf43586ceea7791630f4ca1dbdc432">00233</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a8ebf43586ceea7791630f4ca1dbdc432" title="Clears and fills the vector with the reference pixel&amp;#39;s indexes.">fillRefPixelIndices</a> ( std::vector &lt; int &gt; &amp; indices )<span class="keyword"> const</span>
<a name="l00234"></a>00234 <span class="keyword"></span>{
<a name="l00235"></a>00235   indices.clear ();
<a name="l00236"></a>00236   <span class="keywordtype">int</span> naxis = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a2aa2f714585973dc2d3ec0b6649a0a8a" title="Returns the number of dimensions (axes) of an image.">getImageDimensions</a> ();
<a name="l00237"></a>00237   indices.reserve ( naxis );
<a name="l00238"></a>00238 
<a name="l00239"></a>00239   <span class="keywordtype">char</span> key [ FLEN_KEYWORD];
<a name="l00240"></a>00240   <span class="keywordtype">char</span> * keyroot = const_cast &lt; <span class="keywordtype">char</span> * &gt; ( <span class="stringliteral">&quot;CRPIX&quot;</span> );
<a name="l00241"></a>00241   <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; naxis; i++ ) {
<a name="l00242"></a>00242     <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = 0;
<a name="l00243"></a>00243     fits_make_keyn ( keyroot, i+1, key, &amp; <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00244"></a>00244     <span class="keywordtype">bool</span> yes = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a85107333ac3fd32889e6a5c2d9cec948" title="Returns true if the keyword key exists, otherwise returns false.">hasKey</a> ( key );
<a name="l00245"></a>00245 
<a name="l00246"></a>00246     <span class="keywordflow">if</span> ( yes ) {
<a name="l00247"></a>00247       <span class="keywordtype">int</span> value = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a0df857269fa4528cb218653240efb9d3" title="Read a specified keyword value and returns it as a int.">intValueForKey</a> ( key );
<a name="l00248"></a>00248       indices.push_back ( value );
<a name="l00249"></a>00249     }
<a name="l00250"></a>00250     <span class="keywordflow">else</span> { <span class="comment">// no key, take default</span>
<a name="l00251"></a>00251       indices.push_back ( 1 );
<a name="l00252"></a>00252     }
<a name="l00253"></a>00253   }
<a name="l00254"></a>00254 }
<a name="l00255"></a>00255 
<a name="l00256"></a>00256 <span class="keywordtype">void</span>
<a name="l00257"></a>00257 <a class="code" href="classhippodraw_1_1FitsFile.html#a5a5862c0df1c0290af9fb24a4a28439d" title="Clears and fills the vector with the reference pixel&amp;#39;s values.">FitsFile::</a>
<a name="l00258"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a5a5862c0df1c0290af9fb24a4a28439d">00258</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a5a5862c0df1c0290af9fb24a4a28439d" title="Clears and fills the vector with the reference pixel&amp;#39;s values.">fillRefPixelValues</a> ( std::vector &lt; double &gt; &amp; values )<span class="keyword"> const</span>
<a name="l00259"></a>00259 <span class="keyword"></span>{
<a name="l00260"></a>00260   values.clear ();
<a name="l00261"></a>00261   <span class="keywordtype">int</span> naxis = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a2aa2f714585973dc2d3ec0b6649a0a8a" title="Returns the number of dimensions (axes) of an image.">getImageDimensions</a> ();
<a name="l00262"></a>00262   values.reserve ( naxis );
<a name="l00263"></a>00263 
<a name="l00264"></a>00264   <span class="keywordtype">char</span> key [ FLEN_KEYWORD];
<a name="l00265"></a>00265   <span class="keywordtype">char</span> * keyroot = const_cast &lt; <span class="keywordtype">char</span> * &gt; ( <span class="stringliteral">&quot;CRVAL&quot;</span> );
<a name="l00266"></a>00266   <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; naxis; i++ ) {
<a name="l00267"></a>00267     <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = 0;
<a name="l00268"></a>00268     fits_make_keyn ( keyroot, i+1, key, &amp; <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00269"></a>00269     <span class="keywordtype">bool</span> yes = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a85107333ac3fd32889e6a5c2d9cec948" title="Returns true if the keyword key exists, otherwise returns false.">hasKey</a> ( key );
<a name="l00270"></a>00270 
<a name="l00271"></a>00271     <span class="keywordflow">if</span> ( yes ) {
<a name="l00272"></a>00272       <span class="keywordtype">double</span> value = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a5406f5a1c59dc990c83811b138c61623" title="Read a specified keyword value and return it as a double.">doubleValueForKey</a> ( key );
<a name="l00273"></a>00273       values.push_back ( value );
<a name="l00274"></a>00274     }
<a name="l00275"></a>00275     <span class="keywordflow">else</span> { <span class="comment">// no key, take default</span>
<a name="l00276"></a>00276       values.push_back ( 0. );
<a name="l00277"></a>00277     }
<a name="l00278"></a>00278   }
<a name="l00279"></a>00279 }
<a name="l00280"></a>00280 
<a name="l00281"></a>00281 <span class="keywordtype">bool</span>
<a name="l00282"></a>00282 <a class="code" href="classhippodraw_1_1FitsFile.html#a3ecbe00e1419aab8771052b080fe2c45" title="Returns true if coordinate system of the axis is should undergo Hammer-Aitoff transformation...">FitsFile::</a>
<a name="l00283"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a3ecbe00e1419aab8771052b080fe2c45">00283</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a3ecbe00e1419aab8771052b080fe2c45" title="Returns true if coordinate system of the axis is should undergo Hammer-Aitoff transformation...">isHammerAitoff</a> ()<span class="keyword"> const</span>
<a name="l00284"></a>00284 <span class="keyword"></span>{
<a name="l00285"></a>00285   <span class="keywordtype">bool</span> hammer = <span class="keyword">true</span>;
<a name="l00286"></a>00286 
<a name="l00287"></a>00287   <span class="keywordtype">char</span> key [FLEN_KEYWORD];
<a name="l00288"></a>00288   <span class="keywordtype">char</span> * keyroot = const_cast &lt; <span class="keywordtype">char</span> * &gt; ( <span class="stringliteral">&quot;CTYPE&quot;</span> );
<a name="l00289"></a>00289   <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; 2; i++ ) {
<a name="l00290"></a>00290     fits_make_keyn ( keyroot, i+1, key, &amp; <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00291"></a>00291     <span class="keywordtype">bool</span> yes = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a85107333ac3fd32889e6a5c2d9cec948" title="Returns true if the keyword key exists, otherwise returns false.">hasKey</a> ( key );
<a name="l00292"></a>00292 
<a name="l00293"></a>00293     <span class="keywordflow">if</span> ( yes ) {
<a name="l00294"></a>00294       <span class="keywordtype">string</span> value = <a class="code" href="classhippodraw_1_1FitsFileBase.html#acb542016c8bb427121d07d26704a4805" title="Read a specified keyword value and returns it as a string.">stringValueForKey</a> ( key );
<a name="l00295"></a>00295       <span class="keywordflow">if</span> ( value.find ( <span class="stringliteral">&quot;-AIT&quot;</span> ) == string::npos ) {
<a name="l00296"></a>00296         hammer = <span class="keyword">false</span>;
<a name="l00297"></a>00297       }
<a name="l00298"></a>00298     } <span class="keywordflow">else</span> {
<a name="l00299"></a>00299       hammer = <span class="keyword">false</span>;
<a name="l00300"></a>00300     }
<a name="l00301"></a>00301   }
<a name="l00302"></a>00302 
<a name="l00303"></a>00303   <span class="keywordflow">return</span> hammer;
<a name="l00304"></a>00304 }
<a name="l00305"></a>00305 
<a name="l00306"></a>00306 <span class="keywordtype">int</span>
<a name="l00307"></a>00307 <a class="code" href="classhippodraw_1_1FitsFile.html#a786d481db05fbbf51622060e25ba6dfc" title="Fills the vector vec from an image HDU.">FitsFile::</a>
<a name="l00308"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a786d481db05fbbf51622060e25ba6dfc">00308</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a786d481db05fbbf51622060e25ba6dfc" title="Fills the vector vec from an image HDU.">fillFromImage</a> ( std::vector &lt; double &gt; &amp; <a class="codeRef" doxygen="Minuit.tag:http://seal.web.cern.ch/seal/MathLibs/Minuit/html/" href="http://seal.web.cern.ch/seal/MathLibs/Minuit/html/classvec.html">vec</a>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> zplane )
<a name="l00309"></a>00309 {
<a name="l00310"></a>00310   vector &lt; long &gt; naxes;
<a name="l00311"></a>00311   <a class="code" href="classhippodraw_1_1FitsFile.html#af1b4314998e48919a461f779f7608de3" title="Clears and fills the vector vec with the size of each dimension of an image.">fillAxisSizes</a> ( naxes );
<a name="l00312"></a>00312 
<a name="l00313"></a>00313   <span class="keywordtype">int</span> datatype = <a class="code" href="classhippodraw_1_1FitsFileBase.html#ad8ed01ff3ff33333d8e19db4d2818bb6afb7825ebed9ad96348ee8588d84db633" title="64 bit floating point">Double</a>;
<a name="l00314"></a>00314   <span class="keywordtype">long</span> nelements = naxes[0] * naxes[1];
<a name="l00315"></a>00315   <span class="keywordtype">double</span> nulval = 0;
<a name="l00316"></a>00316   vector &lt; double &gt;::iterator first = vec.begin();
<a name="l00317"></a>00317   <span class="keywordtype">double</span> * ptr = &amp; *first;
<a name="l00318"></a>00318   <span class="keywordtype">int</span> anynul;
<a name="l00319"></a>00319   <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = 0;
<a name="l00320"></a>00320   <span class="keywordflow">if</span> ( naxes.size () == 2 ) {
<a name="l00321"></a>00321     <span class="keywordtype">long</span> fpixel[2] = { 1, 1 }; <span class="comment">// index like Fortran</span>
<a name="l00322"></a>00322     fits_read_pix ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, datatype, fpixel, nelements,
<a name="l00323"></a>00323                     &amp; nulval, ptr, &amp; anynul, &amp; <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00324"></a>00324   } <span class="keywordflow">else</span> {
<a name="l00325"></a>00325     <span class="keywordtype">long</span> fpixel[] = { 1, 1, 1 }; <span class="comment">// index like Fortran</span>
<a name="l00326"></a>00326     fpixel[2] = zplane + 1; <span class="comment">// like Fortran</span>
<a name="l00327"></a>00327     fits_read_pix ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, datatype, fpixel, nelements,
<a name="l00328"></a>00328                     &amp; nulval, ptr, &amp; anynul, &amp; <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00329"></a>00329   }
<a name="l00330"></a>00330 
<a name="l00331"></a>00331   <span class="keywordflow">return</span> <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a>;
<a name="l00332"></a>00332 }
<a name="l00333"></a>00333 
<a name="l00334"></a>00334 <span class="keywordtype">int</span>
<a name="l00335"></a>00335 <a class="code" href="classhippodraw_1_1FitsFile.html#a952e2d2261656fc496777e16912337fb" title="Read elements from an ASCII or binary table column (in the CDU) and fill STL vector&amp;lt;int&amp;gt;...">FitsFile::</a>
<a name="l00336"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a952e2d2261656fc496777e16912337fb">00336</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a952e2d2261656fc496777e16912337fb" title="Read elements from an ASCII or binary table column (in the CDU) and fill STL vector&amp;lt;int&amp;gt;...">fillIntVectorFromColumn</a>( std::vector &lt; int &gt; &amp; <a class="codeRef" doxygen="Minuit.tag:http://seal.web.cern.ch/seal/MathLibs/Minuit/html/" href="http://seal.web.cern.ch/seal/MathLibs/Minuit/html/classvec.html">vec</a>, <span class="keywordtype">int</span> <a class="code" href="namespacehippodraw_1_1DataPoint2DTuple.html#ae78e6e11a40e6dba1bae097358f97d15" title="The column indices for 2 dimension data point tuple.">column</a> )
<a name="l00337"></a>00337 {
<a name="l00338"></a>00338   <span class="keywordtype">int</span> anynul, <a class="code" href="classhippodraw_1_1FitsFileBase.html#a8bcf950a774cbd3106d4c68d3b2f38c9" title="Returns the cfitsio status code for the last operation.">status</a> = 0;
<a name="l00339"></a>00339   <span class="keywordtype">int</span> nulval = 0;
<a name="l00340"></a>00340   <span class="keywordtype">long</span> nelements = vec.size();
<a name="l00341"></a>00341   vector&lt;int&gt;::iterator it = vec.begin();
<a name="l00342"></a>00342   <span class="keywordtype">int</span> * ptr = <span class="keyword">new</span> <span class="keywordtype">int</span> [ nelements ];
<a name="l00343"></a>00343   <span class="comment">// Careful, counting columns like Fortran</span>
<a name="l00344"></a>00344   <a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> = 0;
<a name="l00345"></a>00345   fits_read_col_int( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, column+1, 1, 1, nelements, nulval,
<a name="l00346"></a>00346                      ptr, &amp;anynul, &amp;status);
<a name="l00347"></a>00347   copy ( ptr, ptr+nelements, it );
<a name="l00348"></a>00348 
<a name="l00349"></a>00349   <span class="keywordflow">return</span> status;
<a name="l00350"></a>00350 }
<a name="l00351"></a>00351 
<a name="l00352"></a>00352 <span class="keywordtype">void</span>
<a name="l00353"></a>00353 <a class="code" href="classhippodraw_1_1FitsFile.html#a96b37b4edb90bb374357a4e357ffd2ea">FitsFile::</a>
<a name="l00354"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a96b37b4edb90bb374357a4e357ffd2ea">00354</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a96b37b4edb90bb374357a4e357ffd2ea">writeHDU</a> ( <span class="keywordtype">long</span> rows, <span class="keywordtype">int</span> columns, 
<a name="l00355"></a>00355            <span class="keyword">const</span> std::vector &lt; std::string &gt; &amp; names,
<a name="l00356"></a>00356            <span class="keyword">const</span> std::vector &lt; std::vector &lt; int &gt; &gt; &amp; shapes,
<a name="l00357"></a>00357            <span class="keyword">const</span> std::string &amp; extname )
<a name="l00358"></a>00358 {
<a name="l00359"></a>00359   <span class="keywordtype">char</span> ** <a class="code" href="namespacehippodraw_1_1Axes.html#a95297d89b70967ab37e9333ec7a48dca" title="An array to allow conversion of integer to enumeration.">types</a> = <span class="keyword">new</span> <span class="keywordtype">char</span> * [ columns ];
<a name="l00360"></a>00360   <span class="keywordtype">char</span> ** tform = <span class="keyword">new</span> <span class="keywordtype">char</span> * [ columns ];
<a name="l00361"></a>00361   <span class="keywordtype">char</span> ** tunits = 0;
<a name="l00362"></a>00362   <span class="keywordtype">char</span> * m_extname;
<a name="l00363"></a>00363 
<a name="l00364"></a>00364   vector &lt; string &gt; forms;  
<a name="l00365"></a>00365   <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; columns; i ++ ) {
<a name="l00366"></a>00366     types[i]=<span class="keyword">const_cast&lt;</span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span> (names[i].c_str());
<a name="l00367"></a>00367     <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a137f48a49d12a7dae8ba7c86db2a0c01">size</a> = 1;
<a name="l00368"></a>00368     <span class="keyword">const</span> vector &lt; int &gt; &amp; <a class="code" href="namespacenum__util.html#a8570d9b34e8e9d714823c1b1986764f7">shape</a> = shapes [ i ];
<a name="l00369"></a>00369     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a59851d76f9624ac3de899f818f9e0a6b">rank</a> = shape.size();
<a name="l00370"></a>00370     <span class="keywordflow">if</span> ( rank &gt; 1 ) {
<a name="l00371"></a>00371       <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j = 1; j &lt; rank; j++ ) { <span class="comment">// strip row index</span>
<a name="l00372"></a>00372         <span class="keywordtype">int</span> dim = shape [ j ];
<a name="l00373"></a>00373         size *= dim;
<a name="l00374"></a>00374       }
<a name="l00375"></a>00375     }
<a name="l00376"></a>00376     <span class="keywordtype">string</span> form = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a6de66d7d917a1b1335ad6ac23cfe85ca" title="Converts an integer to HduType.">String::convert</a> ( size );
<a name="l00377"></a>00377     form += <span class="stringliteral">&quot;D&quot;</span>;
<a name="l00378"></a>00378     forms.push_back ( form );
<a name="l00379"></a>00379 <span class="comment">//    unsigned int n = form.size();</span>
<a name="l00380"></a>00380     tform[i] = strdup ( form.c_str() );
<a name="l00381"></a>00381 
<a name="l00382"></a>00382 <span class="comment">//    tform [i] = const_cast &lt;char *&gt; ( forms[i].c_str() ); // will stay in scope</span>
<a name="l00383"></a>00383   }
<a name="l00384"></a>00384 
<a name="l00385"></a>00385   m_extname = <span class="keyword">const_cast&lt;</span><span class="keywordtype">char</span>*<span class="keyword">&gt;</span> (extname.c_str());
<a name="l00386"></a>00386 
<a name="l00387"></a>00387   fits_create_tbl( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, BINARY_TBL, 0, columns, 
<a name="l00388"></a>00388                    types, tform, tunits, m_extname, &amp;<a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a>);
<a name="l00389"></a>00389 <span class="comment">//fits_report_error ( stdout, m_status );</span>
<a name="l00390"></a>00390   <span class="keywordflow">for</span> ( <span class="keywordtype">int</span> i = 0; i &lt; columns; i ++ ) {
<a name="l00391"></a>00391     <span class="keyword">const</span> vector &lt; int &gt; &amp; <a class="code" href="namespacenum__util.html#a8570d9b34e8e9d714823c1b1986764f7">shape</a> = shapes [ i ];
<a name="l00392"></a>00392     <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="namespacenum__util.html#a59851d76f9624ac3de899f818f9e0a6b">rank</a> = shape.size();
<a name="l00393"></a>00393     <span class="keywordflow">if</span> ( rank &gt; 1 ) {
<a name="l00394"></a>00394       vector &lt; long &gt; naxes;
<a name="l00395"></a>00395       <span class="keywordflow">for</span> ( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> j = 1; j &lt; rank; j++ ) { <span class="comment">// strip row index</span>
<a name="l00396"></a>00396         naxes.push_back ( shape [ j ] );
<a name="l00397"></a>00397       }
<a name="l00398"></a>00398       fits_write_tdim ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, i+1, <span class="comment">// like Fortran</span>
<a name="l00399"></a>00399                         rank -1, &amp;naxes [0], &amp;<a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00400"></a>00400     }
<a name="l00401"></a>00401   }    
<a name="l00402"></a>00402   <span class="comment">// clean up</span>
<a name="l00403"></a>00403   <span class="keyword">delete</span> types;
<a name="l00404"></a>00404   <span class="keyword">delete</span> tform;
<a name="l00405"></a>00405 }
<a name="l00406"></a>00406 
<a name="l00407"></a>00407 <span class="keywordtype">void</span>
<a name="l00408"></a>00408 <a class="code" href="classhippodraw_1_1FitsFile.html#afb56c024bd0720f1d5a7a1c725a047d1">FitsFile::</a>
<a name="l00409"></a><a class="code" href="classhippodraw_1_1FitsFile.html#afb56c024bd0720f1d5a7a1c725a047d1">00409</a> <a class="code" href="classhippodraw_1_1FitsFile.html#afb56c024bd0720f1d5a7a1c725a047d1">writeImageHDU</a> ( <span class="keywordtype">long</span> x, <span class="keywordtype">long</span> y )
<a name="l00410"></a>00410 {
<a name="l00411"></a>00411   <span class="keywordtype">long</span> naxes[2]={x,y};
<a name="l00412"></a>00412   fits_create_img ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, DOUBLE_IMG, 2, naxes, &amp;<a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00413"></a>00413 }
<a name="l00414"></a>00414 
<a name="l00415"></a>00415 
<a name="l00416"></a>00416 <span class="keywordtype">void</span>
<a name="l00417"></a>00417 <a class="code" href="classhippodraw_1_1FitsFile.html#acf27e827fc30fcbf1141ccfdc3c74717" title="Writes the vector to FITS table.">FitsFile::</a>
<a name="l00418"></a><a class="code" href="classhippodraw_1_1FitsFile.html#acf27e827fc30fcbf1141ccfdc3c74717">00418</a> <a class="code" href="classhippodraw_1_1FitsFile.html#acf27e827fc30fcbf1141ccfdc3c74717" title="Writes the vector to FITS table.">writeColumn</a> ( <span class="keywordtype">int</span> col, <span class="keyword">const</span> std::vector &lt; double &gt; &amp; <a class="code" href="namespacenum__util.html#a0c664ca7e08d03a2b3275f4f35efa933">data</a> )
<a name="l00419"></a>00419 {
<a name="l00420"></a>00420   LONGLONG nelements = data.size ();
<a name="l00421"></a>00421 LONGLONG firstrow = 1;
<a name="l00422"></a>00422 LONGLONG firstelem = 1;
<a name="l00423"></a>00423   fits_write_col( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, TDOUBLE, col+1, firstrow, firstelem, nelements,
<a name="l00424"></a>00424                   const_cast &lt; double * &gt; ( &amp;data[0] ), &amp;<a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a>); 
<a name="l00425"></a>00425 }
<a name="l00426"></a>00426 
<a name="l00427"></a>00427 <span class="keywordtype">void</span>
<a name="l00428"></a>00428 <a class="code" href="classhippodraw_1_1FitsFile.html#a9387030f53af304c15f4d57a38148345">FitsFile::</a>
<a name="l00429"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a9387030f53af304c15f4d57a38148345">00429</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a9387030f53af304c15f4d57a38148345">writePix</a> ( <span class="keywordtype">long</span> x, <span class="keywordtype">long</span> y, <span class="keyword">const</span> std::vector &lt; double &gt; &amp; <a class="code" href="namespacenum__util.html#a0c664ca7e08d03a2b3275f4f35efa933">data</a> )
<a name="l00430"></a>00430 {
<a name="l00431"></a>00431   <span class="keywordtype">long</span> fpixel[2]={1,1};
<a name="l00432"></a>00432   <span class="keywordtype">long</span> nelements = x * y;
<a name="l00433"></a>00433   fits_write_pix ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, TDOUBLE, fpixel, nelements,
<a name="l00434"></a>00434                    const_cast &lt; double * &gt; ( &amp;data[0] ), &amp;<a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> ); 
<a name="l00435"></a>00435 }
<a name="l00436"></a>00436 
<a name="l00437"></a>00437 <span class="keywordtype">void</span>
<a name="l00438"></a>00438 <a class="code" href="classhippodraw_1_1FitsFile.html#a26172babd803fefd59436a62039f1a06">FitsFile::</a>
<a name="l00439"></a><a class="code" href="classhippodraw_1_1FitsFile.html#a26172babd803fefd59436a62039f1a06">00439</a> <a class="code" href="classhippodraw_1_1FitsFile.html#a26172babd803fefd59436a62039f1a06">writeCloseFile</a> ()
<a name="l00440"></a>00440 {
<a name="l00441"></a>00441   fits_close_file( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, &amp;<a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00442"></a>00442   <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a> = 0; <span class="comment">// to remember its already closed.</span>
<a name="l00443"></a>00443 }
<a name="l00444"></a>00444 
<a name="l00445"></a>00445 <span class="keywordtype">bool</span>
<a name="l00446"></a>00446 <a class="code" href="classhippodraw_1_1FitsFile.html#af324cf8e9791896afbdff12683ae69f1">FitsFile::</a>
<a name="l00447"></a><a class="code" href="classhippodraw_1_1FitsFile.html#af324cf8e9791896afbdff12683ae69f1">00447</a> <a class="code" href="classhippodraw_1_1FitsFile.html#af324cf8e9791896afbdff12683ae69f1">pixCenter</a> ()<span class="keyword"> const</span>
<a name="l00448"></a>00448 <span class="keyword"></span>{
<a name="l00449"></a>00449   
<a name="l00450"></a>00450   <span class="keywordtype">char</span> * key = const_cast &lt; <span class="keywordtype">char</span> * &gt; ( <span class="stringliteral">&quot;PIXCENT&quot;</span> );
<a name="l00451"></a>00451   <span class="keywordtype">bool</span> yes = <a class="code" href="classhippodraw_1_1FitsFileBase.html#a85107333ac3fd32889e6a5c2d9cec948" title="Returns true if the keyword key exists, otherwise returns false.">hasKey</a> ( key );
<a name="l00452"></a>00452   <span class="keywordflow">if</span> ( yes ) 
<a name="l00453"></a>00453     {
<a name="l00454"></a>00454       <span class="keywordflow">if</span> ( <a class="code" href="classhippodraw_1_1FitsFileBase.html#acb542016c8bb427121d07d26704a4805" title="Read a specified keyword value and returns it as a string.">stringValueForKey</a> ( key ) == <span class="stringliteral">&quot;T&quot;</span> ) <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00455"></a>00455     }
<a name="l00456"></a>00456 
<a name="l00457"></a>00457   <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00458"></a>00458 
<a name="l00459"></a>00459 }
<a name="l00460"></a>00460 
<a name="l00461"></a>00461 <span class="keywordtype">void</span>
<a name="l00462"></a>00462 <a class="code" href="classhippodraw_1_1FitsFile.html#ae517f0dc78993e393ae1040cc0cd4083">FitsFile::</a>
<a name="l00463"></a><a class="code" href="classhippodraw_1_1FitsFile.html#ae517f0dc78993e393ae1040cc0cd4083">00463</a> <a class="code" href="classhippodraw_1_1FitsFile.html#ae517f0dc78993e393ae1040cc0cd4083">writeRefPixelValues</a> ( <span class="keywordtype">double</span> value1, <span class="keywordtype">double</span> value2 )
<a name="l00464"></a>00464 {
<a name="l00465"></a>00465   <span class="keywordtype">char</span> * key1 = const_cast &lt; <span class="keywordtype">char</span> * &gt; ( <span class="stringliteral">&quot;CRVAL1&quot;</span> );
<a name="l00466"></a>00466   <span class="keywordtype">char</span> * key2 = const_cast &lt; <span class="keywordtype">char</span> * &gt; ( <span class="stringliteral">&quot;CRVAL2&quot;</span> );
<a name="l00467"></a>00467 
<a name="l00468"></a>00468   fits_write_key( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, TDOUBLE, key1, &amp;value1, NULL, &amp;<a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00469"></a>00469   fits_write_key( <a class="code" href="classhippodraw_1_1FitsFileBase.html#ac9c317bd754799e0fc31688c45b8a000" title="Pointer to the fits file data structure.">m_fptr</a>, TDOUBLE, key2, &amp;value2, NULL, &amp;<a class="code" href="classhippodraw_1_1FitsFileBase.html#a9fe0cdf49723f51eb797adbee7e7e2e6" title="The status return code from the last cfitsio operation.">m_status</a> );
<a name="l00470"></a>00470 }
</pre></div></div>
<hr size="1"><address style="align: right;"><small>
Generated for HippoDraw Class Library by <a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border=0>
</a> </small></address>
</body>
</html>