! X-Midas macro to generate statistics file for comparison against NeXtMidas version.
!
! @author  Jason Broussard / J. Czechowski IV
! @version $Id: test_firwind.txt,v 1.4 2013/01/09 19:49:43 jxc Exp $
! @since   NeXtMidas 2.1.1
!
startmacro
  say "Running Firwin primitives..."
  firwin test_filt1  BANDPASS NONE    32  2.55e6  3.55e6   5e6
  firwin test_filt2  BANDPASS BARTL  512     2e6   4.1e6  10e6
  firwin test_filt3  LOW      HANNI  512     2e6  ,,      10e6
  firwin test_filt4  LOW      HAMMI 1024     333  ,,     2.5e6
  firwin test_filt5  HIGH     BLACK 4096 21.93e6  ,,    28.8e6
  firwin test_filt6  HIGH     BH61    64   100e6  ,,     999e6
  firwin test_filt7  LOW      BH67   512      89  ,,       100
  firwin test_filt8  BANDPASS BH74   512     2e6   9.1e6  10e6
  firwin test_filt9  HIGH     BH92     8   777e6  ,,     900e6
  firwin test_filt10 HIGH     NONE    64   888e6  ,,     999e6
  firwin test_filt11 LOW      NONE    32      22  ,,       100

  res L:count   11
  res A:outfile "firwinspecs"

  say "Creating statistics file"
  FCREATE,^{outfile},I*02,count
  headermod ^{outfile} t=3000 f=nh nsr=5 rl=20 sr(1)=(MEAN,SF,0) sr(2)=(STDV,SF,4) sr(3)=(MAXV,SF,8) &
                                               sr(4)=(MINV,SF,12) sr(5)=(ELEM,SF,16)
  headermod ^{outfile} sz=count
  
  loop count cnt
    fstat/quiet test_filt^cnt MEAN=^{outfile}(^cnt;~MEAN) STDV=^{outfile}(^cnt;~STDV) &
                              MAXV=^{outfile}(^cnt;~MAXV) MINV=^{outfile}(^cnt;~MINV) &
                              ELEM=^{outfile}(^cnt;~ELEM)
  endloop

  say "Done"
  status   ^{outfile}
  datalist ^{outfile}
endmacro
