bpmwf/wfstats.c

Go to the documentation of this file.
00001 
00006 #include <bpm/bpm_wf.h>
00007 
00008 int wfstat_reset( wfstat_t *s ) {
00009 
00010   if ( ! s ) {
00011     bpm_error( "Invalid pointer argument in reset_wfstats()",
00012                __FILE__, __LINE__ );
00013     return BPM_FAILURE;
00014   }
00015 
00016   // re-initialise the structure
00017   s->imax = 0;
00018   s->imin = 0;
00019   s->max  = -DBL_MAX;
00020   s->min  =  DBL_MAX;
00021   s->mean = 0.;
00022   s->rms  = 0.;
00023 
00024   return BPM_SUCCESS;
00025 }
00026 
00027 // ----------------------------------------------------------------------------
00028 
00029 void wfstat_print( FILE *of, wfstat_t *s ) {
00030 
00031   if ( ! of || ! s ) {
00032     bpm_error( "Invalid pointer arguments in wfstat_print()", __FILE__, __LINE__ );
00033     return;
00034   }
00035 
00036   fprintf( of, "Basic waveform statistics:\n" );
00037   fprintf( of, " - maximum ... : wf[%d] = %.14e\n", s->imax, s->max );
00038   fprintf( of, " - minimum ... : wf[%d] = %.14e\n", s->imin, s->min );
00039   fprintf( of, " - mean ...... : %.14e\n", s->mean );
00040   fprintf( of, " - rms ....... : %.14e\n", s->rms );
00041   fflush( of );
00042 
00043   return;
00044 }

Generated on Thu Jan 10 10:18:05 2008 for libbpm by  doxygen 1.5.1