0
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 1 <h2>Description</h2>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 2 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 3 Spikes in data due to different nature can be removed, if desired, from the original data. LTPDA <a href="matlab:doc('ao/spikecleaning')"><tt>spikecleaning</tt></a> detects and replaces
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 4 spikes of the input AOs. A spike in data is defined as a single sample exceeding a certain value (usually, the
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 5 floor noise of the data) defined by the user:
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 6 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 7 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 8 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 9 <div align="center">
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 10 <IMG src="images/spike10x.png" width="147" height="15" border="0" />
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 11 </div>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 12 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 13 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 14 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 15 where <IMG src="images/spike41x.png" width="50" height="14" border="0" /> is the input data high-pass filtered, <IMG src="images/spike42x.png" width="34" height="13" border="0"/> is a value defined by the user (by default is 3.3) and <IMG src="images/spike43x.png" width="35" height="8" border="0"/> is the standard deviation of <IMG src="images/spike41x.png" width="50" height="14" border="0" /> . In consequence, a spike is defined as the value that exceeds the floor noise of the data by a factor <IMG src="images/spike42x.png" width="34" height="13" border="0"/>, the higher of this parameter the more difficult to "detect" a spike.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 16 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 17 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 18 <h2>Syntax</h2>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 19 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 20 <div class="fragment"><pre>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 21 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 22 b = spikecleaning(a, pl)
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 23 </pre>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 24 </div>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 25 <h2>Parameters</h2>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 26 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 27 The following parameters can be set in this method:
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 28 <ul>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 29 <li> <tt>'kspike'</tt> - set the <IMG src="images/spike42x.png" width="34" height="13" border="0"/> value (default is 3.3) </li>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 30 <li> <tt>'method'</tt> - method used to replace the "spiky" sample. Three methods are available ---see below for details---:</li>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 31 <ul>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 32 <li> <tt>'random'</tt> </li>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 33 <li> <tt>'mean'</tt> </li>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 34 <li> <tt>'previous'</tt> </li>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 35 </ul>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 36 <li> <tt>'fc'</tt> - frequency cut-off of the high-pass IIR filter (default is 0.025) </li>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 37 <li> <tt>'order'</tt> - specifies the order of the IIR filter (default is 2) </li>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 38 <li> <tt>'ripple'</tt> - specifies pass/stop-band ripple for bandpass and bandreject filters (default is 0.5) </li>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 39 </ul>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 40 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 41 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 42 <h2>Algorithm</h2>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 43 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 44 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 45 <b>Random: </b> this method substitutes the spiky sample by:
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 46 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 47 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 48 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 49 <div align="center">
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 50 <IMG src="images/spike20x.png" width="197" height="15" align="center" border="0"/>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 51 </div>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 52 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 53 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 54 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 55 where <IMG src="images/spike44x.png" width="42" height="14" border="0"/> is a random number of mean zero and standard deviation 1.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 56 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 57 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 58 <b>Mean: </b>this method uses the following equation to replace the spike detected in data.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 59 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 60 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 61 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 62 <div align="center">
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 63 <IMG src="images/spike30x.png" width="158" height="29" align="center" border="0"/>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 64 </div>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 65 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 66 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 67 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 68 <b>Previous: </b>the spike is substitued by the previous sample, i.e.:
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 69 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 70 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 71 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 72 <div align="center">
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 73 <IMG src="images/spike40x.png" width="90" height="14" align="center" border="0"/>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 74 </div>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 75 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 76 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 77 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 78 <h2>Examples</h2>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 79 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 80 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 81 1. Spike cleaning of a sequence of random data with <tt>kspike = 2</tt>.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 82 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 83 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 84 <div class="fragment"><pre>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 85 <br>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 86 x = ao(plist( <span class="string">'waveform'</span>, <span class="string">'noise'</span>, <span class="string">'nsecs'</span>,1e4, <span class="string">'fs'</span>,10)); <span class="comment">% create an AO of random data sampled at 1 Hz.</span>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 87 pl = plist( <span class="string">'kspike'</span>, 2); <span class="comment">% kspike = 2</span>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 88 y = spikecleaning(x, pl); <span class="comment">% spike cleaning function applied to the input AO, x</span>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 89 iplot(x, y) <span class="comment">% plot original and "cleaned" data</span>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 90 </pre>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 91 </div>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 92 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 93 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 94 <div align="center">
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 95 <img src="images/spike1.png" border="1" >
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 96 </div>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 97 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 98 <!-- <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 99 2. Example of real data: the first image shows data from the real world prior to
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 100 the application of the spike cleaning tool. It is clear that some spikes are
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 101 present in data and might be convenient to remove them. The second image shows
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 102 the same data after the spike samples supression.
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 103 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 104 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 105 <img src="images/stat1x.png" border="1" width="400px">
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 106 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 107 <p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 108 <img src="images/stat2x.png" border="1" width="400px">
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 109 </p>
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 110 -->
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 111
Daniele Nicolodi <nicolodi@science.unitn.it>
parents:
diff
changeset
+ − 112