Querying parameters

It is often helpful to access the parameters used in a simulation after it has been run. There are two main ways to achieve this:

simulationsTable

The function simulationsTable can be used to print a table of simulation data. This function, by default, only prints varied values and does some renaming to make the column names more human-readable.

The function printSimulationsTable is a convenience wrapper around simulationsTable that prints the table directly. Use the sink keyword argument to, for example, redirect the output to a file instead of the console.

getAllParameterValues

The function getAllParameterValues can be used to programmatically access all the terminal elements in the XML input files for a given set of simulations. The simulations must all belong to the same Sampling, i.e. use the same input files. The column names are the XML paths to the parameters, meaning they can be converted into the format for creating a DiscreteVariation, for example, by splitting on /.

df = getAllParameterValues(sampling)
col1 = names(df)[1] # get the name of the first column
xml_path = split(col1, "/") # convert to XML path format
dv = DiscreteVariation(xml_path, [0.0, 1.0]) # create a discrete variation using this parameter

The internal functions PhysiCellModelManager.columnName and PhysiCellModelManager.columnNameToXMLPath can also be used to convert between the column names and XML paths.

Note: The XML paths returned by getAllParameterValues as column names may include what look like attributes to distinguish between multiple children with the same tag. These can be found by searching for column names with ":temp_id:" in them:

df = getAllParameterValues(sampling)
names_with_temp_id = filter(contains(":temp_id:"), names(df))