From d486bcc6e5fbd55a11fa5743554a52028e1a896a Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 12 Oct 2010 20:11:53 +0000 Subject: [PATCH] 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 --- gp.bat | 2 ++ map65.py | 2 +- pulsar.f90 | 63 ++++++++++++++++++++++++++++++++++++++++-------------- 3 files changed, 50 insertions(+), 17 deletions(-) create mode 100644 gp.bat diff --git a/gp.bat b/gp.bat new file mode 100644 index 000000000..5d5e130c6 --- /dev/null +++ b/gp.bat @@ -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 diff --git a/map65.py b/map65.py index 0828707a8..a63b5c3a7 100644 --- a/map65.py +++ b/map65.py @@ -1,4 +1,4 @@ -#---------------------------------------------------------------------- MAP65 +#--------------------------------------------------------------------- MAP65 # $Date$ $Revision$ # from Tkinter import * diff --git a/pulsar.f90 b/pulsar.f90 index 65b3985cf..bbe4fe4b2 100644 --- a/pulsar.f90 +++ b/pulsar.f90 @@ -2,27 +2,50 @@ program pulsar ! Receives timf2 data from Linrad and saves it for pulsar processing. - parameter (NSPP=174) - logical first + parameter (NSPP=174) !Samples per UDP packet integer*1 userx_no,iusb integer*2 id - integer*2 nblock,nblock0 + integer*2 nblock 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) ! 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 - call setup_rsocket + nargs=iargc() + if(nargs.ne.1) then + print*,'Usage: pulsar ' + 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 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 + nb=nblock + if(nb.lt.0) nb=nb+65536 + 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. do i=1,NSPP sq=sq + float(int(id(1,i)))**2 + float(int(id(2,i)))**2 + & @@ -34,17 +57,25 @@ program pulsar k=k+1 id2(k)=0.001*sq if(k.eq.1000) then - write(*,1000) center_freq,0.001*msec,nblock,sqave,rxnoise,id2(1) - write(13,1000) center_freq,0.001*msec,nblock,sqave,rxnoise,id2(1) -1000 format(f7.3,f11.3,i7,f10.0,f8.2,i8) - write(12) center_freq,msec,nblock,id2 - call flush(12) - call flush(13) + tsec=0.001d0*msec + nsec=tsec + ih=nsec/3600 + im=mod(nsec/60,60) + is=mod(nsec,60) + 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 endif + nb0=nb go to 10 -end program pulsar +999 end program pulsar ! To compile: % gfortran -o pulsar pulsar.f90 plrr_subs.c