program avpower c************************************************************* c This program is named avpw.FOR. Its purpose is to produce c an output average power from an input amplitude file. c************************************************************* implicit double precision (a-h,o-z) character*20 dumc, infile c c name input file from tty c write(*,1) 1 format(1x,' input amp file is: ',$) read(*,2) infile 2 format(a20) open(9,file=infile,status='old') c NO NUMBER OF POINTS, AS IN NEWSFTS c read(9,*)npoints np=0 nph=0 avpwh=0.0d0 avpw=0.0d0 2010 do 50 i=1,5000000 read (9,*,end=300,err=3000)x,y c compute average above 1000s if(x.le.1.0d-3)then nph=nph+1 avpwh=avpwh+y*y else np=np+1 avpw=avpw+y*y endif 50 continue 300 avpw=avpw/np avamp=dsqrt(avpw) if(nph.gt.0)then avpwh=avpwh/nph avamph=dsqrt(avpwh) endif write (*,1010) np,avpw,avamp,nph,avamph 1010 format('Npoints(P<1000s)= ',i8,1x,'avpw(P<1000s)=',1pe10.2,1x, !'avamp(P<1000s)=',1pe10.2,/1x,'Npoints(P>1000s)=',i8,1x,'avamp(P>1000s)=',1pe10.2) stop 3000 write(*,3100)np 3100 format('End of file or error after Npoints=',i5) close(9) stop end