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 Deviate class that draws from an arbitrary P(x) distribution. #306
Comments
I have C++ code for this--could adapt to or wrap in Python. |
@msimet Melanie, I wanted to point out two relatively new things in GalSim that should be useful for this:
So I think the code for this issue #306 on drawing random numbers from an arbitrary distribution could be implemented in python by: In practice I think that you might want to make a class called probdist (or something) that is initialized from numpy arrays and does steps (1)-(3), then it can have a method that draws random numbers by doing (4) and (5). (For context, for anyone else reading this, Melanie mentioned that her code that does this is not in C/C++ after all, so she can't just adapt and wrap it. That's why I'm suggesting how to simply do this from scratch using these new tools in GalSim.) |
Question for the group at large: what should we call this? I was thinking about UserDeviate, but knowing how people tend to abbreviate things I worry about confusion with UniformDeviate. |
I don't have a strong opinion. I agree there's potential for confusion with people referring to 'ud' but this is not a very big deal. Another option might be DistDeviate (i.e., deviate from a distribution). On Jan 15, 2013, at 1:48 PM, msimet notifications@github.com wrote:
Rachel Mandelbaum |
Either seems pretty good to me. Leave your mark! :) On 16 Jan 2013, at 03:20, rmandelb wrote:
|
Conflicts: CHANGELOG.md galsim/base.py pysrc/files.txt pysrc/module.cpp
… self in seed() and reset(), min<=max check instead of max<=min) (#306)
…method now always uses equally-spaced abscissa points (#306)
…)==0 points, and touching up the documentation. (#306)
Conflicts: CHANGELOG.md galsim/base.py
…anges, plus some variable name tweaking (#306)
…ow up, fixing some of the flat-probability-removal routine, minor bug fixing (#306)
…e interpolant kwarg alongside callable functions (#306)
Conflicts: CHANGELOG.md doc/GalSim_Quick_Reference.pdf doc/ref/GalSim_Quick_Reference.tex tests/test_random.py
Useful for when we have an arbitrary (e.g. realistic) P(e) function for the ellipticity.
The text was updated successfully, but these errors were encountered: