2 Input Files
All the input files for Gadget are plain ASCII text files, so they can be viewed in any plain-text text editor. Any whitespace or blank lines in the data files are ignored, so the layout of the files can be adjusted into a easily viewable form to check the content of the files. The case of any text in an input file is ignored by Gadget, so for example, “Stock” and “stock” would be interpreted by Gadget as being the same.
Unless stated otherwise, all the input and output files use the following measurement units:
length - all measurements are in centimetres
weight - all measurements are in kilogrammes
age - all measurements are in years
Gadget is a program that runs on a Linux computing platform, so the input data files must use a Linux style end-of-line character (\(<\)linefeed\(>\)) and not a Windows style end-of-line character (\(<\)carriage return\(><\)linefeed\(>\)). All the lines of the input files containing data should end with an end-of-line character.
2.1 Comments in Input Files
Any of the input files used by Gadget can contain comments that are not used by Gadget. The start of the comment is denoted by a semi-colon “;”. Once Gadget has read as far as the semi-colon, the rest of the line will be ignored.
2.2 What Does The # Mean?
When Gadget is performing an optimising run, a number of the parameters can be adjusted to try to find a better fit between the modelled output and the data. The parameters that are to be adjusted are termed “switches” and are marked in the input files by the ‘#’ character. There are two valid formats for switches in the data file - either directly, or as part of a function.
2.2.1 Switches
The format for the switches is given by:
<numerical part>#<name>
where the \(<\)numerical part\(>\) consists of the (optional) initial value for the switch, and the \(<\)name\(>\) is a alpha-numerical text string used to identify the switch in the parameter file. Note that there is no whitespace either before or after the ‘#’ character. Also note that the name of the switch cannot contain a hyphen, since this will be interpreted by Gadget as the mathematical subtraction symbol.
Any initial value specified in the data files will be overwritten by the initial value given in the parameter file (see chapter 10. If the initial value is not given, then a value of 1 with be assumed by Gadget. A switch can appear in more than one place in the data files, but needs to be defined with the same initial value each time.
Examples of valid switches in the data files can include:
defining a simple switch (called “age2”) without an initial value
#age2
defining a switch with an initial value
10#age2
2.2.2 Functions
The format for the functions is given by:
(<function> <parameters>)
where the \(<\)function\(>\) defines the name of the function, and the \(<\)parameters\(>\) is a vectors of the parameters to be used - either numbers or the names of switches denoted by the ‘#’ character. Note that the function is contained within (round brackets). Valid function names include the 4 mathematical operators (‘*’, ‘+’, ‘-’ and ‘/’), trigonometric functions (‘sin’ and ‘cos’, with the argument in radians), logarithmic functions (‘log’, ‘log10’ and ‘exp’), square root (‘sqrt’) and a function to generate a random number between 0 and 1 (‘rand’).
Examples of valid functions for the switches in the data files can include:
defining a function based on a switch
(* 10 #age2)
note that in this case, Gadget will use 10 times the value of parameter “age2”.
defining a function based on more than one switch
(* #area1 #age2)
note that in this case, Gadget will use the value of parameter “area1” multiplied by the value of parameter “age2”.
nesting functions
(log (+ #area1 #age2))
note that in this case, Gadget will use the value of the natural logarithm of parameter “area1” plus parameter “age2”.