load

giant.camera_models.camera_model.load(file, name, group=None)[source]

This function is used to retrieve a camera model from a GIANT xml file.

This function will return the queried camera model if it exists, otherwise it raises a LookupError.

If you saved your camera model to a specific group, you can optionally specify this group which may make the search faster. If you have two camera models with the same name but different groups then you must specify group.

Warning

There is a security risk when loading XML files (exacerbated here by using a eval on some of the field of the xml tree and by importing the module the camera model is defined in). Do not pass untrusted/unverified files to this function. The files themselves are simple text files that can easily be verified for malicious code by inspecting them in a text editor beforehand.

Parameters:
  • file (Path | str) – The path to the xml file to retrieve the camera models from.

  • name (str) – The name of the camera model to retrieve from the file

  • group (str | None) – The group that contains the camera model in the file

Returns:

The camera model retrieved from the file

Raises:

LookupError – when the camera model can’t be found in the file

Return type:

CameraModel