Merging two experiments

Hi everyone,

OS (e.g. Win10): Win10
PsychoPy version (e.g. 1.84.x): 1.90
Standard Standalone? (y/n) If not then what?: y
**What are you trying to achieve?:
I have two seperate experiments which I would like to merge into one for easier presentation to the participants (kids).

**What did you try to make it work?: copy and paste elements does not work from one file to another

Hi @fragmag, it will be useful to know more about your two experiments. Are they completely different tasks, or counterbalanced versions of the same experiment, etc?

Hi dvbridges, they are completely different. I just want to avoid having 25 kids open a new file while I run my experiments…

Sure, you could do this, where you have two separate loops, one for each experiment, separated by a rest routine, so participants have a chance to rest. Each experiment could use its own routines, or can share them if they follow the same pattern.

Alternatively, you could use a batch file (in Windows) where you would run the batch file to load the experiment Python scripts consecutively, such that when one closes, the other one opens. To do this, open a notepad file, enter the following commands, and save as “runExp.bat” (or whatever you want to call it) and allow any file type when saving, but must have the extension .bat.

In the .bat file, you will want to add the path to PsychoPys version of Python, which will be in the PsychoPy installation folder, and the path to your experiment.py script. For example

"C:\PsychoPy2\python.exe" "C:\folderContainingExpOne\yourFirstExperiment.py"
"C:\PsychoPy2\python.exe" "C:\folderContainingExpTwo\yourSecondExperiment.py"

With this setup, you can just double click your new batch file, and it will run, without you even having to open PsychoPy manually.

3 Likes

Thank you very much for your help!

Hello,

I tried out your advice with the batch file, but it doesn’t seem to do the trick for me. For one thing the experiments don’t work properly and the other problem is that the kids would still return to the desktop in between experiments where they could do unwanted things.
Much better for me would be a kind of frame-psychopy-file that calls on my different experiments consecutively. I’m sure others have had the problem of wanting to run more than one experiment?!
Merging them into one file doens’t make sense to me as I want to work on them individually and as it would become quite confusing in the builder view.
Thanks for any ideas!

Thanks for the update. May I ask how the experiments do not work properly? Having a dialog box to run multiple experiments from Builder could be done and would not take too much time too implement, but you will always have the same issue of having one experiment stopping and another loading with a GUI asking for participant names etc, unless you choose to bypass the GUI in Builders Experiment settings. Let me post an issue on GitHub, and see if we can get an experiment runner set up for the next release of PsychoPy.

Hello @dvbridges
one experiment simply crashed, in the other one the images appeared at wrong positions and keyboard input didn’t work.
Would it be possible to copy and paste code from the skript compiler into one big skript?
Thanks for posting on GitHub.

No problem @fragmag . Would you be able to post the error message you get when trying to run from the console?

Hi,

tried running it again today and now I get the old error message and python crashes?! Very annoying

Thanks, so you get that error when you attempt to run two consecutive experiments from the batch file?

No, thats an error I encountered before with any psychopy experiment (not using the batch file). I rebooted my system, now python is working and I get this error with the bat-file (first experiment). The second experiment worked fine…


this is my bat-file:

Ok, so that suggests that you are passing a position value with too many coordinates. I can replicate this error if, for a position of my stim, I use (0, 0, 0), which would be (x, y, z), not (x, y), which is needed for the screen coordinates. Perhaps we could take a look at your experiment, as see if there are any typos.

Ok, what do you need? The funny thing is that the experiment works fine when I open it manually?!

If you upload just the psyexp file I can take a look at the components and just check if things are ok. Also, any conditions files

Reaction_mouse.py (24.6 KB)
trials.xlsx (9.9 KB)