Skip to contents

Mapping of model outputs to observed data

Super class

ospsuite.utils::Printable -> DataMapping

Public fields

log

String defining which axis will be plotted in logarithmic scaling. Possible values are "" (empty string, both axis in linear scaling, default), "x", "y", "xy" (both axis are in logarithmic scaling).

title

Title of the plot. If the value is an empty string, no title is added. Otherwise, the title appears on top of the plot.

addLegend

Boolean defining if the legend should be added to the plot. If TRUE, a legend will be added for each group and each XYSeries that is not in any group

legendPosition

Position of the legend in the plot. Default value is "topright". See legend() for more information.

Active bindings

xySeries

Named list with the XYData that will be plotted. Names are the labels of the xySeries objects

xySeriesCount

number of XYData objects to be plotted

xLim

Limits of the x-axis. Numerical vector c(min, max)

yLim

Limits of the y-axis. Numerical vector c(min, max)

xLab

label of the x-axis.

yLab

label of the y-axis.

xDimension

Dimension of x values. See enum ospDimensions for the list of supported dimensions. If no dimension is specified, the dimension of the first added XYSeries is used. If no XYSeries are present, the dimension is NULL When changing the dimension, the unit is automatically set to the base unit of the dimension.

yDimension

Dimension of y values. See enum ospDimensions for the list of supported dimensions. If no dimension is specified, the dimension of the first added XYSeries is used. If no XYSeries are present, the dimension is NULL #' When changing the dimension, the unit is automatically set to the base unit of the dimension.

xUnit

Unit of x values. If no unit is specified, the default unit of the dimension is used. If no dimension is specified, the unit is NULL

yUnit

Unit of y values. If no unit is specified, the default unit of the dimension is used. If no dimension is specified, the unit is NULL

groupings

A named list listing which data sets are grouped together. Grouped data sets will be plotted with the same color and used together in the legend.

ungroupedSeries

A list of XYData that do not belong to any group. NULL if empty.

plotType

A string defining what kind of plot is generated when the plot() method of the object is called. Supported plot types are listed in the enum PlotTypes. Default is "IndividualProfile"

populationQuantiles

A numerical vector with three quantile values used if plotType = "PopulationQuantiles". Default is c(0.05, 0.5, 0.95)

Methods

Inherited methods


    Method new()

    Initialize a new instance of the class

    Usage

    Returns

    A new DataMapping object.


    Method finalize()

    Clean up upon object removal

    Usage

    DataMapping$finalize()


    Method addModelOutputs()

    Add simulated results to the data mapping

    Add new ModelOutput to be plotted. Line type is set to "l" (line) by default.

    Usage

    DataMapping$addModelOutputs(
      paths,
      labels,
      simulationResults,
      groups = NULL,
      removeNA = TRUE
    )

    Arguments

    paths

    A string or a list of strings representing the path(s) to the output(s) in the model.

    labels

    A string or a list of strings that are used as a label (e.g. in the legend) for the output(s). If NULL (default), the path of the output is used as a label.

    simulationResults

    Simulated results as returned by runSimulation

    groups

    A string or a list of strings assigning the outputs to a group. All outputs may be assigned to one group, or to different groups, while each output can be assigned to not more than one group. If an entry within the list is NULL, the corresponding output is not assigned to any group

    removeNA

    If TRUE (default), NA values will be removed from the simulated results. NA values can be the result of observer not being calculated at a certain time point.


    Method addXYSeries()

    Add XYData object(s).

    Usage

    DataMapping$addXYSeries(
      xValsList,
      yValsList,
      labels,
      yErrorList = NULL,
      groups = NULL
    )

    Arguments

    xValsList

    A single array or a list of arrays of x-values. For time series, the values must be in minutes.

    yValsList

    A single array or a list of arrays of y-values.

    labels

    A string or a list of strings that are used as unique label for the output(s). Must be of same length as xValsList.

    yErrorList

    A single array or a list of arrays of y-error values. If NULL (default), no errors are assigned. If not NULL, the list must have the same number of entries (numerical arrays) as yValsList. If an entry of the list is NULL, the respective data set has no error.

    groups

    A string or a list of strings assigning the data set to a group. If an entry within the list is NULL, the corresponding data set is not assigned to any group. If NULL (default), all data sets are not assigned to any group. If provided, groups must have the same length as xValsList

    Details

    Add new series of x-y values to be plotted. If an XYData with the same label already exists, it will be overwritten

    Examples

    dataMapping <- DataMapping$new()
    xVals <- list(c(1, 2, 3, 4), c(1, 2, 3, 4), c(2, 3, 4, 5))
    yVals <- list(c(5, 6, 7, 8), c(5, 6, 7, 8), c(6, 7, 8, 9))
    yErr <- list(c(0.1, 0.1, 0.1, 0.2), NULL, c(0.2, 0.3, 0.1, 0.2))
    groups <- list("Group1", NULL, "Group1")
    dataMapping$addXYSeries(xValsList = xVals, yValsList = yVals,
    yErrorList = yErr, labels = list("my series1", "my series2", "my series3"), groups = groups)


    Method addXYData()

    Add XYData object(s). The objects are cloned at adding.

    Usage

    DataMapping$addXYData(XYData, groups = NULL)

    Arguments

    XYData

    Object or a list of objects of the type XYData

    groups

    A string or a list of strings assigning the data set to a group. If an entry within the list is NULL, the corresponding data set is not assigned to any group. If NULL (default), all data sets are not assigned to any group. If provided, groups must have the same length as XYData output is not assigned to any group


    Method addDataSets()

    Add DataSet object(s).

    Usage

    DataMapping$addDataSets(dataSets, groups = NULL)

    Arguments

    dataSets

    Object or a list of objects of the type DataSet

    groups

    A string or a list of strings assigning the data set to a group. If an entry within the list is NULL, the corresponding data set is not assigned to any group. If NULL (default), all data sets are not assigned to any group. If provided, groups must have the same length as dataSets output is not assigned to any group

    Details

    The objects are transformed to XYData before adding.


    Method removeXYSeries()

    Remove the observed data with given label from the DataMapping.

    Usage

    DataMapping$removeXYSeries(label)

    Arguments

    label

    label of the x-y values series to be removed


    Method getXYSeriesGroupMap()

    Return group mapping of labels.

    Usage

    DataMapping$getXYSeriesGroupMap()

    Details

    Returns a named list with keys being labels of xySeries and values group names. If value is NA, no group is defined for this label.

    Returns

    A named list with keys being labels of xySeries and values group names.


    Method setXFactors()

    Set the X-factors of x-y values by labels.

    Usage

    DataMapping$setXFactors(labels, xFactors)

    Arguments

    labels

    A list of labels of XYData.

    xFactors

    Numeric values that will be multiplied by the x-values during plotting.

    Details

    If the data set with a label is not present in the mapping, the label is ignored.


    Method setYFactors()

    Set the y-factors of x-y values by labels.

    Usage

    DataMapping$setYFactors(labels, yFactors)

    Arguments

    labels

    A list of label of XYData

    yFactors

    Numeric values that will be multiplied by the y-values during plotting

    Details

    If the data set with a label is not present in the mapping, the label is ignored


    Method setXOffsets()

    Set the X-offset of x-y values by labels.

    Usage

    DataMapping$setXOffsets(labels, xOffsets)

    Arguments

    labels

    A list of label of XYData

    xOffsets

    Numeric values that will be added to the x-values during plotting

    Details

    If the data set with a label is not present in the mapping, the label is ignored


    Method setYOffsets()

    Set the Y-offset of x-y values by labels.

    Usage

    DataMapping$setYOffsets(labels, yOffsets)

    Arguments

    labels

    A list of label of XYData

    yOffsets

    Numeric values that will be added to the y-values during plotting

    Details

    If the data set with a label is not present in the mapping, the label is ignored


    Method setTypes()

    Set the type(s) of the data to be plotted, e.g. line, points, etc.

    Usage

    DataMapping$setTypes(labels, types)

    Arguments

    labels

    A list of label of XYData

    types

    Plot types as accepted by the base plot method

    Details

    If no data set for the provided label is present in the mapping, the corresponding value is ignored. No check is performed whether a valid type is provided.


    Method setLinetypes()

    Set the line type(s) property of the data to be plotted. Line types as accepted by the base plot lty argument.

    Usage

    DataMapping$setLinetypes(labels, linetypes)

    Arguments

    labels

    A list of label of XYData

    linetypes

    Values that will be set as line type(s).

    Details

    If no data set for the provided label is present in the mapping, the corresponding value is ignored. No check is performed whether a valid type is provided.Line types as accepted by the base plot lty argument. Line types can be provided either as numeric or as character vectors (e.g. "dashed").


    Method setColors()

    Set the colors of the data to be plotted

    Usage

    DataMapping$setColors(labels, colors)

    Arguments

    labels

    A list of label of XYData

    colors

    String names of colors of the data as accepted by the base plot method If the value is NULL, the color is automatically selected when plotting the data.

    Details

    If the data set with a label is not present in the mapping, the label is ignored


    Method setConfiguration()

    Apply settings stored in a DataMappingConfiguration

    Usage

    DataMapping$setConfiguration(dataMappingConfiguration)

    Arguments

    dataMappingConfiguration

    An object of type DataMappingConfiguration

    Details

    If the data set with a label is not present in the mapping, the label is ignored Equivalent to calling setXFactors, setYFactors, setXOffsets, setYOffsets, setTypes, and setColors.


    Method plot()

    Plot the data stored in this DataMapping.

    Usage

    DataMapping$plot(...)

    Arguments

    ...

    Any parameter that can be interpreted by the default plot() function


    Method print()

    Print the object to the console

    Usage

    DataMapping$print(...)

    Arguments

    ...

    Rest arguments.


    Method clone()

    The objects of this class are cloneable with this method.

    Usage

    DataMapping$clone(deep = FALSE)

    Arguments

    deep

    Whether to make a deep clone.

    Examples

    
    ## ------------------------------------------------
    ## Method `DataMapping$addXYSeries`
    ## ------------------------------------------------
    
    dataMapping <- DataMapping$new()
    xVals <- list(c(1, 2, 3, 4), c(1, 2, 3, 4), c(2, 3, 4, 5))
    yVals <- list(c(5, 6, 7, 8), c(5, 6, 7, 8), c(6, 7, 8, 9))
    yErr <- list(c(0.1, 0.1, 0.1, 0.2), NULL, c(0.2, 0.3, 0.1, 0.2))
    groups <- list("Group1", NULL, "Group1")
    dataMapping$addXYSeries(xValsList = xVals, yValsList = yVals,
    yErrorList = yErr, labels = list("my series1", "my series2", "my series3"), groups = groups)