-
Notifications
You must be signed in to change notification settings - Fork 129
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
Picking 'random' numbers which will always be the same for a given event? #682
Comments
Generate a hash from filename:start:stop and use that for the seed? |
Yeah I was thinking that but I can imagine scenarios where I end up running the same file with different chunk sizes |
Perhaps the performance cost would not be too bad from using e.g. in CMs the luminosity block as the seed for the random generator and filling an array via masking/where. I don’t know if I ever checked to see if that varies in CMS MC or not, though, the lumi… run is always 1 IIRC. Anything else that might be common across 1000s of events but not dependent on chunking/skimming/etc? Nick M |
A similar issue came up with JER smearing as discussed in #454. |
This appears answered. Re-open if not. |
Yes, correctionlib includes a facility to generate deterministic pseudorandom data. See https://cms-nanoaod.github.io/correctionlib/correctionlib_tutorial.html#Resolution-models for an example |
In the c++ version of my analysis code there are a few spots where we make use of random numbers. In order to ensure the results are always the same for a given event we set the generator seed using the event number. Is there a fast/efficient way to do this with numpy arrays? Seems bad to generate the array one event at a time in a for loop.
Something like:
From what I can find this functionality does not exist in numpy. Perhaps what I actually want is a hash of the event number where the hashing function samples the uniform distribution.
The text was updated successfully, but these errors were encountered: