Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixing access of calibration info object #39

Merged
merged 1 commit into from
Oct 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions cuvis/Calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@

from typing import Union


class Calibration(object):

def __init__(self, base: Union[Path, str, SessionFile]):
self._handle = None
_ptr = cuvis_il.new_p_int()
if isinstance(base, SessionFile):
retval = cuvis_il.cuvis_calib_create_from_session_file(base._handle, _ptr)
retval = cuvis_il.cuvis_calib_create_from_session_file(
base._handle, _ptr)
elif (isinstance(base, Path) and base.is_dir()) or os.path.exists(base):
retval = cuvis_il.cuvis_calib_create_from_path(str(base), _ptr)
else:
raise SDKException("Could not interpret input of type '{}'.".format(type(base)))
raise SDKException(
"Could not interpret input of type '{}'.".format(type(base)))
if cuvis_il.status_ok != retval:
raise SDKException()
self._handle = cuvis_il.p_int_value(_ptr)
Expand All @@ -34,18 +37,20 @@ def get_capabilities(self, operation_mode: OperationMode) -> Capabilities:
raise SDKException()
return Capabilities(cuvis_il.p_int_value(_ptr))

def get_info(self) -> cuvis_il.cuvis_calibration_info_t:
info = cuvis_il.cuvis_calibration_info_t()
@property
def info(self) -> CalibrationInfo:

ret = cuvis_il.cuvis_calibration_info_t()
if cuvis_il.status_ok != cuvis_il.cuvis_calib_get_info(
self._handle, info):
self._handle, ret):
raise SDKException()
return CalibrationInfo(
self.model_name,
self.serial_no,
self.calibration_date,
self.annotation_name,
self.unique_id,
self.file_path)
ret.model_name,
ret.serial_no,
ret.calibration_date,
ret.annotation_name,
ret.unique_id,
ret.file_path)

@property
def id(self) -> str:
Expand Down