[AstroPy] How can I preserve the precision of the data in the votable file?
Thu Mar 7 10:12:11 CST 2013
By default, floating point values are output using 4 decimal points of
precision. You can control the amount of precision using the
"precision" attribute on the field. This is either "F" followed by a
number of decimal places, or "E" followed by the number of significant
digits. For example, when you define your fields, you can do:
# Define some fields
Field(votable, name="float", datatype="double", precision="E8"))
On 03/07/2013 06:33 AM, Susana Sanchez Exposito wrote:
> 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
> "Building a new table from scratch"):
> In : table
> Out: <astropy.io.votable.tree.Table object at 0x32bcbd0>
> In : table.array
> 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:
> 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!
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the AstroPy