cgrima / subradar

Tools for subsurface radar processing
MIT License
3 stars 3 forks source link

Undefined behavior if unknown kind in spectrum() #1

Closed gregoryng closed 5 years ago

gregoryng commented 5 years ago

https://github.com/cgrima/subradar/blob/fae4b33325732cf08daf1a265d092d9aa8c5aeca/roughness.py#L8-L14

This function has undefined behavior (I think it throws an exception) if the kind is not 'isotropic gaussian'

Suggest adding "else: return None"? Not sure if you want to do that or to throw a ValueError exception. I would raise a ValueError exception.

else: # pragma: no cover
    raise ValueError("Unsupported argument for kind: " + kind)