Difference between revisions of "Configuring and running FIA"

From Flametree Technologies
Jump to navigation Jump to search
 
(29 intermediate revisions by the same user not shown)
Line 3: Line 3:
 
==Calling FIA from the command line==
 
==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.
+
The simplest and quickest way to get going with FIA is to run in stand-alone mode from the command prompt. This requires
 +
 
 +
* data files;
 +
* a configuration file
 +
 
 +
With these you can start generating attribution analyses immediately, using the supplied <tt>fia64</tt> program.
 +
 
 +
<tt>fia64</tt> is a simple program that reads in the supplied data and configuration settings, passes them through to the Flametree engine using its API, and generates reports.
 +
 
 +
All output is in the form of Excel or CSV files, as specified in the configuration settings.
  
 
[[Setting up data files|Setting up data files]]
 
[[Setting up data files|Setting up data files]]
Line 19: Line 28:
 
To call FIA from code, the information required is almost exactly the same as for stand-alone mode. The main differences are
 
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;
+
* data must be supplied as in-memory arrays rather than CSV files, using string_matrix() structures
* configuration settings are carried out in code, rather than by assinging values in a configuration file.
+
* configuration settings are assigned using function calls, rather than by assinging values in a configuration file
 
+
* some code is required to pull everything together.
 
 
===Assigning configuration settings in Python===
 
 
 
Configuration settings are assigned using functions.
 
 
 
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
+
In general, a program that calls FIA has the following form:
  
From Python, we use the following statement:
+
* Required program dependencies are loaded
 +
* FIA data structures are loaded
 +
* The program is initialized, via a call to FIA_init(). This ensures that all variables are assigned appropriate default values if not set by the user.
 +
* Variables and data are initialized via calls to FIA_set_matrix, FIA_set_string, FIA_set_double, FIA_set_integer
 +
* FIA is run via a call to FIA_run()
 +
* Results are either written to disk as reports, or read back into a string_matrix structure via a call to FIA_get_matrix for subsequent use elsewhere.
  
FIA_python36.FIA_set_string ( FIA_API_constants.FT_STRING_SOVEREIGN_CURVE_DECOMPOSITION, "STB" );
+
===Languages supported===
  
Let's describe what is going on here in detail.
+
[[Calling FIA from Python|Calling FIA from Python]]
  
Firstly, <tt>SovereignCurveDecomposition</tt> takes a string value, so we use the <tt>FIA_set_string</tt> function to set its value. This function call is prefixed with 'FIA_python36' because this is the name of 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).
+
[[Calling FIA from Java|Calling FIA from Java]]
  
The function takes two arguments: an integer that corresponds to the <tt>SOVEREIGN_CURVE_DECOMPOSITION</tt> setting, and the value "<tt>STB</tt>". However, integers are not very readable, so instead we use a symbolic constant called <tt>FT_STRING_SOVEREIGN_CURVE_DECOMPOSITION</tt>, where
+
[[Calling FIA from Java|Calling FIA from Java]]
  
* FT shows that this is a Flametree-defined constant
+
If the language you wish to use is not shown here, please contact Flametree support.
* 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 <tt>FIA_API_constants</tt> 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.
+
===API constants===
  
===Configuration constants===
+
Values of the configuration constants are supplied in file <tt>FIA_API_CONSTANTS.py</tt> (for Python), <tt>FIA_API_CONSTANTS.cs</tt> (for C#), and <tt>FIA_API_CONSTANTS.java</tt> (for Java). These files are always supplied with the run-time files for FIA.
  
Values of the configuration constants are supplied in file FIA_API_CONSTANTS.py
+
[[API constants|Using API constants]]

Latest revision as of 06:13, 20 August 2021

FIA can be configured in two ways, depending on how you want to call the program:

Calling FIA from the command line

The simplest and quickest way to get going with FIA is to run in stand-alone mode from the command prompt. This requires

  • data files;
  • a configuration file

With these you can start generating attribution analyses immediately, using the supplied fia64 program.

fia64 is a simple program that reads in the supplied data and configuration settings, passes them through to the Flametree engine using its API, and generates reports.

All output is in the form of Excel or CSV files, as specified in the configuration settings.

Setting up data files

Setting up a configuration file

Configuration settings

Running FIA from Windows

Runng FIA from Linux

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, using string_matrix() structures
  • configuration settings are assigned using function calls, rather than by assinging values in a configuration file
  • some code is required to pull everything together.

In general, a program that calls FIA has the following form:

  • Required program dependencies are loaded
  • FIA data structures are loaded
  • The program is initialized, via a call to FIA_init(). This ensures that all variables are assigned appropriate default values if not set by the user.
  • Variables and data are initialized via calls to FIA_set_matrix, FIA_set_string, FIA_set_double, FIA_set_integer
  • FIA is run via a call to FIA_run()
  • Results are either written to disk as reports, or read back into a string_matrix structure via a call to FIA_get_matrix for subsequent use elsewhere.

Languages supported

Calling FIA from Python

Calling FIA from Java

Calling FIA from Java

If the language you wish to use is not shown here, please contact Flametree support.

API constants

Values of the configuration constants are supplied in file FIA_API_CONSTANTS.py (for Python), FIA_API_CONSTANTS.cs (for C#), and FIA_API_CONSTANTS.java (for Java). These files are always supplied with the run-time files for FIA.

Using API constants