Configuring and running FIA
FIA can be configured in two ways, depending on how you want to call the program:
Calling FIA from the command line
To run FIA in stand-alone mode from the command prompt, you must supply data files and a configuration file.
Setting up a configuration file
Calling FIA from code
To call FIA from code, the information required is almost exactly the same as for stand-alone mode. The main differences are
- data must be supplied as in-memory arrays rather than CSV files;
- configuration settings are carried out in code, rather than by assinging values in a configuration file.
Assigning configuration settings in Python
Configuration settings are assigned using the following functions:
FIA_python36.FIA_set_matrix
For instance, suppose we need to instruct FIA to use STB for sovereign curve decomposition. To do this we assign the string value 'STB' to the variable SovereignCurveDecomposition.
In a configuration file, we would include the line
SovereignCurveDecomposition= STB
From Python, we use the following statement:
FIA_python36.FIA_set_string ( FIA_API_constants.FT_STRING_SOVEREIGN_CURVE_DECOMPOSITION, "STB" );
Let's describe what is going on here in detail.
Firstly, SovereignCurveDecomposition takes a string value, so we use the FIA_set_string function. This function call is prefixed with 'FIA_python36' because this is the module in which the function is defined. (This also requires that we have an import FIA_python36 at the start of the Python program).
The function takes two arguments: an integer that corresponds to the SOVEREIGN_CURVE_DECOMPOSITION setting, and the value "STB". However, integers are not very readable, so instead we use a symbolic constant called FT_STRING_SOVEREIGN_CURVE_DECOMPOSITION, where
- FT shows that this is a Flametree-defined constant
- STRING shows that this constant corresponds to a string value
- SOVEREIGN_CURVE_DECOMPOSITION is the variable we are assigning.
The symbolic constant is prefixed by FIA_API_constants as this is the module in which the value is defined. As above, this also requires an 'import FIA_API_constants' statement at the start of the Python program.