Skip to content

docstring bug: data consistency check (count_trials) #107

Closed

Description

@Ver0Ha

docstring states that data consistency checks are performed for stimuli, accuracy and confidence:

cpm/cpm/utils/metad.py

Lines 62 to 63 in ecfa900

All trials where `stimuli` is not 0 or 1, accuracy is not 0 or 1, or confidence is
not in the range [1, nRatings], are automatically omitted.

in the implementation: stimuli, responses and confidence are checked.

cpm/cpm/utils/metad.py

Lines 122 to 131 in ecfa900

# Check data consistency
tempstim, tempresp, tempratg = [], [], []
for s, rp, rt in zip(stimuli, responses, confidence):
if (s == 0 or s == 1) and (rp == 0 or rp == 1) and (rt >= 1 and rt <= nRatings):
tempstim.append(s)
tempresp.append(rp)
tempratg.append(rt)
stimuli = tempstim
responses = tempresp
confidence = tempratg

docstring should be changed to:
All trials where stimuli is not 0 or 1, responsesis not 0 or 1, or confidence is not in the range [1, nRatings], are automatically omitted.

Activity

  1. added theissue type on Nov 2, 2026
  2. lenarddome commented on Nov 11, 2026

    @lenarddome
    Collaborator

    Thanks for the report! The docstring was corrected as part of #106 (merged in #108, released in 0.26.1). The Notes section of count_trials now reads:

    All trials where stimuli is not 0 or 1, the response is not 0 or 1, or confidence is not a whole number in the range [1, nRatings], are automatically omitted. When accuracy is provided, trials where accuracy is not 0 or 1 (including missing values) are omitted as well.

    This matches the filtering in the implementation: responses (given or inferred from accuracy) are checked, and accuracy is checked as well when it is provided. A follow-up on branch 107-docstring-bug-data-consistency-check-count_trials also makes the "no valid trials" error name the same rules.

  3. added a commit that references this issue on Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions