# Script Nodes

A PoPy script file is in YAML format, which consists of nested dictionaries that form a tree structure.

Each node of the tree is either:-

- a dictionary (dict) with sub nodes

- or a leave node

A leave node has to be one of the script node types listed below.

auto

  The word “auto”, indicating a preference for default behaviour.

bool

  A boolean: “true”/”yes”/”y”/”1” or “False”/”no”/”n”/”0”

dict

  A dictionary of unspecified structure - the user chooses the keys.

  Many of the elements of a script file are known as dictionaries (also known as mappings or associative arrays). These are key:value pairs that can be written as follows using curly brackets:-

      my_dictionary1: { key1: value1, key2: value2 }

  or alternatively using spacing:-

      my_dictionary2:
          key1: value1
          key2: value2

  Whichever you use is a matter of convenience and space.

dict_record

  A dictionary with a pre-determined structure (i.e. key names and corresponding types)

float

  Any number

input_file

  The path to a file that already exists. (An error occurs if it does not.)

input_file_as_glob

  A pattern (e.g. `*.csv`) that has only a single match. (An error occurs if there are multiple matching filenames.)

input_files_as_glob

  A pattern (e.g. `"*.csv"`) that has at least one match. (An error occurs only if there are no matching filenames.)

input_folder

  The path to a folder that already exists. (An error occurs if it does not.)

int

  An integer (whole number)

list

  A list of values of unspecified type.

list_of

  A list of one or more strings taken from the list of options in brackets.

list_record

  A list

none

  The word “none”, indicating a file that does not exist.

one_of

  A string, limited to one of the options given in brackets.

one_of_record

  One from a selection of dict_records

output_file

  The path to a file that may not yet exist (in contrast to input_file).

output_folder

  The path to a folder that may not yet exist (in contrast to input_folder).

pseudocode

  verbatim sections of the script file accept Python code with extra PoPy syntax added. For example special variable names such as `f[X]`, `r[X]` etc. We refer to this code as ‘pseudocode’. Pseudocode is automatically translated into runnable Python functions that are executed by PoPy to process your script.

repeat_dict_record

  One or more of a selection of dict_records

repeat_verb_record

  One or more of a selection of verbatim records

star

  The “*” character, shorthand for “all possibilities”.

str

  A string.

verbatim

  Several blocks in the script file (namely MODEL_PARAMS, STATES, DERIVATIVES and PREDICTIONS) are reserved for pseudocode of a relatively unstructured kind. This is translated into executable code.