-
Notifications
You must be signed in to change notification settings - Fork 55
Conversation
…ally residuals, predicted signal and R-squared
I'll check more in detail tomorrow -- hopefully-- but you need to add test for these functionalities to ensure that they work properly. |
If I understood correctly, you are trying to fix two issues in the same PR. It makes reviewing harder. I think it is better to fix one issue in a PR. My general comment. |
OK, I made a separate pull request for that #174 |
…and FirstLevelModel
OK. I added some tests in last commit. |
nistats/first_level_model.py
Outdated
else: | ||
return output | ||
|
||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We tend to avoid properties, which makes the code hard to undertand and debug.
|
||
@setattr_on_read | ||
@property | ||
def resid(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
residuals. I would not make it a property.
nistats/regression.py
Outdated
@@ -310,28 +311,35 @@ def norm_resid(self): | |||
""" | |||
return self.resid * pos_recipr(np.sqrt(self.dispersion)) | |||
|
|||
@setattr_on_read | |||
@property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment.
# assert that we only have one theta as there is only on voxel in our image | ||
assert_true(first_level_model.results_[0][0].theta.shape == (1, 1)) | ||
# assert that the theta is equal to the one voxel value | ||
#def test_high_level_glm_one_session(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do not leave commented code:
@Gilles86: Do you still have time to work on this? Just an interested third party since I would be rather happy to investigate regional model fit using nistats. |
Hey @jdkent , Yes. Time is always so precious, since so much is expected from new postdocs. I would still really like to finish this sometime soon though. Your ping motivates me to put it on my todo for the coming weeks again :). |
- Don’t report peaks in matrix space. - Report cluster size in mm3 instead of voxels. - Report top 3 subpeaks more than 8mm separated when available. - Add argument for voxel-connectivity for cluster definition.
Also, I removed the connectivity argument for get_clusters_table. I kept the separate neighborhood matrix function (`_get_conn`), just in case. Currently, it uses 6-connectivity (aka NN1, faces-only connectivity, or first-nearest neighbor clustering).
Also, I’ve made the subpeak detection explicitly work around binary clusters. Now it just reports the center of mass.
Numpy did not have `cbrt` function in 1.8.2, the version used for Python2.7 CI.
_local_max now checks distance between subpeaks explicitly, since the approach used in the StackOverflow post wasn’t quite doing it.
- Use minimum distance in millimeters in _local_max. - Requires including the image affine in the arguments as well. - Should also be robust to non-isotropic voxels. - Add min_distance argument to get_clusters_table, for minimum distance in millimeters. Default is 8mm. - Address PEP8 problems.
…mination) - Renamed manual-cache-timestamp.txt to manual-cache-timestamp
OK. I rebased and revised the code a bit. I notice that in the I thus now also used it in the |
Hey @Gilles86 thanks so much for attending to this. It has been a while so the conflicts in master might take more work than usual to resolve. Let me know if I can help. |
Yes. I'm sorry that the commit history got a bit messy. I'm not very used to work with multiple branches like this. We'll get there though. |
Yup. Tests passed. Anyone? |
The good news is CI is green. The not yet good news is the commit history now makes it impossible to review. |
I'm sorry. I'm learning. I made a clean version of this pull request: |
Hey @Gilles86 that's totally fine, you are helping us out here. |
@Gilles86 Never mind the cleaned up one. let's continue working here. I was concerned about GIthub showing number of files changed to be 49 something (which was in your other PR and makes it very difficult to review) but in this one it's showing the files pertinent to this PR only so it's fine. Bertrand reviewed the PR earlier, we can start by working on those. |
This commit makes it possible to calculate voxelwise residuals and R-squareds for a given GLM. Note that you can only do so when the "full" RegressionResults are returned (by setting minimize_memory of the FirstlevelModel to False). When this is asked from a SimpleRegressionResults, an exception with explanation is thrown.
I also fixed this issue:
https://github.com/nistats/nistats/issues/150