previous next Up Title Contents

Analysis_Averages: Channel Averaging

File name

This routine calculates the average signal value over a specified time range and time offset, for each channel of the input signal. The result for each channel is returned in the first sample output signal channels.

Three different times of averages are calculated, according to the mode required: full, half wave rare averages (-wave) and half-wave complement averages (+wave). (The -/+ wave options were revised from code from Trevor Shackleton, MRC, Nottingham).

Example parameter file format
full	Average mode specification (full, -wave or +wave).
0.0e-3	Time offset for start of averaging period (s).
-1e-3	Averaging period (s).

Test program directory

Generic Module Routines

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

The Calc_Analysis_Averages(...) Process Routine

BOOLN Calc_Analysis_Averages(EarObjectPtr data);

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

The SetMode_Analysis_Averages(...) Routine

BOOLN SetMode_Analysis_Averages(char *theMode);

Special Values

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

The SetPars_Analysis_Averages(...) Routine

BOOLN SetPars_Analysis_Averages(char *mode, double timeOffset, double timeRange);

Special Values
Mode options: "full", " -wave" or "+wave".

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

The SetTimeRange_Analysis_Averages(...) Routine

BOOLN SetTimeRange_Analysis_Averages(double theTimeRange);

Special Values
Negative values assumes a range to the end of the signal.

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

The SetTimeOffset_Analysis_Averages(...) Routine

BOOLN SetTimeOffset_Analysis_Averages(double theTimeOffset);

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

Example: Tests/Analysis/CalcAverage.c

Parameter file: CalcAverage.par:
# Main Parameter file

# Module specifications.

#Par. file		Name		Description
#---------		-----		-------------
PTone1.par		PureTone	Stimulus generation paradigm.

Average1.par	Averages analysis module parameter file.

# Miscellaneous parameters

0.0e-3	Time offset for averaging period (s).
-1		averaging period (s).
Starting Test Harness...
Reading parameters from file: CalcAverage.par

This test generates a 'PureTone' stimulus.
The calculated intensity of the signal is generated.
The the signal from offset 0 for -1000 ms is averaged using the
Averages Analysis module, set using the 'Average1.par' parameter file, and the
result is printed to the screen.

ReadPars_PureTone: Reading from 'PTone1.par':
Pure Tone Module Parameters:-
	Frequency = 1000 Hz,	Intensity = 20 dB SPL,
	Duration = 50 ms,	Sampling interval = 0.05 ms
ReadPars_Analysis_Averages: Reading from 'Average1.par':
Averages Analysis Module Parameters:-
	Mode = FULL,	Time offset = 0 ms,
	Time range = <end of signal>
Stimulus signal generated by the 'Pure Tone stimulus' paradigm.
The average value for the period is -4.41921e-14 uPa
Averaging over the entire signal should produce a very small
(almost zero) result.
Finished test.

Figure [33] Output for the Averages test.


The program provides diagnostic comments giving the run results and the expected output.

previous next Up Title Contents