psychopy.org | Reference | Downloads | Github

How to avoid getting jigged lines (when line stimulus' orientation = tilted) Software for creating stimuli?

Hello dear Psychopyers,

I am new and need your kind help and knowledge sharing.

I try to make a visual search Exp, by adapting a template provided by @colinquirk (thank you!!) using the Psychopy library (in spyder).

In the code, the stimuli are used from a folder. I have created a line stimulus file and it works fine when vertical, but not when presented tilted (not vertical), as intended. The following problem arises: the line is jagged and the pixels are messed up.

Is there a way to avoid this ? e.g. by using specialized software for high-quality stimuli ? I tried some changes in size (400x400, 32x226) adapting also the stim_size = (0.25,1) to get it to work, while I tried also the code with the author’s original stimulus (450x450, with stim_size =1) and still got jagged lines.

Any suggestion ?

Dear @colinquirk how did you make the stimuli and what would you suggest ?

Thank you very much in advance :slight_smile:

1 Like

I’m glad the code was useful! I believe this problem is caused by trying to draw lines (the edges of the stimuli) that don’t line up well with the screen’s pixels. What is the resolution of your screen? I am worried that there is not much you can do if you are working on a lower res screen, but it is possible that creating higher res images or even drawing them directly with psychopy could help. Hopefully someone else can weigh in as well. Good luck!

1 Like

My screen resolution is x1600-900.

I tried making the stimulus directly with psychopy, but it was asking me for the “window” argument (win), which I couldn’t figure out how to handle it in the larger code scale.
(In tutorials I see you just type the numbers in win, but it’s confusing for me how I can draw a line and use it flexibly as an object as I did with pictures. It would be great to have the stimulus regardless of the window complexities.

Unless there is a simple way-out that I am not aware ? (I am new to psychopy :/)

Is there a good software I can use for this purpose ? (high resolution image for exps)

Thank you very much again.

1 Like

Is that the same resolution you plan on using when running the experiment?

I do have an another example of how to use my code here: https://github.com/colinquirk/PsychopyChangeDetection

In that experiment I create my own stimuli, you might want to look at the display_stimuli function.

1 Like

Thank you a lot!

Probably the same or a bit smaller (given that the testing computers are a bit old). By creating the stimuli with psychopy though this is solved I guess ? (it’s resolution-indepedent reasonably).

You suggest creating visual stimuili as a pic with a software or making them in psychopy is generally less troublesome ?

Thanks again.

Try adding interpolate=True to the call of visual.ImageStim. If that doesn’t work, you can try creating the image that you’re displaying in real size. So, if you want your image to be 100x20 pixels, create the image with the same dimensions.
I think the problem occurs when psychopy tries to shrink the image to the size you want and with tilted lines, it doesn’t work very well

It would depend on the experiment, though usually I am doing things with working memory which involves drawing lots of colored squares, so most of the time I use psychopy directly.

1 Like