Skip to content

Accessing metadata

Joe Futrelle edited this page Jun 22, 2017 · 3 revisions

Timestamp

One of the most important pieces of metadata about a sample bin is the timestamp indicating when the sample was run. This information is encoded in LIDs and can be accessed using a sample bin's timestamp property. Timestamps are represented as UTC datetime objects. This example computes the amount of time between two sample bins:

elapsed = abs(bin_a.timestamp - bin_b.timestamp)

Headers

Each sample bin contains metadata, represented as a set of key/value pairs called "headers". This metadata is available as a dict using the headers property of a sample bin. There are a variety of header keys, and they may vary from one instrument to the next. This example prints out the temperature header field:

print('Temperature is {:.3f}'.format(sample_bin.headers['temperature']))