Skip to content

Commit

Permalink
Add __array_interface__
Browse files Browse the repository at this point in the history
  • Loading branch information
thangleiter committed Oct 2, 2024
1 parent b12edb9 commit f6d32fe
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions filter_functions/pulse_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,17 @@ class PulseSequence:
Due to the heavy use of NumPy's :func:`~numpy.einsum` function,
results have a floating point error of ~1e-13.
"""
__array_interface__ = {
'shape': (),
'typestr': '|O',
'version': 3
}
"""Describes to NumPy how to convert this object into an array.
Since :class:`PulseSequence` is iterable (through
:meth:`__getitem__`), NumPy would otherwise try to create an
ndarray of single-segment :class:`PulseSequence` s.
"""

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

0 comments on commit f6d32fe

Please sign in to comment.