Search code examples
healpy

healpy synfast: how to define the random seed


I'm using healpy.synfast to create maps, but it seems that healpy does not have the "iseed" function (as in here: http://healpix.jpl.nasa.gov/html/facilitiesnode14.htm) which let me define the random seed to be used for the generation of alms from the power spectrum.

Could anyone tell me how to achieve the "iseed" function in healpy? Thanks!


Solution

  • healpy internally uses np.random.standard_normal to generate the real and imaginary components of the alms, see sphtfunc.py.

    Therefore you can use the numpy.random.seed function to set the seed, as:

    numpy.random.seed(1234)
    

    before running synfast.