OS: Win10
PsychoPy version: 2024.1.4
Standard Standalone?: yes
Is there some more information on the new counterbalance routine? I did read
- Counterbalance Standalone Routine — PsychoPy v2024.1.5
- Using the Shelf for Multi-session testing, Counterbalancing and more online — PsychoPy v2024.1.5
There are still some questions opens after reading and testing it out, though.
I am using it locally.
First of all: If I enter 2 for Num. Groups, 1 for Slots per group, 1 for Num. repeats, and check “End experiment on depletion” I would expect that the I can run the experiment two times. One time with group 0 and one time with group 1.
This, however, is not the case. I can only run it one time. After that it ends with “Slots for Counterbalancer counterbalance_test have been fully depleted, ending experiment.”
Contents of the shelf.jason after the first run is:
{
"counterbalance_test": {
"_reps": 1,
"0": 0,
"1": 1
}
}
Contents after the second (failed) attempt is:
{
"counterbalance_test": {
"_reps": 1,
"0": 0,
"1": 0
}
}
This is reproducable (on my machine at least). If I set Num. repeats to 2, I would expect it to run group 0 two times and group 1 two times as well. For repeat 1 it works fine. For repeat 2 psychopy ends it after one group.
Same goes for setting Slots per group to 2. It will alays skip the last round.
Am I misunderstanding how the counterbalancing routine is supposed to work or is this a bug?
Second:
If instead I use a spreadsheet (conditionsfile) for specifying the groups, it always fails (but in a different way).
PsychoPy cannot find the specified conditionsfile:
File "###\Downloads\numgroup_test-master\numgroup_test-master\numgroup_lastrun.py", line 625, in <module>
run(
File "###\Downloads\numgroup_test-master\numgroup_test-master\numgroup_lastrun.py", line 351, in run
counterbalance_testConditions = data.utils.importConditions('');
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\data\utils.py", line 314, in importConditions
raise exceptions.ConditionsImportError(
psychopy.exceptions.ConditionsImportError: Conditions file not found:
Regardless of what I specify in the builder, PsychoPy will always compile it to this line:
counterbalance_testConditions = data.utils.importConditions('');
So, it seems to forget to put in the file path I specified in builder. (Btw: Why is it putting a semicolon after the function call?).
When I open the coder, insert the path myself, and run the experiment then, the experiment crashes with various messages like:
File "C:\Users\####\Downloads\numgroup_test-master\numgroup_test-master\numgroup.py", line 625, in <module>
run(
File "C:\Users\####\Downloads\numgroup_test-master\numgroup_test-master\numgroup.py", line 354, in run
counterbalance_test = data.Counterbalancer(
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\data\counterbalance.py", line 58, in __init__
self.makeNewEntry()
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\data\counterbalance.py", line 112, in makeNewEntry
self.resetSlots()
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\data\counterbalance.py", line 121, in resetSlots
self.shelf.data[self.entry] = entry
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\data\shelf.py", line 237, in __setitem__
self.write(data)
File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\data\shelf.py", line 229, in write
json.dump(data, f, indent=True)
File "C:\Program Files\PsychoPy\lib\json\__init__.py", line 179, in dump
for chunk in iterable:
File "C:\Program Files\PsychoPy\lib\json\encoder.py", line 431, in _iterencode
yield from _iterencode_dict(o, _current_indent_level)
File "C:\Program Files\PsychoPy\lib\json\encoder.py", line 405, in _iterencode_dict
yield from chunks
File "C:\Program Files\PsychoPy\lib\json\encoder.py", line 405, in _iterencode_dict
yield from chunks
File "C:\Program Files\PsychoPy\lib\json\encoder.py", line 438, in _iterencode
o = _default(o)
File "C:\Program Files\PsychoPy\lib\json\encoder.py", line 179, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type int64 is not JSON serializable
Contents of the counterbalance conditions file:
group,probability,cap,param1
EXP,0.5,1,0
CONT,0.5,1,0
(I have also tried different names, like 0 and 1, for the group names)
Am I just misunderstanding the whole routine or am I doing something wrong?
Best,
umb