Programs¶
All available programs are contained in the top-level directory where this package is installed. Programs are written in python and use the ‘.py’ file extension.
All programs are configured by passing command-line options. Pass the –help option to view documentation for these options, e.g.:
python generate.py --help
Executable Programs¶
generate¶
The generate program writes to a CSV file that can be later be read by the analysis.galfun
or by analysis.fisher
modules to generate galaxy images and their analysis. Fast image rendering with galsim.
The user specifies the arguments of the galaxy and the PSF in the following way:
python generate.py -p PROJECT_NAME -gal 1 --galaxy-model MODEL_NAME --snr VALUE --PARAM1_NAME PARAM1_VALUE ...
For a given galaxy model at least the following parameters should always be specified:
- x0
- y0
- flux
- measure of size (sigma,hlr,fwhm)
- measure of ellipticity ((g1,g2),(e1,e2))
You can look up what the different parameters mean exactly in this section. The project name, the galaxy model, the snr value, and the galaxy ID (in the case when you draw 1 you only need one galaxy ID) should also always be specified. One can optionally add a PSF for the galaxy to be convolved with:
python generate.py -p PROJECT_NAME -gal 1 --galaxy-model MODEL_NAME --snr VALUE --PARAM1_NAME PARAM1_VALUE ... --psf_model PSF_MODEL_NAME --PSF_PARAM1 PSF_PARAM1_VALUE ...
A PSF always needs a model name, a measure of size, and a flux (which should be 1). The PSF and the galaxy are treated differently in the package. If you want to generate two galaxies just use the procedure above changing the id:
python generate.py -p PROJECT_NAME -gal 2 --galaxy-model MODEL_NAME --snr VALUE --PARAM1_NAME PARAM1_VALUE ... --psf_model PSF_MODEL_NAME --PSF_PARAM1 PSF_PARAM1_VALUE ...
Then the .csv file should contain information about both galaxies (one row per galaxy). It is recommended you use specify the same PSF for both galaxies.
display¶
The display.py program displays simulated images and analysis results stored in the CSV file generated by the generate.py program. It will display the images when the program is executed produced unless the –hide argument is used when executed. Please run:
python display.py --help
For the different images that can be produced and some explanations for them. More information on how to use the module can also be found in here.
fitting¶
The fitting program runs fits using lmfit. as an alternative way of estimating the noise bias and error in order to compare it to the Fisher Formalism.
In order to run a certain number N of fits, make sure you already created a galaxy with the generate program and then run:
fitting.py -p EXISTING_PROJECT_NAME -rf -n N --snr SNR_VALUE
If you are Stanford SLAC affiliated and want send N batch jobs to SLAC, then log in to SLAC and then run:
fitting.py -p EXISTING_PROJECT_NAME -rfs short -n N --snr SNR_VALUE
This fitting module internally calls another module named runfits N times which produces the results from a single fits
and then writes them to a .csv file. The correct way to read the data produced from this process is to use the analysis.galfun.read_results()
function which returns the results in a convenient format. For more specific information about the output of this function please consult the
docstring. To see how these process can be used to produce interesting fits and their plots please take a look at the fits_anlaysis tutorial notebooks.
Other Modules¶
models¶
The analysis.models
module contains the galaxy and PSF models that can be produced by generate and
analyzed by analysis.fisher
. It specifies the commands that galsim
should use to produce them.
fisher¶
The analysis.fisher
module contains the analysis by the Fisher Formalism which is made on the galaxy that generate produced.
Please refer to the tutorials in tutorial notebooks for specific instructions on how to use this module efficiently
in conjunction with analysis.galfun
module.
galfun¶
The analysis.galfun
is a multipurpose module that contains important functions ranging from managing parameters of
generated galaxies to extracting information from relevant files.
defaults¶
The analysis.defaults
module stores defaults parameter values for different parts of the package.