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

Working with fixed seed in XRayTracer #132

Open
acanbay opened this issue Nov 13, 2022 · 2 comments
Open

Working with fixed seed in XRayTracer #132

acanbay opened this issue Nov 13, 2022 · 2 comments

Comments

@acanbay
Copy link

acanbay commented Nov 13, 2022

Hello,

Is there a seed definition feature in the GeometricSource method to work on the same beam all the time ?
Normally, a different beam is generated in each run. What we want is to generate the same beam (phase spaces and energies of the photons in the beam must be the same) in every operation, as long as the parameters do not change.

I tried to define it as np.random.seed(seed_number) in some scripts but it didn't work.

Thanks in advance

@kklmn
Copy link
Owner

kklmn commented Nov 13, 2022

Hi,
Use the numpy's seed() method anywhere before running the shine() method of your photon source. This works in my examples.

@acanbay
Copy link
Author

acanbay commented Nov 13, 2022

Thank you!
I just put it in the first line of the run_process method (before the shine) as below and it worked.

def run_process(beamLine):
   np.random.seed(0)

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

2 participants