HERA-Team / hera_pspec

HERA power spectrum estimation code and data formats
http://hera-pspec.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
4 stars 3 forks source link

average_spectra() does not check input #317

Open hughbg opened 3 years ago

hughbg commented 3 years ago

This comes from the code review. It is related to issue #281.

As I was trying out the code I called average_spectra() with an object of the wrong type (class). The first argument to average_spectra() should be a UVSpec object but I passed a PSpecData object. This gave an error:

AttributeError: 'PSpecData' object has no attribute 'antnums_to_blpair'

The error doesn’t indicate that the cause of the problem is passing an object of the wrong type. It appears that average_specta() does not check the type of the input object and provide a more informative error. Do all functions check their inputs?