simulateCW.py: properly initialise noise_seed
Description
Various methods of the CWSimulator class take a noise_seed input to set the random seed for Gaussian noise generated by XLALAddGaussianNoise(). These methods also call get_strain_blocks() to generate blocks of strain data for generating frames and SFTs.
If the default seed value (noise_seed=0) was used, the first block returned by get_strain_blocks() would pass seed=0 to XLALAddGaussianNoise(), which would interpret that as a request to get a random seed from /dev/urandom. But subsequent blocks would use seed=1, seed=2, etc. which XLALAddGaussianNoise() would interpret as actual seeds. If one was calling CWSimulator to generate multiple sets of frames/SFTs, one would find that all frames/SFTs apart from the first one would be generated with the same seed, and hence have the same Gaussian noise, across the multiple sets.
This MR changes the default noise_seed to None, which is interpreted in get_strain_blocks() as a request to get a random seed in Python using os.urandom(). This random seed is then incremented for each block. Now, when calling CWSimulator to generate multiple sets of frames/SFTs, using the default noise_seed=None, each set will invoke get_strain_blocks() which will get a new random seed, and so each frame/SFT will get a different random seed across the multiple sets, and should therefore have different Gaussian noise, as desired.
API Changes and Justification
Backwards Compatible Changes
-
This change does not modify any class/function/struct/type definitions in a public C header file or any Python class/function definitions -
This change adds new classes/functions/structs/types to a public C header file or Python module
Backwards Incompatible Changes
-
This change modifies an existing class/function/struct/type definition in a public C header file or Python module -
This change removes an existing class/function/struct/type from a public C header file or Python module
Review Status
Closes #610 (closed)