Jelajahi Sumber

added gflicker function and function comments

Dimokratis Karamanlis 1 tahun lalu
induk
melakukan
55169a5e12

+ 13 - 3
stimulus_reconstruction/getGratingFlashStimulus.m

@@ -1,7 +1,17 @@
 function [stimmat, stimparams] = getGratingFlashStimulus(stimdesc, spX, spY, bwflag)
-%UNTITLED Summary of this function goes here
-%   Detailed explanation goes here
-
+% getGratingFlashStimulus - Generates a matrix of grating stimuli and corresponding parameters
+%
+% Syntax:  [stimmat, stimparams] = getGratingFlashStimulus(stimdesc, spX, spY, bwflag)
+%
+% Inputs:
+%    stimdesc - struct containing information about the widths, phases, and orientations of the gratings
+%    spX - the values of spatial x coordinates for which the grating is calculated
+%    spY - the values of spatial y coordinates for which the grating is calculated
+%    bwflag - marks whether the grating is square instead of sinusoidal 
+%
+% Outputs:
+%    stimmat - [numel(spY) x numel(spX) x Nstimuli] matrix of grating stimuli, where the first two dimensions match the size of the spatial grid, and the third dimension corresponds to the number of different gratings generated.
+%    stimparams - [Nstimuli x 3] matrix containing the parameters used to generate the gratings, including spatial frequency, orientation, and phase.
 
 Nwidths   = numel(stimdesc.stripewidths);
 Nstimuli  = sum(stimdesc.Nphases .* stimdesc.Norientations);

+ 28 - 0
stimulus_reconstruction/orderGratingFlicker.m

@@ -0,0 +1,28 @@
+function gforder = orderGratingFlicker(Nbase, oseed, Npresent)
+% orderGratingFlicker - Generates a random order of grating stimuli for a fixed or running sequence
+%
+% Syntax:  gforder = orderGratingFlicker(Nbase, oseed, Npresent)
+%
+% Inputs:
+%    Nbase - number of different gratings
+%    oseed - seed for the random number generator, used to generate a random sequence of values
+%    Npresent - number of grating stimuli that were presented
+%
+% Outputs:
+%    gforder - [1, Npresent] random order of grating stimuli
+%
+% Example:
+%    currorder = orderGratingFlicker(Ngratings, seed, Npresent)
+%    where seed is either the seed for the frozen sequence, 
+%    or the seed for the running sequence
+
+% Other m-files required: ran1
+% Subfunctions: none
+% MAT-files required: none
+
+rnd_val = ran1(oseed, Npresent);
+gforder = floor(Nbase*rnd_val) + 1;
+
+
+end
+

+ 20 - 0
stimulus_reconstruction/returnFixMovie.m

@@ -1,4 +1,24 @@
 function blockstimulus = returnFixMovie(screensize, imEnsemble, listfixations)
+% returnFixMovie - Generates a movie of fixations using an image ensemble
+%
+% Syntax:  blockstimulus = returnFixMovie(screensize, imageEnsemble, listfixations)
+%
+% Inputs:
+%    screensize - [Ny, Nx] size of the monitor, always [600, 800] for our experiments
+%    imageEnsemble - ensemble of images, contains frozenImages and runningImages
+%    listfixations - [3, Nframes] list of fixations (image index, x, y)
+%                   for the frozen sequence it is frozenfixations, for the running sequence is runningfixations
+%
+% Outputs:
+%    blockstimulus - [Ny, Nx, Nframes] movie of fixations, where the images presented at each frame are shifted based on gaze data
+%
+% Example:
+%    blockstimulus = returnFixMovie([600, 800], imageEnsemble, listfixations)
+%
+% Other m-files required: none
+% Subfunctions: getRanges
+% MAT-files required: none
+%--------------------------------------------------------------------------
 
 Nx  = screensize(2);
 Ny  = screensize(1);