atomica.cascade.validate_cascade

atomica.cascade.validate_cascade(framework, cascade, cascade_name=None, fallback_used=False)[source]

Check if a cascade is valid

A cascade is invalid if any stage does not contain a compartment that appears in subsequent stages i.e. if the stages are not all nested. Also, all compartments referred to must exist in the same population type, otherwise it is not possible to define a population-specific cascade as it would intrinsically span populations.

Parameters
  • framework – A ProjectFramework instance

  • cascade – A cascade representation supported by sanitize_cascade()

  • cascade_name – Name of cascade to be printed in error messages

  • fallback_used (bool) – If True, then in the event that the cascade is not valid, the error message will reflect the fact that it was not a user-defined cascade

Return type

str

Returns

The population type if the cascade is valid

Raises

InvalidCascade if the cascade is not valid