Memorandums

知覚・認知心理学の研究と教育をめぐる凡庸な日々の覚書

JavaScript-STAR:分散分析(被験者内3要因まで)

2005-06-30 | Education for 3,4年
3要因被験者内計画の分散分析と、単純主効果の検定および多重比較までが可能なプログラム(フリーウェア)。
例題があるので、試してみるとよい。

References
JavaScript-STAR
www.kisnet.or.jp/nappa/software/star/index.htm
コメント (1)
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

Screen WaitBlanking: PsychToolBox

2005-06-30 | PsychToolBox
>>Screen WaitBlanking?

Usage:

framesSinceLastWait=Screen(windowPtrOrScreenNumber,'WaitBlanking',[waitFrames])

Wait specified number of blankings (frame endings). Call with waitFrames==1 (or
omit it, since that's the default) to wait for the beginning of the next frame.
Video cards mark the end of each video frame by briefly reducing the voltage to
the Vertical Blanking Level (VBL), which "blanks" the screen to black. We do all
video timing relative to the beginning of blanking.
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

Rush 使い方: PsychToolBox

2005-06-30 | PsychToolBox
>>help Rush

Rush(string,[priorityLevel]) % or alternate calling form below

Rush.mex runs a critical bit of your Matlab code with minimal
interruption by Macintosh interrupt tasks. The first argument is a
string containing Matlab code to be passed to EVAL. Within the string,
you can have multiple statements separated by ";" or ",".

The optional "priorityLevel" argument specifies how much to block
interrupt tasks. The allowed values are 0, 0.5, 1, 2, 3, 4, 5, 6, and 7.
A priorityLevel of 0 gives normal execution: simply calls EVAL. Rush
offers two approaches to minimizing interruption, selected by setting
priorityLevel 0.5 (the default) or higher (1 ... 7). Both approaches
temporarily block the processing of deferred tasks, which lessens
interruption of your code. ("Deferred" tasks are called by the Mac OS to
do the time-consuming work scheduled by an interrupt service routine.)
Setting priorityLevel>0.5 also blocks interrupts, blocking more
interrupts as the priorityLevel is raised higher. Raising priority
disables important functions, which is okay if your rushed code doesn't
use them.

Use MaxPriority to determine the highest priority that allows normal
operation of the functions you use, e.g. Snd and Screen 'WaitBlanking'.
We suggest you always call MaxPriority rather than hard coding any
particular priorityLevel, so that your program will gracefully adapt to
run optimally on any computer. Here's a typical use:

Screen('Screens'); % Make sure all functions (Screen.mex) are in memory.
i=0; % Allocate all variables.
loop={
'for i=1:100;'
'Screen(window,''WaitBlanking'');'
'Screen(''CopyWindow'',w(i),window);'
'end;'
};
priorityLevel=MaxPriority(window,'WaitBlanking');
Rush(loop,priorityLevel);
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

screen関数の例2 : PsychToolBox

2005-06-30 | PsychToolBox
>>screen screens?

Usage:

screenNumbers=Screen('Screens')

Return an array of screenNumbers.
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

MovieDemo 2 :PsychToolBox

2005-06-30 | PsychToolBox
MovieDemo 後半

% Show the movie again, now using Rush to minimize interruptions.
loop={
'for i=1:length(w);'
'Screen(window,''WaitBlanking'');'
's(i)=GetSecs;'
'Screen(''CopyWindow'',w(i),window,rect,rect2);'
'end;'
};
priorityLevel=MaxPriority(screenNumber,'WaitBlanking');
Screen(window,'FillRect');
Screen(window,'DrawText',sprintf('Showing movie at priority %g ...?n',priorityLevel),10,30);
i=0;Screen('Screens'); % Make sure all Rushed variables and functions are in memory.
Rush(loop,priorityLevel);
s=diff(s);
frames2=sum(s)*FrameRate(screenNumber)-length(s);
ShowCursor;
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

Screen('FillOval'): PsychToolBox

2005-06-30 | PsychToolBox
>>Screen FillOval?

Usage:

Screen(windowPtr,'FillOval',[color],[rect])

Fills an ellipse with the given color, inscribed within "rect"."color" is the
clut index (scalar or [r g b] triplet) that you want to poke into each pixel;
default produces white with the standard CLUT for this window's pixelSize.
Default rect is whole window.
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

screen関数の例1 : PsychToolBox

2005-06-30 | PsychToolBox
>>Edit MovieDemo

前半----
% Open a window
screenNumber=0;
pixelSize=8;
[window,windowRect]=Screen(screenNumber,'OpenWindow',[],[],pixelSize);
n=300;
% n=min(windowRect(RectBottom),2*round((Bytes*2-1e6)^0.33/2)); % make movie as big as memory will allow.
rect=[0 0 n n];
rect2=AlignRect(rect,windowRect,RectRight,RectBottom);

waitSecs(1); % Give display a moment to recover from the change of pixelSize

% Make a movie by drawing disks into 1+n/2 offscreen windows.
black=BlackIndex(window);
for i=1:(1+n/2)
w(i)=Screen(window,'OpenOffscreenWindow',[],rect);
w(n+2-i)=w(i);
r=[0 0 2 2]*(i-1);
Screen(w(i),'FillOval',black,r);
end

% Show the movie, first forwards, then backwards.
Screen(window,'TextSize',24);
Screen(window,'DrawText','Showing movie at priority 0 ...',10,30);
HideCursor;
for i=1:length(w)
Screen(window,'WaitBlanking');
s(i)=GetSecs;
Screen('CopyWindow',w(i),window,rect,rect2);
end
s=diff(s);
frames1=sum(s)*FrameRate(screenNumber)-length(s);
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

screen 関数: PsychToolBox

2005-06-30 | PsychToolBox
>>help screen

Screen is a MEX file to use on- and off-screen windows for display in
experiments. Screen has many functions; type "Screen" for a list:
Screen
For explanation of any particular screen function, just add a question
mark "?". E.g. for 'OpenWindow', try either of these equivalent forms:
Screen('OpenWindow?')
Screen OpenWindow?
All the Screen Preference settings are documented together:
Screen Preference?


Each on-screen window normally fills a monitor's whole screen. (The OS9
version allows smaller windows; the Win version doesn't.) Off-screen
windows are invisible, but useful as an intermediate place to create and
store images for later display. Copying from window to window is very
fast, e.g. 36 MB/s on a PowerMac 7500/100 and 171 MB/s on a PowerBook
G4/500. It's easy to precompute a series of off-screen windows and then
show them as a movie, in real time, one per video frame.

Screen ARGUMENTS

"windowPtr" argument: Screen 'OpenWindow' and 'OpenOffscreenWindow' both
return a windowPtr, a number that designates the window you just
created. You can create many windows. And you can obtain a windowPtr to
any of Matlab's windows. To use a window, you pass its windowPtr to the
Screen function you want to apply to that window.

"rect" argument: "rect" is a 1x4 matrix containing the upper left and
lower right coordinates of an imaginary box containing all the pixels.
Thus a rect [0 0 1 1] contains just one pixel. All screen and window
coordinates follow Apple Macintosh conventions. (In Apple's the pixels
occupy the space between the coordinates.) Coordinates can be local to
the window (i.e. 0,0 origin is at upper left of window), or local to the
screen (origin at upper left of screen), or "global", which follows
Apple's convention of treating the entire desktop (all your screens) as
one big screen, with origin at the upper left of the main screen, which
has the menu bar. You can rearrange the screens in the desktop by using
Apple's Control Panel: Monitors or Monitors and Sounds. Historically
we've had two different orderings of the elements of rect, so, for
general compatibility, all of the Psychophysics Toolbox refers to the
elements symbolically, through RectLeft, RectTop, etc. Since 2/97, we
use Apple's standard ordering: RectLeft=1, RectTop=2, RectRight=3,
RectBottom=4.

[optional arguments]: Brackets in the function list, e.g. [color],
indicate optional arguments, not matrices. Optional arguments must be in
order, without omitting earlier ones, but you can use the empty matrix
[] as a place holder, with the same effect as omitting it.



HALTING A PROGRAM

OS9:
Command-period halts any program. (Type a period "." while holding the
apple-cloverleaf "command" key down.) If the command-period is
intercepted by any of our MEX files, all of Screen's windows will be
closed, and the cursor will be shown, to allow you to work normally in
the Matlab Command window.
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする

KbCheck : PsychToolBox

2005-06-30 | PsychToolBox
>>help KbCheck

[keyIsDown,secs,keyCode] = KbCheck

Return keyboard status (keyIsDown), time (secs) of the status check, and
keyboard scan code (keyCode).

keyIsDown 1 if any key, including modifiers such as <shift>,
<control> or <caps lock> is down. 0 otherwise.

secs time of keypress as returned by GetSecs.

keyCode OS9: a 128-element logical array. Each bit within the
logical array represents one keyboard key. If a key is
pressed, its bit is set, othewise the bit is clear. To
convert a keyCode to a vector of key numbers use
FIND(keyCode). To find a key's keyNumber use KbName
or KbDemo.

See also: FlushEvents, KbName, KbDemo, KbWait, GetChar, CharAvail, KbDemo.

David Brainard and Allen Ingling
コメント
  • X
  • Facebookでシェアする
  • はてなブックマークに追加する
  • LINEでシェアする