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

[bugifx] Make sure region edge units are in code_length. #2399

Merged
merged 1 commit into from
Jan 23, 2020

Conversation

brittonsmith
Copy link
Member

After PR #2391 was merged, I encountered a few cases of all_data selection returning empty arrays. It seems in some cases the region edges are not in code units.

@matthewturk
Copy link
Member

This looks right to me, but any chance you can say more about which situations it might happen?

@brittonsmith
Copy link
Member Author

brittonsmith commented Dec 17, 2019

Sure, I encountered this making lightray data sets with Trident. The underlying data format is ytdata. I think data set is saved with domain_left_edge and domain_right_edge defined in unitary units. When I was debugging this, that's what region.left_edge and region.right_edge were in.

I'm happy to share the lightray file if you want to play around, but it may be more trouble than it's worth to add a test that uses it.

@matthewturk
Copy link
Member

This error is odd -- it looks like a transient AppVeyor issue, maybe? It's nothing related to this PR, so I think we should accept this and address the AppVeyor issue (which seems to be showing up elsewhere) in another PR.

@brittonsmith
Copy link
Member Author

I'll just add this for anyone interested. The problem can be demonstrated by loading up a particle dataset and doing the following:

ds = yt.load(...)
ds.domain_right_edge = ds.domain_right_edge.to('unitary')
ds.domain_left_edge = ds.domain_left_edge.to('unitary')

Not that I'm condoning that operation, but it demonstrates what happens when the default domain units are not code_length, as in the case I encountered.

@matthewturk
Copy link
Member

@brittonsmith I am not sure I understand how this is possible -- aren't domain_left_edge and domain_right_edge instances of MutableAttribute objects, which shouldn't allow them to be reset?

Also, would this problem be solved if all of our "index"-related arrays were immutable?

@brittonsmith
Copy link
Member Author

brittonsmith commented Jan 4, 2020

You can still do

ds.domain_right_edge = 'reginaldbarclay'

and it will stick.

The MutableAttribute only prevents the units from changing permanently with convert_to_units.

The primary issue of this bugfix is that there is a an assumption within the selection routines that domain bounds are always in code_length, but there are instances where that isn't true.

@brittonsmith
Copy link
Member Author

Any objections to merging this?

@matthewturk
Copy link
Member

matthewturk commented Jan 23, 2020 via email

@matthewturk matthewturk merged commit 8dcc2fa into yt-project:yt-4.0 Jan 23, 2020
@brittonsmith brittonsmith deleted the select branch May 15, 2020 18:51
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.

2 participants