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.

Feature request: incremental updates to an `mne.Report`

See original GitHub issue

This is something that came up when writing the huge analysis pipeline for the conpy project:

I think the Report object of MNE-Python could be made even more useful if we could write incremental updates to it.

As the analysis progresses, more and more figures are incrementally added to the report. Every time the report is saved, the .html file is updated. This would make it super easy to add visual checks to each step of the analysis. Easier than the current situation where we have to make one giant make_report.py file at the end of the pipeline that reads in all the intermediate results and plots them.

Say I have three analysis scripts:

01_filter_raw.py
02_make_epochs.py
03_grand_average.py

It would be cool if each of these scripts could add/update figures in a shared Report object, for example like this:

# Somewhere in 01_filter_raw.py
report = mne.read_report('subject1_report.pickle')  # Loads existing or creates new
report.add_figs_to_section([raw.plot_psd()], ['PSD plot'], 'preprocessing')
report.pickle()  # since report.save() is already taken

# Somewhere in 02_make_epochs.py
report = mne.read_report('subject1_report.pickle')
report.add_figs_to_section([epochs.average.plot()], ['Evokeds'], 'preprocessing')
report.pickle()

# Somewhere in 03_grand_average.py
report = mne.read_report('subject1_report.pickle')
report.add_figs_to_section([grand_average.plot()], ['Grand average'], 'preprocessing')
report.pickle()

Even implement __enter__() and __exit__() blocks so we can do this:

with mne.read_report('subject1_report.pickle') as report:
     report.add_figs_to_section(...)
# report is automatically saved when exiting the block

For this to be used as intended, there needs to be a way to overwrite existing figures.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
larsonercommented, Sep 10, 2018

From what I understand pickling is a bad way to get long-term persistence. I’d rather use hdf5, in theory it shouldn’t add too many lines beyond what the pickle does.

0reactions
wmvanvlietcommented, Sep 11, 2018

maybe use save and decide what to use based on file extension?

that’s a good idea!

Read more comments on GitHub >

github_iconTop Results From Across the Web

mne.Report — MNE 1.3.dev0 documentation - MNE-Python
This feature is useful for grouping multiple related content elements together under a single, collapsible section. Each content element will ...
Read more >
minor issue: MNE naming convention enforcement #5163
I think we can add to the Notes section of Report to say what it currently will parse properly, and update it once...
Read more >
MNE 4.16.0 Administration Guide - Quest Software
This Administration Guide provides operating instructions for the various administrator components of Quest. Migrator for Notes to Exchange, ...
Read more >
MnE Chapter 1&2 Flashcards - Quizlet
To adapt, optimally, people need a motivational repertoire that features: just as many avoidence-based motives as approach-based motives.
Read more >
Global Anti-Base Erosion Model Rules (Pillar Two) - OECD
This report was approved by the Inclusive Framework on 14 ... MNE Group and Chapter 4 then identifies the taxes attributable to such...
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