I am currently designing a paradigm where participants receive thermal stimulation after visual presentation of a cue. I have written my own function in Python which allows me to trigger the thermal stimulation once executed (function inputs are temperature value and DeviceChannel (see below)).
I have used the Code component at the beginning of a Routine (termed HeatStim which is preceded by a ButtonPress Routine and followed by a rating screen) where a visual cue is shown for 3 seconds in conjunction with the thermal stimulation. The following code is as follows:
#calling thermode stimulation function
if (ActionStart.corr == 1):
heat_stim_end, input_val=nidaqmx_analog_out.analog_in_out(temp_val,DeviceChannel)
elif (ActionStart.corr == 0):
heat_stim_end, input_val=nidaqmx_analog_out.analog_in_out(0,DeviceChannel)
Where ActionStart.corr = whether a preceding button press was correct, nidaqmx_analog_out.analog_in_out = my function for thermode stimulation, relevant libraries imported at the beginning of the experiment, temp_val = the temperature value, inputted at the beginning of the experiment, and DeviceChannel = variable defined in my .csv file. It outputs heat_stim_end to indicate that the stimulation has finished, and a value telling me the temperature of my thermode which I save to my log file.
The script runs without error and the thermodes are triggered by the correct temperature value, but it skips my last routine (a rating screen) and I’m not sure why? I was wondering if the function triggers the end of my trial for some reason? I’m a beginner with Python and PsychoPy so any help would be much appreciated!
Thank you in advance!