C                       1
C *** WAVE READ, FOURIER TRANS., AND AMPLITUDE SPEC. PLOT
C
      PROGRAM MWVFOUR
C
C PARAMETER
C *** MWV    : WAVE AMPLITUDE DATA IN MAIN PROGRAM DIMENSION
C            : IF MWV > 2**13(=8192), CAN NOT USE IN SUBROUTINE !!!
C READ DATA FROM FILE
C *** TITL   : TITLE OF EACH CHANNEL
C *** WV     : WAVE AMPLITUDE DATA
C *** NWV    : WAVE DATA NUMBER
C *** DT     : DELTA TIME ( SEC )
C            : DURATION = (NWV-1)*DT IN PLOTTER, NWV*DT IN FFT
C DATA FOT PLOTTER
C *** FOUR(I): FOURIER COEFFICIENTS OR SPECTRUM
C            : FOURIER SPECTRUM = FOURIER COEFFICIENTS * DURATION/2.0
C
      PARAMETER(MWV=9000)
      CHARACTER TITL*50,FNAME*30
      DIMENSION WV(MWV)
      COMPLEX*8 FOUR(MWV)
C
C *** WAVE DATA READ AND FOURIER COEFF. TRANS. ***
C
      CALL WVREAD(TITL,WV,NWV,MWV,DT)
      CALL WVFOUR(WV,NWV,MWV,FOUR,NFAST)
C
      DUR=FLOAT(NFAST)*DT
      FOM=0.0
      DOM=6.2831853070/DUR
      NOM=NFAST/2+1
C
C *** OUTPUT OF SPEC DATA TO FILE FOR LAZER SHOT ***
C
      WRITE(*,*)
   10 WRITE(*,1000)
      READ(*,'(A)')FNAME
      IF(FNAME(1:1).EQ.' ')GOTO 10
 1000 FORMAT( ' From MWVFOUR : '
     *       /' Enter spec file name for Lazer Shot : ',\)
C      
      OPEN(8,FILE=FNAME)
        WRITE(8,1100)DOM,NOM-1
        WRITE(8,1110)
        DO 100 K=2,NOM,5
          WRITE(8,1120)(FOUR(K+J)*DUR,J=0,4)
  100   CONTINUE
      CLOSE(8)
C
 1100 FORMAT(F15.8,I15)
 1110 FORMAT(///)
 1120 FORMAT(10F8.2)
C
C *** TRANS. FROM FOURIER COEFF. TO AMPLITUDE SPECTRUM ***
C
      DO 200 I=1,NFAST
      WV(I)=CABS(FOUR(I))*DUR
  200 CONTINUE
C
C *** PLOTTER DATA OUTPUT ***
C
      CALL SPAPLT(FOM,DOM,NOM,MWV,WV)
C
      STOP
      END
