Metadata Utilities#

Metadata utilities.

The public helpers in this module normalise instrument metadata into a single dictionary with a few well-known keys such as framerate, pixelsize and exposuretime.

Converted metadata schema (typical):

{
    "framerate": value,           # float, value before any binning
    "framerate_unit": value,      # str, typically "Hz"
    "framebinning": value,        # int, number of frames binned together
    "pixelsize": value,           # float, value before any binning
    "pixelsize_unit": value,      # str, typically "um"
    "pixelbinning": value,        # int, number of pixels binned together
    "exposuretime": value,        # float, value before any binning
    "exposuretime_unit": value,   # str, typically "ms"
    "instrument": value,          # str, instrument name (if available)
    "camera": value,              # str, camera name (if available)
}
massphoto.metadata.empty_metadata()[source]#

Return minimal, generic metadata.

Returns:

Metadata dictionary with default values for framerate, pixelsize and exposuretime.

Return type:

dict

massphoto.metadata.update_derived_metadata(metadata)[source]#

Update derived fields for standardized metadata.

Parameters:

metadata (dict) – Standardized metadata dictionary.

Returns:

The same dictionary with derived fields refreshed.

Return type:

dict

massphoto.metadata.convert_metadata(metadata, include_native=False)[source]#

Convert metadata dictionary to a standardized format.

Note

Available as both massphoto.convert_metadata and massphoto.metadata.convert_metadata.

Parameters:
  • metadata (dict) – Metadata dictionary to convert.

  • include_native (bool) – Include the original input mapping under a separate key in the output.

Returns:

Normalised metadata dictionary.

Return type:

dict

massphoto.metadata.lookup_pixelsize(metadata)[source]#

Look up and apply known instrument pixel sizes in micrometers.

Parameters:

metadata (dict)

Return type:

float | None