pysdic.cordin.CORDIN#

class CORDIN(xml_file, convert_types=True)[source]#

Bases: object

Acquisition information of a CORDIN capture, read from its CaptureInfo XML file.

Each image of the capture has a frame number (FrameNumber, from 1 to the number of frames, in the order of acquisition) and a module number (Module, the module of the camera that took it). This class gives the information of an image from either number, and converts one into the other.

Important

The frame numbers start at 1 (not 0), as in the XML file.

Parameters:
  • xml_file (str or pathlib.Path) – Path to the CaptureInfo XML file.

  • convert_types (bool, optional (default: True)) – If True, the values of the attributes are converted to bool, int or float when possible (see convert_value()).

Examples

>>> calibration = CORDIN("calibration/capture.xml")
>>> measure = CORDIN("measure/capture.xml")
>>> measure.get_infos(frame=12)["FileName"]
>>> measure.get_module(frame=12)
>>> measure.get_frame(module=60)
property camera: Dict[str, str]#

The camera description (attributes of CameraDetails), a copy.

property frames: List[int]#

The frame numbers, sorted (from 1).

get_frame(module)[source]#

Return the frame number (from 1) of the image taken by a module.

Raises:

KeyError – If the module does not exist.

Parameters:

module (int)

Return type:

int

get_infos(frame=None, module=None)[source]#

Return the information of an image, given either its frame number or its module number (exactly one of them).

Parameters:
  • frame (int, optional) – The frame number (from 1).

  • module (int, optional) – The module number.

Returns:

A copy of the attributes of the FrameInfo element, with its FileName.

Return type:

dict

Raises:
  • ValueError – If both or none of frame and module are given.

  • KeyError – If the frame or the module does not exist.

get_module(frame)[source]#

Return the module number of the image of a frame (from 1).

Raises:

KeyError – If the frame does not exist.

Parameters:

frame (int)

Return type:

int

property modules: List[int]#

The module numbers, sorted.

property n_frames: int#

The number of frames.

property parameters: Dict[str, str]#

The global capture parameters (attributes of CaptureInfo), a copy.

property xml_file: Path#

The path of the XML file.