Skip to content

Arbitrary default value of origin in mne.make_field_map #13390

Closed

Description

@Mettphysik

Proposed documentation enhancement

When creating a field map via mne.make_field_map (e.g. for evoked.plot_field() plots), it feels arbitrary that the default value of the "origin" parameter is (0.0, 0.0, 0.04), and it can result in inaccurate field maps.

Is there a reason why it is not set to "auto" or at least made a necessary input? The internal method _make_surface_mapping() in mne/forward/_field_interpolation.py has the same default value, but its documentation states that "auto" is the default value. So maybe it was supposed to be "auto" all along?

Activity

  1. welcome commented on Aug 21, 2025

    @welcome

    Hello! 👋 Thanks for opening your first issue here! ❤️ We will try to get back to you soon. 🚴

  2. larsoner commented on Aug 21, 2025

    @larsoner
    Member

    I think it's just for historical reasons. I agree "auto" is a better default here. +1 for changing it via deprecation. @Mettphysik are you up for a PR to fix it? The process would be:

    1. Change the default to None
    2. In code if it's None, emit a warning that it will be (0, 0, 0.04) in 1.11 but change to "auto" in 1.12 so set it explicitly to avoid the warning

    And then once we're in the 1.12 development cycle we actually change the default to "auto"

  3. added this to the 1.11 milestone on Aug 21, 2025
  4. Mettphysik commented on Aug 21, 2025

    @Mettphysik
    ContributorAuthor

    Yes I can give it a try. Just for my understanding, after changing it to None for 1.11, should I then make another PR for 1.12?

  5. larsoner commented on Aug 21, 2025

    @larsoner
    Member

    Yes in theory! But in practice we take care of all deprecations in one big PR post-release, so doing the PR now to make the change for 1.11 will be good enough

  6. Mettphysik commented on Aug 23, 2025

    @Mettphysik
    ContributorAuthor

    @larsoner Going over the whole file I just realized there is a remark here which complicates things. I guess if I want to address this it would mean to add origin to "_as_meg_type_inst" as a new parameter and then to go over all usages of it to add origin as input, ultimately resulting in adding origin to the as_type methods of Epochs and Evoked and changing the documentation. Otherwise we would end up with"auto" as default in one place and (0, 0, 0.04) in another.

    Again, I can try it, but since its the first time I contribute I will probably have some questions in the process.

  7. larsoner commented on Aug 23, 2025

    @larsoner
    Member

    I guess if I want to address this it would mean to add origin to "_as_meg_type_inst" as a new parameter and then to go over all usages of it to add origin as input, ultimately resulting in adding origin to the as_type methods of Epochs and Evoked and changing the documentation. Otherwise we would end up with"auto" as default in one place and (0, 0, 0.04) in another.

    Well we are sort of in that situation already. Let's start small and incremental with a PR that just changes make_field_map properly. Once that's ready to merge, if you are motivated to keep going, you can figure out what other public functions would need the change and we can decide if it makes sense (it probably does!). That can be part of the same PR or a new one. But starting with changing just the one function we'll see what tests, examples, tutorials, etc. will need to be adjusted which will give a useful perspective.

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