Skip to content

Conversation

@sappelhoff
Copy link
Member

This PR also comes with a question: Why do we support saving Dipoles in dip and bdip, but FixedDipoles in FIF? would it not be possible to support all formats for all objects?

https://mne.tools/stable/generated/mne.DipoleFixed.html#mne.DipoleFixed.save

https://mne.tools/stable/generated/mne.Dipole.html#mne.Dipole.save

@larsoner
Copy link
Member

For formats we inherited those from Elekta/Neuromag/MEGIN. The .dip is meant for sequential dipole fits which vary in location and orientation for every time point (potentially). The DipoleFixed has at least a fixed position. See notes in https://mne.tools/1.8/generated/mne.DipoleFixed.html

Co-authored-by: Stefan Appelhoff <stefan.appelhoff@mailbox.org>
Copy link
Member

@larsoner larsoner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Committed that change and marking for merge-when-green, thanks @sappelhoff !

@larsoner larsoner enabled auto-merge (squash) March 11, 2025 16:03
@sappelhoff
Copy link
Member Author

For formats we inherited those from Elekta/Neuromag/MEGIN. The .dip is meant for sequential dipole fits which vary in location and orientation for every time point (potentially). The DipoleFixed has at least a fixed position.

Okay -- thanks for the pointer :)

I am still not very sure why (1) there are three formats, (2) what advantages they have over each other, (3) which non-mne softwares produce them, and (4) whether some dipoles (fixed, non-fixed) can only be saved in some but not other formats 🤔

For (4) I think you say that any dipole can be saved and loaded from any format (fif, dip, bdip)

for (3) I know have heard of "xfit", which seems to be Neuromag/Elekta/MEGIN proprietary software (?)

for (2) dip and bdip are the same except that one is binary and therefore saves disk space? ... but why is there also FIF then? -- this is related to (1)

@larsoner
Copy link
Member

larsoner commented Mar 11, 2025

I am still not very sure why (1) there are three formats, (2) what advantages they have over each other, (3) which non-mne softwares produce them, and (4) whether some dipoles (fixed, non-fixed) can only be saved in some but not other formats 🤔

Maybe it's easier to think of in terms of the type of fit you do:

  1. Non-fixed-position (sequential) dipole fits. These are Dipole and cannot be saved to FIF, only to dip/bdip.
  2. Fixed-position dipole fits. These are DipoleFixed and can be saved to FIF, and are really a lot more like an Evoked instance than anything else. The amplitude and maybe ori vary as a function of time, but not the position. You could in principle maybe save these to dip/bdip but I'm not sure we support it (or want to).

I think Xfit (Neuromag dipole fitting software) can write both formats.

@drammock
Copy link
Member

I am still not very sure why (1) there are three formats, (2) what advantages they have over each other, (3) which non-mne softwares produce them, and (4) whether some dipoles (fixed, non-fixed) can only be saved in some but not other formats

Sounds like we should add a Notes section with some version of what @larsoner just posted:

Maybe it's easier to think of in terms of the type of fit you do:

  1. Non-fixed-position (sequential) dipole fits. These are Dipole and cannot be saved to FIF, only to dip/bdip.
  2. Fixed-position dipole fits. These are DipoleFixed and can be saved to FIF, and are really a lot more like an Evoked instance than anything else. The amplitude and maybe ori vary as a function of time, but not the position. You could in principle maybe save these to dip/bdip but I'm not sure we support it (or want to).

I think Xfit (Neuromag dipole fitting software) can write both formats.

@larsoner larsoner merged commit 2cdc4af into mne-tools:main Mar 11, 2025
30 checks passed
@sappelhoff sappelhoff deleted the dipdoc branch March 11, 2025 18:59
@sappelhoff
Copy link
Member Author

Thanks Eric, and agreed Dan. I can look into this as part of my #13153 or in a separate PR.

larsoner added a commit to larsoner/mne-python that referenced this pull request Apr 4, 2025
* upstream/main: (149 commits)
  FIX make_watershed_bem to handle missing talairach_with_skull.lta courtesy Freesurfer 8 (mne-tools#13172)
  ENH: Add upsampling for MEG helmet surface (mne-tools#13179)
  MAINT: Update code credit (mne-tools#13180)
  BUG: Fix bug with least-squares sphere fit (mne-tools#13178)
  fix EDF export (mne-tools#13174)
  fix typo (mne-tools#13171)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#13164)
  Fix dev installation guide (mne-tools#13163)
  expose 'mode' for plotting dipole on brain (mne-tools#13162)
  turn dipole attrs into properties (mne-tools#13153)
  remove misformatted (and unused) crossref anchor (mne-tools#13155)
  doc: point to read_dipole (mne-tools#13149)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#13152)
  BUG: Fix bug with not short-circuiting n_jobs=1 (mne-tools#13147)
  FIX: Missing coordinates.xml in MFF file (mne-tools#13148)
  FIX: Gracefully handle bad XML files in EGI reader (mne-tools#13145)
  Fixes for Latest IPython (9.0.1) (mne-tools#13146)
  Fix intersphinx (mne-tools#13143)
  BUG: Fix bug with parallel doc build (mne-tools#13140)
  [pre-commit.ci] pre-commit autoupdate (mne-tools#13141)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants