From 05b9b567ab2c0b86f7af659dd67365679aa5ddc3 Mon Sep 17 00:00:00 2001 From: Ryan Herbst Date: Tue, 22 Aug 2023 09:39:05 -0700 Subject: [PATCH 1/2] Override bitsize for list variables, make offset mandatory --- python/pyrogue/_Variable.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/python/pyrogue/_Variable.py b/python/pyrogue/_Variable.py index 973aaeb72..78d166a82 100644 --- a/python/pyrogue/_Variable.py +++ b/python/pyrogue/_Variable.py @@ -954,7 +954,7 @@ def __init__(self, *, highWarning=None, highAlarm=None, base=pr.UInt, - offset=None, + offset, numValues=0, valueBits=0, valueStride=0, @@ -1017,7 +1017,8 @@ def __init__(self, *, pollInterval=pollInterval,updateNotify=updateNotify, guiGroup=guiGroup, **kwargs) - # If numValues > 0 the bit size array must only have one entry and the total number of bits must be a multiple of the number of values + # If numValues > 0 the bit size array must only have one entry + # Auto calculate the total number of bits if numValues != 0: self._nativeType = np.ndarray self._ndType = self._base.ndType @@ -1029,8 +1030,8 @@ def __init__(self, *, if valueBits > valueStride: raise VariableError(f'ValueBits {valueBits} is greater than valueStrude {valueStride}') - if (numValues * valueStride) != sum(bitSize): - raise VariableError(f'Total bitSize {sum(bitSize)} is not equal to multile of numValues {numValues} and valueStride {valueStride}') + # Override the bitSize + bitSize = [numValues * valueStride] if self._ndType is None: raise VariableError(f'Invalid base type {self._base} with numValues = {numValues}') From 2f2f7241bd7d2703d7771299c03d72fa4bf1ff02 Mon Sep 17 00:00:00 2001 From: Ryan Herbst Date: Tue, 22 Aug 2023 09:41:08 -0700 Subject: [PATCH 2/2] Fix" --- python/pyrogue/_Variable.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/pyrogue/_Variable.py b/python/pyrogue/_Variable.py index 78d166a82..26983dde4 100644 --- a/python/pyrogue/_Variable.py +++ b/python/pyrogue/_Variable.py @@ -1031,7 +1031,7 @@ def __init__(self, *, raise VariableError(f'ValueBits {valueBits} is greater than valueStrude {valueStride}') # Override the bitSize - bitSize = [numValues * valueStride] + bitSize[0] = numValues * valueStride if self._ndType is None: raise VariableError(f'Invalid base type {self._base} with numValues = {numValues}')