If you like to remove portions of data, for example artifacts, to exclude them from your data analysis there are different ways to achieve this.
- Simply delete: select the area and choose Edit > Clear Selection. Please note, this will delete this time of recording from all channels.
deleting is no option you can use Channel Calculations > Arithmetics... to process your data so that portions of your recording become zero or NaN
(not a Number).
a) you like to remove Out of Range Data:
For reference see attached example file Hide
out_of_range data.adicht (download here). Using arithmetics you use a combination of three functions Window(), Smoothsec() and Threshold() to hide
(set zero) regions where data are out of range. Detailed information about these functions can be found in the LabChart Help documentation.
function identifies the regions that are within the lower and upper limits (regions of good data become 1, out of range data become 0). Smoothsec()
is used to combine areas close together. Threshold() is then used to create a 0 or 1 wave form. When combining those functions one gets a trace with 0
for the out of range data and 1 where the signal is good. By multiplying it with the source channel the good data remain while the out of range data become 0.
Note: if you divide the source channel by the combined function you get NaNs for the out of range data.
b) you like to remove data you marked manually:
In a similar way as described above you use a combination of
arithmetic functions to zero (or NaN) those areas you like to remove, based on time windows. However, since you manually define the regions (defining time
intervals) it is a bit more complicate. For reference see attached file Hide selected data.adicht (download here). The approach is to tell LabChart to set time
intervals, say from 5s to 7s, to zero. In Arithmetics there is a function SampleTime that plots the time in seconds from start of block. Using the
Window() function with the parameter of start and end point one identifies the regions of unwanted data. As the good data become 0 here, one does some math
to invert this. All these Window() functions for each unwanted region can now be added and eventually multiplied with the source channel.
finding the time in seconds and afterwards typing the arithmetic function into the Arithmetic Formula field is rather time consuming the file contains some
macros to ease the work.
How to use the Macros:
- Select the region you like to set zero
- Start Macro > CommentSelection - this places comments at the beginning and end of the selection and will be used by the second macro. You can move
the comments to fine tune the unwanted region. The macro works in every channel. Repeat these two steps for all other unwanted regions.
- Click in
any channel and start Macro > CreateArithmetics - this reselects the portion between the start and end comments, finds the time points and builds up
the arithmetics formula. When the chosen block is finished it writes the formula to a text file.
- Repeat the procedure with other channels as needed.
- Open the text file and copy and paste the formula into the arithmetics formula field. Note: this can be done in a separate channel or directly in the
channel of the original data.
NB: as SampleTime is calculated new for each data block, but the arithmetics applies to the whole channel
this approach has limited usefulness in channels with multiple blocks: if there is zero values from 5 to 6 seconds in block one, there will be also a zero from
5 to 6 seconds in block two.
c) remove artifacts, but replace NaNs or zeros by data that fill the gap:
Under certain condition a more
sophisticated approach is possible, for example if you see stimulation artifacts, but setting these region to zero or to a NaN would impede your analysis. In
case you do electrical stimulation on a subject artifacts will be visible on ECG or Skin Conductance Level (SCL) waveforms. For LabChart to detect this
artifacts a stimulation marker would be essential. As described under a) the approach is to set the portion of the artifact zero. In a second calculation the
original waveform will be filtered to remove the artifact, however, this also filters the good signal. Eventually, we end up with the original waveform but the
small zero-portions are filled with the filtered waveform
A detailed description of the applied arithmetics steps can be found in the attached file ArtifactRemoval_median.adicht (download here).
For further advice
please contact your ADInstruments Support Team.