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 convenience function for openmc.stats.Discrete for single values or multiple equal probability values #2961

Open
MicahGale opened this issue Apr 16, 2024 · 0 comments

Comments

@MicahGale
Copy link
Contributor

Description

I find myself writing openmc.stats.Discrete([1.23], [1]). The probabilities here just seem silly. Also sometimes selecting multiple values with equal probability is a bit clunky too:

values = [1,2,3]
openmc.stats.Discrete(values, [1/len(values)]*len(values))

Name for this is TBD:

@staticmethod
def equal_probability(values):
   return openmc.stats.Discrete(values, [1/len(values)]*len(values))

Alternatives

Let the user continue to do as they currently do.

Compatibility

This would only add a new method.

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

No branches or pull requests

1 participant