Skip to content

Commit

Permalink
Update datakey on describe (#16)
Browse files Browse the repository at this point in the history
* update datakey on describe

* update datakey only for complex and array datatypes

* fix update_dtype bug
  • Loading branch information
Bilchreis authored Nov 15, 2024
1 parent f80edae commit 6d18f86
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/secop_ophyd/SECoPSignal.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,19 @@ async def put(self, value: Any | None, wait=True, timeout=None):

async def get_datakey(self, source: str) -> DataKey:
"""Metadata like source, dtype, shape, precision, units"""

if self.SECoP_type_info._is_composite or isinstance(
self.SECoPdtype_obj, ArrayOf
):
# getlast cached value
dataset = await self._secclient.get_parameter(
**self.get_param_path(), trycache=True
)

# this ensures the datakey is updated to the latest cached value
SECoPReading(entry=dataset, secop_dt=self.SECoP_type_info)
self.describe_dict.update(self.SECoP_type_info.describe_dict)

return self.describe_dict

async def get_reading(self) -> Reading:
Expand Down
2 changes: 1 addition & 1 deletion src/secop_ophyd/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ def update_dtype(self, input_val):
self.dtype_str = self.numpy_dtype.str
self.describe_dict["dtype_str"] = self.dtype_str

self.dtype_descr = str(self.numpy_dtype.descr)
self.dtype_descr = self.numpy_dtype.descr
self.describe_dict["dtype_descr"] = self.dtype_descr

self.describe_dict["dtype"] = self.dtype
Expand Down

0 comments on commit 6d18f86

Please sign in to comment.