-
Notifications
You must be signed in to change notification settings - Fork 3
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
Problem with rng/seed of rgalsim.random.GaussianDeviate #5
Comments
Actually galsim.GaussianDeviate can take a rng instead of a seed... So maybe there s no problem at all... But Actually I don't understand why do we create again an rng inside the sample method... (gd = galsim.GaussianDeviate(rng)) Why don t we just do : sample(rng):
if rng=None:
rng = galsim.GaussianDeviate(rng). # because rng=None, it means we don t have any control on the seed of the GD
if random nornal...: # for the flow
noise = np.empty(...)
# no gd = new rng
rng.generate(noise) # gaussiandeviates actually has a generate method, inheritate it fron basedeviate If you want a control on the seed, you create the rng outside the function, with : |
I've tried it, it looks like it works. I can share you my version if you think it's the good solution. |
Ok nice :-) And it works with both GalSim 1.15 and 2.x? |
And yes, for sure, feel free to submit a PR, I'll be happy to review it |
While gaslim.BaseDeviate takes a random generator (which is what we want), galsim.GaussianDeviate takes a seed.
We need a method which takes a rng, but with which we can also generate vectors (sampling).
The text was updated successfully, but these errors were encountered: