Skip to content
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

FIX: Fix missing enums #8

Merged
merged 10 commits into from
Oct 5, 2018
Merged

FIX: Fix missing enums #8

merged 10 commits into from
Oct 5, 2018

Conversation

larsoner
Copy link
Member

Fixes missing enums.

@larsoner larsoner force-pushed the missing branch 2 times, most recently from 261d7c2 to 00f8db4 Compare September 12, 2018 15:01
Copy link
Member Author

@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.

@jnenonen @mkajola this PR:

  1. Adds a few missing entries from the coil enum in the MEGIN range
  2. Adds two missing units from hte unit enum in the MEGIN range
  3. Adds a new next enum in the MEGIN range (not sure if this makes sense)
  4. Adds a new mne_coord enum in the MNE range

Let me know if this makes sense to you! Feel free to comment in-line on the changes -- I've already highlighted the 4 change categories.

@@ -200,6 +200,8 @@ enum(unit) "FIFF value unit code"
lx 116 "lux"
T_m 201 "T/m"
Am 202 "Am"
Am_m2 203 "Am/m^2"
Am_m3 204 "Am/m^3"
Copy link
Member Author

Choose a reason for hiding this comment

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

These are in MNE but missing here. Okay to add to the MEGIN range?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems fine to me.

artemis123_ref_mag 7502 "Artemis123 reference magnetometer"
artemis123_ref_grad 7503 "Artemis123 reference gradiometer"
kriss_grad 8001 "KRISS gradiometer"
sample_tms_planar 9001 "Sample TMS sensor"
Copy link
Member Author

Choose a reason for hiding this comment

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

Same -- MNE has these 7 FIFFV_COIL_ types that MEGIN does not have. Okay to add these? I think they have already been used in MNE-C software by @mshamalainen

Copy link
Collaborator

Choose a reason for hiding this comment

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

7003 conflicts with LorenzE suggestion. What is the difference between baby_ref_mag (7003) and baby_ref_mag2 (7003)?

Copy link
Member Author

@larsoner larsoner Sep 18, 2018

Choose a reason for hiding this comment

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

I think his names are better/more complete. I'll see if he can push those changes here, and then reviewing again should be possible / hopefully not so bad.

DictionaryTypes.txt Show resolved Hide resolved
fs_tal_gtz 2004 "FreeSurfer Talairach (MNI z > 0)"
fs_tal_ltz 2005 "FreeSurfer Talairach (MNI z < 0)"
fs_tal 2006 "FreeSurfer Talairach"
}
Copy link
Member Author

Choose a reason for hiding this comment

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

These MNE coordinate frames in principle could live in the MEGIN range for enum(coord), but it might make sense to leave them separate (done in current PR).

Copy link
Collaborator

Choose a reason for hiding this comment

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

Seems OK, consider later whether to add in MEGIN range.

Copy link
Member Author

Choose a reason for hiding this comment

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

From @mkajola:

Are “enum(mne_coord) "Additional coordinate type"” used to define coordinate systems ...

In theory these could just be in the main MEGIN range, yes. I'm happy either way.

The advantage/logic to having them in the MNE range is that I don't think they are used in MEGIN software anywhere. In MNE usually these coordinate frames are transient and we put everything in standard Neuromag head, device, or MRI (FreeSurfer RAS) coordinates.

The drawback is that now there are two places that coordinate frame definitions live: the "main" ones in MEGIN range and some "auxiliary" ones in MNE range.

@jnenonen @mkajola if you're okay moving these to the MEGIN range, I'm happy to do it -- it probably does make things simpler in the long run. I don't anticipate needing many more coordinate frame definitions -- maybe a couple if other systems have different head coordinate definitions we need to respect?

@larsoner
Copy link
Member Author

Thanks for catching the inconsistencies @jnenonen. I have fixed the "Sequence" to have 0 for next file, and put @LorenzE's better BabyMEG definitions in this file. Ready for another round of review from my end.

@@ -306,6 +315,13 @@ enum(role) "Values for 'ref_role'; the role of a reference"
}


enum(next) "File pointers"
Copy link
Member Author

Choose a reason for hiding this comment

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

Also @jnenonen better description welcome here if you have one!

artemis123_grad 7501 "Artemis123 gradiometer"
artemis123_ref_mag 7502 "Artemis123 reference magnetometer"
artemis123_ref_grad 7503 "Artemis123 reference gradiometer"
kriss_grad 8001 "KRISS gradiometer"
Copy link
Member

Choose a reason for hiding this comment

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

@larsoner Can you pls double check if you switched the value of kriss_grad with sample_tms_planar? The mne-python coil_def.dat https://github.com/mne-tools/mne-python/blob/master/mne/data/coil_def.dat suggest otherwise.

Copy link
Member Author

Choose a reason for hiding this comment

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

Over in our constants file it's 8001 but in the coil_def I see it's 9001, so looks like our constants file has a bug! I've pushed a commit to fix it here and will make an MNE PR shortly.

@mshamalainen
Copy link
Member

mshamalainen commented Sep 27, 2018 via email

@larsoner
Copy link
Member Author

From over in the MNE-Python PR:

# Coil definitions for artemis123 coils make use of integration points
# according to the last formula in section 25.4.62 in the
# "Handbook of Mathematical Functions: With Formulas,
# Graphs, and Mathematical Tables" edited by Abramowitz and Stegun.
# http://people.math.sfu.ca/~cbm/aands/abramowitz_and_stegun.pdf
# They were generated using
# gist: https://gist.github.com/bloyl/84a2dc04d77ef0f300aef397f57201f2

So using the code here.

@larsoner
Copy link
Member Author

@jnenonen @mkajola I pushed a commit to unify the "mne_coord" enum with the "coord" enum since it does seem like a cleaner approach. Let me know if this looks reasonable to you and, if so, we can hopefully merge these changes.

@mkajola
Copy link
Collaborator

mkajola commented Oct 2, 2018

Hello @larsoner ,
Looked at the current head of larsoner-missing. I think it more or less there.

Could revert the modernization of Am_m2 & m3. Has some character encoding that looks weird in my emacs. Anyway the dictionary is intended to be machine readable, so at this phase it might better to stay in ascii. Could align the the tabs at the same time.
Same for moles.

Could remove the Finnish comment about "stukturaalista". I think it is not needed.

@mshamalainen just question about old stuff: how does the "MRI voxel coordinates" compare to
"data volume".
It would be nice if DictionaryIOD_MNE had explanations what the blocks mean.

@larsoner larsoner mentioned this pull request Oct 2, 2018
@larsoner
Copy link
Member Author

larsoner commented Oct 2, 2018

Could revert the modernization of Am_m2 & m3

Yep, I can do that.

Could align the the tabs at the same time.

So far there are tabs used for alignment. Tab-based alignment for variable-length entries -- such as some long names and some short names -- is a bit of a pain because it relies on the tab width being rendered in a standardized way, which in general varies by editor. We could decide how many characters we want a tab stop to be equivalent to, but then everyone has to view the files with these settings. So I'd suggest we change to using spaces. I'll do that for the entries I've changed unless someone objects. We should change the other entries at a later time: #11

how does the "MRI voxel coordinates" compare to "data volume".

From what I understand, in MNE the FIFFV_COORD_MRI / "data volume" coordinates are in units of meters relative to the center of the head (today we usually use the Freesurfer surface RAS coordinates for this). The "mri voxel" coordinates are in units of pixel indices of the volume, i.e., for a 1mm^3 acquisition the units are effectively mm, with the center at one of the volume corners (I think).

It would be nice if DictionaryIOD_MNE had explanations what the blocks mean.

I did not change that file in this PR, so I suggest that we do it in a separate PR. It's generally easier to review in smaller separable chunks, easier me to get to it later, and better to get this PR merged sooner. GitHub facilitates making this sort of small incremental progress. I have opened a new issue for this so we don't forget to do it: #10

@larsoner
Copy link
Member Author

larsoner commented Oct 2, 2018

Pushed a commit to remove the non-ASCII chars, as well as one to change the tabs to spaces for alignment in this file only.

I also added basic continuous integration (Travis-CI, which is free for open-source projects) to ensure that we don't add non-ASCII chars in the future. You can look at the .travis.yml to see what runs automagically for us, and click on the status badge to look at the result, which I ran on an intentionally bad commit. In case you are not familiar with CI services -- you can have them do all sorts of useful things. For example, you could set it up to remotely build the fiff-support library on any PR you open, and on merge make the binaries available somewhere, etc. In MNE we have a (free) CI service continuously build our docs and upload them (see modified date at the bottom), for example.

@jnenonen @mkajola good to go from your end now? Since there are a ton of whitespace changes the diff looks painful, but if you just look at each of the last few commits (can click on them on GitHub) it's not as painful.

@mkajola
Copy link
Collaborator

mkajola commented Oct 4, 2018

Hi @larsoner,
Looks good to me. Only thing I saw was an old typo Neuormag in Types.txt.
What si now the correct way to proceed?

@larsoner
Copy link
Member Author

larsoner commented Oct 4, 2018

I would suggest tha you click the big green button. Then you or I (or someone else) opens a PR to fix the typo. If you're interested in learning how to use git and GitHub a typo fix is a nice one to start with. If you aren't interested in doing that, it can wait until someone else gets around to it.

@mkajola mkajola merged commit 134eec7 into mne-tools:master Oct 5, 2018
@larsoner larsoner deleted the missing branch October 5, 2018 14:36
@larsoner
Copy link
Member Author

larsoner commented Oct 5, 2018

Thanks for the reviews and iterations @mkajola @jnenonen ! I hope to open a PR soon to unify our coil_def.dat files next.

@jnenonen can you email me the latest coil_def.dat you have been using so I can merge the two?

@jnenonen
Copy link
Collaborator

jnenonen commented Oct 5, 2018 via email

@LorenzE
Copy link
Member

LorenzE commented Oct 5, 2018

@mshamalainen is currently working on an updated version of the coil_def.dat (Artemis is missing in the mne-c and mne-cpp version). I will open PRs to mne-python and mne-cpp when ready. Once merged and all three projects (mne-c, mne-python and mne-cpp) are on the same page we could add the coil_def.dat to this repo as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants