Wiki

Clone wiki

TailZ / examples / SingleGaussian

Single Gaussian example

This example is in the repository at examples/gaussian_example . First we will run the script examples/gaussian_example/gaussian_example.py to build the mock data by drawing from a Gaussian distribution. This creates files in a new subdirectory called data.

cd examples/gaussian_example
python gaussian_example.py

The script should generate three data files:

ls data
single_gaussian.pickle    single_gaussian_test.npy  single_gaussian_train.npy

Next we will run Tailz to estimate a redshift PDF. The configuration is already set up in the file examples/gaussian_example/tailz.config .

python ../../tailz/main.py -c tailz.config

One of the output files is results/pdf_gauss.pickle. This contains the estimated redshift PDFs. If you run the code again it will not overwrite this file but add a counter to make a unique filename like this results/pdf_gauss.0.pickle.

We can now plot the results

python plot_gaussian_example.py

This script uses matplotlib to make a plot and show it on the screen. The plot is saved at results/plot.png. The black thick line is the underlying Gaussian PDF. The hot pink shaded curve is the TailZ estimate from the mock catalog. The plot should look like this:

examples/figs/singlegauss.png

Updated