Skip to content

Commit

Permalink
Added version to the Python metadata class.
Browse files Browse the repository at this point in the history
  • Loading branch information
pjarosik committed Feb 10, 2022
1 parent abe1bfa commit 1bcada9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 13 additions & 1 deletion api/python/arrus/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,14 @@ class ConstMetadata:
"""
def __init__(self, context: FrameAcquisitionContext,
data_desc: DataDescription,
input_shape, is_iq_data, dtype):
input_shape, is_iq_data, dtype,
version=None):
self._context = context
self._data_char = data_desc
self._input_shape = input_shape
self._is_iq_data = is_iq_data
self._dtype = dtype
self._version = version

@property
def context(self) -> FrameAcquisitionContext:
Expand All @@ -84,6 +86,16 @@ def is_iq_data(self):
def dtype(self):
return self._dtype

@property
def version(self):
return self._version

def __setstate__(self, data):
self.__dict__ = data
# Default version is None for packages < 0.7.0
if "_version" not in data:
self._version = None

def copy(self, **kwargs):
kw = dict(context=self.context, data_desc=self.data_description,
input_shape=self.input_shape, is_iq_data=self.is_iq_data,
Expand Down
4 changes: 3 additions & 1 deletion api/python/arrus/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ def upload(self, scheme: arrus.ops.us4r.Scheme):

const_metadata = arrus.metadata.ConstMetadata(
context=fac, data_desc=echo_data_description,
input_shape=input_shape, is_iq_data=False, dtype="int16")
input_shape=input_shape, is_iq_data=False, dtype="int16",
version=arrus.__version__
)

# numpy/cupy processing initialization
if processing is not None:
Expand Down

0 comments on commit 1bcada9

Please sign in to comment.