The image of the stimulus does not appear. However, if i get rid of the scaling code segment and leave the stimulus drawing to builder with size in the gui set to blank and Units = “from exp settings” on, such that it does the computation itself, it appears just fine. What did I break? Ideas? I tried a whole bunch of other scaling tricks and somehow nothing works perfectly.
Could someone just point me to a simple code snippet of scaling that actually works using the code component to rescale (and not the ImageStim gui)?
thank you,
OS (e.g. Win10): mac sierra PsychoPy version (e.g. 1.84.x): 2020.2.3 Standard Standalone? (y/n) If not then what?: scratch build
The main reason this does not work is : when you don’t specify the size explicitly but leave the unit to “from exp settings” , it fits the stimulus to your screen properly but the cod/mechanism is hidden. Can someone point me to how the code works for this particular setting?
If i can retrieve that, then scaling from that point onward is easy.
It seems to be exactly what is required when I tried it. What exactly is going wrong?
It is in the source code:
where if the size is left as None, a default of [0.5, 0.5] will be used.
This will only rarely occur, as leaving the size as None generally isn’t something one would want to do, unless displaying a bitmap and you want it to use its native size. But as above, it isn’t really clear to me what issue you are facing here.
Normally when I display, I leave the size [w,h] blank and unit = “from exp settings”. This allows my stimuli to display properly no matter what machine i am on.
If you stick in size to image.size or whatever else, it ends up not sizing to entire screen.
0.5,0.5 - I don’t get the units. are the units norm? It says in the docs that the default is in heights (window size) . But that makes no sense with (0.5,0.5).
What is the recommended way to change a stimulus’ position after its been created?
I do want to point out that the Psychopy demo examples create stimuli with position field empty and with the units = “from exp settings” . I adopted the same approach. I see the stimuli at that point. However, if I change the units and position after, it has disappeared.
Try downloading this new Builder demo file unitDemo.psyexp (not yet released with PsychoPy itself):
If you look inside the code component, you’ll see that it is indeed possible to switch units, size and position of a stimulus as required, at any time. The thing to be careful of is that you often need to update both the size and position attributes of a stimulus simultaneously if you change its units. e.g. if a stimulus in height units has a reasonably large size like 0.1, it will become almost invisible when changed to pix units, as it is now smaller than one pixel. Conversely, a stimulus with pix units and a relatively central location of [25, 0] will not be visible when switched to height units, as it will now be 25 screen heights to the right of the central position. The interactive demo will show this, as for some combinations of units, size and location, the white rectangle can either become invisible (because it is too small to be seen or is positioned off-screen) or take over the entire screen (because its size now exceeds the window dimensions in norm or height units).
As the demo shows, everything you want to do can be done. You just need to take careful account of the very different ways each of the unit scales can work, which can affect both size and position simultaneously.