Skip to content

simulate_sparse_stc throws assertion error when n_dipoles > len(labels) #5953

Closed

Description

@QB3

Describe the bug

simulate_sparse_stc throws an assertion error when n_dipoles > len(labels) .
It should generate min(n_dipoles, len(labels)) dipoles.

Steps and/or code to reproduce

If you slightly modified the code of the following MNE example:
https://www.martinos.org/mne/stable/auto_examples/simulation/plot_simulate_evoked_data.html#sphx-glr-auto-examples-simulation-plot-simulate-evoked-data-py
by remplacing n_dipoles=2 by n_dipoles=4 ligne 58, whiwh I did here:
https://gist.github.com/QB3/6ac76962c9ab7b9f1b44c1026021cafe
an assertion error is thrown.

Expected results

As len(labels) = 3 I expect 3 dipoles.

Actual results

assertion error from this line

assert datas.shape == data.shape

Activity

  1. changed the title [-]simulate_sparse_stc crashes when n_dipoles > len(labels)[/-] [+]simulate_sparse_stc throws assertion error when n_dipoles > len(labels)[/+] on Feb 18, 2019
  2. agramfort commented on Feb 18, 2019

    @agramfort
    SponsorMember
  3. QB3 commented on Feb 18, 2019

    @QB3
    ContributorAuthor

    OK then we will have to change also the current warning msg:

    warn('The number of labels is different from the number of '

  4. agramfort commented on Feb 18, 2019

    @agramfort
    SponsorMember

    hum so now you get a warning but it will always crash afterwards? Basically warn should be ValueError or the min(n_dipoles, len(labels)) should actually be implemented?

  5. QB3 commented on Feb 18, 2019

    @QB3
    ContributorAuthor

    yes, current warning is The number of labels is different from the number of dipoles. 2 dipole(s) will be generated, but then an assertion error is thrown

  6. agramfort commented on Feb 18, 2019

    @agramfort
    SponsorMember
  7. QB3 commented on Feb 19, 2019

    @QB3
    ContributorAuthor

    OK I will do this then:

    • n_dipoles > len(labels) --->>> ValueError
    • n_dipoles < len(labels) ---->>> keep the same generate n_dipoles dipoles
  8. agramfort commented on Feb 19, 2019

    @agramfort
    SponsorMember
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions