You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using a WaveformOut record and doing .set() and .get(), the behaviour is not as expected when the initial_value is an empty numpy array:
# Import the basic framework components.
from softioc import softioc, builder, asyncio_dispatcher
import numpy
# Create an asyncio dispatcher, the event loop is now running
dispatcher = asyncio_dispatcher.AsyncioDispatcher()
# Set the record prefix
builder.SetDeviceName("PREFIX")
# Create some records
wo = builder.WaveformOut("TEST", initial_value=numpy.array([]))
# Boilerplate get the IOC started
builder.LoadDatabase()
softioc.iocInit(dispatcher)
print(wo.get())
wo.set(numpy.array([10]))
print(wo.get())
# Finally leave the IOC running with an interactive shell.
softioc.interactive_ioc(globals())
This program prints:
...
iocRun: All initialization complete
[]
[]
If you change the initial_value to numpy.array([1]) then the program prints out the expected results:
...
iocRun: All initialization complete
[1]
[10]
Apologies if this is a duplicate of an existing issue, but it certainly is a novel symptom.
The text was updated successfully, but these errors were encountered:
This is likely to be an issue in ProcessDeviceSupportOut._process. The check against empty arrays is not working as intended - passing a numpy.array(10.) and a numpy.array([]) passes the check and returns EPICS_OK.
The probable fix for this is to extend the if check to do something like this:
if value.shape == self._value.shape and (value == self._value).all() and not self.__always_update:
This needs testing and tweaking for all Out record types, as this'll obviously fail for any non-array values.
When using a
WaveformOut
record and doing.set()
and.get()
, the behaviour is not as expected when theinitial_value
is an empty numpy array:This program prints:
If you change the
initial_value
tonumpy.array([1])
then the program prints out the expected results:Apologies if this is a duplicate of an existing issue, but it certainly is a novel symptom.
The text was updated successfully, but these errors were encountered: