pysdic.cordin.get_frames#

get_frames(root, key='frame', convert_types=True)[source]#

Return the frame acquisition information.

Each FrameInfo element is converted into a dictionary containing both its XML attributes and the associated raw image filename.

The returned dictionary can be indexed either by frame number or by module number.

Parameters:
  • root (xml.etree.ElementTree.Element) – Root element returned by load_capture_info().

  • key ({“frame”, “module”}, optional (default: "frame")) –

    Dictionary indexing strategy.

    • "frame": keys correspond to FrameNumber.

    • "module": keys correspond to Module.

  • convert_types (bool, optional (default: True)) – If True, XML attribute values are automatically converted to native Python types (bool, int and float whenever possible). Otherwise, all values remain strings.

Returns:

Dictionary whose keys are frame numbers or module numbers and whose values are dictionaries containing the acquisition metadata.

Return type:

dict

Notes

Each frame dictionary additionally contains the FileName entry, which corresponds to the text contained in the FileName XML child node.

Examples

Index by frame number

>>> frames = get_frames(root)
>>> frames[12]["ExposureTime"]

Index by module number

>>> modules = get_frames(root, key="module")
>>> modules[60]["FileName"]