biac:experimentalcontrol:biac6hardware
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
biac:experimentalcontrol:biac6hardware [2024/04/15 19:23] – [BIAC6 Screen Configuration] cmp12 | biac:experimentalcontrol:biac6hardware [2024/04/15 20:26] – [BIAC6 Screen Configuration] cmp12 | ||
---|---|---|---|
Line 127: | Line 127: | ||
A **CLONED** configuration with goggles off, will result in a single monitor to programs like PsychToolbox and PsychoPy. | A **CLONED** configuration with goggles off, will result in a single monitor to programs like PsychToolbox and PsychoPy. | ||
+ | PTB: | ||
<code matlab> | <code matlab> | ||
>> run SetupPsychtoolbox.m | >> run SetupPsychtoolbox.m | ||
- | >> Screen(' | + | >> |
ans = | ans = | ||
0 | 0 | ||
+ | % there is only a single screen | ||
+ | |||
+ | % you can use the first index, or min / max functions because there is only 1 option | ||
+ | >> screens(1) | ||
+ | ans = | ||
+ | 0 | ||
+ | >> min(screens) | ||
+ | ans = | ||
+ | 0 | ||
+ | >> max(screens) | ||
+ | ans = | ||
+ | 0 | ||
+ | |||
+ | |||
+ | |||
+ | </ | ||
+ | |||
+ | PsychoPy: | ||
+ | <code python> | ||
+ | |||
+ | import pyglet | ||
+ | |||
+ | display = pyglet.canvas.get_display() | ||
+ | screens = display.get_screens() | ||
+ | screens | ||
+ | >> | ||
+ | |||
+ | # screens[0] is the one and only screen | ||
+ | |||
</ | </ | ||
- | Any **EXTENDED** configuration will result in multiple monitors being available | ||
+ | Any **EXTENDED** configuration, | ||
+ | | ||
+ | PTB: | ||
<code matlab> | <code matlab> | ||
>> run SetupPsychtoolbox.m | >> run SetupPsychtoolbox.m | ||
- | >> Screen(' | + | >> |
ans = | ans = | ||
| | ||
| | ||
%in this case | %in this case | ||
- | % 0 - the full display across the extended | + | % 0 - the full extended |
- | % 1 - screen #1 | + | % 1 - screen #1 only |
- | % 2 - screen #2 | + | % 2 - screen #2 only |
+ | % because matlab is indexed a 1, you need to select the correct index to get to screen #1 | ||
+ | >> screens(2) | ||
+ | ans = | ||
+ | 1 | ||
+ | |||
+ | |||
</ | </ | ||
- | + | PsychoPy: | |
- | For instance | + | |
<code python> | <code python> | ||
Line 160: | Line 197: | ||
display = pyglet.canvas.get_display() | display = pyglet.canvas.get_display() | ||
screens = display.get_screens() | screens = display.get_screens() | ||
- | screenNum | + | screens |
- | #get resolution of screen | + | >> |
- | win_res | + | |
- | #set the output to always go to screen | + | # screens[0] is the first screen |
- | win = visual.Window(size=win_res, | + | # |
- | fullscr=True, | + | |
- | color=(0.2, 0.2, 0.2)) | + | |
- | + | ||
- | msg1 = visual.TextStim(win, | + | |
- | msg1.draw() #draw it | + | |
- | win.flip() #put it on the screen | + | |
- | core.wait(5) #wait 5 seconds | + | |
- | win.close() #close it | + | |
- | core.quit() #stop | + | |
</ | </ | ||
- | matlab PTB the first screen | + | You need to code your tasks to send to the specific screen you want your subjects to see. If they are viewing the projector, then they can only single a screen at a time. The default is to send the first display to the projector. |
- | < | + | * screen 0 in matlab |
+ | * screen 0 in PTB | ||
- | %configure the first screen is psychtoolbox | ||
- | screenNumber = 1; | ||
- | [Window, | ||
+ | One of the best ways to account for a variable to setup in matlab would be to code the task to work with either. | ||
- | </code> | + | < |
+ | screens=Screen(' | ||
+ | %if there is only 1 entry | ||
+ | if (length(screens) == 1) | ||
+ | %use it | ||
+ | S.screenNumber = min(screens); | ||
+ | %but if there are more, use #1 explicitely | ||
+ | elseif (length(screens) > 1) | ||
+ | S.screenNumber = screens(2); | ||
+ | %same as S.screenNumber = 1; | ||
+ | end | ||
+ | [S.Window, S.screenRect]=Screen(' | ||
+ | </ | ||
biac/experimentalcontrol/biac6hardware.txt · Last modified: 2024/07/15 13:39 by cmp12