ENH: add to_data_frame method to EpochsTFR#9124
Merged
drammock merged 23 commits intomne-tools:mainfrom Apr 6, 2021
eioe:todf_meth_tfr
Merged
ENH: add to_data_frame method to EpochsTFR#9124drammock merged 23 commits intomne-tools:mainfrom eioe:todf_meth_tfr
drammock merged 23 commits intomne-tools:mainfrom
eioe:todf_meth_tfr
Conversation
Member
|
don't forget to add some tests |
Co-authored-by: Britta Westner <britta.wstnr@gmail.com>
Contributor
Author
|
I updated the original post to better reflect what happened in the mean time.
|
drammock
approved these changes
Mar 31, 2021
Member
drammock
left a comment
There was a problem hiding this comment.
Sorry it took a while to get around to reviewing this. It looks good! I've made only minor tweaks/suggestions.
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
Co-authored-by: Daniel McCloy <dan@mccloy.info>
drammock
reviewed
Apr 6, 2021
Co-authored-by: eioe <klotzsche@cbs.mpg.de>
Member
|
thanks @eioe! |
vagechirkov
pushed a commit
to vagechirkov/mne-python
that referenced
this pull request
Apr 6, 2021
* implement to_df method; missing selection attr * add to_data_frame method * Apply suggestions from code review Co-authored-by: Britta Westner <britta.wstnr@gmail.com> * cosmetics * add test_to_data_frame * fix tests _index and _time_format * fix codespell * fix codespell (I now learned to run flake locally) * add selection, drop_log to EpochsTFR * forward selection and drop_log to EpochsTFR * assign selection and drop_log also in else case * consistency checks * add tests for selection, drop_log, rw epochstfr * doc: add EpochsTFR to params of read_ write_tfrs * add doc string for test_init_EpochsTFR * fix doc str test * move to_data_frame to _BaseTFR for inheritance * extend tests * simplify Co-authored-by: Daniel McCloy <dan@mccloy.info> * upgrade coding style Co-authored-by: Daniel McCloy <dan@mccloy.info> * shorten doc string Co-authored-by: Daniel McCloy <dan@mccloy.info> * shorten doc string Co-authored-by: Daniel McCloy <dan@mccloy.info> * Apply suggestions from code review Co-authored-by: eioe <klotzsche@cbs.mpg.de> Co-authored-by: Britta Westner <britta.wstnr@gmail.com> Co-authored-by: Daniel McCloy <dan@mccloy.info>
Contributor
|
Looks very nice, great job @eioe! |
Contributor
Author
Contributor
|
Yes, still on my agenda! |
larsoner
added a commit
that referenced
this pull request
Apr 26, 2021
* extend ERDS example with df method * housekeeping for PR #9124 * rm space * improve doc Co-authored-by: Daniel McCloy <dan@mccloy.info> * improve code stringency Co-authored-by: Daniel McCloy <dan@mccloy.info> * refactor plotting to use FacetGrid * refactor using FacetGrid; rename file * change filename * test * improve plotting * move legend * Update examples/time_frequency/time_frequency_erds.py fix doc string layout Co-authored-by: Clemens Brunner <clemens.brunner@gmail.com> * rework text Co-authored-by: Clemens Brunner <clemens.brunner@gmail.com> * rework text Co-authored-by: Clemens Brunner <clemens.brunner@gmail.com> * fix spelling Co-authored-by: Clemens Brunner <clemens.brunner@gmail.com> * fix length block splitters * add explanation for time_format=None * change binning * thinner violin outlines * remove empty plots * fix doc Co-authored-by: Daniel McCloy <dan@mccloy.info> Co-authored-by: Clemens Brunner <clemens.brunner@gmail.com> Co-authored-by: Eric Larson <larson.eric.d@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is related to issue #7975
EpochsTFR and AverageTFR do not allow to extract data as a (pandas) data frame which in turn would be handy for export to (e.g.) R.
To build this functionality, I use the
to_data_frame()method of theBaseEpochsclass as template.Major differences:
EpochsTFRdid not yet have theselectionattribute which should be used for theepochindex in the resulting data frame.BaseEpochsgets scaled (according to the channel type) before it's written out. For TFR data this seems to be more complicated because it should also be taken into account whether any/which baselining procedure was applied to get meaningful units/scaling.I implemented 1. and 2.
EpochsTFRandAverageTFRnow both inherit ato_data_framemethod from_BaseTFRwhich has similar way of functioning as the methods forEpochsandEvoked. Currently, I'm skipping the scaling for the TFR classes and leave it to the users to interpret/label the output as they should know best what state the data is in.