[AstroPy] How can I preserve the precision of the data in the votable file?

Susana Sanchez Exposito sse at iaa.es
Thu Mar 7 06:33:08 EST 2013


Hello again,

I have followed the instructions given by Tom Aldcroft as answer of my
previous mail (thanks for that!), and finally I get the xml file with
the VOTable, but I realized the number are rounded when they are
written in the xml file.

For example, if I have a table like this:
(I built this Table following the example in
https://astropy.readthedocs.org/en/v0.2/io/votable/index.html,
"Building a new table from scratch"):

In [62]: table
Out[62]: <astropy.io.votable.tree.Table object at 0x32bcbd0>

In [63]: table.array
Out[63]:
masked_rec.array(data = [(17.257360147629999, 18.999976544568401)
 (13.257360147629999, 78.999976544568398)],
                 mask = [(False, False) (False, False)],
           fill_value = (1e+20, 1e+20),
                dtype = [('precision', '<f8'), ('precision2', '<f8')])


When I build the xml file with the comand votable.to_xml, the file
contains this data:

 <TABLEDATA>
     <TR>
      <TD>17.2574</TD>
      <TD>19</TD>
     </TR>
     <TR>
      <TD>13.2574</TD>
      <TD>79</TD>
     </TR>
    </TABLEDATA>


As you can see, the numbers have been rounded, but I would like to
preserve the precision of these data. Is this possible?


Thanks again for your useful help!

Susana.
-- 
Susana Sánchez Expósito

Instituto de Astrofísica de Andalucía   IAA (CSIC)
Camino Bajo de Huétor, 50. Granada E-18008
Tel:(+34) 958 121 311 / (+34) 958 230 618
Fax:(+34) 958 814 530
e-mail: sse at iaa.es



More information about the AstroPy mailing list