Skip to content

Commit f6d32fe

Browse files
committed
Add __array_interface__
1 parent b12edb9 commit f6d32fe

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

filter_functions/pulse_sequence.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,17 @@ class PulseSequence:
237237
Due to the heavy use of NumPy's :func:`~numpy.einsum` function,
238238
results have a floating point error of ~1e-13.
239239
"""
240+
__array_interface__ = {
241+
'shape': (),
242+
'typestr': '|O',
243+
'version': 3
244+
}
245+
"""Describes to NumPy how to convert this object into an array.
246+
247+
Since :class:`PulseSequence` is iterable (through
248+
:meth:`__getitem__`), NumPy would otherwise try to create an
249+
ndarray of single-segment :class:`PulseSequence` s.
250+
"""
240251

241252
def __init__(self, *args, **kwargs) -> None:
242253
"""Initialize a PulseSequence instance."""

0 commit comments

Comments
 (0)