Dissertation - assigning conditions to BART experiment

Hello, for my dissertation I’m taking the BART experiment and testing gamification through points rewards. I’m assigning conditions wherein participants either see no bonus points (control group), see bonus points every fixed 4 trials (experimental group 1), or see bonus points every few random trials (experimental group 2). I just need to incorporate this into a BART experiment from Pavlovia so I thought this would be simple, but it’s been days and I still can’t get it to work.

The control condition works fine, but I cannot get the bonus points to show up for the fixed or random experimental conditions. It seems to potentially be an issue loading maxPumps (trial rows that indicate how many pumps of the balloon before it pops), which confuses me as I’ve tried many things to fix it but nothing seems to be working. If I could receive help on this, I would be extremely grateful.

bart_new.psyexp (108.2 KB)

These are also some of the errors I keep experiencing when trying to run it:

(most recent error code, i keep getting this no matter what i try to change)

######### Running: /Users/biancalao/Downloads/bart/bart_new_lastrun.py #########
2025-04-21 17:45:00.841 python[35661:1395909] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/y9/0rsn53zn1c173s_mz89twm_40000gn/T/org.opensciencetools.psychopy.savedState
||PaMacCore (AUHAL)|| Error on line 520: err=‘‘what’’, msg=Unspecified Audio Hardware Error
Traceback (most recent call last):
||PaMacCore (AUHAL)|| Error on line 520: err=‘‘what’’, msg=Unspecified Audio Hardware Error
File “/Users/biancalao/Downloads/bart/bart_new_lastrun.py”, line 2326, in
run(
File “/Users/biancalao/Downloads/bart/bart_new_lastrun.py”, line 1227, in run
pump = data.TrialHandler2(
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/data/trial.py”, line 935, in init
self.nReps = int(nReps)
TypeError: int() argument must be a string, a bytes-like object or a real number, not ‘NoneType’
2.0982 WARNING Monitor specification not found. Creating a temporary one…

(from earlier yesterday)

######### Running: /Users/biancalao/Downloads/bart/bart_new_lastrun.py #########
2025-04-21 13:25:19.957 python[33926:1316981] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/y9/0rsn53zn1c173s_mz89twm_40000gn/T/org.opensciencetools.psychopy.savedState
Traceback (most recent call last):
File “/Users/biancalao/Downloads/bart/bart_new_lastrun.py”, line 2112, in
run(
File “/Users/biancalao/Downloads/bart/bart_new_lastrun.py”, line 375, in run
core.rush(enable=True)
TypeError: rush() got an unexpected keyword argument ‘enable’
1.8896 WARNING Monitor specification not found. Creating a temporary one…
ioHub Server Process Completed With Code: 0
################ Experiment ended with exit code 1 [pid:33926] #################

Thank you loads!

You have code in Before Experiment which should be in Begin Experiment, especially the section defining trialsFile.

Your first error suggests a blank value on maxPumps in one of your spreadsheets. I’m not sure about the core.rush error.

Are you trying to run the experiment locally, online or both? Your finalScore code is JS only.

Hello, thanks so much for the reply! I’ve switched the code to Begin Experiment, but I still get an issue when trying to run the fixed or random bonus conditions. I’ve checked the spreadsheets many times, and none of the maxPumps cells are blank. I can’t think of how else to solve the error I still get.

Also, I’m running it online, but just running locally for now to test if the experiment works. The finalScore code is from the template I downloaded, so would you suggest I also write in a Python code?

I believe PsychoPy is still not registering maxPumps.

######### Running: /Users/biancalao/Downloads/bart/bart_new_lastrun.py #########
2025-04-22 20:50:34.087 python[6220:436352] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/y9/0rsn53zn1c173s_mz89twm_40000gn/T/org.opensciencetools.psychopy.savedState
Traceback (most recent call last):
File “/Users/biancalao/Downloads/bart/bart_new_lastrun.py”, line 2237, in
run(
File “/Users/biancalao/Downloads/bart/bart_new_lastrun.py”, line 1225, in run
pump = data.TrialHandler2(
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.10/psychopy/data/trial.py”, line 935, in init
self.nReps = int(nReps)
TypeError: int() argument must be a string, a bytes-like object or a real number, not ‘NoneType’
2.0896 WARNING Monitor specification not found. Creating a temporary one…
ioHub Server Process Completed With Code: 0
################# Experiment ended with exit code 1 [pid:6220] #################

My experiment is still exactly the same, except I moved the code in my assign_participants Routine from Before Experiment to Begin Experiment

bart_new.psyexp (108.2 KB)

Your fixed bonus spreadsheet had 30 rows. Here’s a fixed version.
fixed_bonus.xlsx (8.8 KB)

If you only want to run it online and the existing JS code works then you could leave it.

Oh wow I see thank you so much!! I would not have caught that 30 rows issue. The experiment finally runs on PsychoPy now which is so relieving after all this time trying to get it to work!! It was very satisfying to witness.

However, I am now facing an issue when I try to either run or pilot it on Pavlovia (right after the instructions routine):


Error

Unfortunately we encountered the following error:

  • ReferenceError: maxPumps is not defined

Try to run the experiment again. If the error persists, contact the experiment designer.


I edited the spreadsheets slightly by turning the bonusText into separate paragraphs, to help it look cleaner. I don’t think this slight change would be the cause of the issue though?

I’m thinking the issue might be with the java code in assign_participants, but I can’t figure out how to solve it. Sorry about this new issue popping up! Just trying to make sure I’m actually able to send the link to participants now.

bart_new.psyexp (108.2 KB)

Thanks loads again!!

Hi,

Just wanted to update you that I’ve sorted out my experiment, and it is now up and running! Thank you so much for all the help; I really appreciate it.

In case you wanted to have a look: irp_experiment [PsychoPy]

Take care :slight_smile: