-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
ENH: add to_data_frame method to EpochsTFR #9124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
don't forget to add some tests |
Co-authored-by: Britta Westner <britta.wstnr@gmail.com>
|
I updated the original post to better reflect what happened in the mean time.
|
drammock
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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>
Co-authored-by: eioe <klotzsche@cbs.mpg.de>
|
thanks @eioe! |
* 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>
|
Looks very nice, great job @eioe! |
|
Yes, still on my agenda! |
* 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 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.