An “ini” file format with typed, uncertain data (pwkit.tinifile)

pwkit.tinifile - Dealing with typed ini-format files full of measurements.

Functions:

read

Generate pwkit.Holder instances of measurements from an ini-format file.

write

Write pwkit.Holder instances of measurements to an ini-format file.

read_stream

Lower-level version; only operates on streams, not path names.

write_stream

Lower-level version; only operates on streams, not path names.

pwkit.tinifile.write_stream(stream, holders, defaultsection=None, extrapos=(), sha1sum=False, **kwargs)[source]

extrapos is basically a hack for multi-step processing. We have some flux measurements that are computed from luminosities and distances. The flux value is therefore an unwrapped Uval, which doesn’t retain memory of any positivity constraint it may have had. Therefore, if we write out such a value using this routine, we may get something like fx:u = 1pm1, and the next time it’s read in we’ll get negative fluxes. Fields listed in extrapos will have a “P” constraint added if they are imprecise and their typetag is just “f” or “u”.