Home > FMAToolbox > Analyses > FiringCurve.m

FiringCurve

PURPOSE ^

FiringCurve - Compute firing curve (e.g. for a head direction cell).

SYNOPSIS ^

function [curve,stats] = FiringCurve(samples,spikes,varargin)

DESCRIPTION ^

FiringCurve - Compute firing curve (e.g. for a head direction cell).

  Compute firing curve (e.g. for a head direction cell, or a place or grid cell
  on a linear track), as well as occupancy and spike count curves. Optionnally,
  curve statistics can also be computed, including in-field peak and mean firing
  rates, firing field width, etc.

  USAGE

    [curve,stats] = FiringCurve(samples,spikes,<options>)

    samples        angular or linear <a href="matlab:help samples">samples</a>
    spikes         spike timestamps
    <options>      optional list of property-value pairs (see table below)

    =========================================================================
     Properties    Values
    -------------------------------------------------------------------------
     'smooth'      smoothing size in bins (0 = no smoothing, default = 2)
     'nBins'       number of bins (default = 50)
     'minTime'     minimum time spent in each bin (in s, default = 0)
     'maxGap'      z values recorded during time gaps between successive (x,y)
                   samples exceeding this threshold (e.g. undetects) will not
                   be interpolated; also, such long gaps in (x,y) sampling
                   will be clipped to 'maxGap' to compute the occupancy map
                   (default = 0.100 s)
     'type'        'linear' for linear data, 'circular' for angular data
                   (default 'linear')
     'threshold'   values above threshold*peak belong to the field
                   (default = 0.2)
     'minSize'     fields smaller than this size are considered spurious
                   and ignored (default = 10)
     'minPeak'     peaks smaller than this size are considered spurious
                   and ignored (default = 1)
     'mode'        'interpolate' to interpolate missing points (< minTime),
                   or 'discard' to discard them (default)
     'maxDistance' maximal distance for interpolation (default = 5)
     'verbose'     display processing information (default = 'off')
    =========================================================================

  OUTPUT

    curve.x             x bins
    curve.rate          average firing rate curve (in Hz)
    curve.count         spike count curve
    curve.time          occupancy curve (in s)

    stats.x             location of the peak rate (in bins)
    stats.peak          in-field peak rate
    stats.mean          in-field mean value
    stats.size          field size (in bins)
    stats.field         field (1 = bin in field, 0 = bin not in field)
    stats.fieldX        field x boundaries (in bins)
    stats.specificity   spatial specificity (Skaggs et al., 1993)

    For circular data:

    stats.m             mean angle
    stats.mode          distribution mode, prefered angle
    stats.r             mean resultant length
    stats.k             von Mises concentration

  NOTE

    This function is provided for convenience. It simply calls <a href="matlab:help Map">Map</a> and <a href="matlab:help MapStats">MapStats</a>
    using the same parameters. The outputs are the same except for curve.z which
    is replaced by curve.rate.

  SEE

    See also Map, MapStats, FiringMap, PlotXY.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [curve,stats] = FiringCurve(samples,spikes,varargin)
0002 
0003 %FiringCurve - Compute firing curve (e.g. for a head direction cell).
0004 %
0005 %  Compute firing curve (e.g. for a head direction cell, or a place or grid cell
0006 %  on a linear track), as well as occupancy and spike count curves. Optionnally,
0007 %  curve statistics can also be computed, including in-field peak and mean firing
0008 %  rates, firing field width, etc.
0009 %
0010 %  USAGE
0011 %
0012 %    [curve,stats] = FiringCurve(samples,spikes,<options>)
0013 %
0014 %    samples        angular or linear <a href="matlab:help samples">samples</a>
0015 %    spikes         spike timestamps
0016 %    <options>      optional list of property-value pairs (see table below)
0017 %
0018 %    =========================================================================
0019 %     Properties    Values
0020 %    -------------------------------------------------------------------------
0021 %     'smooth'      smoothing size in bins (0 = no smoothing, default = 2)
0022 %     'nBins'       number of bins (default = 50)
0023 %     'minTime'     minimum time spent in each bin (in s, default = 0)
0024 %     'maxGap'      z values recorded during time gaps between successive (x,y)
0025 %                   samples exceeding this threshold (e.g. undetects) will not
0026 %                   be interpolated; also, such long gaps in (x,y) sampling
0027 %                   will be clipped to 'maxGap' to compute the occupancy map
0028 %                   (default = 0.100 s)
0029 %     'type'        'linear' for linear data, 'circular' for angular data
0030 %                   (default 'linear')
0031 %     'threshold'   values above threshold*peak belong to the field
0032 %                   (default = 0.2)
0033 %     'minSize'     fields smaller than this size are considered spurious
0034 %                   and ignored (default = 10)
0035 %     'minPeak'     peaks smaller than this size are considered spurious
0036 %                   and ignored (default = 1)
0037 %     'mode'        'interpolate' to interpolate missing points (< minTime),
0038 %                   or 'discard' to discard them (default)
0039 %     'maxDistance' maximal distance for interpolation (default = 5)
0040 %     'verbose'     display processing information (default = 'off')
0041 %    =========================================================================
0042 %
0043 %  OUTPUT
0044 %
0045 %    curve.x             x bins
0046 %    curve.rate          average firing rate curve (in Hz)
0047 %    curve.count         spike count curve
0048 %    curve.time          occupancy curve (in s)
0049 %
0050 %    stats.x             location of the peak rate (in bins)
0051 %    stats.peak          in-field peak rate
0052 %    stats.mean          in-field mean value
0053 %    stats.size          field size (in bins)
0054 %    stats.field         field (1 = bin in field, 0 = bin not in field)
0055 %    stats.fieldX        field x boundaries (in bins)
0056 %    stats.specificity   spatial specificity (Skaggs et al., 1993)
0057 %
0058 %    For circular data:
0059 %
0060 %    stats.m             mean angle
0061 %    stats.mode          distribution mode, prefered angle
0062 %    stats.r             mean resultant length
0063 %    stats.k             von Mises concentration
0064 %
0065 %  NOTE
0066 %
0067 %    This function is provided for convenience. It simply calls <a href="matlab:help Map">Map</a> and <a href="matlab:help MapStats">MapStats</a>
0068 %    using the same parameters. The outputs are the same except for curve.z which
0069 %    is replaced by curve.rate.
0070 %
0071 %  SEE
0072 %
0073 %    See also Map, MapStats, FiringMap, PlotXY.
0074 
0075 % Copyright (C) 2005-2016 by Michaƫl Zugaro
0076 %
0077 % This program is free software; you can redistribute it and/or modify
0078 % it under the terms of the GNU General Public License as published by
0079 % the Free Software Foundation; either version 3 of the License, or
0080 % (at your option) any later version.
0081 
0082 % Default values
0083 type = 'linear';
0084 
0085 % Check number of parameters
0086 if nargin < 2,
0087   error('Incorrect number of parameters (type ''help <a href="matlab:help FiringCurve">FiringCurve</a>'' for details).');
0088 end
0089 
0090 if size(samples,2) ~= 2,
0091   error('Parameter ''samples'' is not a Nx2 matrix (type ''help <a href="matlab:help FiringCurve">FiringCurve</a>'' for details).');
0092 end
0093 
0094 im = 1;argsm = {};
0095 is = 1;argss = {};
0096 % Parse parameter list
0097 for i = 1:2:length(varargin),
0098     if ~ischar(varargin{i}),
0099         error(['Parameter ' num2str(i+2) ' is not a property (type ''help <a href="matlab:help FiringCurve">FiringCurve</a>'' for details).']);
0100     end
0101     switch(lower(varargin{i})),
0102         case 'type',
0103             argss{is} = 'type';
0104             argss{is+1} = varargin{i+1}(1);
0105             is = is+2;
0106             argsm{im} = 'type';
0107             argsm{im+1} = [varargin{i+1}(1) 'l'];
0108             im = im+2;
0109         case {'threshold','minsize','minpeak','verbose','debug'},
0110             argss{is} = varargin{i};
0111             argss{is+1} = varargin{i+1};
0112             is = is+2;
0113         otherwise,
0114             argsm{im} = varargin{i};
0115             argsm{im+1} = varargin{i+1};
0116             im = im+2;
0117   end
0118 end
0119 
0120 curve = Map(samples,spikes,argsm{:});
0121 if nargout == 2,
0122     stats = MapStats(curve,argss{:});
0123 end
0124 curve.rate = curve.z;
0125 curve = rmfield(curve,'z');

Generated on Fri 16-Mar-2018 13:00:20 by m2html © 2005