| Reference | Downloads | Github

Psychojs reference questions: Units, TextStim clarity, and element visibility

Hi all,

Is there a currently a reference of what units psychojs windows currently support? So far from briefly testing, it looks like norm and pix are in, deg and cm are out (which is a little surprisingly, because cm is a valid css unit size). Visual degree is my go-to unit for almost everything (since it’s isometric and scalable if you’re cheating by adjusting the distance), but some quick searching suggests that there really isn’t an easy js physical dimension or even dpi measure, so even an “arm’s length” assumed distance (in the past I’ve seen 28in) wouldn’t help.

I’m trying to get a basic TextStim to display, but using pix and norm on my laptop screen both are a bit fuzzy (far below the crispness of creating an image of text and displaying it when specifying an image with native pixel size). Are there any aliasing or rendering options I can play with to clean it up?

Finally, is there any method either in psychojs or pixi that allows for testing of whether an element, regardless of whether its hidden or shown, is actualy within the screen and viewable? Given all the selenium work and “scrolling into view” I’d think so, but don’t know whether that’s base js or something layered on top.


There is some documentation for the PsychoJS lib at
but I think you’ll need to look the source directly to check the units:

I think currently supported are pix, height, norm. Units are one place where we sort of need to rethink completely, due to the move from controlled lab settings to browsers on wide-ranging devices. But this is where things are a bit of a headache for an app designed originally for calibrated labs.

I suppose we could allow cm but we’d have to trust that the conversion was correct.

I think degrees are out of the question. You don’t know how far the screen is or how big it is. Even if you found a way to calibrate that the range of displays in a browser would mean the stimulus would be either way too big for a phone, or way too small on a large desktop display (actually that’s an issue with all except norm and height I expect)

For the fuzzy text, I don’t know the answer. Maybe need @apitiot for that question. You can see the (pixi) text object getting created here though as a place to start looking:

My guess about the last question (testing scales for visibility) is that it’s beyond the scope of pixi but would be great to hear otherwise. I think pixi is really close to the likes of pyglet and pygame - it provides raw low-level rendering but then you’re on your own. But that’s a pretty uninformed guess.


Sorry for the late reply; somehow missed this one.

Thanks for the references; have you mostly been using height in your own cross-browser testing? I somehow missed when that got introduced! Agree that degrees are out of the question, sadly. :-/ I wonder if there’s a way to use em or rem for responsive sizing? Probably not a bad candidate for another discussion issue in the psychojs tracker.

I don’t see any alias options naively searching the PIXI doc, but admit that’s a total superifical search. This basic text example on their own site looks sharp, so maybe it is something with how psychojs is defining text styles, but I’ll have to dig a little deeper.

I’ll let you know if I find answers to any of these! -Erik