cortex-lab / Rigbox

A MATLAB toolbox for running behavioral neuroscience experiments and managing data
GNU General Public License v3.0
33 stars 16 forks source link

added option to display calibration plot within expServer #245

Closed kevin-j-miller closed 4 years ago

kevin-j-miller commented 4 years ago

I've had this in my branch for a while, and Laura requested that I try and merge it into the regular branch. If you press 'k' in expServer, a plot will appear that shows the rigs current calibration curve and the date of last calibration. I tweaked this to work with the regular rig, and tested it with zredone.

kevin-j-miller commented 4 years ago

This looks great! I love the idea of displaying the keyboard shortcuts too. I'd been thinking of printing out cheat-sheets and leaving them in the room, but this is much more elegant.

k1o0 commented 4 years ago

@kevin-j-miller If everything looks good to you I'll merge.

kevin-j-miller commented 4 years ago

I just took a look using a rig. Two things weren't perfect: After displaying the calibration plot, the background went to black rather than grey, and also the help text was kind of hard to read (see below)

The first I think could be solved by just not changing the background color to begin with (lines 420 and 423) -- the plot displays as an image, so it's background will still be white, just not the psychtoolbox background behind it. The second I think just needs a smaller fontsize or larger line spacing.

image

k1o0 commented 4 years ago

Hmm, that's weird. The background doesn't go black on my rig. It should return to whatever value bgColour is set to in expServer. Changing the background isn't so important be we should figure out why it goes black for you. Are you calling expServer with any inputs?

Regarding the text, it looks fine for me so I guess this depends on the resolution of the screen. Perhaps I should scale the font size by the vertical resolution?

By the way for testing I use hw.debugWindow.

k1o0 commented 4 years ago

I looked into the text size setting. It seems PTB uses the system default, which should work fine. The clipping your seeing is not affected by the line spacing. In Windows Settings > System, is Scaling set to 100? Try running this code and telling me how it looks:

rig = hw.devices([], false);
win = rig.stimWindow;
win.open();

sz = 20;
def = Screen('TextSize', win.PtbHandle, sz);

msg = sprintf('Default text size: %.0f,\n current size: %.0f', def, sz);
win.drawText(msg, 'centerblock', 'center', win.White, 1, 40)
win.flip()
pause(5)

Screen('TextSize', win.PtbHandle, def);
win.close;
k1o0 commented 4 years ago

I'm going to merge this into the branch for the next release, so I'm closing this PR.