Skip to content
Chieh-An Lin edited this page Jul 23, 2020 · 5 revisions

In demo, users can find 4 python scripts. It is not necessary to run Salmo through scripts. These rather provide examples for users who want to set up their own analyses.

The required python libraries are numpy, astropy (for FITS I/O), healpy, and matplotlib (only for visualization). To run scripts, one should execute:

$ cd demo
$ python file_preparation.py
$ python flask_salmo_wrapper.py ## This needs a bit configuration.
$ python unitary_test.py
$ python visualization.py

The paths are configured as being executed in demo in order to work. If users want to execute them from elsewhere, then they might have to change some paths therein.

file_preparation.py

The masks and redshift distribution files contained in demo/input are generated from this script.

flask_salmo_wrapper.py

This script provides an example to wrap Flask and Salmo together. In order to make this script work, users have to configure FLASK_EXEC to the location the Flask executable on their own machine.

Users can also change the runInd value in __main__ to make other runs. However, only runInd=0 can pass the unitary test.

The callFlask function calls Flask twice. The first call creates galaxy density maps with matter C_ell scaled by GALAXY_BIAS-squared. The second call creates matter density maps with unscaled matter C_ell to yield lensing maps. We keep the same seed so that the galaxy and lensing maps stay coherent.

If the galaxy bias is not 1 but a different constant, then only matter C_ell is required as we can use SCALE_CLS in Flask to scale it. Still 2 Flask calls: the first one with SCALE_CLS set to bias-squared, and the second one without scaling but with the same seed.

Both callFlask and callSalmo show how to change parameter values dynamically in a command line.

unitary_test.py

This script provides a unitary test. Users can either execute

$ cd demo
$ python flask_salmo_wrapper.py

or

$ cd build
$ ./salmo default 3 seed=2718281828

The first one will overwrite existing flask maps and create new catalogues. The second will only provide the latter. In both cases, the new galaxy catalogues are supposed to be identical to output/galCat_ref_type%d.fits.

visualization.py

The visualization script generates 4 figures. For both types (0 and 1) of galaxies, each has a mask comparison and a redshift comparison. The mask comparison visualizes the mask and compare it with the positions of the generated galaxies. The redshift comparison shows the reconstructed distribution with the input histogram.

A copy of 4 figures can be found in demo/plots. Users are free to hack this plotting script to create their own ones.

In nOfZ_comp_type1.png, one may see that the input redshift is not fully consistent with the output. This is an example that I provide on purpose as a bad configuration of Salmo.

Why does this happen? Because we have chosen 0.0, 0.2, 0.4, and 0.6 as the redshift bin edges for input maps. Whatever the resolution of the redshift histogram is, Salmo will consider it to be flat within each map redshift bin. The flattened distribution is such that the integrated value stays unchanged. In our example, the redshift distribution of type 1 galaxies is 0 on [0.2, 0.3], and uniform but non-zero on [0.3, 0.4]. The mean value on [0.2, 0.4] is therefore half of the non-zero value, and this is what we observe from the reconstruction. As a result, users should be careful about the choice of map redshift bins.

Clone this wiki locally