Skip to content

Commit 7eaca07

Browse files
committed
Added missing length validation method docstring and simplified boolean accuracy validation.
1 parent 9d73268 commit 7eaca07

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

rtanalysis/rtanalysis.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def fit(self, rt, accuracy, verbose=True):
4545

4646
self._validate_length(rt, accuracy)
4747

48-
# ensure that accuracy values are boolean
49-
assert not set(accuracy.unique()).difference([True, False])
48+
# Ensure that accuracy values are boolean.
49+
assert accuracy.dtype == bool
5050

5151
if self.outlier_cutoff_sd is not None:
5252
cutoff = rt.std() * self.outlier_cutoff_sd
@@ -69,6 +69,20 @@ def fit(self, rt, accuracy, verbose=True):
6969

7070
@staticmethod
7171
def _validate_length(rt, accuracy):
72+
"""Validate response time and accuracy series lengths.
73+
74+
Parameters
75+
----------
76+
rt : pd.Series
77+
Response time values
78+
accuracy : _type_
79+
Accuracy values
80+
81+
Raises
82+
------
83+
ValueError
84+
Length mismatch
85+
"""
7286
same_length = rt.shape[0] == accuracy.shape[0]
7387
try:
7488
assert same_length

0 commit comments

Comments
 (0)