atomica.cascade.sanitize_cascade(framework, cascade, fallback_used=False)[source]

Normalize cascade inputs

For convenience, users can specify cascades in one of several representations. To facilitate working with these representations on the backend, this function turns any valid representation into a dictionary mapping cascade stage names to a list of compartments/characs. It also returns the name of the cascade (if one is present) for use in plot titles.

As an example of the cascade dictionary, suppose the spreadsheet had stages

  • Stage 1 - sus,vac,inf

  • Stage 2 - vac,inf

Then example usage would be:

>>> sanitize_cascade(framework,'main')[1]
{'Stage 1':['sus','vac','inf'],'Stage 2':['vac','inf']

This function also validates the cascade, so it is not necessary to call validate_cascade() separately.

  • framework – A ProjectFramework instance

  • cascade

    Supported cascade representation. Could be - A string cascade nameP - An integer specifying the index of the cascade - None, which maps to the first cascade in the framework - A list of cascade stages - A dict defining the cascade The first three input formats will

    result in the cascade name also being returned (otherwise it will be assigned None

Return type



A tuple with (cascade_name,cascade_dict) - the cascade name is None if the cascade was specified as a list or dict