Skip to content

2.5.2 plotLicks()

Shun Li edited this page Dec 7, 2023 · 4 revisions

Overview

This function will extract lick events and calculate lick rates aligned to a given event of interest.

Inputs and options

Required inputs

  • eventIdx: double, a vector indicating at which sample the desired event happens
  • timeRange: double, indicates seconds before and after the desired event
  • binSize: double, indicates the size of bin (in seconds) to calculate instantaneous lick rate
  • color: color of the line, should provide two colors in cell array if there's two sides or lick ports
  • leftLick: logical, whole session recording of the left lick ports (in form [0 0 0 1 0 0 0 1 0 0 0 0])
  • rightLick: logical, whole session recording of the right lick ports
  • params: struct, created in loadSessions(), stores the synchronization and other session-related parameters

Options

  • mode: string, default is 'trace'; determines the style of plot. Can also be 'raster' which returns a raster plot of the licks

  • side: double, default is [0 1]; indicates which lick port is active during the session. Default indicates only the right lick port is active

  • leftSolenoid: double, events of left solenoid water delivery

  • rightSolenoid: double, events of right solenoid water delivery

  • airpuff: double, events of airpuff delivery

  • plot: logical, default is true; determines whether or not to plot traces or just return the extracted event aligned signals

  • markerSize: double, default is 20; determines the size of event markers

Outputs

  • lickRate: a 1xn cells (n is 2 when two lick ports are active) where each cell stores the event-aligned lick rate for the event of interest. Basically traces returned in plotTraces(). See getLicks() for more details
  • lickEvents: a 1xn cells (n is 2 when two lick ports are active) where each cell stores all the lick events relative to the events of interests. See getLicks() for more details
  • t: double, an vector where each element stores to appropriate time (i.e. x-axis value) for plotting. Same as timestamp returned in plotTraces()

Examples

initializeFig(0.5,0.3);
plotLicks(waterLickIdx,timeRange,options.lick_binSize,bluePurpleRed(1,:),[],rightLick,params);
plotLicks(airpuffIdx,timeRange,options.lick_binSize,[0.2, 0.2, 0.2],[],rightLick,params);
plotLicks(toneIdx,timeRange,options.lick_binSize,bluePurpleRed(350,:),[],rightLick,params);
plotLicks(stimIdx,timeRange,options.lick_binSize,bluePurpleRed(end,:),[],rightLick,params);
plotLicks(baselineIdx,timeRange,options.lick_binSize,[.75 .75 .75],[],rightLick,params);
plotEvent('',0);
xlabel('Time (s)'); ylabel('Licks/s'); 
legend(taskLegend,'Location','best');

image

Clone this wiki locally