plotcurves
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
plotcurves [2010/06/18 16:39] – initial page (without screenshot and usage) jochen | plotcurves [2010/06/19 19:03] – added output reference jochen | ||
---|---|---|---|
Line 15: | Line 15: | ||
% store data from mat file in ntt | % store data from mat file in ntt | ||
ntt.Data = data;</ | ntt.Data = data;</ | ||
+ | |||
+ | Usually, it is best to first resample the data and then filter the channel which is to be examined (potentially into a new channel): | ||
+ | |||
+ | <code matlab plotcurves_pres1.m> | ||
+ | % this resamples all channels, applying cubic/ | ||
+ | % for channel 1 and simple re-indexing for channels 2 through 9 | ||
+ | gsr.Resample(100, | ||
+ | |||
+ | % this filters channel 1 into a new channel (10) | ||
+ | % all parameters are default, the post-filtering cut-off is set to 0.5s | ||
+ | gsr.Filter(1, | ||
===== Function reference ('help plotcurves' | ===== Function reference ('help plotcurves' | ||
< | < | ||
- | FORMAT: | + | FORMAT: |
Input fields: | Input fields: | ||
- | obj xff object with plotable data | + | obj xff object with plotable |
opts optional settings | opts optional settings | ||
| | ||
Line 32: | Line 43: | ||
| | ||
| | ||
+ | | ||
| | ||
+ | | ||
+ | {' | ||
| | ||
- | | + | |
- | .spots 1x1 or 1x2 index into S | + | .spot |
| | ||
{' | {' | ||
Line 43: | Line 57: | ||
sel | sel | ||
- | | + | |
spot updated spots | spot updated spots | ||
sets updates sets (new indices)</ | sets updates sets (new indices)</ | ||
Line 49: | Line 63: | ||
===== GUI ===== | ===== GUI ===== | ||
This function has its own GUI. Once called (with appropriate parameters), | This function has its own GUI. Once called (with appropriate parameters), | ||
+ | |||
+ | {{: | ||
+ | |||
+ | The dialog has the following controls: | ||
+ | * curve filtering setting (various filter lengths) | ||
+ | * curve (onset-based window) selection | ||
+ | * set-mean standard error patch switch (not yet implemented) | ||
+ | * use-curve checkbox (selection of curves is stored in the object) | ||
+ | * variables (edit boxes for manual override) | ||
+ | * accept button (same as close dialog) | ||
+ | * force-spot-on-curve checkbox | ||
+ | * actual curve/spot plot | ||
+ | * overview plot | ||
+ | |||
+ | Additionally the following keyboard commands are supported (when no UI control has the focus!): | ||
+ | * cursor up/down -> select previous/ | ||
+ | * '' | ||
+ | * ''' | ||
+ | * ''' | ||
+ | * ''' | ||
+ | * ''' | ||
+ | * ''' | ||
+ | |||
+ | The curve/spot plot has the following mouse-based functions: | ||
+ | * a cursor (crosshair) is moving along with the mouse pointer | ||
+ | * when the cursor gets close to one of the defined spots, the closest spot will become movable (indicated by a dashed line) | ||
+ | * pressing and holding the mouse button and then moving the mouse will either | ||
+ | * move one of the spots (if the cursor was close enough to catch it), the spot can only be moved between the window axes limits and any neighboring spots (e.g. the peak spot can not be moved in front of the onset or delay spots!) | ||
+ | * create a zoom-box (which grows/ | ||
+ | |||
+ | Operating the dialog is straight forward: | ||
+ | * select the curve to work on (either clicking into the list or using the cursor up/down keys) | ||
+ | * if this curve is not usable, deselect it (either by unchecking the use-curve box or by pressing the '' | ||
+ | * in case the auto-detection worked well, continue with the next curve | ||
+ | * otherwise move, for instance, the latency (delay) and peak spots to their approximate location | ||
+ | * zoom in each spot's location and fine-tune the value | ||
+ | * if you wish to free the spot from the curve, uncheck the force-to-curve box (temporarily at least) | ||
+ | * **important: | ||
+ | * check that all variables (amplitude, etc.) are as desired and adapt if necessary | ||
+ | * move on to the next curve | ||
+ | |||
+ | After all curves have been inspected/ | ||
===== Usage ===== | ===== Usage ===== | ||
+ | The most basic usage is by simply creating as many onsets as required and defining some basic spots: | ||
+ | |||
+ | <code matlab plotcurves_genericonsets.m> | ||
+ | % onsets are in variable onsets, data in channel 1 | ||
+ | curves = cell(numel(onsets), | ||
+ | for cc = 1: | ||
+ | curves{cc, 1} = sprintf(' | ||
+ | curves{cc, 2} = [1, onsets(cc) - 2, onsets(cc) + 20]; | ||
+ | end | ||
+ | |||
+ | % we define three spots of interest: | ||
+ | % - onset (time of stimulus), | ||
+ | % - delay of response (minimum before peak), | ||
+ | % - and peak of response (amplitude) | ||
+ | spotnames = {' | ||
+ | spottype = {' | ||
+ | |||
+ | % the spots are simply defined as the onsets (and added values) | ||
+ | spots = {onsets, onsets + 3, onsets + 7}; | ||
+ | |||
+ | % then we define some variables of interest: | ||
+ | % - Latency (defined as x-diff between onset and delay) | ||
+ | % - Response time (defined as x-diff between delay and peak) | ||
+ | % - Base amplitude (defined as y-value at delay) | ||
+ | % - Peak amplitude (defined as y-value at peak) | ||
+ | % - Peak-to-peak response amplitude (defined as y-diff between delay and peak) | ||
+ | % additionally, | ||
+ | % should be applied after we're done | ||
+ | vars = struct( ... | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | % options: | ||
+ | % - data is now in channel 10 (filtered!) | ||
+ | % - original data is in channel 1 (pre-filter) | ||
+ | % - variables and spots as defined | ||
+ | pcopts = struct( ... | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | % now we call plotcurves | ||
+ | plotcurves(gsr, | ||
+ | |||
+ | If the data contains onset/ | ||
+ | |||
+ | <code matlab plotcurves_withonsets.m> | ||
+ | % we define three spots of interest: | ||
+ | % - onset (time of stimulus), | ||
+ | % - delay of response (minimum before peak), | ||
+ | % - and peak of response (amplitude) | ||
+ | spotnames = {' | ||
+ | spottype = {' | ||
+ | |||
+ | % the spot values are set to empty arrays with size 0x2! | ||
+ | % this tells plotcurves to autodetect... | ||
+ | spot = {zeros(0, | ||
+ | |||
+ | % re-using the variables definition from above, options: | ||
+ | % - data is now in channel 10 (filtered!) | ||
+ | % - original data is in channel 1 (pre-filter) | ||
+ | % - onsets are coded in channel 8 (0Volts nothing, 5 Volts boxes) | ||
+ | % - variables and spots as defined | ||
+ | pcopts = struct( ... | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | |||
+ | % now we call plotcurves | ||
+ | plotcurves(gsr, | ||
+ | |||
+ | ===== Output ===== | ||
+ | The function outputs the following variables: | ||
+ | * sel (boolean vector with curve selection, copied from use-curve checkbox) | ||
+ | * varc (number-of-curves - by - number-of-variables double table) | ||
+ | * spot (1 - by - number-of-spots cell array with coordinates of spots) | ||
+ | * sets (updated list of sets, that is to say with correct indices, only if sets defined!) | ||
+ | In addition to this, the final options and configuration (when the dialog was closed) is stored in the gsr object under '' |
plotcurves.txt · Last modified: 2011/05/27 15:54 by jochen