previous next Up Title Contents

Analysis_Histogram:


File name
AnHistogram.[ch]


Description
This routine generates a period histogram (PH) or a post stimulus time histogram (PSTH) from the process EarObject's input signal. It puts the result in the output signal, overwriting any previous data if the signal has already been initialised. Accurate binning must be achieved, so real values mut be used in determining the binWidth (s), bin widths. The histogram is calculated from the first minimum after the specified offset (s) of the input signal. There are several operating mode options. Not all of the parameters are used for all modes, though they must always be present in the parameter file when using ReadPars, i.e. In the "continuous" detection mode, the eventThreshold parameter is not used.

Data will be accumulated until the process is resetsee section 0 Accumulating Data with Process Modules.



Example parameter file format
continuous	Detection mode - spike (detection) or continuous (signal).
PH		Histogram type - PSTH or PH.
0.5		Event threshold for bin counts (units as appropriate).
0.01e-3		Bin width for the histogram (s).
1e-3		Period for period histogram (s).
0.0e-3		Offset for period histogram (s).



Test program directory
Tests/Analysis

Generic Module Routines

This module has the standard Generic Module Routines (see Basic Module Routines used in Generic Programming, page 52).

The Calc_Analysis_Histogram(...) Process Routine

Syntax
BOOLN Calc_Analysis_Histogram(EarObjectPtr data);


Returns
TRUE if the process is successful, otherwise it returns FALSE.

The SetBinWidth_Analysis_Histogram(...) Routine

Syntax
BOOLN SetBinWidth_Analysis_Histogram(double theBinWidth);


Special Values
A negative bin width assumes a value the same as the input signal's sampling interval


Returns
TRUE if the function is successful, otherwise it returns FALSE.

The SetDetectionMode_Analysis_Histogram(...) Routine

Syntax
BOOLN SetDetectionMode_Analysis_Histogram(double theDetectionMode);


Special Values
Mode Options: "Continuous" signal or "spike" detection above eventThreshold value.


Returns
TRUE if the function is successful, otherwise it returns FALSE.

The SetEventThreshold_Analysis_Histogram(...) Routine

Syntax
BOOLN SetEventThreshold_Analysis_Histogram(double theEventThreshold);


Special Values
(Not used in "continuous" signal mode.)


Returns
TRUE if the function is successful, otherwise it returns FALSE.

The SetTimeOffset_Analysis_Histogram(...) Routine

Syntax
BOOLN SetTimeOffset_Analysis_Histogram(double theTimeOffset);


Returns
TRUE if the function is successful, otherwise it returns FALSE.

The SetPars_Analysis_Histogram(...) Routine

Syntax
BOOLN SetPars_Analysis_Histogram(char *detectionMode, char *typeMode, double eventThreshold, double binWidth, double period, double timeOffset);


Returns
TRUE if the function is successful, otherwise it returns FALSE.

The SetPeriod_Analysis_Histogram(...) Routine

Syntax
BOOLN SetPeriod_Analysis_Histogram(double thePeriod);


Special Values
(Not used in "PSTH" mode.)


Returns
TRUE if the function is successful, otherwise it returns FALSE.

The SetTypeMode_Analysis_Histogram(...) Routine

Syntax
BOOLN SetTypeMode_Analysis_Histogram(double theTypeMode);


Special Values
Mode Options: Post Stimulus Time Histogram "PSTH" or Period Histogram "PH".


Returns
TRUE if the function is successful, otherwise it returns FALSE.

Example: Tests/Analysis/Histogram.c

Parameter file: Histogram.par:
#
# Main Parameter file
#
output1.dat	Name of output file.
output2.dat	Name of output file.
output3.dat	Name of output file.
#
# Module specifications.
#
#Par. file		Name			Description
#---------		-----			-------------
PTone2.par		PureTone		Stimulus generation paradigm.

Histogm1.par	Histogram analysis parameter file.

# Miscellaneous parameters

1			Number of repeated runs.
0.05e-3		Histogram bin width override (s).
2			Bin width adjustment scaler.
1000		Stimulus frequency (Hz).
2.0		Stimulus adjustment scaler.
Output1

Figure [38] Output 1 for PSTH histogram with the specified bin width.

Figure [39] Output 2 for PSTH histogram with the specified bin width scaled by a factor of two.

Figure [40] Output 3 for PSTH histogram with the specified frequency scaled by two.

Comments:

In this test program the routine is used three times each with a pure tone stimulus: figure [38] tests the normal post stimulus time histogram: figure [39] repeats the previous test but with a larger bin width for the histogram; and figure [40] repeats the first test, but uses a stimulus with twice the frequency.

Output2

Figure [41] Output 1 for PH histogram with the specified bin width.

Figure [42] Output 2 for PH histogram with the specified bin width scaled by a factor of two.

Figure [43] Output 3 for PH histogram with the specified frequency scaled by two.

Comments:

The period histograms shown above can be produced by changing the histogram mode in the "Histogm1.par" file from "PSTH" to "PH".

The period histogram , like the auto-correlation function, is used to investigate periodicity effects in signals. In constructing a period histogram the occurrence of each spike is summed into a histogram bin corresponding to time, but the time axis is reset for a constant period on the stimulus time scale.

In this test program the routine is used three times each with a pure tone stimulus: figure [41] tests the normal period histogram behaviour with a period width of one signal period (1/f): figure [42] repeats the previous test but with a smaller bin width for the histogram; and figure [43] repeats the first test, but uses a stimulus with twice the frequency. Thus the histogram period width is now twice the signal period.


previous next Up Title Contents