Commit c29f379
authored
Merge pull request #700 from ochase10/seedfix
What I am updating here is the code for generating log normal mock catalogs.
How those work is by first using a random number to create a density field which follows some power spectrum. You need the random number because there are many possible random fields for a given power spectrum. Once you have a density field, you then look in each grid cell and do Poisson sampling to determine whether there is a source there. This is, of course, random.
Therefore, there are 2 separate stages of randomness involved in making a mock catalog. First, one needs the initial conditions to determine the exact density field, and two, the density field needs to be randomly sampled to generate sources.
The way the code currently works is to use the same seed for both of these random processes (making the density field and sampling it). Now suppose I make a mock catalog and realize it was too small. If I use a new seed for the density field (with the same power spectrum), the two mocks will be incompatible at the field level because the specific locations of the density peaks would be uncorrelated between them. Their power spectra would match, but if you combined them and computed a power spectrum you would not get the right answer. However, in the current implementation, the only way to use the same initial conditions (same density field) again for a new mock is to also use the same Poisson sampling. In other words, there is only 1 random sample of sources possible from each random density field. So, if I ever want to increase the size of my mock, I have to recreate all the sources I already have. This is an issue not only due to wasted compute, it limits the size of mocks I can possibly make to the density I can fit in the RAM. If I want anything bigger (more dense), I simply cannot do it because I will always get the same source catalog from a given set of initial conditions.
What my update does is separate the seeds for these two random processes to allow for each set of initial conditions to result in myriad possible source instantiations. If only the standard 'seed' is provided or no seed is provided at all, the behavior is identical to before and should preserve the functionality of all legacy code (I think). There is simply a new argument which allows me to fix the initial conditions (using the random seed for the density field) while leaving the sampling seed free to vary. Or, at least, that is its intention.1 file changed
Lines changed: 13 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
32 | 35 | | |
33 | 36 | | |
34 | 37 | | |
| |||
43 | 46 | | |
44 | 47 | | |
45 | 48 | | |
46 | | - | |
| 49 | + | |
47 | 50 | | |
48 | 51 | | |
49 | 52 | | |
50 | 53 | | |
51 | 54 | | |
52 | | - | |
| 55 | + | |
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| |||
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
86 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
87 | 97 | | |
88 | 98 | | |
89 | 99 | | |
| |||
141 | 151 | | |
142 | 152 | | |
143 | 153 | | |
144 | | - | |
| 154 | + | |
145 | 155 | | |
146 | 156 | | |
147 | 157 | | |
| |||
0 commit comments