Stuermer / EchelleSimulator

GNU General Public License v3.0
11 stars 2 forks source link

Improve random generation number handing #8

Closed Stuermer closed 2 years ago

Stuermer commented 6 years ago

There are two issues with the current random number handling:

  1. For a 'too many' number of wavelength, the code will fail, because the vectors won't fit into memory. Suggestion: create chunks of wavelength that can fit into memory. Maybe dynamically adjust size of chunks with respect to available memory and loop through chunks ?

  2. Random number generation should be separated completely from the tracing.

One function should generate a vector of N uniformly distributed values that are used for sampling in the slit, the wavelength and the PSF. By separating the process, it can more easily replaced with a CUDA function. The tracing function should then access a member variable that stores the random numbers.

With the implementation right now, the PSF randomization does not allow calculating how many random numbers there are needed in advance. Therefore, the function that generates 'new' random numbers should be triggered by e.g. the trace function as soon as all so far generated numbers have been used. Possible issues: thread safety ? Slowdown due to if statement ?

Stuermer commented 2 years ago

done in PyEchelle