Exceptions and warnings#
Every error raised by forestpd derives from ForestPDError, and also from the matching
built-in exception (ValueError, ImportError), so code that catches the built-in keeps
working.
- exception forestpd.ForestPDError[source]#
Bases:
ExceptionBase exception for all forestpd errors.
Catch this to handle any forestpd-specific error with a single
exceptclause.
- exception forestpd.ForestPDValueError[source]#
Bases:
ForestPDError,ValueErrorRaised when a value passed to a forestpd function is invalid.
Inherits from both ForestPDError and ValueError.
- exception forestpd.ForestPDInputError[source]#
Bases:
ForestPDValueErrorRaised when the input trees, weights, costs, survival probabilities or budget are invalid.
This covers malformed input (unparsable Newick, missing branch lengths, non-positive costs, survival probabilities outside
[0, 1), unknown taxon labels) as well as input outside the supported scope (differing leaf sets), and a MAF stage that does not return an agreement forest.
- exception forestpd.ForestPDImportError[source]#
Bases:
ForestPDError,ImportErrorRaised when an optional dependency is needed but not installed.
Converting to and from PhyloZoo objects requires the
phylozooextra (pip install forestpd[phylozoo]). Inherits from both ForestPDError and ImportError.
- exception forestpd.ForestPDWarning[source]#
Bases:
UserWarningWarning for input that is valid but probably not what was intended.
For example, trees that look rooted while PD is computed on unrooted trees.