-
Notifications
You must be signed in to change notification settings - Fork 519
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
Adding methods to automatically apply results to existing Tally objects. #2671
Adding methods to automatically apply results to existing Tally objects. #2671
Conversation
02d7f3d
to
1838375
Compare
1838375
to
f72b96f
Compare
f72b96f
to
54c938e
Compare
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.
I like this feature. My one concern is that right now this PR drops coverage.
bc86858
to
5e249a9
Compare
0690457
to
25dd302
Compare
After a good amount of massaging related to the When the I've updated the documentation about the With that, I think I'm pretty happy with the state of this pending further review or something I've missed (impossible); I'll be looking forward to updating tutorials/notebooks to use this feature as I think it will make setup and post-processing in a single script/notebook more intuitive. @MicahGale @paulromano @jtramm I'd be curious to hear your thoughts in particular! |
…ifferent than an explicity specified estimator
…n Tally.__eq__. The default value of None for the `Tally.estimator` attribute allows the C++ code to provide additional warnings/errors if a user explicitly specifies an estimator that is incompatible with the tally filters/scores. When this value is None, no entry appears in the XML inputs and OpenMC is free to choose an appropriate estimator without error.
8466fb4
to
2fb7e3d
Compare
I still need to pull this branch and play around with it a bit. My first inclination for the equality of |
Yeah I agree that an explicit default might be more clear in terms of intention, but I think the equivalence logic would mainly remain the same. We can't really rely on 'tracklength' as the default value because there are restrictions for estimators on certain scores/filters, but the C++ will try to respect an explicitly set estimator on the Line 283 in dcb2557
Explicitly setting tracklength is going to cause a lot of problems in the test suite and a lot of this implicit default is already baked into that in one way or another. I actually tried this out earlier in this PR but it was clear that it's sort of its own mess to untangle if we want to change that behavior. Another option is on the C++ side, the calls to |
Sorry for the delay, yes that makes sense for now. Long term it would be nice it the default were automatically changed as needed, but that's beyond this scope. |
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.
Thanks for this usability improvement @pshriwise! Definitely will make our workshops run a little smoother :) I ended up modifying the approach a bit. Rather than separating out the _populate_tally
method as you had done in the StatePoint
class and then using that within the Tally
class, I simply updated the Tally._read_results
method to get all the information it needs (number of realizations, list of nuclides) and then add_results
just adds the _sp_filename
attribute that is used when _read_results
is called. This makes the overall diff a bit smaller.
Some things we ought to consider as part of follow-on PRs:
- Taking that logic you had as
_populate_tally
and perhaps having it be aTally.from_hdf5
classmethod. - Setting
Tally.nuclides
to be["total"]
by default (explicit is better than implicit). I could definitely sense some awkwardness around this in our logic.
@MicahGale all of your comments should be addressed at this point. Let us know if you're satisfied and if so, we'll go ahead and merge. Thanks! |
Nice! I like it. More succinct; fewer methods to maintain. Thanks! |
Yeah I think that might be nice. I'll snag the last commit with that here and make an issue.
I like it. As @MicahGale suggested, I think we might want to do something with the estimator that's more descriptive than Thanks for cleaning this up! |
Description
One thing I've always found a bit clunky when working with our simulation results is the process of extracting user-specified tally results from the statepoint file. It seems to me that finding a match is left to the user, but it should be possible to automate that in the majority of cases.
The idea here is that we can now apply results from our statepoint file to the original tally objects created as inputs to the simulation. This simplifies situations like:
to
or even
Keeping this as a draft for now as I'm kind of workshopping it. But I'll take care of the following dev tasks soon if there aren't any objections to heading this direction.