Save a bare-bones "pulsar" program.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/map65@2217 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2010-10-12 20:11:53 +00:00
parent 45b7aeed1e
commit d486bcc6e5
3 changed files with 50 additions and 17 deletions

2
gp.bat Normal file
View File

@ -0,0 +1,2 @@
gcc -c plrr_subs_win.c
g95 -o pulsar -fno-second-underscore -fbounds-check -ftrace=full pulsar.f90 plrr_subs_win.o

View File

@ -1,4 +1,4 @@
#---------------------------------------------------------------------- MAP65 #--------------------------------------------------------------------- MAP65
# $Date$ $Revision$ # $Date$ $Revision$
# #
from Tkinter import * from Tkinter import *

View File

@ -2,27 +2,50 @@ program pulsar
! Receives timf2 data from Linrad and saves it for pulsar processing. ! Receives timf2 data from Linrad and saves it for pulsar processing.
parameter (NSPP=174) parameter (NSPP=174) !Samples per UDP packet
logical first
integer*1 userx_no,iusb integer*1 userx_no,iusb
integer*2 id integer*2 id
integer*2 nblock,nblock0 integer*2 nblock
integer*2 id2(1000) integer*2 id2(1000)
real*8 center_freq integer nt(8)
character pname*12,cdate*8,ctime*12,czone*8
character*40 fname20,fname21
real*8 center_freq,tsec
common/plrscom/center_freq,msec,fselect,iptr,nblock,userx_no,iusb,id(4,NSPP) common/plrscom/center_freq,msec,fselect,iptr,nblock,userx_no,iusb,id(4,NSPP)
! 8 4 4 4 2 1 1 1392 ! 8 4 4 4 2 1 1 1392
data first/.true./,nblock0/0/,sqave/0.0/,u/0.001/ data nb0/0/,sqave/0.0/,u/0.001/,nw/0/
save save
call setup_rsocket nargs=iargc()
if(nargs.ne.1) then
print*,'Usage: pulsar <pname>'
go to 999
endif
call getarg(1,pname)
! nt: year, month, day, time difference in minutes, hours, minutes,
! seconds, and milliseconds.
call date_and_time(cdate,ctime,czone,nt)
write(fname20,1001) nt(1)-2000,nt(2),nt(3),nt(5),nt(6),nt(7)
1001 format(3i2.2,'_',3i2.2,'.raw')
open(20,file=fname20,access='stream',status='unknown')
write(20) cdate,ctime,czone,nt,pname !Write header
! write(fname21,1002) nt(1)-2000,nt(2),nt(3),nt(5),nt(6),nt(7)
!1002 format(3i2.2,'_',3i2.2,'.sq')
! open(21,file=fname21,access='stream',status='unknown')
! write(21) cdate,ctime,czone,nt,pname !Write header
call setup_rsocket !Prepare to receive UDP packets
k=0 k=0
10 call recv_pkt(center_freq) 10 call recv_pkt(center_freq)
lost=nblock-nblock0-1 nb=nblock
if(lost.ne.0 .and. .not.first) print*,'Lost packets:',lost,nblock,nblock0 if(nb.lt.0) nb=nb+65536
nblock0=nblock lost=nb-nb0-1
if(lost.ne.0 .and. nb0.ne.0) print*,'Lost packets:',lost,nb,nb0
write(20) id !Write raw data
sq=0. sq=0.
do i=1,NSPP do i=1,NSPP
sq=sq + float(int(id(1,i)))**2 + float(int(id(2,i)))**2 + & sq=sq + float(int(id(1,i)))**2 + float(int(id(2,i)))**2 + &
@ -34,17 +57,25 @@ program pulsar
k=k+1 k=k+1
id2(k)=0.001*sq id2(k)=0.001*sq
if(k.eq.1000) then if(k.eq.1000) then
write(*,1000) center_freq,0.001*msec,nblock,sqave,rxnoise,id2(1) tsec=0.001d0*msec
write(13,1000) center_freq,0.001*msec,nblock,sqave,rxnoise,id2(1) nsec=tsec
1000 format(f7.3,f11.3,i7,f10.0,f8.2,i8) ih=nsec/3600
write(12) center_freq,msec,nblock,id2 im=mod(nsec/60,60)
call flush(12) is=mod(nsec,60)
call flush(13) nw=nw+1
write(*,1000) nw,center_freq,ih,im,is,nblock,sqave,rxnoise,id2(1)
! write(13,1000) nw,center_freq,0.001*msec,nblock,sqave,rxnoise,id2(1)
1000 format(i10,f7.3,i4,2i3.2,i7,f10.0,f8.2,i8)
write(21) id2
call flush(20)
call flush(21)
k=0 k=0
endif endif
nb0=nb
go to 10 go to 10
end program pulsar 999 end program pulsar
! To compile: % gfortran -o pulsar pulsar.f90 plrr_subs.c ! To compile: % gfortran -o pulsar pulsar.f90 plrr_subs.c