Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

chronux.html 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/REC-html40/loose.dtd">
  3. <html>
  4. <head>
  5. <title>Description of chronux</title>
  6. <meta name="keywords" content="chronux">
  7. <meta name="description" content="This library performs time-frequency analysis (mostly using the">
  8. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  9. <meta name="generator" content="m2html &copy; 2005 Guillaume Flandin">
  10. <meta name="robots" content="index, follow">
  11. <link type="text/css" rel="stylesheet" href="../../m2html.css">
  12. <script type="text/javascript">
  13. if (top.frames.length == 0) { top.location = "../../index.html"; };
  14. </script>
  15. </head>
  16. <body>
  17. <a name="_top"></a>
  18. <!-- ../menu.html chronux_2_10 --><!-- menu.html spectral_analysis -->
  19. <h1>chronux
  20. </h1>
  21. <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
  22. <div class="box"><strong>This library performs time-frequency analysis (mostly using the</strong></div>
  23. <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
  24. <div class="box"><strong>function chronux </strong></div>
  25. <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
  26. <div class="fragment"><pre class="comment"> This library performs time-frequency analysis (mostly using the
  27. multi-taper spectral estimation method) of univariate and multivariate
  28. data, both for continuous processes such as LFP/EEG and for point
  29. processes such as spike times. Point process can either be stored as
  30. times or as a binned process of counts. The routines in this library
  31. are named differently for the three cases. For calculations
  32. that can be performed for each of the three data types, we use suffixes
  33. c, pb, or pt to refer to continuous, point process binned counts, or
  34. point process times. For example, the spectrum calculation is performed
  35. mtspectrumc for continuous processes, mtspectrumpb for a binned point
  36. process, and mtspectrumpt for a point process consisting of times. There
  37. are also routines for calculating hybrid quantities involving one continuous
  38. and one point process. These are suffixed in a similar manner. For
  39. example, coherencycpb calculates the coherency between a binned point process
  40. and a continuous process.
  41. Certain variables are used repeatedly in this library.
  42. DATA
  43. data in most cases can be univariate or multivariate, and either point process,
  44. or continuous.
  45. Continuous data: Continuous data is assumed to be a matrix with
  46. dimensions samples x channels/trials.
  47. Point Process: A single time series of spike times can be in the form of
  48. a column vector.
  49. Multichannel/trial spike time data is not amenable to this
  50. storage format, since there are generally different
  51. number of spikes in each channel/trial. Instead,
  52. multichannel/trial spike data is stored in a structure
  53. array. A structure is a matlab data object with various
  54. fields. These fields contain the elements
  55. e.g. The command data=struct('times',[]); creates an empty
  56. structure with field 'times'. Similarly, the command
  57. data=struct('times',[1 2 3]); creates the structure with
  58. the field 'times' containing integers 1, 2, and 3.
  59. We can also have a structure array (or an array of structures)
  60. defined for example, by
  61. data(1)=struct('times',rand(1,100)); and
  62. data(2)=struct('times',rand(1,200));
  63. This is a 2 dimensional structure array where the
  64. first field is a 100 dimensional random vector, and
  65. the second field is a 200 dimensional random vector.
  66. This format allows storage of multichannel point
  67. process times in a single variable data.
  68. The above holds for point processes stored as times.
  69. If instead, the point processes are binned, then one
  70. can use a matrix to represent them
  71. Summary: data - array of continuous data with dimensions time x channels
  72. structural array of spike times with dimensions
  73. equal to the number of channels
  74. 1d array of spike times as a column vector
  75. array of binned spike counts with dimensions time x channels
  76. PARAMETERS:
  77. These are various parameters used in the spectral calculations. Since
  78. these parameters are used by most routines in Chronux, they are stored in
  79. a single structure params. The fields of params are
  80. tapers : precalculated tapers from dpss or in the one of the following
  81. forms:
  82. (1) A numeric vector [TW K] where TW is the
  83. time-bandwidth product and K is the number of
  84. tapers to be used (less than or equal to
  85. 2TW-1).
  86. (2) A numeric vector [W T p] where W is the
  87. bandwidth, T is the duration of the data and p
  88. is an integer such that 2TW-p tapers are used. In
  89. this form there is no default i.e. to specify
  90. the bandwidth, you have to specify T and p as
  91. well. Note that the units of W and T have to be
  92. consistent: if W is in Hz, T must be in seconds
  93. and vice versa. Note that these units must also
  94. be consistent with the units of params.Fs: W can
  95. be in Hz if and only if params.Fs is in Hz.
  96. The default is to use form 1 with TW=3 and K=5
  97. pad: (padding factor for the FFT) - optional (can take values -1,0,1,2...).
  98. -1 corresponds to no padding, 0 corresponds to padding
  99. to the next highest power of 2 etc.
  100. e.g. For N = 500, if PAD = -1, we do not pad; if PAD = 0, we pad the FFT
  101. to 512 points, if pad=1, we pad to 1024 points etc.
  102. Defaults to 0.
  103. Fs:sampling frequency.optional (default 1)
  104. fpass: frequencies in an fft calculation can range from 0 to Fs/2 where
  105. Fs is the sampling frequency. Sometimes it may be useful to
  106. compute fourier transforms (and resulting quantities like the
  107. spectrum over a smaller range of frequencies). This is specified
  108. by fpass, which can be in the form [fmin fmax] where fmin &gt;=0 and
  109. fmax&lt;=Fs/2. optional (default [0 Fs/2])
  110. err=[errtype p] calculates theoretical error bars (confidence levels)
  111. when errtype=1 and jackknife error bars when errchk=2. In each case, the
  112. error is calculated at a p value specified by p. -
  113. optional (default 0)
  114. trialave: trialave controls whether or not to average over channels/trials for
  115. multichannel/trial analyses. trialave=0 (default) implies no trial
  116. averaging, trialave=1 implies that the quantity of interest is averaged
  117. over channels/trials. optional (default 0)
  118. Other parameters are discussed in individual routines as and when they
  119. are used.</pre></div>
  120. <!-- crossreference -->
  121. <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
  122. This function calls:
  123. <ul style="list-style-image:url(../../matlabicon.gif)">
  124. </ul>
  125. This function is called by:
  126. <ul style="list-style-image:url(../../matlabicon.gif)">
  127. <li><a href="../../chronux_2_10/test/testAvg3.html" class="code" title="">testAvg3</a> This is a calling routine to test & check out the power spectrum &</li><li><a href="../../chronux_2_10/test/testAvg4.html" class="code" title="">testAvg4</a> This is a calling routine to test & check out the power spectrum &</li></ul>
  128. <!-- crossreference -->
  129. <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../../up.png"></a></h2>
  130. <div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function chronux</a>
  131. 0002 <span class="comment">% This library performs time-frequency analysis (mostly using the</span>
  132. 0003 <span class="comment">% multi-taper spectral estimation method) of univariate and multivariate</span>
  133. 0004 <span class="comment">% data, both for continuous processes such as LFP/EEG and for point</span>
  134. 0005 <span class="comment">% processes such as spike times. Point process can either be stored as</span>
  135. 0006 <span class="comment">% times or as a binned process of counts. The routines in this library</span>
  136. 0007 <span class="comment">% are named differently for the three cases. For calculations</span>
  137. 0008 <span class="comment">% that can be performed for each of the three data types, we use suffixes</span>
  138. 0009 <span class="comment">% c, pb, or pt to refer to continuous, point process binned counts, or</span>
  139. 0010 <span class="comment">% point process times. For example, the spectrum calculation is performed</span>
  140. 0011 <span class="comment">% mtspectrumc for continuous processes, mtspectrumpb for a binned point</span>
  141. 0012 <span class="comment">% process, and mtspectrumpt for a point process consisting of times. There</span>
  142. 0013 <span class="comment">% are also routines for calculating hybrid quantities involving one continuous</span>
  143. 0014 <span class="comment">% and one point process. These are suffixed in a similar manner. For</span>
  144. 0015 <span class="comment">% example, coherencycpb calculates the coherency between a binned point process</span>
  145. 0016 <span class="comment">% and a continuous process.</span>
  146. 0017 <span class="comment">%</span>
  147. 0018 <span class="comment">% Certain variables are used repeatedly in this library.</span>
  148. 0019 <span class="comment">%</span>
  149. 0020 <span class="comment">% DATA</span>
  150. 0021 <span class="comment">% data in most cases can be univariate or multivariate, and either point process,</span>
  151. 0022 <span class="comment">% or continuous.</span>
  152. 0023 <span class="comment">%</span>
  153. 0024 <span class="comment">% Continuous data: Continuous data is assumed to be a matrix with</span>
  154. 0025 <span class="comment">% dimensions samples x channels/trials.</span>
  155. 0026 <span class="comment">%</span>
  156. 0027 <span class="comment">% Point Process: A single time series of spike times can be in the form of</span>
  157. 0028 <span class="comment">% a column vector.</span>
  158. 0029 <span class="comment">% Multichannel/trial spike time data is not amenable to this</span>
  159. 0030 <span class="comment">% storage format, since there are generally different</span>
  160. 0031 <span class="comment">% number of spikes in each channel/trial. Instead,</span>
  161. 0032 <span class="comment">% multichannel/trial spike data is stored in a structure</span>
  162. 0033 <span class="comment">% array. A structure is a matlab data object with various</span>
  163. 0034 <span class="comment">% fields. These fields contain the elements</span>
  164. 0035 <span class="comment">% e.g. The command data=struct('times',[]); creates an empty</span>
  165. 0036 <span class="comment">% structure with field 'times'. Similarly, the command</span>
  166. 0037 <span class="comment">% data=struct('times',[1 2 3]); creates the structure with</span>
  167. 0038 <span class="comment">% the field 'times' containing integers 1, 2, and 3.</span>
  168. 0039 <span class="comment">%</span>
  169. 0040 <span class="comment">% We can also have a structure array (or an array of structures)</span>
  170. 0041 <span class="comment">% defined for example, by</span>
  171. 0042 <span class="comment">% data(1)=struct('times',rand(1,100)); and</span>
  172. 0043 <span class="comment">% data(2)=struct('times',rand(1,200));</span>
  173. 0044 <span class="comment">% This is a 2 dimensional structure array where the</span>
  174. 0045 <span class="comment">% first field is a 100 dimensional random vector, and</span>
  175. 0046 <span class="comment">% the second field is a 200 dimensional random vector.</span>
  176. 0047 <span class="comment">% This format allows storage of multichannel point</span>
  177. 0048 <span class="comment">% process times in a single variable data.</span>
  178. 0049 <span class="comment">%</span>
  179. 0050 <span class="comment">% The above holds for point processes stored as times.</span>
  180. 0051 <span class="comment">% If instead, the point processes are binned, then one</span>
  181. 0052 <span class="comment">% can use a matrix to represent them</span>
  182. 0053 <span class="comment">%</span>
  183. 0054 <span class="comment">%</span>
  184. 0055 <span class="comment">% Summary: data - array of continuous data with dimensions time x channels</span>
  185. 0056 <span class="comment">% structural array of spike times with dimensions</span>
  186. 0057 <span class="comment">% equal to the number of channels</span>
  187. 0058 <span class="comment">% 1d array of spike times as a column vector</span>
  188. 0059 <span class="comment">% array of binned spike counts with dimensions time x channels</span>
  189. 0060 <span class="comment">%</span>
  190. 0061 <span class="comment">% PARAMETERS:</span>
  191. 0062 <span class="comment">% These are various parameters used in the spectral calculations. Since</span>
  192. 0063 <span class="comment">% these parameters are used by most routines in Chronux, they are stored in</span>
  193. 0064 <span class="comment">% a single structure params. The fields of params are</span>
  194. 0065 <span class="comment">%</span>
  195. 0066 <span class="comment">% tapers : precalculated tapers from dpss or in the one of the following</span>
  196. 0067 <span class="comment">% forms:</span>
  197. 0068 <span class="comment">% (1) A numeric vector [TW K] where TW is the</span>
  198. 0069 <span class="comment">% time-bandwidth product and K is the number of</span>
  199. 0070 <span class="comment">% tapers to be used (less than or equal to</span>
  200. 0071 <span class="comment">% 2TW-1).</span>
  201. 0072 <span class="comment">% (2) A numeric vector [W T p] where W is the</span>
  202. 0073 <span class="comment">% bandwidth, T is the duration of the data and p</span>
  203. 0074 <span class="comment">% is an integer such that 2TW-p tapers are used. In</span>
  204. 0075 <span class="comment">% this form there is no default i.e. to specify</span>
  205. 0076 <span class="comment">% the bandwidth, you have to specify T and p as</span>
  206. 0077 <span class="comment">% well. Note that the units of W and T have to be</span>
  207. 0078 <span class="comment">% consistent: if W is in Hz, T must be in seconds</span>
  208. 0079 <span class="comment">% and vice versa. Note that these units must also</span>
  209. 0080 <span class="comment">% be consistent with the units of params.Fs: W can</span>
  210. 0081 <span class="comment">% be in Hz if and only if params.Fs is in Hz.</span>
  211. 0082 <span class="comment">% The default is to use form 1 with TW=3 and K=5</span>
  212. 0083 <span class="comment">%</span>
  213. 0084 <span class="comment">%</span>
  214. 0085 <span class="comment">% pad: (padding factor for the FFT) - optional (can take values -1,0,1,2...).</span>
  215. 0086 <span class="comment">% -1 corresponds to no padding, 0 corresponds to padding</span>
  216. 0087 <span class="comment">% to the next highest power of 2 etc.</span>
  217. 0088 <span class="comment">% e.g. For N = 500, if PAD = -1, we do not pad; if PAD = 0, we pad the FFT</span>
  218. 0089 <span class="comment">% to 512 points, if pad=1, we pad to 1024 points etc.</span>
  219. 0090 <span class="comment">% Defaults to 0.</span>
  220. 0091 <span class="comment">%</span>
  221. 0092 <span class="comment">% Fs:sampling frequency.optional (default 1)</span>
  222. 0093 <span class="comment">%</span>
  223. 0094 <span class="comment">%</span>
  224. 0095 <span class="comment">% fpass: frequencies in an fft calculation can range from 0 to Fs/2 where</span>
  225. 0096 <span class="comment">% Fs is the sampling frequency. Sometimes it may be useful to</span>
  226. 0097 <span class="comment">% compute fourier transforms (and resulting quantities like the</span>
  227. 0098 <span class="comment">% spectrum over a smaller range of frequencies). This is specified</span>
  228. 0099 <span class="comment">% by fpass, which can be in the form [fmin fmax] where fmin &gt;=0 and</span>
  229. 0100 <span class="comment">% fmax&lt;=Fs/2. optional (default [0 Fs/2])</span>
  230. 0101 <span class="comment">%</span>
  231. 0102 <span class="comment">% err=[errtype p] calculates theoretical error bars (confidence levels)</span>
  232. 0103 <span class="comment">% when errtype=1 and jackknife error bars when errchk=2. In each case, the</span>
  233. 0104 <span class="comment">% error is calculated at a p value specified by p. -</span>
  234. 0105 <span class="comment">% optional (default 0)</span>
  235. 0106 <span class="comment">%</span>
  236. 0107 <span class="comment">% trialave: trialave controls whether or not to average over channels/trials for</span>
  237. 0108 <span class="comment">% multichannel/trial analyses. trialave=0 (default) implies no trial</span>
  238. 0109 <span class="comment">% averaging, trialave=1 implies that the quantity of interest is averaged</span>
  239. 0110 <span class="comment">% over channels/trials. optional (default 0)</span>
  240. 0111 <span class="comment">%</span>
  241. 0112 <span class="comment">% Other parameters are discussed in individual routines as and when they</span>
  242. 0113 <span class="comment">% are used.</span></pre></div>
  243. <hr><address>Generated on Fri 12-Aug-2011 11:36:15 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/" target="_parent">m2html</a></strong> &copy; 2005</address>
  244. </body>
  245. </html>