-
Notifications
You must be signed in to change notification settings - Fork 58
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
Add support for IBMA estimators with t-statistic images in Reports #896
Conversation
Reviewer's Guide by SourceryThis pull request adds support for IBMA estimators with t-statistic images in the report generation process. The changes include updating the test cases to handle t maps and modifying the report generation logic to accommodate t maps in addition to z maps and beta maps. File-Level Changes
Tips
|
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.
Hey @JulioAPeraza - I've reviewed your changes and they look great!
Here's what I looked at during the review
- 🟡 General issues: 2 issues found
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.
if self.results.estimator.aggressive_mask: | ||
voxel_mask = self.results.estimator.inputs_["aggressive_mask"] | ||
corr = np.corrcoef( | ||
self.results.estimator.inputs_["z_maps"][:, voxel_mask], | ||
self.results.estimator.inputs_[key_maps][:, voxel_mask], | ||
rowvar=True, |
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.
suggestion: Add a comment explaining the different approaches for aggressive and non-aggressive masking
The reasoning behind using different methods for correlation calculation based on the masking approach is not immediately clear. A brief comment would improve code understanding.
if self.results.estimator.aggressive_mask: | |
voxel_mask = self.results.estimator.inputs_["aggressive_mask"] | |
corr = np.corrcoef( | |
self.results.estimator.inputs_["z_maps"][:, voxel_mask], | |
self.results.estimator.inputs_[key_maps][:, voxel_mask], | |
rowvar=True, | |
# Calculate correlation based on masking approach | |
if self.results.estimator.aggressive_mask: | |
voxel_mask = self.results.estimator.inputs_["aggressive_mask"] | |
corr = np.corrcoef( | |
self.results.estimator.inputs_[key_maps][:, voxel_mask], | |
rowvar=True, | |
) | |
else: | |
corr = np.corrcoef(self.results.estimator.inputs_[key_maps], rowvar=True) |
|
||
filename = "report.html" | ||
outpath = op.join(tmpdir, filename) | ||
outpath = op.join(stouffers_dir, filename) | ||
assert op.isfile(outpath) |
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.
suggestion (testing): Consider adding edge case tests for invalid or missing t-statistic images
While the current tests cover the basic functionality, it would be beneficial to add tests for edge cases such as invalid t-statistic images or missing images. This will ensure the robustness of the new feature.
def test_invalid_tstat_images():
with pytest.raises(ValueError):
IBMAWorkflow(invalid_image_path)
def test_missing_tstat_images():
with pytest.raises(FileNotFoundError):
IBMAWorkflow(non_existent_image_path)
Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #896 +/- ##
=======================================
Coverage 88.23% 88.24%
=======================================
Files 48 48
Lines 6386 6389 +3
=======================================
+ Hits 5635 5638 +3
Misses 751 751 ☔ View full report in Codecov by Sentry. |
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.
LGTM!
Closes None.
Changes proposed in this pull request:
Summary by Sourcery
Add support for IBMA estimators with t-statistic images in report generation and update the report generation logic to handle different types of input maps. Extend smoke tests to cover the new functionality.
New Features:
Enhancements:
Tests: