Skip to content

Raise appropriate exception for EventArray.arrayMinMeanMax() when length is 0 #137

@StokesMIDE

Description

@StokesMIDE

EventArray.arrayMinMeanMax() should raise an appropriate exception when used on a zero-length EventArray. As of commit 1e33a2a (which may have introduced the issue), this is what currently happens:

>>> a.getRangeMinMeanMax()
Traceback (most recent call last):
  File "C:\Program Files\Python37\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "C:\Users\dstokes\workspace\idelib\idelib\dataset.py", line 2277, in getRangeMinMeanMax
    display=display, iterator=iterator)
  File "C:\Users\dstokes\workspace\idelib\idelib\dataset.py", line 2229, in arrayMinMeanMax
    if out[0, i, 0] > out[2, i, 0]:
IndexError: index 0 is out of bounds for axis 2 with size 0

Instead, it should return None or raise a more meaningful exception including a message explaining there is no data. The method getRangeMinMeanMax() (used above) is expected to return None if there is no data, and should catch the exception raised by arrayMinMeanMax(), or handle it returning None.

There may be other, similar methods that don't explicitly raise meaningful exceptions as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions