Implementing Method of Adjustments for a Visual Illusion

OS (e.g. Win10): MacOS Sonoma 14.0
PsychoPy version (e.g. 1.84.x): v2023.2.1
Standard Standalone? (y/n) Yes
What are you trying to achieve?:

I’m attempting to determine a participant’s point of subjective by using the method of adjustment. To that end, I’ve adapted some code to enable the participant to adjust the size of a stimulus using the arrow keys. The aspect of this procedure that I’m stuck on in storing the PSE estimate from each trial.

At present, the test stimulus (the one adjusted) and the reference stimulus at size 0.5. The test is offset from 0.5 by the value “offset”. Thereafter, the code I’ve mentioned adjusts the size of the test stimulus by changing the variable “nudge”. Once the participant is satisfied that the test stimulus is equal in size to the reference, they must press ‘space’. Thereafter, the difference between offset and nudge should be stored as the PSE estimate.

This final step is where I’m stuck. I’ve tried creating an empty list called ‘PSE_estimate’. Once the participant presses spacebar, the difference between offset and nudge should be appended to this empty list. After five trials, the average value of PSE_estimate will be used in my main experiment.

What did you try to make it work?:

The codeblock below is what I’m using to adjust the test stimulus within a given trial:

(Before Experiment:)

(Begin routine):

nudge = 0

(Each frame)


key = event.getKeys(keyList=['left', 'right'])
if key and key[0] == 'left':  # if left key is pressed, change contrast if wouldn't exceed the possible values
    nudge -= 0.1
elif key and key[0] == 'right':  # same here...
    nudge += 0.1

Now, here’s the part that doesn’t work: Below is the codeblock I’m using for storing the given trial’s final PSE estimate.

(Begin experiment:)

trial_counter = -1

(End routine)

trial_counter += 1
PSE_estimate.append = (offset - nudge)

The error I receive when I end a trial with ‘space’ is as follows:

AttributeError: ‘list’ object attribute ‘append’ is read-only