klabhub / neurostim

Design and run visual neuroscience experiments using Matlab and the Psychophysics Toolbox.
MIT License
5 stars 4 forks source link

new stimulus "arc" #210

Closed nicholasprice closed 11 months ago

nicholasprice commented 2 years ago

A new stimulus for drawing a framed of filled wedge. Useful for creating a rotational wedge. Less missed frames than an arc achieved through convpoly.

adammorrissirrommada commented 2 years ago

@nicholasprice This looks good. Just to confirm, if I changed only the startAngle smoothly over time, would this do rotation of a wedge around a central point? (it seems your rect is creating space for a full implied circle, rather than just the bounding box of the drawn arc?)

nicholasprice commented 2 years ago

@dshimaoka I have a feeling these commits are getting pushed under my account.

dshimaoka commented 2 years ago

How weird I still get notices??? Answering Adam's query, yes the trick is to set startAngle dynamically. A version of it is implemented here. By specifying a window for a full circle, we don't need to worry about the center of the rotation.

adammorrissirrommada commented 2 years ago

A minor performance observation on your demo script:

ptch.startAngle= '@contour.contDir * contour.shiftPerT*(rem(1/contour.fps*contour.frame, contour.dur))';

If part of that is a constant, I'd precompute it rather than calculate it every frame. e.g. maybe you are just adding a fixed offset each frame?

Also, I suspect you would want to stopLog() on the startAngle property to avoid huge file size and potentially frame drops? If so, you would need a separate parameter to log the starting angle at beginning of trial.

When you said you were getting frame drops with convPoly version, potentially that was why?

dshimaoka commented 2 years ago

Ah thanks for the suggestion, I am keen to learn how to achieve less dropped frames! Do you mind elaborating a bit more about how to do precomputing in this context, or point to a relevant demo code?