atomica.model.Characteristic

class atomica.model.Characteristic(pop, name)[source]

Bases: Variable

A characteristic represents a grouping of compartments.

Attributes

name

Variable code name

vals

id

Unique identifier for the integration object

units

The units for the quantity, used for plotting and for validation.

pop

Reference back to the Population containing this object

Methods

add_denom

add_include

get_included_comps

plot

Produce a time series plot

preallocate

Preallocate data storage

relink

set_dynamic

Make the variable a dependency

unlink

update

Update the value at a given time index

id

Unique identifier for the integration object

property name: str

Variable code name

This is implemented as a property method because the id of the Variable is a tuple containing the population name and the variable code name, so this property method returns just the variable code name portion. That way, storage does not need to be duplicated.

Returns:

A code name

plot()

Produce a time series plot

This is a quick function to make a basic line plot of this Variable. Mainly intended for debugging. Production-ready plots should be generated using the plotting library functions instead

Return type:

None

pop

Reference back to the Population containing this object

preallocate(tvec, dt)[source]

Preallocate data storage

Parameters:
  • tvec (array) – An array of time values

  • dt (float) – Time step size

Return type:

None

set_dynamic(**kwargs)[source]

Make the variable a dependency

For Compartments and Links, this does nothing. For Characteristics and Parameters, it will set the dynamic flag, but in addition, any validation constraints e.g. a Parameter that depends on Links cannot itself be dynamic, will be enforced.

This method generally must be overloaded in derived classes e.g. Parameter.set_dynamic()

units

The units for the quantity, used for plotting and for validation. Note that the default 'unknown' units are distinct to dimensionless units, which have value ''

update(ti)[source]

Update the value at a given time index

This method performs any required computations to update the value of the variable at a given time index. For example, Parameters may require their update function to be called, while characteristics need their source compartments to be added up.

This method generally must be overloaded in derived classes e.g. Parameter.update()

Parameters:

ti – Time index to update