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

ensure clump info is calculated when clumps are created #2053

Merged
merged 2 commits into from
Oct 10, 2018

Conversation

ngoldbaum
Copy link
Member

Currently the clump info attribute is only populated by clump.save_as_dataset. This PR makes it so that information is calculated for all clump objects when the clump is initially created.

@brittonsmith I'd very much appreciate any insight you might have on whether this will have unintended consequences elsewhere.

Copy link
Member

@brittonsmith brittonsmith left a comment

Choose a reason for hiding this comment

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

This solution will add slightly to the computation time since the clump info items will be calculated by default instead of only after determining which clumps should survive, but that should be pretty minimal. We don't have any stock info items whose results could change over the course of the clump finding, but it's possible to imagine some. It might interesting in the future to implement on-demand calculation of the info items, but that can wait.

return "Cell Volume: %6e cm**3.", total_vol
add_clump_info("total_volume",_total_volume)
master_clump.add_info_item("total_volume")

find_clumps(master_clump, 0.5, 2. * high_rho, 10.)

# there should be two children
assert_equal(len(master_clump.children), 2)

leaf_clumps = get_lowest_clumps(master_clump)
Copy link
Member

Choose a reason for hiding this comment

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

I suppose this is unrelated to this PR, but I realize that we just marked get_lowest_clumps as deprecated. Could you change this to master_clump.leaves?

Copy link
Member Author

Choose a reason for hiding this comment

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

done, as well as a few other places we were still using it internally and in the docs.

@ngoldbaum
Copy link
Member Author

@yt-fido test this please

@ngoldbaum ngoldbaum merged commit c1611fa into yt-project:master Oct 10, 2018
@ngoldbaum ngoldbaum deleted the clump-info-fix branch December 11, 2018 15:30
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