Skip to content

Indexing a Signal with an integer raises an exception #1232

@Orbinaut42

Description

@Orbinaut42

Version 8.6.10

mdf.get('time')[0]

raises

File "c:\Users\xxxxxxxx\AppData\Local\Programs\Python\Python313\Lib\site-packages\asammdf\signal.py", line 1372, in getitem
return Signal(
self.samples[val],
...<17 lines>...
virtual_master_conversion=self.virtual_master_conversion,
)
File "c:\Users\xxxxxxxx\AppData\Local\Programs\Python\Python313\Lib\site-packages\asammdf\signal.py", line 158, in init
if self.samples.shape[0] != self.timestamps.shape[0]:
~~~~~~~~~~~~~~~~~~^^^
IndexError: tuple index out of range

It seems __getitem__ creates a new Signal with the provided index, but if it is an integer instead of a slice, the new samples are only np.float instead of np.array. And np.float.shape returns an empty tuple

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions