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

Add warning when coordinates dataset contains both positive and negative z_stats #699

Merged
merged 4 commits into from
Jun 11, 2022

Conversation

JulioAPeraza
Copy link
Collaborator

@JulioAPeraza JulioAPeraza commented Jun 7, 2022

Closes #465.

Changes proposed in this pull request:

  • Check for z_stat in Dataset.coordinates.columns.
  • Check if there are values with z_stat >= 0 AND z_stat < 0 in Dataset.__init__() and when the ImagesToCoordinates.transform() is applied.

@codecov
Copy link

codecov bot commented Jun 7, 2022

Codecov Report

Merging #699 (3019aa9) into main (2b9229f) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #699      +/-   ##
==========================================
+ Coverage   85.31%   85.34%   +0.02%     
==========================================
  Files          41       41              
  Lines        4521     4530       +9     
==========================================
+ Hits         3857     3866       +9     
  Misses        664      664              
Impacted Files Coverage Δ
nimare/dataset.py 89.96% <100.00%> (+0.23%) ⬆️
nimare/transforms.py 75.71% <100.00%> (+0.26%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2b9229f...3019aa9. Read the comment docs.

@tsalo
Copy link
Member

tsalo commented Jun 7, 2022

It looks like the additions to transforms.py is covered by tests, but the changes to dataset.py are not.

nimare/dataset.py Outdated Show resolved Hide resolved
@JulioAPeraza
Copy link
Collaborator Author

It looks like the additions to transforms.py is covered by tests, but the changes to dataset.py are not.

I think this happens because db_file = op.join(get_test_data_path(), "neurosynth_dset.json") contains Nones in the "z_stat" column, so it doesn't get to check for positive and negative values.

@tsalo
Copy link
Member

tsalo commented Jun 7, 2022

Do you know how it's checked in transforms.py? Do we can any tests that actually cover the case where there are positive and negative z-stat values? My concern is that we don't currently have any methods that use z-stat values, so I think the only place we're going to catch any bugs is by testing the warning directly, rather than downstream in any meta-analyses.

@JulioAPeraza
Copy link
Collaborator Author

Do you know how it's checked in transforms.py?

I think it is checked when an images dataset is transformed to coordinates here: https://github.com/neurostuff/NiMARE/blob/main/nimare/tests/test_transforms.py#L131. We don't initialize a Dataset class here, so the changes to dataset.py are not covered.

I think to test the changes to dataset.py we would need to initialize the Dataset class with a source that contains a z_stat with negative and positive values.

@tsalo
Copy link
Member

tsalo commented Jun 8, 2022

I think to test the changes to dataset.py we would need to initialize the Dataset class with a source that contains a z_stat with negative and positive values.

Maybe we can add z-stats to one of the test Datasets.

@JulioAPeraza
Copy link
Collaborator Author

Maybe we can add z-stats to one of the test Datasets.

I have added the new test, and it looks like it's covering dataset.py. After expanding the warning message I got an error in the Upload Coverage that I don't know how to fix.

@tsalo
Copy link
Member

tsalo commented Jun 8, 2022

I re-ran that step and it worked this time. I assume it was just a random upload issue. I'll take another quick look and approve if it looks good.

Copy link
Member

@tsalo tsalo left a comment

Choose a reason for hiding this comment

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

LGTM!

@JulioAPeraza
Copy link
Collaborator Author

Great. Thanks!

@tsalo tsalo added enhancement New feature or request cbma Issues/PRs pertaining to coordinate-based meta-analysis labels Jun 11, 2022
@tsalo
Copy link
Member

tsalo commented Jun 11, 2022

@JulioAPeraza do you want to merge this?

@JulioAPeraza
Copy link
Collaborator Author

Sure!

@JulioAPeraza JulioAPeraza merged commit f9d05d7 into neurostuff:main Jun 11, 2022
@JulioAPeraza JulioAPeraza deleted the posneg-warning branch June 11, 2022 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cbma Issues/PRs pertaining to coordinate-based meta-analysis enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Raise warning if coordinates dataset contains both positive and negative z_stats
3 participants