Skip to content

[MRG] scale_source_space(): add support for vol source spaces - #4894

Merged
larsoner merged 8 commits into
mne-tools:masterfrom
christianbrodbeck:scale-vol
Feb 3, 2018
Merged

larsoner merged 8 commits into
mne-tools:masterfrom
christianbrodbeck:scale-vol

Conversation

@christianbrodbeck

Copy link
Copy Markdown
Member

Resurrecting #1205...

@agramfort

Copy link
Copy Markdown
Member

you seem to ahve some legit travis failures

@christianbrodbeck

christianbrodbeck commented Jan 26, 2018 •

Copy link
Copy Markdown
Member Author

Ah, so the fsaverage in the testing environment does not have the MRI images... And it looks like when creating a source space without MRI image then it becomes a discrete source space, and after saving and reloading the src_mri_t entry is gone... Using the sample data (which has MRI images) instead makes the test go way longer, so I should probably stick with the discrete source space and just remove the test of src_mri_t? [Edit: 533.151s vs 13.168s on my setup]

@codecov

codecov Bot commented Jan 26, 2018 •

Copy link
Copy Markdown

Codecov Report

Merging #4894 into master will decrease coverage by 0.05%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #4894      +/-   ##
==========================================
- Coverage    87.7%   87.64%   -0.06%     
==========================================
  Files         351      351              
  Lines       62761    62832      +71     
  Branches    10757    10767      +10     
==========================================
+ Hits        55043    55071      +28     
- Misses       4969     5007      +38     
- Partials     2749     2754       +5

@larsoner

Copy link
Copy Markdown
Member

Using the sample data (which has MRI images) instead makes the test go way longer

This is probably a function of your spacing. Change it to 2cm and it should be fast. If it's not, we should look at which step is slow.

(Another alternative: you can hack it by copying the fsaverage dir to a temp dir and copy in sample's T1.mgz. It won't align properly but it hopefully won't matter for testing purposes. But hopefully we can get sample to work instead.)

@agramfort

Copy link
Copy Markdown
Member

still WIP ? or MRG now?

@christianbrodbeck

christianbrodbeck commented Jan 31, 2018 •

Copy link
Copy Markdown
Member Author

This is probably a function of your spacing. Change it to 2cm and it should be fast. If it's not, we should look at which step is slow.

I am already using pos=50. The difference in in timing seems to come from just using the sample dataset, not from enabling the MRI test. I think it's because create_default_subject() copies all files in the subject's directory, and the fsaverage in the sample dataset has a lot more files, so this will in turn cause scale_mri to scale a lot more files. Trying by copying just the MRI file from sample data now...

@christianbrodbeck

Copy link
Copy Markdown
Member Author

This fixed the tests, so I will set this to MRG

@christianbrodbeck christianbrodbeck changed the title WIP scale_source_space(): add support for vol source spaces [MRG] scale_source_space(): add support for vol source spaces Jan 31, 2018

@larsoner larsoner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM +1 for merge.

Does it add much time to the tests?

Comment thread mne/tests/test_coreg.py
from shutil import copyfile

from nose.tools import assert_equal, assert_raises, assert_true
from nose.tools import assert_equal, assert_raises, assert_true, assert_is_not

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

FYI we have gone to pytest so you can just do assert x is not y in tests now

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Do you want me to update the tests in this PR?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Only if you are bored :)

@christianbrodbeck

Copy link
Copy Markdown
Member Author

I think it added about a second on my Mac mini.

@agramfort

Copy link
Copy Markdown
Member

@larsoner merge if you're happy too

@larsoner

larsoner commented Feb 3, 2018

Copy link
Copy Markdown
Member

@christianbrodbeck I don't get nan when doing this:

np.linalg.norm(np.array([-0.0005, -0.0005,  0.0005], dtype=np.float32))

So I am a bit confused by that commit message. But we can merge in any case.

@larsoner
larsoner merged commit ba7447e into mne-tools:master Feb 3, 2018
@christianbrodbeck

Copy link
Copy Markdown
Member Author

It might be the specific version/platform/distribution combination? I figured using scipy's norm wouldn't hurt.

In [2]: import numpy as np

In [3]: np.__version__
Out[3]: '1.11.3'

In [4]: np.linalg.norm(np.array([-0.0005, -0.0005,  0.0005], dtype=np.float32))
//anaconda/envs/mayavi45/lib/python2.7/site-packages/numpy/linalg/linalg.py:2130: RuntimeWarning: invalid value encountered in sqrt
  ret = sqrt(sqnorm)
Out[4]: nan

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.

3 participants