Skip to content

BF: Fix TrialHander2's __eq__ error at staircase in loop#7062

Merged
peircej merged 1 commit intopsychopy:devfrom
hideh1231:fix_trial_handler2_eq
Jan 24, 2025
Merged

BF: Fix TrialHander2's __eq__ error at staircase in loop#7062
peircej merged 1 commit intopsychopy:devfrom
hideh1231:fix_trial_handler2_eq

Conversation

@hideh1231
Copy link
Copy Markdown
Contributor

When I tried to use a staircase loop in a loop, I encountered this error.
self.loopsUnfinished in if loopHandler in self.loopsUnfinished:, is an empty array, so it caused an AttributeError.
So I fixed it to check for the existence of _rng before doing del.

experiment overview

Traceback (most recent call last):
  File "F:\Research\psychopy_demos\Design Templates\psychophysicsStaircase\psychophysicsStaircase_lastrun.py", line 945, in <module>
    run(
  File "F:\Research\psychopy_demos\Design Templates\psychophysicsStaircase\psychophysicsStaircase_lastrun.py", line 616, in run
    for thisTrial in trials:
  File "F:\Development\psychopy\psychopy\data\staircase.py", line 395, in __next__
    self._terminate()
  File "F:\Development\psychopy\psychopy\data\base.py", line 106, in _terminate
    exp.loopEnded(self)
  File "F:\Development\psychopy\psychopy\data\experiment.py", line 154, in loopEnded
    if loopHandler in self.loopsUnfinished:
  File "F:\Development\psychopy\psychopy\data\trial.py", line 1005, in __eq__
    del self_copy._rng, other_copy._rng
AttributeError: _rng

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 24, 2025

Codecov Report

Attention: Patch coverage is 0% with 4 lines in your changes missing coverage. Please review.

Project coverage is 50.00%. Comparing base (3a04f08) to head (94d1a52).
Report is 153 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #7062      +/-   ##
==========================================
- Coverage   50.59%   50.00%   -0.59%     
==========================================
  Files         347      347              
  Lines       62867    64051    +1184     
==========================================
+ Hits        31807    32030     +223     
- Misses      31060    32021     +961     
Components Coverage Δ
app ∅ <ø> (∅)
boilerplate ∅ <ø> (∅)
library ∅ <ø> (∅)
vm-safe library ∅ <ø> (∅)

@peircej peircej merged commit ee7e860 into psychopy:dev Jan 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants