Skip to content

Conversation

@KristijanArmeni
Copy link
Contributor

Reference issue

Fixes #12413.

What does this implement/fix

So far, to insert gap data (0's representing missing samples), the AnalogSignalGap class with a dummy load() method was defined and used to mirror the neo.AnalogSignalProxy object which loads recorded samples from disk.

As of v13, neo allows onlyAnalogSignal/AnalogSignalProxy types to be appended to Segment.analogsignals attribute. To fix this, we drop the over-engineered AnalogSignalGap class. Instead, we create zero-arrays directly with AnalogSignal and use a simple control statement to distinguish loading real data (via AnalogSignalProxy.load().magnitude) and padding 0's (via AnalogSignal.magnitude) when looping over segments and creating the output data array.

signal.load(channel_indexes=idx).magnitude[
samples[0] : samples[-1] + 1, :
]
if type(signal) is not AnalogSignal # then it's AnalogSignalProxy
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if type(signal) is not AnalogSignal # then it's AnalogSignalProxy
if not isinstance(signal, AnalogSignal) # then it's AnalogSignalProxy

or better, actually check if it's AnalogSignalProxy rather than AnalogSignal?

Copy link
Contributor Author

@KristijanArmeni KristijanArmeni Feb 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, was just editing this. Can also check for AnalogSignalProxy. Wasn't sure if it's worth doing an import for that (from neo.io.proxyobjects import AnalogSignalProxy).

Commit coming + sorting the neo import at the correct location.

@KristijanArmeni
Copy link
Contributor Author

@larsoner See if it looks good? If yes, needs update from main and good on my end.

@larsoner larsoner merged commit 0f5c91b into mne-tools:main Feb 2, 2024
@larsoner
Copy link
Member

larsoner commented Feb 2, 2024

Thanks for the quick fix @KristijanArmeni !

snwnde pushed a commit to snwnde/mne-python that referenced this pull request Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI failing after new release of neo

2 participants