Caution
You're reading an old version of this documentation. If you want up-to-date information, please have a look at 0.11.0.
librosa.util.valid_int
- librosa.util.valid_int(x, *, cast=None)[source]
- Ensure that an input value is integer-typed. This is primarily useful for ensuring integrable-valued array indices. - Parameters:
- xnumber
- A scalar value to be cast to int 
- castfunction [optional]
- A function to modify - xbefore casting. Default: np.floor
 
- Returns:
- x_intint
- x_int = int(cast(x))
 
- Raises:
- ParameterError
- If - castis provided and is not callable.