naplib-python
naplib-python copied to clipboard
Add better bad-input checking after parsing outstruct args
Expected Behavior
After parsing args, there should be better and more descriptive errors thrown if data is not correct.
Actual Behavior
For example, if you try to pass a list of length 2 (when it should be an array of length 2), to responsive_ttest, the error comes up later, but it should really happen right after the inputs are parsed
https://github.com/naplab/naplib-python/blob/main/naplib/stats/responsive_elecs.py#L112
Template Code
Y = [np.random.rand(400,3) for _ in range(5)]
_, stats = responsive_ttest(resp=Y, befaft=[1,1], sfreq=100, alpha=0.01, random_state=1)
whereas no error happens if you correctly pass befaft as an array:
_, stats = responsive_ttest(resp=Y, befaft=np.array([1,1]), sfreq=100, alpha=0.01, random_state=1)
Your Environment
- Python version: 3.9
- naplib-python version: 1.4