Skip to content

tfr_array_stockwell data argument does not match the epoch_data argument of tfr_array_multitaper and _morlet functions #12305

Closed

Description

@tsbinns

Proposed documentation enhancement

Hi, just a small suggestion:

Issue

I noticed that that data is given to the tfr_array_multitaper and tfr_array_morlet functions as epoch_data, but as data for tfr_array_stockwell.

All three of these functions state that the data must be of shape (n_epochs, n_channels, n_times), so it is clear that even for tfr_array_stockwell, data should be epoched, however this is not so clear from the Looking at the Time-Frequency module API.

I could see someone skimming the API thinking that tfr_array_multitaper and tfr_array_morlet must be performed on epoched data, but tfr_array_stockwell on raw or epoched data (given the different name of the data argument).

Possible solution

Changing data to epoch_data in tfr_array_stockwell would bring it in line with the other functions and make it clear from even the module API that the Stockwell function expects epoched data.


Cheers,
Thomas!

Activity

  1. larsoner commented on Dec 18, 2023

    @larsoner
    Member

    +1 for changing the name. It's very likely people mostly have exclusively used it positionally so doing

    def tfr_array_stockwell(epoch_data, ..., *, data=None, verbose=None)
    

    and emitting a FutureWarning when data is not None should be safe enough. @tsbinns up for opening a PR to do this?

  2. added this to the 1.7 milestone on Dec 18, 2023
  3. drammock commented on Dec 18, 2023

    @drammock
    Member

    just to play devil's advocate for a moment, would it be better to change the other two functions' first param to data instead? To me it feels slightly better (because data as first param is a very common pattern, and not just for us). But I'm content to defer to @larsoner or others on this point

  4. larsoner commented on Dec 18, 2023

    @larsoner
    Member

    Works for me

  5. tsbinns commented on Dec 18, 2023

    @tsbinns
    MemberAuthor

    Okay, so switch the multitaper and Morlet functions to data and set epoch_data=None as default (raising a FutureWarning if epoch_data is not None)?

    Happy to open a PR for this, latest after the holidays. Cheers!

  6. drammock commented on Dec 18, 2023

    @drammock
    Member

    Okay, so switch the multitaper and Morlet functions to data and set epoch_data=None as default (raising a FutureWarning if epoch_data is not None)?

    yep! thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions