Skip to content

Commit

Permalink
fix: set default shape in NDDerivedSignal
Browse files Browse the repository at this point in the history
  • Loading branch information
Mathias Guijarro committed Jun 5, 2024
1 parent 85b6561 commit 6d92c3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion ophyd/areadetector/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@

from ..device import Component, Device, DynamicDeviceComponent
from ..ophydobj import Kind, OphydObject
from ..signal import ArrayAttributeSignal, DerivedSignal, EpicsSignal, EpicsSignalRO
from ..signal import (
ArrayAttributeSignal,
DerivedSignal,
EpicsSignal,
EpicsSignalRO,
NumericValueInfo,
)
from . import docs


Expand Down Expand Up @@ -92,6 +98,7 @@ def __init__(
if isinstance(num_dimensions, str):
num_dimensions = getattr(parent, num_dimensions)
self._num_dimensions = num_dimensions
kwargs.setdefault("value", NumericValueInfo(None, shape))
super().__init__(derived_from=derived_from, parent=parent, **kwargs)

@property
Expand Down
2 changes: 1 addition & 1 deletion ophyd/tests/test_areadetector.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@ def test_ndderivedsignal_with_scalars():
shaped.derived_ndims == 2
assert shaped.get().shape == (4, 3)
# Describe returns list
assert shaped.describe()[shaped.name]["shape"] == [4, 3]
assert shaped.describe()[shaped.name]["shape"] == (4, 3)
shaped.put(np.ones((4, 3)))
assert all(sig.get() == np.ones(12))

Expand Down

0 comments on commit 6d92c3e

Please sign in to comment.