This PR splits the interface for generating fields up so that it becomes possible to simulate multiple related fields, such as e.g. biased tracers.
The fundamental sampling of the Gaussian random field is done by the new generate_alms() generator, which returns the Gaussian alm for each shell. New functions alm_to_gaussian() and alm_to_lognormal() can transform these alm to the respective random fields. The mean and variance of the Gaussian random field are stored in alm.dtype.metadata, which helps in transforming the lognormal field without additional inputs being provided. The existing generate_gaussian() and generate_lognormal() are reimplemented in terms of the new functions.
For generating biased tracers specifically, there is a new function biased_cls() which will take cls and apply linear bias factors. For lognormal fields, these biased cls can be transformed to biased Gaussian gls with lognormal_gls() as usual. The new rescaled_alm() function can then be used to change the power spectrum of a sampled Gaussian alm from the unbiased to the biased gls.
Closes: #134
Closes: #131
Changed: The gaussian_gls() functions is now called discretized_cls() to better reflect its functionality.
Changed: The lognormal_gls() function no longer calls discretized_cls()/gaussian_gls() internally.
Added: A new generate_alms() generator for Gaussian alm.
Added: New functions alm_to_gaussian() and alm_to_lognormal() to transform Gaussian alm to the respective random fields.
Added: A new biased_cls() function to apply bias factors to a sequence of cls.
Added: A new rescaled_alm() function to change the power spectrum of a given alm array.
This PR splits the interface for generating fields up so that it becomes possible to simulate multiple related fields, such as e.g. biased tracers.
The fundamental sampling of the Gaussian random field is done by the new
generate_alms()
generator, which returns the Gaussian alm for each shell. New functionsalm_to_gaussian()
andalm_to_lognormal()
can transform these alm to the respective random fields. The mean and variance of the Gaussian random field are stored inalm.dtype.metadata
, which helps in transforming the lognormal field without additional inputs being provided. The existinggenerate_gaussian()
andgenerate_lognormal()
are reimplemented in terms of the new functions.For generating biased tracers specifically, there is a new function
biased_cls()
which will take cls and apply linear bias factors. For lognormal fields, these biased cls can be transformed to biased Gaussian gls withlognormal_gls()
as usual. The newrescaled_alm()
function can then be used to change the power spectrum of a sampled Gaussian alm from the unbiased to the biased gls.Closes: #134 Closes: #131 Changed: The
gaussian_gls()
functions is now calleddiscretized_cls()
to better reflect its functionality. Changed: Thelognormal_gls()
function no longer callsdiscretized_cls()
/gaussian_gls()
internally. Added: A newgenerate_alms()
generator for Gaussian alm. Added: New functionsalm_to_gaussian()
andalm_to_lognormal()
to transform Gaussian alm to the respective random fields. Added: A newbiased_cls()
function to apply bias factors to a sequence of cls. Added: A newrescaled_alm()
function to change the power spectrum of a given alm array.