From e7d7e51dbdca96215eec650159e2f094a7869927 Mon Sep 17 00:00:00 2001 From: Stephen Dixon Date: Tue, 1 Aug 2023 20:14:44 +0100 Subject: [PATCH] adding get_images function to matpyuda mast client --- .../pyuda_interface/+matpyuda/MastClient.m | 23 +++++++++++++++++-- .../matlab/pyuda_interface/TestMatpyudaMast.m | 7 +++--- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/source/wrappers/matlab/pyuda_interface/+matpyuda/MastClient.m b/source/wrappers/matlab/pyuda_interface/+matpyuda/MastClient.m index e0e26277..3be866a1 100644 --- a/source/wrappers/matlab/pyuda_interface/+matpyuda/MastClient.m +++ b/source/wrappers/matlab/pyuda_interface/+matpyuda/MastClient.m @@ -55,7 +55,24 @@ end end - // function get_images(obj, signal, source, options) + function result = get_images(obj, signal, source, options) + arguments + obj + signal + source + options.first_frame = py.None + options.last_frame = py.None + options.stride = py.None + options.frame_number = py.None + options.header_only = py.None + options.rcc_calib_path = py.None + end + + kwargs = py.dict(options); + pyobj = pyrun("r = client.get_images(signal, source, **kwargs)", "r", ... + client=obj.python_client, signal=signal, source=source, kwargs=kwargs); + result = obj.convert_pyuda_obj_to_matlab_type(pyobj); + end function result = geometry(obj, signal, source, options) arguments @@ -88,6 +105,8 @@ atts = fieldnames(pyobj); for i = 1: numel(atts) name = atts{i}; - s.(name) = matpyuda.get_attribute_value(pyobj.(name)); + if py.hasattr(pyobj, name) + s.(name) = matpyuda.get_attribute_value(pyobj.(name)); + end end end \ No newline at end of file diff --git a/source/wrappers/matlab/pyuda_interface/TestMatpyudaMast.m b/source/wrappers/matlab/pyuda_interface/TestMatpyudaMast.m index 103827b3..a261868e 100644 --- a/source/wrappers/matlab/pyuda_interface/TestMatpyudaMast.m +++ b/source/wrappers/matlab/pyuda_interface/TestMatpyudaMast.m @@ -208,7 +208,8 @@ function test_get_video(testCase) % client.server= "uda2.mast.l"; % client.set_property('get_meta', py.True); % -% data = client.get_images("rgb", "47699", last_frame=0); -% % unimplemented -% verifyFail(testCase); +% data = client.get_images("rgb", "47125", last_frame=0); +% verifyEqual(testCase, size(data.frames(1).k), [480, 640]); +% verifyEqual(testCase, length(data.frame_times), 248); +% verifyEqual(testCase, data.filter, "(Da/SS)/C-CXRS/He-CXRS"); %end \ No newline at end of file