bilby.gw.utils.safe_cast_mode_to_int

bilby.gw.utils.safe_cast_mode_to_int(value)[source]

Converts a string or integer, representing a mode index in a mode array, to an integer.

Raises an error if the value is a float or any unsupported type.

Parameters:
value:

The input value to be cast to an integer.

Returns:
int:

The converted integer.

Raises:
TypeError

If the input is a float or an unsupported type.

ValueError

If the string cannot be converted to an integer.