GLAMERDOC++
Gravitational Lensing Code Library
|
Structure for reading and writing parameters to and from a parameter file as well as a container for passing the parameters to other classes and functions. More...
#include <InputParams.h>
Public Member Functions | |
InputParams () | |
The constructor creates an empty map of input params. | |
InputParams (std::string paramfile) | |
The constructor reads in all the lines from the parameter file and stores the labels and values of each parameter. | |
bool | get (std::string label, bool &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout. | |
bool | get (std::string label, std::string &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. | |
bool | get (std::string label, MassFuncType &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout. | |
bool | get (std::string label, LensHaloType &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout. | |
bool | get (std::string label, HaloCatFormats &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout. | |
bool | get (std::string label, GalaxyLensHaloType &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout. | |
bool | get (std::string label, ClumpInternal &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout. | |
bool | get (std::string label, Band &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout. | |
bool | get (std::string label, IMFtype &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout. | |
bool | get (std::string label, EllipMethod &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout. | |
template<typename Number > | |
bool | get (std::string label, Number &value) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned and the value is set to the default value of the numerical type. | |
template<typename T > | |
T | get (std::string label, const T &def=T()) const |
template<typename T > | |
T | require (std::string label) const |
bool | exist (std::string label) const |
void | print () const |
Print all parameters and values to stdout. | |
void | print_used () const |
Print parameters and values that have been accessed within the code to stdout. | |
void | print_unused () const |
Print parameters and values that where read in but not accessed within the code to stdout. | |
std::size_t | Nparams () const |
Returns total number of parameters. | |
void | PrintToFile (std::string filename, bool strip_unused=false) const |
Print all parameters to a file in the format needed for an input parameter file. Unused parameters can be stripped with the optional second argument. | |
std::string | filename () const |
Return name of the parameter file. | |
void | put (std::string label, std::string value, std::string comment=std::string()) |
template<typename Number > | |
void | put (std::string label, Number value, std::string comment=std::string()) |
void | readMOKA () |
Read input parameters from a MOKA FITS header. This function reads the FITS file given by the MOKA_input_file parameter and uses the values found in its header to set various input parameters such as z_lens, z_source, Omega_matter, ... | |
Static Public Member Functions | |
static InputParams | sample () |
Lists all acceptable input parameters with description. | |
static void | add (std::string label, std::string value=std::string(), std::string comment=std::string()) |
Friends | |
std::ostream & | operator<< (std::ostream &os, InputParams const ¶ms) |
Structure for reading and writing parameters to and from a parameter file as well as a container for passing the parameters to other classes and functions.
The constructor reads in all parameters in the parameter file. They can then be accessed with the get functions. There should be no interaction with the parameter file except through the InputParams structure.
InputParams::InputParams | ( | std::string | paramfile | ) |
The constructor reads in all the lines from the parameter file and stores the labels and values of each parameter.
If a parameter is provided that should not exist an error message is printed
|
static |
add a new parameter with default value and comment
Add a given parameter with default value and comment.
bool InputParams::get | ( | std::string | label, |
Band & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout.
MainLensType entries in the parameter file must be EUC_VIS,EUC_Y,EUC_J,EUC_H,SDSS_U,SDSS_G,SDSS_R,SDSS_I,SDSS_Z,J,H,Ks,IRAC1,IRAC2,F435W,F606W,F775W,F850LP,F814W,F110W,F160W
bool InputParams::get | ( | std::string | label, |
bool & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout.
bool entries in the parameter file must be 0,1,true or false.
bool InputParams::get | ( | std::string | label, |
ClumpInternal & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout.
MainLensType entries in the parameter file must be 0 through 2 or NFW, PowerLaw, or PointMass.
T InputParams::get | ( | std::string | label, |
const T & | def = T() ) const |
Return a parameter value.
bool InputParams::get | ( | std::string | label, |
EllipMethod & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout.
MainLensType entries in the parameter file must be Fourier,Pseudo,Schramm or Keeton
bool InputParams::get | ( | std::string | label, |
GalaxyLensHaloType & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout.
GalaxyLensType entries in the parameter file must be 0 or none, 1 or NSIE
bool InputParams::get | ( | std::string | label, |
HaloCatFormats & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout.
MainLensType entries in the parameter file must be 0 through 2 or NFW, PowerLaw, or PointMass.
bool InputParams::get | ( | std::string | label, |
IMFtype & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout.
MainLensType entries in the parameter file must be One,Mono,BrokenPowerLaw,Salpeter,SinglePowerLaw,Kroupa or Chabrier
bool InputParams::get | ( | std::string | label, |
LensHaloType & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout.
MainLensType entries in the parameter file must needs to be 0 or nolens, 1 or NFW, 2 or PseudoNFW, 3 or PowerLaw, 4 or NSIE, 5 or AnaLens, 6 or UniLens, 7 or MOKALens, 8 or DummyLens
bool InputParams::get | ( | std::string | label, |
MassFuncType & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned. If the parameter in the file does not "match" the type of value false will also be returned and a warning printed to stdout.
MassFuncType entries in the parameter file must be 0 through 2 or PS (Press & Schechter), ST (Sheth & Torman) or PowerLaw (Power-law).
bool InputParams::get | ( | std::string | label, |
Number & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned and the value is set to the default value of the numerical type.
The entry in the parameter file must have a numerical value. If it does not, an exception message is printed and false is returned.
bool InputParams::get | ( | std::string | label, |
std::string & | value ) const |
Assigns to "value" the value of the parameter called "label". If this parameter label does not appear in the parameter file false is returned.
If there is an entry in the parameter file this function will always return it in string format - no type checking.
void InputParams::put | ( | std::string | label, |
Number | value, | ||
std::string | comment = std::string() ) |
Add a new parameter to the parameter list.
void InputParams::put | ( | std::string | label, |
std::string | value, | ||
std::string | comment = std::string() ) |
Add a new parameter to the parameter list.
void InputParams::readMOKA | ( | ) |
Read input parameters from a MOKA FITS header. This function reads the FITS file given by the MOKA_input_file parameter and uses the values found in its header to set various input parameters such as z_lens, z_source, Omega_matter, ...
This method needs ENABLE_FITS to be defined.
T InputParams::require | ( | std::string | label | ) | const |
Return a parameter value or throw an error.
|
static |
Lists all acceptable input parameters with description.
return sample input parameters