-
Notifications
You must be signed in to change notification settings - Fork 98
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
Seeding new_fractal_cluster_model #7
Comments
its caused by the algorithm generating less than the requested number of stars iin some cases - I have a fix: https://github.com/ipelupessy/amuse/tree/fractalcluster_nsmax_fix |
@ipelupessy : I'd like to confirm 500dc59 indeed fixes it for me. I don't know what to make of your comment on backend coding though... |
well, I mean it fixes the error in the code, but the fractal cluster may now return with less particles than requested, which you may still consider unsatisfactor..the new_fractal_cluster_model function could be adapted to catch this and give an error or try again with a different seed and generate a valid model, what do you think? |
I have added an option, match_N [=True by default] to exactly match the requested number of particles.. |
I suppose this is inherent to how the fractal generation algorithm works? I think calling It sounds as if we now don't have the guarantee that if I call |
if it needs to retry, new_fractal_cluster_model continues with the same generator, continuing its internal random sequence (so it will duplicate some other model, but not trivially)..have you tested the new code? |
Yes, it (bc84494) works as advertised. #makefractals3.py
from amuse.ic.fractalcluster import new_fractal_cluster_model
modelsA = []
modelsB = []
for i in range(2000):
modelsA.append(new_fractal_cluster_model(N=100, random_seed=i, match_N=True))
for i in range(2000):
modelsB.append(new_fractal_cluster_model(N=100, random_seed=i, match_N=False))
hundredsA = [len(i) for i in modelsA].count(100)
hundredsB = [len(i) for i in modelsB].count(100)
print(hundredsA, hundredsB)
|
ok, will merge |
I'm trying to create 100 fractal clusters with new_fractal_cluster_model(),
with the following piece of code (makefractals.py).
but running makefractals.py however, throws the following exception:
I've also tried randomizing the seeds like so (makefractals2.py):
This will throw the same exception after 164 models.
Can anybody confirm/reproduce this behaviour of new_fractal_cluster_model?
The text was updated successfully, but these errors were encountered: