bool_cast

sherpa.utils.bool_cast(val: Any) bool[source] [edit on github]

Convert a scalar value to a boolean.

Changed in version 4.18.1: The input value must be a scalar. The support for converting an array of values has been removed.

Parameters:
valbool, str

The input value to decode.

Returns:
flagbool

Notes

The string is compared in a case-insensitive manner to the following: ‘true’, ‘on’, ‘yes’, ‘1’, ‘t’, and ‘y’ for True and ‘false’, ‘off’, ‘no’, ‘0’, ‘f’, and ‘n’ for False.

If there is no match to the above then the default conversion provided by the bool routine is used.