Home

Daqarta for DOS Contents

Introduction

Free Registration

Daqarta for DOS
Data AcQuisition And Real-Time Analysis
Shareware for Legacy Systems

From the Daqarta for DOS Help system:

## WAVE AVERAGER THEORY, Continued:

### HISTOGRAM - AMPLITUDE DISTRIBUTION:

This is not really an "average" in the conventional sense, but rather a statistical record of the individual values in a signal. The X-axis shows all the possible values, similar to the Y-axis in a conventional waveform display. The histogram Y-axis shows the percent of input samples that had each corresponding value.

You can think of the histogram operation as a row of bins that incoming samples are sorted into, according to value. Each bin holds only the count of samples that go into it, not the values themselves. If one sample value appears more often than others, its bin will end up with more counts.

For example, suppose the input signal is a square wave, such that all samples are either +5 or -5 Volts. The histogram will show this as two vertical lines, at -5 and +5. Since half of the samples go into the +5 bin and half into the -5 bin, we expect each line to have a height of 50%.

```          SQUARE WAVE                   HISTOGRAM

+5 -----.    .----.           50%
|    |    |                   |       |
0      |    |    |                   |       |
|    |    |                   |       |
-5      `----'    `----       0 ------^-------^------
-5   0  +5
```

Now consider a ramp or triangle; each value in its amplitude range appears an equal number of times, so the histogram is a rectangular plateau... but at a much lower level, because the values are spread over more amplitude bins. This is called a "uniform" distribution of values, for obvious reasons.

But how high is this uniform plateau? If Npoints is set for 1024 samples per sweep, Daqarta allocates 1024 bins to sort them into, so the width of each bin is 1/1024 = 0.09766% of the full-scale range. If the ramp signal range exactly equals the full-scale range, we'd expect one sample in each bin, so that the plateau would extend the entire width of the trace at just under 0.1%. If the ramp covers only half the range, there would be a central plateau that was only half the width of the trace, but it would be twice as tall as before, nearly 0.2%.

If we set Npoints to 512, Daqarta allocates 512 bins for data, but they are still equally spread over the full-scale range. Each bin is twice as wide, but since we are collecting only half as many samples per sweep the counts per bin are the same, and likewise the percentages. The same reasoning holds for Npoints = 256. So the plateau is the same height regardless of the Npoints setting.

But look what happens with our original square wave: With 1024 samples per sweep and 1024 bins, there are 512 samples in the -5 bin and 512 in the +5 bin. With 512 samples the bins are twice as wide, but that extra width does not result in any additional samples from the adjacent empty regions; there are only 256 samples in each of the two active bins, so the height is half that of the 1024-sample case. For 256 samples per sweep, the two active bins are only one-forth the 1024-sample heights.

So if the the input distribution is very narrow, the Y-axis percentage calibration is only correct for 1024 points. The other Npoints settings give the proper readings only for broader distributions, which fortunately includes the vast majority of the interesting cases. What's more, the overall shape is often more important than the exact scaling anyway, so it will rarely be necessary to even consider this issue.

You may want to experiment with the Virtual Source, or with the STIM3A signal generator, to get a feel for the way the histogram works, and to get a sense of what to expect from different types of signals. Just go to the Averager menu and select Hist, then hit the A-key. In particular, you should observe that the Virtual Source Noise source (or the STIM3A White source) has a uniform distribution, just like a triangle or ramp wave.

Due to the fact that most distributions of interest are fairly broad, they will have rather low percentage values. Just use the normal PgUp control to magnify the trace. The histogram magnification setting is maintained separately from that for the ordinary waveform display; hitting unPause afterward will return to the waveform display with its original magnification.

You may prefer to view histograms with the vertical bar trace line style (Line2), since they are unipolar like the spectrum display.

### HISTOGRAM - POST-STIMULUS TIME (PSTH):

This is not really a waveform average, but rather an average of threshold events. The X-axis shows the same time span as a conventional waveform display. At each sample time-point, the Y-height shows the percent of sweeps that contained a threshold event at that point.

Threshold events are like trigger events; they are set via the Slope and Level of the Intern or Main Trigger Source, even if you are actually using Extern or Stim triggering to start each sweep. For the default Pos Slope and 0 Level, a simple repetitive wave will show a series of 100% spikes, one at each positive zero-crossing:

```              .----.    .----.    .----.    .----.
WAVE       |    |    |    |    |    |    |    |
'    `----'    `----'    `----'    `--

100%
|         |         |         |
|         |         |         |
PSTH     0 ^---------^---------^---------^-------
Time -->

```

You may prefer to view the PSTH with the vertical bar trace line style (Line2), since it is unipolar like a spectrum display.

The interpretation of the above is that for every sweep, the threshold zero-crossings always come at the same places. If there is trigger jitter, then instead of the individual lines there may be broader (but lower) peaks showing a distribution of the threshold times.

The PSTH will allow you to quickly pick out timing problems. If the input is a pulse train, this will easily show skipped or extra pulses.

You can use the Virtual Source or the STIM3A signal generator to experiment with the PSTH option. Just go to the Averager menu and select PSTH, then hit the A-key. With a "pure" waveform, you should see a row of vertical lines as shown above. As you add noise, there will be trigger jitter that will broaden and reduce these peaks.

Note that with the trigger mode set to Auto, any non-zero value for Level will be scaled by the peak amplitude of the input on each sweep, before being used to determine threshold events for that sweep. This may be useful to compensate for drifting signal strength; with Level at 50%, for example, the threshold will track at half the current input peak level.

One typical use for a PSTH is in electrophysiological studies. Neurons typically have some baseline "spontaneous" firing rate; with no stimulus applied, the PSTH would show a low-level random pattern, because there would be no correlation between the neural discharge spikes and any stimulus signal.

Now if a stimulus is applied, such as a tone burst that repeats once per sweep, the neuron will be much more likely to discharge at the start of the stimulus. It won't necessarily fire at the start of each and every stimulus, since it may have fired spontaneously just before that, and not yet recovered. But there should be a big peak in the PSTH at the stimulus time and shortly thereafter.

During the time the stimulus remains on, the neuron may show an elevated firing rate. The PSTH would show a lower-level region after the onset peak, decaying after the stimulus offset.

For some acoustic neurons, the discharge spikes from an ongoing tone are more likely to occur at a certain phase of the tone. The particular phase won't be known in advance, since there will be acoustical and neural delays between the stimulus generator and the neural spike mechanism. But this phase-locking behavior will show up as a series of peaks or clumps in the ongoing portion of the PSTH.

In a typical experiment you would use the STIM3A stimulus generator to produce the tone bursts. To see phase-locking in the response, you will need to give the same exact tone burst on each sweep, so you will want to use the STIM3A Static mode. Remember that you must be in Intern trigger mode, not Stim, to set the trigger Level for the neural spike response. After everything is set, you may want to go back to the STIM3A menu while you run the PSTH, since you can then use the alternate-color stimulus display at the top of the trace to compare to the response PSTH.

GO: