Skip to content

Waveforms with empty array initial values do not update as expected #55

@AlexanderWells-diamond

Description

@AlexanderWells-diamond

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.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions