question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENH: Preserve annotations in epochs

See original GitHub issue

Describe the new feature or enhancement

Is there a way to map annotations from the raw dataset onto the AverageTFR object? Since the tfr is occurring over windows, then the time scale of the annotations from the original time scale are inherently different.

E.g. if I have an event at sample 10000, with sfreq=1000, then it occurs at 10 seconds into the raw dataset. If i have an averageTFR that was computed with a moving window of say 1 second step size, then the new sample point of the event would be 10.

Describe your proposed implementation

Ideally this would consist of two things that I could see being useful:

  1. A public function map_annotations_to_sfreq that allows mapping Annotations to different time-scales based on a passed say… sfreq value. So based on the above example, if I wanted to map Annotations that are based on sfreq=1000Hz, to some tfr object with sfreq=1 Hz, then I would somehow pass that information to map_annotations_to_sfreq that returns me a new Annotations object that has onset and duration in the new time-scale.

  2. Use the public function above to make AverageTFR, or EpochsTFR, etc. to keep their Annotations when the time-scale changes.

I strongly would prefer having 1 because besides mne-python objects, I create other derivatives of the raw data that inherently have a “sliding” window component to them, and hence change the time-scale in the same way as a sliding FFT would.

Additional comments

@larsoner’s comment on gitter for reference:

@adam2392 in principle we should be able to do that at least for EpochsTFR, can you open an issue feature request? For AverageTFR I'm not sure because we don't preserve annotations in Evoked even (just Raw and Epochs) so we'd probably want to do that first before doing it for AverageTFR

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:19 (19 by maintainers)

github_iconTop GitHub Comments

2reactions
drammockcommented, Oct 25, 2021

by the dev meeting you mean the office hours announced on MNE discourse or something else? I’d be interested to join.

on discord, but separate from the office hours. I didn’t find you in a search of the discord users, ping me there and I’ll fill you in.

1reaction
larsonercommented, Oct 22, 2021

I think we’ll want some time to fully test + implement this (including viz) so I think this shouldn’t go into 0.24 but rather 0.25/1.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

mne.Annotations — MNE 1.2.2 documentation
Specifying channel names allows the creation of channel-specific annotations. Once the annotations are assigned to a raw instance with mne.
Read more >
Show information about latest 'save annotations' #252 - GitHub
Understand state of deferred annotation tasks; Visual hint that annotations are not saved too long; In case of any problems with the annotation...
Read more >
PEP 649 – Deferred Evaluation Of Annotations Using ...
This PEP proposes a third way that embodies the best of both previous approaches. It solves the same circular reference problems solved by...
Read more >
Current annotation on the symbol - Custom IC Design
I am using IC6.1.7 and want to annotate DC voltages and currents on ... In order to annotate currents, you need to save...
Read more >
Conceptual Annotations Preserve Structure Across Translations
Conceptual Annotations Preserve Structure Across Translations: ... in recent years. ... ilarity between n(t,F re) and n(t,Eng), which is an.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found