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 the option to fix the random seed #599
Conversation
tests/test_compton.py
Outdated
@@ -87,7 +87,7 @@ def run_simulation( gamma_boost, show ): | |||
zmax, zmin = boost.copropag_length( [zmax_lab, zmin_lab], beta_object=1. ) | |||
sim = Simulation( Nz, zmax, Nr, rmax, Nm, dt, | |||
dens_func=None, zmin=zmin, boundaries={'z':'periodic', 'r':'reflective'}, | |||
use_cuda=use_cuda ) | |||
use_cuda=use_cuda, random_seed=0 ) |
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.
This ensures that the new feature is being used in at least one automated test.
Let us actually create a separate free function, that can be called at the beginning of the script, and include it in some of the examples. |
@@ -75,7 +75,7 @@ | |||
# | |||
# This is also used if you do content translation via gettext catalogs. | |||
# Usually you set "language" from the command line for these cases. | |||
language = None | |||
language = 'en' |
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.
This is unrelated to the rest of the PR, but I took advantage of this PR to quickly clean up conf.py
.
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 PR!
This addresses #48.
Note that this will affect the following parts of FBPIC which rely on random numbers:
numpy.random
(on GPU and CPU)numpy.random
(on GPU and CPU)numpy.random
(CPU) orcupy.random
(GPU)numpy.random
. However, I am not sure whether the current PR will set the seed for the CPU part of the code (https://github.com/fbpic/fbpic/blob/dev/fbpic/particles/elementary_process/compton/numba_methods.py#L192)