Metadata Class
- Updated2022-07-11
- 1 minute(s) read
Metadata Class
Metadata is a class that handles addition and removal of measurement-level metadata and parameters.
When used as a context manager, the Logging Library automatically removes the metadata and parameters that were added within the scope of the Metadata instance. This can be done using the with statement:
with run.Metadata() as loop1:
for mode in modes:
loop1.add_string_parameter(
parameter_name="Mode",
parameter_value=mode
)
loop1.add_metadata(
metadata_name=Fields.LotName,
metadata_value="Lot_2"
)
perform_measurement()
run.log_measurement(measurement)
If not using the with statement, metadata and parameters added to the Metadata object must be removed explicitly:
loop1 = run.Metadata()
for mode in modes:
loop1.add_string_parameter(
parameter_name="Mode",
parameter_value=mode
)
loop1.add_metadata(
metadata_name=Fields.LotName,
metadata_value="Lot_2"
)
perform_measurement()
run.log_measurement(measurement)
loop1.remove_all_metadata()
loop1.remove_all_parameters()
Note You can use the get_parameters() and
get_metadata() functions to retrieve information from the
respective property.