From 4ae21c51e6a503b4820ad2a23b201f265150fdf6 Mon Sep 17 00:00:00 2001 From: Simon Birkholz Date: Wed, 3 Apr 2024 15:09:04 +0200 Subject: [PATCH] * fixing session.get_reference * removing measurement.get_data_info --- cuvis/Measurement.py | 31 ++++++++++--------------------- cuvis/SessionFile.py | 2 +- 2 files changed, 11 insertions(+), 22 deletions(-) diff --git a/cuvis/Measurement.py b/cuvis/Measurement.py index f142c10..b54bbc7 100644 --- a/cuvis/Measurement.py +++ b/cuvis/Measurement.py @@ -127,28 +127,17 @@ def set_name(self, name: str) -> None: self._refresh_metadata() pass - def get_thumbnail(self): - thumbnail = [val for key, val in self.data.items() if "view" in key] - if len(thumbnail) == 0: + @property + def thumbnail(self): + thumb = [val for key, val in self.data.items() if "view" in key] + if len(thumb) == 0: print("No thumbnail available. Use cube instead!") - pass - elif len(thumbnail) == 1: - return thumbnail[0] - elif len(thumbnail) > 1: - shapes = [th.array.shape for th in thumbnail] - return thumbnail[shapes.index(min(shapes))] - - def get_data_info(self): - return_dict = {} - for att in self.data["IMAGE_info"].__dir__(): - if not (att.startswith("__") or att.startswith("this") or att.startswith("_")): - return_dict.update( - {att: self.data["IMAGE_info"].__getattribute__(att)}) - try: - return_dict["readout_time"] = str(return_dict["readout_time"]) - except: - print("No human readable readout_time available!") - return return_dict + return None + elif len(thumb) == 1: + return thumb[0] + elif len(thumb) > 1: + shapes = [th.array.shape for th in thumb] + return thumb[shapes.index(min(shapes))] @property def capabilities(self) -> Capabilities: diff --git a/cuvis/SessionFile.py b/cuvis/SessionFile.py index f99974e..03f013d 100644 --- a/cuvis/SessionFile.py +++ b/cuvis/SessionFile.py @@ -41,7 +41,7 @@ def get_measurement(self, frameNo: int, itemtype: SessionItemType = SessionItemT def get_reference(self, frameNo: int, reftype: ReferenceType) -> Optional[Measurement]: _ptr = cuvis_il.new_p_int() ret = cuvis_il.cuvis_session_file_get_reference_mesu( - self._handle, frameNo, internal.__CuvisSessionItemType__[reftype], + self._handle, frameNo, internal.__CuvisReferenceType__[reftype], _ptr) if cuvis_il.status_no_measurement == ret: return None