Added "pulsar" receiving program.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@420 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2007-06-26 15:20:28 +00:00
parent bb30c86a78
commit 9fd53783a2
2 changed files with 66 additions and 10 deletions

View File

@ -15,24 +15,26 @@ program plrs
integer fd integer fd
integer open,read,close integer open,read,close
integer nm(11) integer nm(11)
character*8 fname,arg character*8 fname,arg,cjunk*1
logical fast logical fast,pause
real*8 center_freq,dmsec,dtmspacket,tmsec real*8 center_freq,dmsec,dtmspacket,tmsec
common/plrscom/center_freq,msec2,fsample,iptr,nblock,userx_no,iusb,buf8(174) common/plrscom/center_freq,msec2,fsample,iptr,nblock,userx_no,iusb,buf8(174)
! 8 4 4 4 2 1 1 1392 ! 8 4 4 4 2 1 1 1392
data nm/45,46,48,50,52,54,55,56,57,58,59/ data nm/45,46,48,50,52,54,55,56,57,58,59/
data nblock/0/,fast/.false./ data nblock/0/,fast/.false./,pause/.false./
nargs=iargc() nargs=iargc()
if(nargs.ne.1 .and. nargs.ne.2) then if(nargs.ne.3) then
print*,'Usage: plrs [-f] <iters>' print*,'Usage: plrs <fast|pause|slow> <minutes> <iters>'
go to 999 go to 999
endif endif
call getarg(1,arg) call getarg(1,arg)
if(arg(1:2).eq.'-f') then if(arg(1:1).eq.'f' .or. arg(1:1).eq.'p') fast=.true.
fast=.true. if(arg(1:1).eq.'p') pause=.true.
call getarg(2,arg) call getarg(2,arg)
endif read(arg,*) nfiles
call getarg(3,arg)
read(arg,*) iters read(arg,*) iters
fname="all.tf2"//char(0) fname="all.tf2"//char(0)
@ -50,7 +52,7 @@ program plrs
dmsec=-dtmspacket dmsec=-dtmspacket
nsec0=time() nsec0=time()
do ifile=1,11 do ifile=1,nfiles
print*,'Reading file',ifile print*,'Reading file',ifile
ns0=0 ns0=0
tmsec=1000*(3600*7 + 60*nm(ifile))-dtmspacket tmsec=1000*(3600*7 + 60*nm(ifile))-dtmspacket
@ -85,6 +87,10 @@ program plrs
1010 format('npkt:',i10,' ns:',i6,' t:',f10.3,' nwait:',i8) 1010 format('npkt:',i10,' ns:',i6,' t:',f10.3,' nwait:',i8)
ns0=ns ns0=ns
enddo enddo
if(pause) then
print*,'Type anything to continue:'
read(*,*) cjunk
endif
enddo enddo
i=close(fd) i=close(fd)
enddo enddo

50
pulsar.f90 Normal file
View File

@ -0,0 +1,50 @@
program pulsar
! Receives timf2 data from Linrad and saves it for pulsar processing.
parameter (NSPP=174)
logical first
integer*1 userx_no,iusb
integer*2 id
integer*2 nblock,nblock0
integer*2 id2(1000)
real*8 center_freq
common/plrscom/center_freq,msec,fselect,iptr,nblock,userx_no,iusb,id(4,NSPP)
! 8 4 4 4 2 1 1 1392
data first/.true./,nblock0/0/,sqave/0.0/,u/0.001/
save
call setup_rsocket
k=0
10 call recv_pkt(center_freq)
lost=nblock-nblock0-1
if(lost.ne.0 .and. .not.first) print*,'Lost packets:',lost,nblock,nblock0
nblock0=nblock
sq=0.
do i=1,NSPP
sq=sq + float(id(1,i))**2 + float(id(2,i))**2 + &
float(id(3,i))**2 + float(id(4,i))**2
enddo
sqave=sqave + u*(sq-sqave)
rxnoise=10.0*log10(sqave) - 48.0
k=k+1
id2(k)=0.001*sq
if(k.eq.1000) then
write(*,1000) center_freq,0.001*msec,sqave,rxnoise,id2(1)
write(13,1000) center_freq,0.001*msec,sqave,rxnoise,id2(1)
1000 format(f7.3,f11.3,f10.0,f8.2,i8)
write(12) center_freq,msec1,id2
call flush(12)
call flush(13)
k=0
endif
go to 10
end program pulsar
! To compile: % gfortran -o pulsar pulsar.f90 plrr_subs.c