Skip to content

Commit

Permalink
changed functions for Average and MaximalCalibrationError to split ar…
Browse files Browse the repository at this point in the history
…ray in arrays of two when both eyes
  • Loading branch information
julia-pfarr committed Nov 9, 2023
1 parent 76bf95e commit 757667e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions eye2bids/edf2bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ def _extract_CalibrationType(df: pd.DataFrame) -> list[int]:


def _extract_CalibrationCount(df: pd.DataFrame) -> int:
if _extract_RecordedEye == "Both":
if _extract_RecordedEye(df) == "Both":
return len(_calibrations(df)) // 2
return len(_calibrations(df))


def _get_calibration_positions(df: pd.DataFrame) -> list[int]:
if _extract_RecordedEye == "Both":
if _extract_RecordedEye(df) == "Both":
return (
np.array(df[df[2] == "VALIDATE"][8].str.split(",", expand=True))
.astype(int)
Expand Down Expand Up @@ -196,12 +196,16 @@ def _has_validation(df: pd.DataFrame) -> bool:
def _extract_MaximalCalibrationError(df: pd.DataFrame) -> list[float]:
if not _has_validation(df):
return []
if _extract_RecordedEye(df) == "Both" and _extract_CalibrationCount(df) > 1:
return np.array_split((np.array(_validations(df)[[11]]).astype(float).tolist()), _extract_CalibrationCount(df))
return np.array(_validations(df)[[11]]).astype(float).tolist()


def _extract_AverageCalibrationError(df: pd.DataFrame) -> list[float]:
if not _has_validation(df):
return []
if _extract_RecordedEye(df) == "Both" and _extract_CalibrationCount(df) > 1:
return np.array_split((np.array(_validations(df)[[9]]).astype(float).tolist()), _extract_CalibrationCount(df))
return np.array(_validations(df)[[9]]).astype(float).tolist()


Expand Down

0 comments on commit 757667e

Please sign in to comment.