#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Supported by

# acc variable not calculated

Hello all,

I have just transferred an experiment from a PC running win 7 with a PST SR box via the serial port to a laptop running win 10 with the PST box running through a serial to usb converter.

The experiment worked fine on the PC but now does not calculate acc on the laptop.  The buttons on the box works. Further, the variable inspector shows that the responses are being collected (i.e. response_SRBOX_trials) and avg_rt is calculated and updated on every trial.  However, the acc variable is always 0 and the correct variable is also always 0.

I am at a loss.

I had to upgrade the opensesame version to 3.2 (Kafkaesque Koffka) for the PC.  Further, the dummy mode on the SRBOX plugin doesn't work, If you tick the box for dummy mode than the experiment crashes and the error window says that the srbox could not be detected.

Any help would be gratefully accepted.

Deiniol

• edited June 2019

Update,

I still can't get this to work. Keyboard inputs work fine and ACC and correct variables are calculated but still no luck with the SR box.

I also get an error when running the SRbox in dummy mode (see below). Don't know if this has anything to do with the ACC not being calculated when srbox is run in 'normal' Mode.

Help!

Unexpected error
item-stack: experiment[run].experimental_block[run].block_sequence_exp_[run].exp_block_loop[run].trial_sequence[run].SRBOX_trials[run]
exception type: AttributeError
time: Fri Jun 07 11:25:57 2019
Traceback:
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libqtopensesame\misc\process.py", line 157, in run
exp.run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\experiment.py", line 456, in run
self.items.execute(self.var.start)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 103, in execute
self.run(name)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
self[name].run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run
self.experiment.items.run(_item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
self[name].run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\loop.py", line 359, in run
self.experiment.items.execute(self._item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 103, in execute
self.run(name)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
self[name].run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run
self.experiment.items.run(_item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
self[name].run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\loop.py", line 359, in run
self.experiment.items.execute(self._item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 103, in execute
self.run(name)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
self[name].run()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\sequence.py", line 51, in run
self.experiment.items.run(_item)
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item_store.py", line 122, in run
self[name].run()
File "C:\Program Files (x86)\OpenSesame\share\opensesame_plugins\srbox\srbox.py", line 115, in run
self.experiment.srbox.start()
File "C:\Program Files (x86)\OpenSesame\lib\site-packages\libopensesame\item.py", line 237, in __getattr__

• edited June 2019

I've managed to get it working by using an inline script right after the srbox item (see below).

Acc and correct are now calculated but total_correct still doesn't work (I can live with that).

Would be nice to know what went wrong in the first place and why the ACC and correct variables were not calculated without the inline script.

Deiniol

# check if the response is the same as correct response 1
if self.get("response") == self.get("correct_response"):
exp.set("correct", 1)
# if the response is not one of the correct responses, set correct to 0
else:
exp.set("correct", 0)
# increase the total amount of responses by one
self.experiment.total_responses += 1
# if the response was correct, increase the amount of correct responses by one
if self.get("correct") == 1:
self.experiment.total_correct += 1
# calculate the accuracy
self.experiment.acc = 100.0 * self.experiment.total_correct / self.experiment.total_responses
# save the accuracy under the two variables OpenSesame saves it to
exp.set("acc", self.experiment.acc)
exp.set("accuracy", self.experiment.acc)


• Hi Deiniol,

There were indeed two issues with the SRBox plugin, and you ran into both: dummy mode was broken, and the correctness of the responses was not correctly set. Both of these should be fixed in the upcoming maintenance release (3.2.8). Could you try the latest prerelease of 3.2.8 and let us know whether this fixes these issues for you?

Cheers!

Sebastiaan

(@pdias: This is also what you ran into, I think.)

• Hi Sebastiaan,

Many thanks for your help. Yes, the pre release version fixed the problems with the srbox and correct variables. However, I have another problem. I have 500 experimental trials set to run sequentially. Repeat is set to "each cycle 1.00x" . However, the block of trials is presented twice (i.e. 1000) trials.

I did experiment with deleting the practice block (which loops until the participant has achieved 70% accuracy) and the 500 experimental trials are only presented once. However, with the practice block included the 500 experimental trials are presented twice.

I am at a loss and would appreciate any guidance.

I have attached the file.

Many thanks

Deiniol

• Hi Deiniol,

the problem is that you call the experimental loop twice. Once, in the inline_script in which you restart the practice loop if necessary, and once Opensesame does it for you, just because the experimental sequence is in the list of items to run. Two alternatives: 1) remove the else statement in that inline_script (checkAcc), or set the run if field of experimental sequence to 'Never'

Eduard

• Eduard,

Fantastic. Thank you very much.