Home | Trees | Indices | Help |
|
---|
|
Definitions of type strings found in LIGO Light Weight XML files. Notes. To guarantee that a double-precision floating-point number can be reconstructed exactly from its representation as a decimal number, one must use 17 decimal digits; for single-precision, the number is 9. Python uses only double-precision numbers, but LIGO Light Weight XML allows for single-precision values, so I provide distinct format specifiers for those cases here. In both cases, I have elected to use 1 fewer digits than are required to uniquely reconstruct the number: the XML written by this library is lossy. I made this choice to reduce the file size, for example >>> "%.17g" % 0.1 '0.10000000000000001' while >>> "%.16g" % 0.1 '0.1' In this worst case, storing full precision increases the size of the XML by more than an order of magnitude. If you wish to make a different choice for your files, for example if you wish your XML files to be lossless, simply include the lines glue.ligolw.types.FormatFunc.update({ "real_4": u"%.9g".__mod__, "real_8": u"%.17g".__mod__, "float": u"%.9g".__mod__, "double": u"%.17g".__mod__, u"complex_8": glue.ligolw.types.mk_complex_format_func(u"%.9g"), u"complex_16": glue.ligolw.types.mk_complex_format_func(u"%.17g") }) anywhere in your code, but before you write the document to a file. References: - http://docs.sun.com/source/806-3568/ncg_goldberg.html
Version: git id 8cbd1b7187ce3ed9a825d6ed11cc432f3cfde9a5
Date: 2017-12-05 15:29:36 +0000
Author: Kipp Cannon <kipp.cannon@ligo.org>
|
|||
FromPyTypeCls |
|
|||
|
|||
|
|||
|
|
|||
BlobTypes =
|
|||
ComplexTypes =
|
|||
FloatTypes =
|
|||
FormatFunc =
|
|||
FromNumPyType =
|
|||
FromPyType = {<type 'long'>: u'int_8s', <type 'bool'>: u'int_4
|
|||
FromSQLiteType =
|
|||
IDTypes =
|
|||
IntTypes =
|
|||
NumericTypes =
|
|||
StringTypes =
|
|||
TimeTypes =
|
|||
ToMySQLType =
|
|||
ToNumPyType =
|
|||
ToPyType =
|
|||
ToSQLiteType =
|
|||
Types =
|
|||
__package__ =
|
|
Function used internally to format binary data. Base64-encodes the data and wraps the resulting string in quotes. |
Function used internally to format string data for output to XML. Escapes back-slashes and quotes, and wraps the resulting string in quotes. |
|
FormatFunc
|
FromNumPyType
|
FromPyType
|
FromSQLiteType
|
IntTypes
|
NumericTypes
|
StringTypes
|
ToMySQLType
|
ToNumPyType
|
ToPyType
|
ToSQLiteType
|
Types
|
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Dec 12 00:34:18 2017 | http://epydoc.sourceforge.net |