GLAMERDOC++
Gravitational Lensing Code Library
Public Member Functions | Static Public Member Functions | Friends | List of all members
InputParams Class Reference

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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
template<typename T >
get (std::string label, const T &def=T()) const
 
template<typename 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, ... More...
 

Static Public Member Functions

static InputParams sample ()
 Lists all acceptable input parameters with description. More...
 
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 &params)
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ InputParams()

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

Member Function Documentation

◆ add()

void InputParams::add ( std::string  label,
std::string  value = std::string(),
std::string  comment = std::string() 
)
static

add a new parameter with default value and comment

Add a given parameter with default value and comment.

◆ get() [1/12]

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

◆ get() [2/12]

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.

◆ get() [3/12]

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.

◆ get() [4/12]

template<typename T >
T InputParams::get ( std::string  label,
const T &  def = T() 
) const

Return a parameter value.

◆ get() [5/12]

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

◆ get() [6/12]

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

◆ get() [7/12]

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.

◆ get() [8/12]

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

◆ get() [9/12]

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

◆ get() [10/12]

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).

◆ get() [11/12]

template<typename Number >
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.

◆ get() [12/12]

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.

◆ put() [1/2]

template<typename Number >
void InputParams::put ( std::string  label,
Number  value,
std::string  comment = std::string() 
)

Add a new parameter to the parameter list.

◆ put() [2/2]

void InputParams::put ( std::string  label,
std::string  value,
std::string  comment = std::string() 
)

Add a new parameter to the parameter list.

◆ readMOKA()

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.

◆ require()

template<typename T >
T InputParams::require ( std::string  label) const

Return a parameter value or throw an error.

◆ sample()

InputParams InputParams::sample ( )
static

Lists all acceptable input parameters with description.

return sample input parameters


The documentation for this class was generated from the following files: