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 pretransform for full-sphere selection #2360

Merged
merged 6 commits into from
Mar 23, 2023

Conversation

Carifio24
Copy link
Member

I realized that I missed one thing in #2348 with regards to selection. Any points whose latitudes were wrapped back into [-π,π] won't be selected when making a ROI selection because the scatter viewer's apply_roi doesn't know about that transformation. This PR adds a pretransform that lets it know about what happens with longitudes.

@dhomeier dhomeier added the bug label Feb 13, 2023
Copy link
Collaborator

@dhomeier dhomeier left a comment

Choose a reason for hiding this comment

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

Thanks for the fix and improving the tests!
I could not read out of the test setup if there is actually an example with, say RA > 2*pi input, tested. Otherwise only the small restructuring request.

pretrans = state.pretransform
assert isinstance(pretrans, ProjectionMplTransform)
assert pretrans._state['y_scale'] == 'log'
for angle_unit in ['radians', 'degrees']:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
for angle_unit in ['radians', 'degrees']:
for angle_unit in ['radians', 'degrees']:

I think testing structure would benefit from instead setting this and the other test up with

@pytest.mark.parametrize('angle_unit', ['radians', 'degrees'])

Copy link
Member Author

Choose a reason for hiding this comment

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

I agree, using parametrize would be better. Maybe should include the expected mask as a parameter as well?

Copy link
Collaborator

Choose a reason for hiding this comment

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

As in parametrize('angle_unit,expected_mask' (...)? Had not even thought of that, but yes, that might make it even clearer.

@Carifio24
Copy link
Member Author

@dhomeier I've updated the tests to use parametrize like we discussed, and have the full-sphere test also check the expected masks. I also made sure that some of the data points require longitude wrapping as you had mentioned, at least in radians mode.

Some of the export tests are now failing. I suspect these failures are unrelated because they're using the rectilinear projection, but my local tests are passing and I haven't had time yet to investigate further.

@Carifio24
Copy link
Member Author

Carifio24 commented Feb 20, 2023

The same errors with the image export are popping up in the CI of other PRs (e.g. #2365), so I think it's safe to say that they're unrelated.

Edit: one of the errors was related, which has been fixed.

@Carifio24
Copy link
Member Author

Just rebased to pick up the changes from #2370 for CI purposes

Copy link
Collaborator

@dhomeier dhomeier left a comment

Choose a reason for hiding this comment

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

Looks all good now; I trust that the tests have the correct expected outcomes, thanks!

Comment on lines +170 to +171
if self.state.using_full_sphere:
transform = FullSphereLongitudeTransform(next_transform=transform)
Copy link
Collaborator

@dhomeier dhomeier Feb 20, 2023

Choose a reason for hiding this comment

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

Was wondering why you switched this, as the conversion from degrees should come first, but now realised the pretransforms are applied in reverse polish notation...

@dhomeier dhomeier merged commit 416cf2f into glue-viz:main Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants