diff options
| author | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-01-09 22:12:06 +0100 |
| commit | 992d4b4b8d3f3a630a2cf00d593ee4ce4dfa7ce8 (patch) | |
| tree | fbfdfe6bcb0a8a114be2480dac53d88c977e4869 /qmap/libqmap | |
| parent | 4320ce238aae1fe87fc9f379cdd816e9317885fa (diff) | |
New upstream version 2.7.0~rc8+repackupstream/2.7.0_rc8+repack
Diffstat (limited to 'qmap/libqmap')
54 files changed, 3209 insertions, 3209 deletions
diff --git a/qmap/libqmap/CMakeLists.txt b/qmap/libqmap/CMakeLists.txt index 34e3382c..2eb3a0bb 100755 --- a/qmap/libqmap/CMakeLists.txt +++ b/qmap/libqmap/CMakeLists.txt @@ -1,57 +1,57 @@ -set (libq65_FSRCS
-# Modules come first:
-
-# Non-module Fortran routines:
- astro.f90
- astro0.f90
- astrosub.f90
- chkstat.f90
- dcoord.f90
- decode0.f90
- dot.f90
- fchisq0.f90
- fftbig.f90
- ftninit.f90
-# ftnquit.f90
- geocentric.f90
- getcand2.f90
- grid2deg.f90
- indexx.f90
- lorentzian.f90
- moon2.f90
- moondop.f90
- q65b.f90
- q65c.f90
- q65_sync.f90
- qmapa.f90
- read_qm.f90
- recvpkt.f90
- save_qm.f90
- sun.f90
- symspec.f90
- timf2.f90
- tm2.f90
- toxyz.f90
- zaptx.f90
-
- f77_wisdom.f
- )
-
-#set (libq65_CXXSRCS
-# ipcomm.cpp
-# )
-
-set (libq65_C_and_CXXSRCS
- ${libq65_CSRCS}
- ${libq65_CXXSRCS}
- )
-set_property (SOURCE ${libq65_C_and_CXXSRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -include wsjtx_config.h")
-set_property (SOURCE ${libq65_C_and_CXXSRCS} APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/wsjtx_config.h)
-
-
-#
-# build our targets
-#
-add_library (qmap_impl STATIC ${libq65_FSRCS} ${libq65_CSRCS} ${libq65_CXXSRCS})
-target_link_libraries (qmap_impl wsjt_fort wsjt_cxx Qt5::Core)
-
+set (libq65_FSRCS +# Modules come first: + +# Non-module Fortran routines: + astro.f90 + astro0.f90 + astrosub.f90 + chkstat.f90 + dcoord.f90 + decode0.f90 + dot.f90 + fchisq0.f90 + fftbig.f90 + ftninit.f90 +# ftnquit.f90 + geocentric.f90 + getcand2.f90 + grid2deg.f90 + indexx.f90 + lorentzian.f90 + moon2.f90 + moondop.f90 + q65b.f90 + q65c.f90 + q65_sync.f90 + qmapa.f90 + read_qm.f90 + recvpkt.f90 + save_qm.f90 + sun.f90 + symspec.f90 + timf2.f90 + tm2.f90 + toxyz.f90 + zaptx.f90 + + f77_wisdom.f + ) + +#set (libq65_CXXSRCS +# ipcomm.cpp +# ) + +set (libq65_C_and_CXXSRCS + ${libq65_CSRCS} + ${libq65_CXXSRCS} + ) +set_property (SOURCE ${libq65_C_and_CXXSRCS} APPEND_STRING PROPERTY COMPILE_FLAGS " -include wsjtx_config.h") +set_property (SOURCE ${libq65_C_and_CXXSRCS} APPEND PROPERTY OBJECT_DEPENDS ${CMAKE_BINARY_DIR}/wsjtx_config.h) + + +# +# build our targets +# +add_library (qmap_impl STATIC ${libq65_FSRCS} ${libq65_CSRCS} ${libq65_CXXSRCS}) +target_link_libraries (qmap_impl wsjt_fort wsjt_cxx Qt5::Core) + diff --git a/qmap/libqmap/astro.f90 b/qmap/libqmap/astro.f90 index f9977cfc..cf59bf27 100755 --- a/qmap/libqmap/astro.f90 +++ b/qmap/libqmap/astro.f90 @@ -1,105 +1,105 @@ -subroutine astro(nyear,month,nday,uth,nfreq,Mygrid,NStation,MoonDX, &
- AzSun,ElSun,AzMoon0,ElMoon0,ntsky,doppler00,doppler,dbMoon,RAMoon, &
- DecMoon,HA,Dgrd,sd,poloffset,xnr,day,lon,lat,LST)
-
-! Computes astronomical quantities for display and tracking.
-! NB: may want to smooth the Tsky map to 10 degrees or so.
-
- character*6 MyGrid,HisGrid
- real LST
- real lat,lon
- integer*2 nt144(180)
-
-! common/echo/xdop(2),techo,AzMoon,ElMoon,mjd
- real xdop(2)
-
- data rad/57.2957795/
- data nt144/ &
- 234, 246, 257, 267, 275, 280, 283, 286, 291, 298, &
- 305, 313, 322, 331, 341, 351, 361, 369, 376, 381, &
- 383, 382, 379, 374, 370, 366, 363, 361, 363, 368, &
- 376, 388, 401, 415, 428, 440, 453, 467, 487, 512, &
- 544, 579, 607, 618, 609, 588, 563, 539, 512, 482, &
- 450, 422, 398, 379, 363, 349, 334, 319, 302, 282, &
- 262, 242, 226, 213, 205, 200, 198, 197, 196, 197, &
- 200, 202, 204, 205, 204, 203, 202, 201, 203, 206, &
- 212, 218, 223, 227, 231, 236, 240, 243, 247, 257, &
- 276, 301, 324, 339, 346, 344, 339, 331, 323, 316, &
- 312, 310, 312, 317, 327, 341, 358, 375, 392, 407, &
- 422, 437, 451, 466, 480, 494, 511, 530, 552, 579, &
- 612, 653, 702, 768, 863,1008,1232,1557,1966,2385, &
- 2719,2924,3018,3038,2986,2836,2570,2213,1823,1461, &
- 1163, 939, 783, 677, 602, 543, 494, 452, 419, 392, &
- 373, 360, 353, 350, 350, 350, 350, 350, 350, 348, &
- 344, 337, 329, 319, 307, 295, 284, 276, 272, 272, &
- 273, 274, 274, 271, 266, 260, 252, 245, 238, 231/
- save
-
- call grid2deg(MyGrid,elon,lat)
- lon=-elon
- call sun(nyear,month,nday,uth,lon,lat,RASun,DecSun,LST,AzSun,ElSun,mjd,day)
-
- freq=nfreq*1.e6
- if(nfreq.eq.2) freq=1.8e6
- if(nfreq.eq.4) freq=3.5e6
-
- call moondop(nyear,month,nday,uth,lon,lat,RAMoon,DecMoon,LST,HA, &
- AzMoon,ElMoon,vr,dist)
-
-! Compute spatial polarization offset
- xx=sin(lat/rad)*cos(ElMoon/rad) - cos(lat/rad)*cos(AzMoon/rad)*sin(ElMoon/rad)
- yy=cos(lat/rad)*sin(AzMoon/rad)
- if(NStation.eq.1) poloffset1=rad*atan2(yy,xx)
- if(NStation.eq.2) poloffset2=rad*atan2(yy,xx)
-
- techo=2.0 * dist/2.99792458e5 !Echo delay time
- doppler=-freq*vr/2.99792458e5 !One-way Doppler
-
- call coord(0.,0.,-1.570796,1.161639,RAMoon/rad,DecMoon/rad,el,eb)
- longecl_half=nint(rad*el/2.0)
- if(longecl_half.lt.1 .or. longecl_half.gt.180) longecl_half=180
- t144=nt144(longecl_half)
- tsky=(t144-2.7)*(144.0/nfreq)**2.6 + 2.7 !Tsky for obs freq
-
- xdop(NStation)=doppler
- if(NStation.eq.2) then
- HisGrid=MyGrid
- go to 900
- endif
-
- doppler00=2.0*xdop(1)
- doppler=xdop(1)+xdop(2)
-! if(mode.eq.3) doppler=2.0*xdop(1)
- dBMoon=-40.0*log10(dist/356903.)
- sd=16.23*370152.0/dist
-
-! if(NStation.eq.1 .and. MoonDX.ne.0 .and.
-! + (mode.eq.2 .or. mode.eq.5)) then
- if(NStation.eq.1 .and. MoonDX.ne.0) then
- poloffset=mod(poloffset2-poloffset1+720.0,180.0)
- if(poloffset.gt.90.0) poloffset=poloffset-180.0
- x1=abs(cos(2*poloffset/rad))
- if(x1.lt.0.056234) x1=0.056234
- xnr=-20.0*log10(x1)
- if(HisGrid(1:1).lt.'A' .or. HisGrid(1:1).gt.'R') xnr=0
- endif
-
- tr=80.0 !Good preamp
- tskymin=13.0*(408.0/nfreq)**2.6 !Cold sky temperature
- tsysmin=tskymin+tr
- tsys=tsky+tr
- dgrd=-10.0*log10(tsys/tsysmin) + dbMoon
-900 AzMoon0=Azmoon
- ElMoon0=Elmoon
- ntsky=nint(tsky)
-
-! auxHA = 15.0*(LST-auxra) !HA in degrees
-! pi=3.14159265
-! pio2=0.5*pi
-! call coord(pi,pio2-lat/rad,0.0,lat/rad,auxha*pi/180.0,
-! + auxdec/rad,azaux,elaux)
-! AzAux=azaux*rad
-! ElAux=ElAux*rad
-
- return
-end subroutine astro
+subroutine astro(nyear,month,nday,uth,nfreq,Mygrid,NStation,MoonDX, & + AzSun,ElSun,AzMoon0,ElMoon0,ntsky,doppler00,doppler,dbMoon,RAMoon, & + DecMoon,HA,Dgrd,sd,poloffset,xnr,day,lon,lat,LST) + +! Computes astronomical quantities for display and tracking. +! NB: may want to smooth the Tsky map to 10 degrees or so. + + character*6 MyGrid,HisGrid + real LST + real lat,lon + integer*2 nt144(180) + +! common/echo/xdop(2),techo,AzMoon,ElMoon,mjd + real xdop(2) + + data rad/57.2957795/ + data nt144/ & + 234, 246, 257, 267, 275, 280, 283, 286, 291, 298, & + 305, 313, 322, 331, 341, 351, 361, 369, 376, 381, & + 383, 382, 379, 374, 370, 366, 363, 361, 363, 368, & + 376, 388, 401, 415, 428, 440, 453, 467, 487, 512, & + 544, 579, 607, 618, 609, 588, 563, 539, 512, 482, & + 450, 422, 398, 379, 363, 349, 334, 319, 302, 282, & + 262, 242, 226, 213, 205, 200, 198, 197, 196, 197, & + 200, 202, 204, 205, 204, 203, 202, 201, 203, 206, & + 212, 218, 223, 227, 231, 236, 240, 243, 247, 257, & + 276, 301, 324, 339, 346, 344, 339, 331, 323, 316, & + 312, 310, 312, 317, 327, 341, 358, 375, 392, 407, & + 422, 437, 451, 466, 480, 494, 511, 530, 552, 579, & + 612, 653, 702, 768, 863,1008,1232,1557,1966,2385, & + 2719,2924,3018,3038,2986,2836,2570,2213,1823,1461, & + 1163, 939, 783, 677, 602, 543, 494, 452, 419, 392, & + 373, 360, 353, 350, 350, 350, 350, 350, 350, 348, & + 344, 337, 329, 319, 307, 295, 284, 276, 272, 272, & + 273, 274, 274, 271, 266, 260, 252, 245, 238, 231/ + save + + call grid2deg(MyGrid,elon,lat) + lon=-elon + call sun(nyear,month,nday,uth,lon,lat,RASun,DecSun,LST,AzSun,ElSun,mjd,day) + + freq=nfreq*1.e6 + if(nfreq.eq.2) freq=1.8e6 + if(nfreq.eq.4) freq=3.5e6 + + call moondop(nyear,month,nday,uth,lon,lat,RAMoon,DecMoon,LST,HA, & + AzMoon,ElMoon,vr,dist) + +! Compute spatial polarization offset + xx=sin(lat/rad)*cos(ElMoon/rad) - cos(lat/rad)*cos(AzMoon/rad)*sin(ElMoon/rad) + yy=cos(lat/rad)*sin(AzMoon/rad) + if(NStation.eq.1) poloffset1=rad*atan2(yy,xx) + if(NStation.eq.2) poloffset2=rad*atan2(yy,xx) + + techo=2.0 * dist/2.99792458e5 !Echo delay time + doppler=-freq*vr/2.99792458e5 !One-way Doppler + + call coord(0.,0.,-1.570796,1.161639,RAMoon/rad,DecMoon/rad,el,eb) + longecl_half=nint(rad*el/2.0) + if(longecl_half.lt.1 .or. longecl_half.gt.180) longecl_half=180 + t144=nt144(longecl_half) + tsky=(t144-2.7)*(144.0/nfreq)**2.6 + 2.7 !Tsky for obs freq + + xdop(NStation)=doppler + if(NStation.eq.2) then + HisGrid=MyGrid + go to 900 + endif + + doppler00=2.0*xdop(1) + doppler=xdop(1)+xdop(2) +! if(mode.eq.3) doppler=2.0*xdop(1) + dBMoon=-40.0*log10(dist/356903.) + sd=16.23*370152.0/dist + +! if(NStation.eq.1 .and. MoonDX.ne.0 .and. +! + (mode.eq.2 .or. mode.eq.5)) then + if(NStation.eq.1 .and. MoonDX.ne.0) then + poloffset=mod(poloffset2-poloffset1+720.0,180.0) + if(poloffset.gt.90.0) poloffset=poloffset-180.0 + x1=abs(cos(2*poloffset/rad)) + if(x1.lt.0.056234) x1=0.056234 + xnr=-20.0*log10(x1) + if(HisGrid(1:1).lt.'A' .or. HisGrid(1:1).gt.'R') xnr=0 + endif + + tr=80.0 !Good preamp + tskymin=13.0*(408.0/nfreq)**2.6 !Cold sky temperature + tsysmin=tskymin+tr + tsys=tsky+tr + dgrd=-10.0*log10(tsys/tsysmin) + dbMoon +900 AzMoon0=Azmoon + ElMoon0=Elmoon + ntsky=nint(tsky) + +! auxHA = 15.0*(LST-auxra) !HA in degrees +! pi=3.14159265 +! pio2=0.5*pi +! call coord(pi,pio2-lat/rad,0.0,lat/rad,auxha*pi/180.0, +! + auxdec/rad,azaux,elaux) +! AzAux=azaux*rad +! ElAux=ElAux*rad + + return +end subroutine astro diff --git a/qmap/libqmap/astro0.f90 b/qmap/libqmap/astro0.f90 index ef37f7d2..ec234215 100755 --- a/qmap/libqmap/astro0.f90 +++ b/qmap/libqmap/astro0.f90 @@ -1,81 +1,81 @@ -subroutine astro0(nyear,month,nday,uth8,nfreq,mygrid,hisgrid, &
- AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8,ntsky,ndop,ndop00, &
- dbMoon8,RAMoon8,DecMoon8,HA8,Dgrd8,sd8,poloffset8,xnr8,dfdt,dfdt0, &
- width1,width2,w501,w502,xlst8)
-
- parameter (DEGS=57.2957795130823d0)
- character*6 mygrid,hisgrid
- real*8 AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8
- real*8 dbMoon8,RAMoon8,DecMoon8,HA8,Dgrd8,xnr8,dfdt,dfdt0,dt
- real*8 sd8,poloffset8,day8,width1,width2,w501,w502,xlst8
- real*8 uth8
- data uth8z/0.d0/
- save
-
- uth=uth8
- call astro(nyear,month,nday,uth,nfreq,hisgrid,2,1, &
- AzSun,ElSun,AzMoon,ElMoon,ntsky,doppler00,doppler, &
- dbMoon,RAMoon,DecMoon,HA,Dgrd,sd,poloffset,xnr, &
- day,xlon2,xlat2,xlst)
- AzMoonB8=AzMoon
- ElMoonB8=ElMoon
- call astro(nyear,month,nday,uth,nfreq,mygrid,1,1, &
- AzSun,ElSun,AzMoon,ElMoon,ntsky,doppler00,doppler, &
- dbMoon,RAMoon,DecMoon,HA,Dgrd,sd,poloffset,xnr, &
- day,xlon1,xlat1,xlst)
-
- day8=day
- xlst8=xlst
- call tm2(day8,xlat1,xlon1,xl1,b1)
- call tm2(day8,xlat2,xlon2,xl2,b2)
- call tm2(day8+1.d0/1440.0,xlat1,xlon1,xl1a,b1a)
- call tm2(day8+1.d0/1440.0,xlat2,xlon2,xl2a,b2a)
- fghz=0.001*nfreq
- dldt1=DEGS*(xl1a-xl1)
- dbdt1=DEGS*(b1a-b1)
- dldt2=DEGS*(xl2a-xl2)
- dbdt2=DEGS*(b2a-b2)
- rate1=2.0*sqrt(dldt1**2 + dbdt1**2)
- width1=0.5*6741*fghz*rate1
- rate2=sqrt((dldt1+dldt2)**2 + (dbdt1+dbdt2)**2)
- width2=0.5*6741*fghz*rate2
-
- fbend=0.7
- a2=0.0045*log(fghz/fbend)/log(1.05)
- if(fghz.lt.fbend) a2=0.0
- f50=0.19 * (fghz/fbend)**a2
- if(f50.gt.1.0) f50=1.0
- w501=f50*width1
- w502=f50*width2
-
- AzSun8=AzSun
- ElSun8=ElSun
- AzMoon8=AzMoon
- ElMoon8=ElMoon
- dbMoon8=dbMoon
- RAMoon8=RAMoon/15.0
- DecMoon8=DecMoon
- HA8=HA
- Dgrd8=Dgrd
- sd8=sd
- poloffset8=poloffset
- xnr8=xnr
- ndop=nint(doppler)
- ndop00=nint(doppler00)
-
- if(uth8z.eq.0.d0) then
- uth8z=uth8-1.d0/3600.d0
- dopplerz=doppler
- doppler00z=doppler00
- endif
-
- dt=60.0*(uth8-uth8z)
- if(dt.le.0) dt=1.d0/60.d0
- dfdt=(doppler-dopplerz)/dt
- dfdt0=(doppler00-doppler00z)/dt
- uth8z=uth8
- dopplerz=doppler
- doppler00z=doppler00
-
- return
-end subroutine astro0
+subroutine astro0(nyear,month,nday,uth8,nfreq,mygrid,hisgrid, & + AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8,ntsky,ndop,ndop00, & + dbMoon8,RAMoon8,DecMoon8,HA8,Dgrd8,sd8,poloffset8,xnr8,dfdt,dfdt0, & + width1,width2,w501,w502,xlst8) + + parameter (DEGS=57.2957795130823d0) + character*6 mygrid,hisgrid + real*8 AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8 + real*8 dbMoon8,RAMoon8,DecMoon8,HA8,Dgrd8,xnr8,dfdt,dfdt0,dt + real*8 sd8,poloffset8,day8,width1,width2,w501,w502,xlst8 + real*8 uth8 + data uth8z/0.d0/ + save + + uth=uth8 + call astro(nyear,month,nday,uth,nfreq,hisgrid,2,1, & + AzSun,ElSun,AzMoon,ElMoon,ntsky,doppler00,doppler, & + dbMoon,RAMoon,DecMoon,HA,Dgrd,sd,poloffset,xnr, & + day,xlon2,xlat2,xlst) + AzMoonB8=AzMoon + ElMoonB8=ElMoon + call astro(nyear,month,nday,uth,nfreq,mygrid,1,1, & + AzSun,ElSun,AzMoon,ElMoon,ntsky,doppler00,doppler, & + dbMoon,RAMoon,DecMoon,HA,Dgrd,sd,poloffset,xnr, & + day,xlon1,xlat1,xlst) + + day8=day + xlst8=xlst + call tm2(day8,xlat1,xlon1,xl1,b1) + call tm2(day8,xlat2,xlon2,xl2,b2) + call tm2(day8+1.d0/1440.0,xlat1,xlon1,xl1a,b1a) + call tm2(day8+1.d0/1440.0,xlat2,xlon2,xl2a,b2a) + fghz=0.001*nfreq + dldt1=DEGS*(xl1a-xl1) + dbdt1=DEGS*(b1a-b1) + dldt2=DEGS*(xl2a-xl2) + dbdt2=DEGS*(b2a-b2) + rate1=2.0*sqrt(dldt1**2 + dbdt1**2) + width1=0.5*6741*fghz*rate1 + rate2=sqrt((dldt1+dldt2)**2 + (dbdt1+dbdt2)**2) + width2=0.5*6741*fghz*rate2 + + fbend=0.7 + a2=0.0045*log(fghz/fbend)/log(1.05) + if(fghz.lt.fbend) a2=0.0 + f50=0.19 * (fghz/fbend)**a2 + if(f50.gt.1.0) f50=1.0 + w501=f50*width1 + w502=f50*width2 + + AzSun8=AzSun + ElSun8=ElSun + AzMoon8=AzMoon + ElMoon8=ElMoon + dbMoon8=dbMoon + RAMoon8=RAMoon/15.0 + DecMoon8=DecMoon + HA8=HA + Dgrd8=Dgrd + sd8=sd + poloffset8=poloffset + xnr8=xnr + ndop=nint(doppler) + ndop00=nint(doppler00) + + if(uth8z.eq.0.d0) then + uth8z=uth8-1.d0/3600.d0 + dopplerz=doppler + doppler00z=doppler00 + endif + + dt=60.0*(uth8-uth8z) + if(dt.le.0) dt=1.d0/60.d0 + dfdt=(doppler-dopplerz)/dt + dfdt0=(doppler00-doppler00z)/dt + uth8z=uth8 + dopplerz=doppler + doppler00z=doppler00 + + return +end subroutine astro0 diff --git a/qmap/libqmap/astrosub.f90 b/qmap/libqmap/astrosub.f90 index 5704df57..ce25a0d9 100755 --- a/qmap/libqmap/astrosub.f90 +++ b/qmap/libqmap/astrosub.f90 @@ -1,26 +1,26 @@ -subroutine astrosub(nyear,month,nday,uth8,nfreq,mygrid,hisgrid, &
- AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8,ntsky,ndop,ndop00, &
- RAMoon8,DecMoon8,Dgrd8,poloffset8,xnr8)
-
- implicit real*8 (a-h,o-z)
- character*6 mygrid,hisgrid
-
- call astro0(nyear,month,nday,uth8,nfreq,mygrid,hisgrid, &
- AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8,ntsky,ndop,ndop00, &
- dbMoon8,RAMoon8,DecMoon8,HA8,Dgrd8,sd8,poloffset8,xnr8,dfdt,dfdt0, &
- width1,width2,w501,w502,xlst8)
-
- return
-end subroutine astrosub
-
-subroutine astrosub00(nyear,month,nday,uth8,nfreq,mygrid,ndop00)
-
- implicit real*8 (a-h,o-z)
- character*6 mygrid
-
- call astrosub(nyear,month,nday,uth8,nfreq,mygrid,mygrid, &
- AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8,ntsky,ndop,ndop00, &
- RAMoon8,DecMoon8,Dgrd8,poloffset8,xnr8)
-
- return
-end subroutine astrosub00
+subroutine astrosub(nyear,month,nday,uth8,nfreq,mygrid,hisgrid, & + AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8,ntsky,ndop,ndop00, & + RAMoon8,DecMoon8,Dgrd8,poloffset8,xnr8) + + implicit real*8 (a-h,o-z) + character*6 mygrid,hisgrid + + call astro0(nyear,month,nday,uth8,nfreq,mygrid,hisgrid, & + AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8,ntsky,ndop,ndop00, & + dbMoon8,RAMoon8,DecMoon8,HA8,Dgrd8,sd8,poloffset8,xnr8,dfdt,dfdt0, & + width1,width2,w501,w502,xlst8) + + return +end subroutine astrosub + +subroutine astrosub00(nyear,month,nday,uth8,nfreq,mygrid,ndop00) + + implicit real*8 (a-h,o-z) + character*6 mygrid + + call astrosub(nyear,month,nday,uth8,nfreq,mygrid,mygrid, & + AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8,ntsky,ndop,ndop00, & + RAMoon8,DecMoon8,Dgrd8,poloffset8,xnr8) + + return +end subroutine astrosub00 diff --git a/qmap/libqmap/cfom.f90 b/qmap/libqmap/cfom.f90 index 986a39dc..e58f005b 100755 --- a/qmap/libqmap/cfom.f90 +++ b/qmap/libqmap/cfom.f90 @@ -1,40 +1,40 @@ -subroutine cfom(dd,k0,k,ndop0)
-
- parameter(NMAX=60*96000)
- real dd(2,NMAX)
- complex*16 w,wstep
- complex*8 c
- real*8 twopi,dphi
- logical first
- data first/.true./
- save twopi,w,first
-
- if(first) then
- twopi=8.d0*atan(1.d0)
- w=1.d0
- first=.false.
- endif
-
- dop0=0.5*ndop0
- dphi=dop0*twopi/96000.0
- wstep=cmplx(cos(dphi),sin(dphi))
-
- do j=k0+1,k
- c=w*cmplx(dd(1,j),dd(2,j))
- dd(1,j)=real(c)
- dd(2,j)=aimag(c)
- w=w*wstep
- enddo
-
- return
-end subroutine cfom
-
-subroutine zaptx(dd,k0,k)
-
- parameter(NMAX=60*96000)
- real dd(2,NMAX)
-
- dd(1:2,k0+1:k)=0.
-
- return
-end subroutine zaptx
+subroutine cfom(dd,k0,k,ndop0) + + parameter(NMAX=60*96000) + real dd(2,NMAX) + complex*16 w,wstep + complex*8 c + real*8 twopi,dphi + logical first + data first/.true./ + save twopi,w,first + + if(first) then + twopi=8.d0*atan(1.d0) + w=1.d0 + first=.false. + endif + + dop0=0.5*ndop0 + dphi=dop0*twopi/96000.0 + wstep=cmplx(cos(dphi),sin(dphi)) + + do j=k0+1,k + c=w*cmplx(dd(1,j),dd(2,j)) + dd(1,j)=real(c) + dd(2,j)=aimag(c) + w=w*wstep + enddo + + return +end subroutine cfom + +subroutine zaptx(dd,k0,k) + + parameter(NMAX=60*96000) + real dd(2,NMAX) + + dd(1:2,k0+1:k)=0. + + return +end subroutine zaptx diff --git a/qmap/libqmap/cfom_iq.f90 b/qmap/libqmap/cfom_iq.f90 index f63af5ae..f34c1d6c 100755 --- a/qmap/libqmap/cfom_iq.f90 +++ b/qmap/libqmap/cfom_iq.f90 @@ -1,48 +1,48 @@ -program cfom_iq
-
- parameter(NMAX=60*96000)
- integer*2 id2(2,NMAX)
- complex*16 c,w,wstep
- real*8 fcenter,uth8,twopi,dphi
- character*6 mygrid
-
- twopi=8.d0*atan(1.d0)
- open(10,file='231028_0131.iq',status='old',access='stream')
- open(12,file='231028_0131.cfom',status='unknown',access='stream')
-
- mygrid='FN20OG'
- nyear=2023
- month=10
- nday=28
- uth8=01 + 31.d0/60
- nfreq=1296
- call astrosub00(nyear,month,nday,uth8,nfreq,mygrid,ndop0)
- call astrosub00(nyear,month,nday,uth8+1.d0/60.d0,nfreq,mygrid,ndop1)
-
- print*,ndop0,ndop1
-
- read(10) fcenter,id2(1:2,1:56*96000)
- id2(1:2,56*96000+1:NMAX)=0
-
- dop0=0.5*ndop0
- dop1=0.5*ndop1
- j=0
- w=1.0
- do isec=1,60
- dop=dop0 + (isec-0.5)*(dop1-dop0)/60.
- dphi=dop*twopi/96000.0
- wstep=cmplx(cos(dphi),sin(dphi))
- do n=1,96000
- j=j+1
- x=id2(1,j)
- y=id2(2,j)
- w=w*wstep
- c=100.d0*w*cmplx(x,y)
- id2(1,j)=0.01d0*real(c)
- id2(2,j)=0.01d0*aimag(c)
- enddo
- enddo
-
- write(12) fcenter,id2
-
-end program cfom_iq
+program cfom_iq + + parameter(NMAX=60*96000) + integer*2 id2(2,NMAX) + complex*16 c,w,wstep + real*8 fcenter,uth8,twopi,dphi + character*6 mygrid + + twopi=8.d0*atan(1.d0) + open(10,file='231028_0131.iq',status='old',access='stream') + open(12,file='231028_0131.cfom',status='unknown',access='stream') + + mygrid='FN20OG' + nyear=2023 + month=10 + nday=28 + uth8=01 + 31.d0/60 + nfreq=1296 + call astrosub00(nyear,month,nday,uth8,nfreq,mygrid,ndop0) + call astrosub00(nyear,month,nday,uth8+1.d0/60.d0,nfreq,mygrid,ndop1) + + print*,ndop0,ndop1 + + read(10) fcenter,id2(1:2,1:56*96000) + id2(1:2,56*96000+1:NMAX)=0 + + dop0=0.5*ndop0 + dop1=0.5*ndop1 + j=0 + w=1.0 + do isec=1,60 + dop=dop0 + (isec-0.5)*(dop1-dop0)/60. + dphi=dop*twopi/96000.0 + wstep=cmplx(cos(dphi),sin(dphi)) + do n=1,96000 + j=j+1 + x=id2(1,j) + y=id2(2,j) + w=w*wstep + c=100.d0*w*cmplx(x,y) + id2(1,j)=0.01d0*real(c) + id2(2,j)=0.01d0*aimag(c) + enddo + enddo + + write(12) fcenter,id2 + +end program cfom_iq diff --git a/qmap/libqmap/chkstat.f90 b/qmap/libqmap/chkstat.f90 index cb0c69d1..7f312189 100755 --- a/qmap/libqmap/chkstat.f90 +++ b/qmap/libqmap/chkstat.f90 @@ -1,28 +1,28 @@ -subroutine chkstat(dd,nhsym,pdb)
-
- real dd(2,5760000)
- real pdb(4)
- integer ia(4),ib(4)
- logical*1 btx0,btx1
-
- btx0=.false.
- btx1=.false.
- ia(1)=23*96000+1
- ib(1)=24*96000
- ia(2)=27*96000+1
- ib(2)=28*96000
- ia(3)=53*96000+1
- ib(3)=54*96000
- ia(4)=57*96000+1
- ib(4)=58*96000
-
- do j=1,4
- sq=0.
- do i=ia(j),ib(j)
- sq=sq + dd(1,i)*dd(1,i) + dd(2,i)*dd(2,i)
- enddo
- pdb(j)=db(1.0 + sq/(2.0*96000.0))
- enddo
-
- return
-end subroutine chkstat
+subroutine chkstat(dd,nhsym,pdb) + + real dd(2,5760000) + real pdb(4) + integer ia(4),ib(4) + logical*1 btx0,btx1 + + btx0=.false. + btx1=.false. + ia(1)=23*96000+1 + ib(1)=24*96000 + ia(2)=27*96000+1 + ib(2)=28*96000 + ia(3)=53*96000+1 + ib(3)=54*96000 + ia(4)=57*96000+1 + ib(4)=58*96000 + + do j=1,4 + sq=0. + do i=ia(j),ib(j) + sq=sq + dd(1,i)*dd(1,i) + dd(2,i)*dd(2,i) + enddo + pdb(j)=db(1.0 + sq/(2.0*96000.0)) + enddo + + return +end subroutine chkstat diff --git a/qmap/libqmap/dcoord.f90 b/qmap/libqmap/dcoord.f90 index 1669ebe2..5ef6877a 100755 --- a/qmap/libqmap/dcoord.f90 +++ b/qmap/libqmap/dcoord.f90 @@ -1,40 +1,40 @@ -SUBROUTINE DCOORD(A0,B0,AP,BP,A1,B1,A2,B2)
-
- implicit real*8 (a-h,o-z)
-! Examples:
-! 1. From ha,dec to az,el:
-! call coord(pi,pio2-lat,0.,lat,ha,dec,az,el)
-! 2. From az,el to ha,dec:
-! call coord(pi,pio2-lat,0.,lat,az,el,ha,dec)
-! 3. From ra,dec to l,b
-! call coord(4.635594495,-0.504691042,3.355395488,0.478220215,
-! ra,dec,l,b)
-! 4. From l,b to ra,dec
-! call coord(1.705981071d0,-1.050357016d0,2.146800277d0,
-! 0.478220215d0,l,b,ra,dec)
-! 5. From ecliptic latitude (eb) and longitude (el) to ra, dec:
-! call coord(0.d0,0.d0,-pio2,pio2-23.443*pi/180,ra,dec,el,eb)
-
- SB0=sin(B0)
- CB0=cos(B0)
- SBP=sin(BP)
- CBP=cos(BP)
- SB1=sin(B1)
- CB1=cos(B1)
- SB2=SBP*SB1 + CBP*CB1*cos(AP-A1)
- CB2=SQRT(1.D0-SB2**2)
- B2=atan(SB2/CB2)
- SAA=sin(AP-A1)*CB1/CB2
- CAA=(SB1-SB2*SBP)/(CB2*CBP)
- CBB=SB0/CBP
- SBB=sin(AP-A0)*CB0
- SA2=SAA*CBB-CAA*SBB
- CA2=CAA*CBB+SAA*SBB
- TA2O2=0.0 !Shut up compiler warnings. -db
- IF(CA2.LE.0.D0) TA2O2=(1.D0-CA2)/SA2
- IF(CA2.GT.0.D0) TA2O2=SA2/(1.D0+CA2)
- A2=2.D0*atan(TA2O2)
- IF(A2.LT.0.D0) A2=A2+6.2831853071795864D0
-
- RETURN
-END SUBROUTINE DCOORD
+SUBROUTINE DCOORD(A0,B0,AP,BP,A1,B1,A2,B2) + + implicit real*8 (a-h,o-z) +! Examples: +! 1. From ha,dec to az,el: +! call coord(pi,pio2-lat,0.,lat,ha,dec,az,el) +! 2. From az,el to ha,dec: +! call coord(pi,pio2-lat,0.,lat,az,el,ha,dec) +! 3. From ra,dec to l,b +! call coord(4.635594495,-0.504691042,3.355395488,0.478220215, +! ra,dec,l,b) +! 4. From l,b to ra,dec +! call coord(1.705981071d0,-1.050357016d0,2.146800277d0, +! 0.478220215d0,l,b,ra,dec) +! 5. From ecliptic latitude (eb) and longitude (el) to ra, dec: +! call coord(0.d0,0.d0,-pio2,pio2-23.443*pi/180,ra,dec,el,eb) + + SB0=sin(B0) + CB0=cos(B0) + SBP=sin(BP) + CBP=cos(BP) + SB1=sin(B1) + CB1=cos(B1) + SB2=SBP*SB1 + CBP*CB1*cos(AP-A1) + CB2=SQRT(1.D0-SB2**2) + B2=atan(SB2/CB2) + SAA=sin(AP-A1)*CB1/CB2 + CAA=(SB1-SB2*SBP)/(CB2*CBP) + CBB=SB0/CBP + SBB=sin(AP-A0)*CB0 + SA2=SAA*CBB-CAA*SBB + CA2=CAA*CBB+SAA*SBB + TA2O2=0.0 !Shut up compiler warnings. -db + IF(CA2.LE.0.D0) TA2O2=(1.D0-CA2)/SA2 + IF(CA2.GT.0.D0) TA2O2=SA2/(1.D0+CA2) + A2=2.D0*atan(TA2O2) + IF(A2.LT.0.D0) A2=A2+6.2831853071795864D0 + + RETURN +END SUBROUTINE DCOORD diff --git a/qmap/libqmap/decode0.f90 b/qmap/libqmap/decode0.f90 index 64099044..a342adb4 100755 --- a/qmap/libqmap/decode0.f90 +++ b/qmap/libqmap/decode0.f90 @@ -1,53 +1,53 @@ -subroutine decode0(dd,ss,savg)
-
- use timer_module, only: timer
- parameter (NSMAX=60*96000,NFFT=32768)
-
- real*4 dd(2,NSMAX),ss(400,NFFT),savg(NFFT)
- real*8 fcenter
- integer offset
- integer hist(0:32768)
- logical*1 bAlso30
- character mycall*12,hiscall*12,mygrid*6,hisgrid*6,datetime*20
- character mycall0*12,hiscall0*12,hisgrid0*6
- character*64 result
- common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, &
- nWTransmitting,kHzRequested,result(50)
- common/npar/fcenter,nutc,fselected,mousedf,mousefqso,nagain, &
- ndepth,ndiskdat,ntx60,newdat,nfa,nfb,nfcal,nfshift, &
- ntx30a,ntx30b,ntol,n60,nCFOM,nfsample,ndop58,nmode, &
- ndop00,nsave,max_drift,offset,nhsym,mycall,mygrid, &
- hiscall,hisgrid,datetime,junk1,junk2,bAlso30
- save
-
- nQDecoderDone=0
- if(newdat.ne.0) then
- nz=96000*nhsym*0.15
- hist=0
- do i=1,nz
- j1=min(abs(dd(1,i)),32768.0)
- hist(j1)=hist(j1)+1
- j2=min(abs(dd(2,i)),32768.0)
- hist(j2)=hist(j2)+1
- enddo
- m=0
- do i=0,32768
- m=m+hist(i)
- if(m.ge.2*nz) go to 10
- enddo
-10 rmsdd=1.5*i
- endif
-
- mycall0=mycall
- hiscall0=hiscall
- hisgrid0=hisgrid
-
- call timer('qmapa ',0)
- call qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, &
- mousedf,mousefqso,nagain,ntx30a,ntx30b,nfshift,max_drift,offset, &
- nfcal,mycall,hiscall,hisgrid,nfsample,nmode,ndepth, &
- datetime,ndop00,fselected,bAlso30,nhsym,NCFOM)
- call timer('qmapa ',1)
-
- return
-end subroutine decode0
+subroutine decode0(dd,ss,savg) + + use timer_module, only: timer + parameter (NSMAX=60*96000,NFFT=32768) + + real*4 dd(2,NSMAX),ss(400,NFFT),savg(NFFT) + real*8 fcenter + integer offset + integer hist(0:32768) + logical*1 bAlso30 + character mycall*12,hiscall*12,mygrid*6,hisgrid*6,datetime*20 + character mycall0*12,hiscall0*12,hisgrid0*6 + character*64 result + common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & + nWTransmitting,kHzRequested,result(50) + common/npar/fcenter,nutc,fselected,mousedf,mousefqso,nagain, & + ndepth,ndiskdat,ntx60,newdat,nfa,nfb,nfcal,nfshift, & + ntx30a,ntx30b,ntol,n60,nCFOM,nfsample,ndop58,nmode, & + ndop00,nsave,max_drift,offset,nhsym,mycall,mygrid, & + hiscall,hisgrid,datetime,junk1,junk2,bAlso30 + save + + nQDecoderDone=0 + if(newdat.ne.0) then + nz=96000*nhsym*0.15 + hist=0 + do i=1,nz + j1=min(abs(dd(1,i)),32768.0) + hist(j1)=hist(j1)+1 + j2=min(abs(dd(2,i)),32768.0) + hist(j2)=hist(j2)+1 + enddo + m=0 + do i=0,32768 + m=m+hist(i) + if(m.ge.2*nz) go to 10 + enddo +10 rmsdd=1.5*i + endif + + mycall0=mycall + hiscall0=hiscall + hisgrid0=hisgrid + + call timer('qmapa ',0) + call qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & + mousedf,mousefqso,nagain,ntx30a,ntx30b,nfshift,max_drift,offset, & + nfcal,mycall,hiscall,hisgrid,nfsample,nmode,ndepth, & + datetime,ndop00,fselected,bAlso30,nhsym,NCFOM) + call timer('qmapa ',1) + + return +end subroutine decode0 diff --git a/qmap/libqmap/dot.f90 b/qmap/libqmap/dot.f90 index a68c5bd1..5829e878 100755 --- a/qmap/libqmap/dot.f90 +++ b/qmap/libqmap/dot.f90 @@ -1,11 +1,11 @@ -real*8 function dot(x,y)
-
- real*8 x(3),y(3)
-
- dot=0.d0
- do i=1,3
- dot=dot+x(i)*y(i)
- enddo
-
- return
-end function dot
+real*8 function dot(x,y) + + real*8 x(3),y(3) + + dot=0.d0 + do i=1,3 + dot=dot+x(i)*y(i) + enddo + + return +end function dot diff --git a/qmap/libqmap/f77_wisdom.f b/qmap/libqmap/f77_wisdom.f index 5fd8b3a6..b0a72585 100755 --- a/qmap/libqmap/f77_wisdom.f +++ b/qmap/libqmap/f77_wisdom.f @@ -1,45 +1,45 @@ - subroutine write_char(c, iunit)
- character c
- integer iunit
- write(iunit,1000) c
- 1000 format(a,$)
- end
-
- subroutine export_wisdom_to_file(iunit)
- integer iunit
- external write_char
-c call dfftw_export_wisdom(write_char, iunit)
- call sfftw_export_wisdom(write_char, iunit)
- end
-
- subroutine read_char(ic, iunit)
- integer ic
- integer iunit
- character*256 buf
- save buf
- integer ibuf
- data ibuf/257/
- save ibuf
- if (ibuf .lt. 257) then
- ic = ichar(buf(ibuf:ibuf))
- ibuf = ibuf + 1
- return
- endif
- read(iunit,1000,end=10) buf
- 1000 format(a256)
- ic = ichar(buf(1:1))
- ibuf = 2
- return
- 10 ic = -1
- ibuf = 257
- rewind iunit
- return
- end
-
- subroutine import_wisdom_from_file(isuccess, iunit)
- integer isuccess
- integer iunit
- external read_char
-c call dfftw_import_wisdom(isuccess, read_char, iunit)
- call sfftw_import_wisdom(isuccess, read_char, iunit)
- end
+ subroutine write_char(c, iunit) + character c + integer iunit + write(iunit,1000) c + 1000 format(a,$) + end + + subroutine export_wisdom_to_file(iunit) + integer iunit + external write_char +c call dfftw_export_wisdom(write_char, iunit) + call sfftw_export_wisdom(write_char, iunit) + end + + subroutine read_char(ic, iunit) + integer ic + integer iunit + character*256 buf + save buf + integer ibuf + data ibuf/257/ + save ibuf + if (ibuf .lt. 257) then + ic = ichar(buf(ibuf:ibuf)) + ibuf = ibuf + 1 + return + endif + read(iunit,1000,end=10) buf + 1000 format(a256) + ic = ichar(buf(1:1)) + ibuf = 2 + return + 10 ic = -1 + ibuf = 257 + rewind iunit + return + end + + subroutine import_wisdom_from_file(isuccess, iunit) + integer isuccess + integer iunit + external read_char +c call dfftw_import_wisdom(isuccess, read_char, iunit) + call sfftw_import_wisdom(isuccess, read_char, iunit) + end diff --git a/qmap/libqmap/fchisq0.f90 b/qmap/libqmap/fchisq0.f90 index 742df078..2c62f275 100755 --- a/qmap/libqmap/fchisq0.f90 +++ b/qmap/libqmap/fchisq0.f90 @@ -1,23 +1,23 @@ -real function fchisq0(y,npts,a)
-
- real y(npts),a(4)
-
-! rewind 51
- chisq = 0.
- do i=1,npts
- x=i
- z=(x-a(3))/(0.5*a(4))
- yfit=a(1)
- if(abs(z).lt.3.0) then
- d=1.0 + z*z
- yfit=a(1) + a(2) * (1.0/d - 0.1)
- endif
- chisq=chisq + (y(i) - yfit)**2
-! write(51,3001) i,y(i),yfit,y(i)-yfit
-!3001 format(i5,3f10.4)
- enddo
- fchisq0=chisq
-
- return
-end function fchisq0
-
+real function fchisq0(y,npts,a) + + real y(npts),a(4) + +! rewind 51 + chisq = 0. + do i=1,npts + x=i + z=(x-a(3))/(0.5*a(4)) + yfit=a(1) + if(abs(z).lt.3.0) then + d=1.0 + z*z + yfit=a(1) + a(2) * (1.0/d - 0.1) + endif + chisq=chisq + (y(i) - yfit)**2 +! write(51,3001) i,y(i),yfit,y(i)-yfit +!3001 format(i5,3f10.4) + enddo + fchisq0=chisq + + return +end function fchisq0 + diff --git a/qmap/libqmap/fftbig.f90 b/qmap/libqmap/fftbig.f90 index b807f6a1..085fd39f 100755 --- a/qmap/libqmap/fftbig.f90 +++ b/qmap/libqmap/fftbig.f90 @@ -1,56 +1,56 @@ -subroutine fftbig(dd,nmax)
-
-! Do the full length FFT of complex data stored in array dd(2,nmax).
-
- use, intrinsic :: iso_c_binding
-
- use FFTW3
- use timer_module, only: timer
- parameter (MAXFFT1=5376000)
- real*4 dd(2,nmax) !Input data
- complex ca(MAXFFT1) !FFT of input
- real*8 df
- type(C_PTR) :: plan1 !Pointer to FFTW plan
- logical first
- common/cacb/ca
- equivalence (rfilt,cfilt)
- data first/.true./,npatience/0/
- save
-
- if(nmax.lt.0) go to 900
-
- nfft1=MAXFFT1
- if(first) then
- nflags=FFTW_ESTIMATE
- if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT
- if(npatience.eq.2) nflags=FFTW_MEASURE
- if(npatience.eq.3) nflags=FFTW_PATIENT
- if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE
-
-! Plan the big FFT just once
- call timer('FFTplan ',0)
- plan1=fftwf_plan_dft_1d(nfft1,ca,ca,+1,nflags)
- call timer('FFTplan ',1)
- df=96000.d0/nfft1
- first=.false.
- endif
-
- nz=min(nmax,nfft1)
- do i=1,nz
- ca(i)=cmplx(dd(1,i),dd(2,i))
- enddo
-
- if(nmax.lt.nfft1) then
- do i=nmax+1,nfft1
- ca(i)=0.
- enddo
- endif
- call timer('FFTbig ',0)
- call fftwf_execute_dft(plan1,ca,ca)
- call timer('FFTbig ',1)
- go to 999
-
-900 call fftwf_destroy_plan(plan1)
-
-999 return
-end subroutine fftbig
+subroutine fftbig(dd,nmax) + +! Do the full length FFT of complex data stored in array dd(2,nmax). + + use, intrinsic :: iso_c_binding + + use FFTW3 + use timer_module, only: timer + parameter (MAXFFT1=5376000) + real*4 dd(2,nmax) !Input data + complex ca(MAXFFT1) !FFT of input + real*8 df + type(C_PTR) :: plan1 !Pointer to FFTW plan + logical first + common/cacb/ca + equivalence (rfilt,cfilt) + data first/.true./,npatience/0/ + save + + if(nmax.lt.0) go to 900 + + nfft1=MAXFFT1 + if(first) then + nflags=FFTW_ESTIMATE + if(npatience.eq.1) nflags=FFTW_ESTIMATE_PATIENT + if(npatience.eq.2) nflags=FFTW_MEASURE + if(npatience.eq.3) nflags=FFTW_PATIENT + if(npatience.eq.4) nflags=FFTW_EXHAUSTIVE + +! Plan the big FFT just once + call timer('FFTplan ',0) + plan1=fftwf_plan_dft_1d(nfft1,ca,ca,+1,nflags) + call timer('FFTplan ',1) + df=96000.d0/nfft1 + first=.false. + endif + + nz=min(nmax,nfft1) + do i=1,nz + ca(i)=cmplx(dd(1,i),dd(2,i)) + enddo + + if(nmax.lt.nfft1) then + do i=nmax+1,nfft1 + ca(i)=0. + enddo + endif + call timer('FFTbig ',0) + call fftwf_execute_dft(plan1,ca,ca) + call timer('FFTbig ',1) + go to 999 + +900 call fftwf_destroy_plan(plan1) + +999 return +end subroutine fftbig diff --git a/qmap/libqmap/fftw3.f b/qmap/libqmap/fftw3.f index 90748b2f..3410184c 100755 --- a/qmap/libqmap/fftw3.f +++ b/qmap/libqmap/fftw3.f @@ -1,64 +1,64 @@ - INTEGER FFTW_R2HC
- PARAMETER (FFTW_R2HC=0)
- INTEGER FFTW_HC2R
- PARAMETER (FFTW_HC2R=1)
- INTEGER FFTW_DHT
- PARAMETER (FFTW_DHT=2)
- INTEGER FFTW_REDFT00
- PARAMETER (FFTW_REDFT00=3)
- INTEGER FFTW_REDFT01
- PARAMETER (FFTW_REDFT01=4)
- INTEGER FFTW_REDFT10
- PARAMETER (FFTW_REDFT10=5)
- INTEGER FFTW_REDFT11
- PARAMETER (FFTW_REDFT11=6)
- INTEGER FFTW_RODFT00
- PARAMETER (FFTW_RODFT00=7)
- INTEGER FFTW_RODFT01
- PARAMETER (FFTW_RODFT01=8)
- INTEGER FFTW_RODFT10
- PARAMETER (FFTW_RODFT10=9)
- INTEGER FFTW_RODFT11
- PARAMETER (FFTW_RODFT11=10)
- INTEGER FFTW_FORWARD
- PARAMETER (FFTW_FORWARD=-1)
- INTEGER FFTW_BACKWARD
- PARAMETER (FFTW_BACKWARD=+1)
- INTEGER FFTW_MEASURE
- PARAMETER (FFTW_MEASURE=0)
- INTEGER FFTW_DESTROY_INPUT
- PARAMETER (FFTW_DESTROY_INPUT=1)
- INTEGER FFTW_UNALIGNED
- PARAMETER (FFTW_UNALIGNED=2)
- INTEGER FFTW_CONSERVE_MEMORY
- PARAMETER (FFTW_CONSERVE_MEMORY=4)
- INTEGER FFTW_EXHAUSTIVE
- PARAMETER (FFTW_EXHAUSTIVE=8)
- INTEGER FFTW_PRESERVE_INPUT
- PARAMETER (FFTW_PRESERVE_INPUT=16)
- INTEGER FFTW_PATIENT
- PARAMETER (FFTW_PATIENT=32)
- INTEGER FFTW_ESTIMATE
- PARAMETER (FFTW_ESTIMATE=64)
- INTEGER FFTW_ESTIMATE_PATIENT
- PARAMETER (FFTW_ESTIMATE_PATIENT=128)
- INTEGER FFTW_BELIEVE_PCOST
- PARAMETER (FFTW_BELIEVE_PCOST=256)
- INTEGER FFTW_DFT_R2HC_ICKY
- PARAMETER (FFTW_DFT_R2HC_ICKY=512)
- INTEGER FFTW_NONTHREADED_ICKY
- PARAMETER (FFTW_NONTHREADED_ICKY=1024)
- INTEGER FFTW_NO_BUFFERING
- PARAMETER (FFTW_NO_BUFFERING=2048)
- INTEGER FFTW_NO_INDIRECT_OP
- PARAMETER (FFTW_NO_INDIRECT_OP=4096)
- INTEGER FFTW_ALLOW_LARGE_GENERIC
- PARAMETER (FFTW_ALLOW_LARGE_GENERIC=8192)
- INTEGER FFTW_NO_RANK_SPLITS
- PARAMETER (FFTW_NO_RANK_SPLITS=16384)
- INTEGER FFTW_NO_VRANK_SPLITS
- PARAMETER (FFTW_NO_VRANK_SPLITS=32768)
- INTEGER FFTW_NO_VRECURSE
- PARAMETER (FFTW_NO_VRECURSE=65536)
- INTEGER FFTW_NO_SIMD
- PARAMETER (FFTW_NO_SIMD=131072)
+ INTEGER FFTW_R2HC + PARAMETER (FFTW_R2HC=0) + INTEGER FFTW_HC2R + PARAMETER (FFTW_HC2R=1) + INTEGER FFTW_DHT + PARAMETER (FFTW_DHT=2) + INTEGER FFTW_REDFT00 + PARAMETER (FFTW_REDFT00=3) + INTEGER FFTW_REDFT01 + PARAMETER (FFTW_REDFT01=4) + INTEGER FFTW_REDFT10 + PARAMETER (FFTW_REDFT10=5) + INTEGER FFTW_REDFT11 + PARAMETER (FFTW_REDFT11=6) + INTEGER FFTW_RODFT00 + PARAMETER (FFTW_RODFT00=7) + INTEGER FFTW_RODFT01 + PARAMETER (FFTW_RODFT01=8) + INTEGER FFTW_RODFT10 + PARAMETER (FFTW_RODFT10=9) + INTEGER FFTW_RODFT11 + PARAMETER (FFTW_RODFT11=10) + INTEGER FFTW_FORWARD + PARAMETER (FFTW_FORWARD=-1) + INTEGER FFTW_BACKWARD + PARAMETER (FFTW_BACKWARD=+1) + INTEGER FFTW_MEASURE + PARAMETER (FFTW_MEASURE=0) + INTEGER FFTW_DESTROY_INPUT + PARAMETER (FFTW_DESTROY_INPUT=1) + INTEGER FFTW_UNALIGNED + PARAMETER (FFTW_UNALIGNED=2) + INTEGER FFTW_CONSERVE_MEMORY + PARAMETER (FFTW_CONSERVE_MEMORY=4) + INTEGER FFTW_EXHAUSTIVE + PARAMETER (FFTW_EXHAUSTIVE=8) + INTEGER FFTW_PRESERVE_INPUT + PARAMETER (FFTW_PRESERVE_INPUT=16) + INTEGER FFTW_PATIENT + PARAMETER (FFTW_PATIENT=32) + INTEGER FFTW_ESTIMATE + PARAMETER (FFTW_ESTIMATE=64) + INTEGER FFTW_ESTIMATE_PATIENT + PARAMETER (FFTW_ESTIMATE_PATIENT=128) + INTEGER FFTW_BELIEVE_PCOST + PARAMETER (FFTW_BELIEVE_PCOST=256) + INTEGER FFTW_DFT_R2HC_ICKY + PARAMETER (FFTW_DFT_R2HC_ICKY=512) + INTEGER FFTW_NONTHREADED_ICKY + PARAMETER (FFTW_NONTHREADED_ICKY=1024) + INTEGER FFTW_NO_BUFFERING + PARAMETER (FFTW_NO_BUFFERING=2048) + INTEGER FFTW_NO_INDIRECT_OP + PARAMETER (FFTW_NO_INDIRECT_OP=4096) + INTEGER FFTW_ALLOW_LARGE_GENERIC + PARAMETER (FFTW_ALLOW_LARGE_GENERIC=8192) + INTEGER FFTW_NO_RANK_SPLITS + PARAMETER (FFTW_NO_RANK_SPLITS=16384) + INTEGER FFTW_NO_VRANK_SPLITS + PARAMETER (FFTW_NO_VRANK_SPLITS=32768) + INTEGER FFTW_NO_VRECURSE + PARAMETER (FFTW_NO_VRECURSE=65536) + INTEGER FFTW_NO_SIMD + PARAMETER (FFTW_NO_SIMD=131072) diff --git a/qmap/libqmap/fftw3.f90 b/qmap/libqmap/fftw3.f90 index f1c8775b..440ccc28 100755 --- a/qmap/libqmap/fftw3.f90 +++ b/qmap/libqmap/fftw3.f90 @@ -1,64 +1,64 @@ - INTEGER FFTW_R2HC
- PARAMETER (FFTW_R2HC=0)
- INTEGER FFTW_HC2R
- PARAMETER (FFTW_HC2R=1)
- INTEGER FFTW_DHT
- PARAMETER (FFTW_DHT=2)
- INTEGER FFTW_REDFT00
- PARAMETER (FFTW_REDFT00=3)
- INTEGER FFTW_REDFT01
- PARAMETER (FFTW_REDFT01=4)
- INTEGER FFTW_REDFT10
- PARAMETER (FFTW_REDFT10=5)
- INTEGER FFTW_REDFT11
- PARAMETER (FFTW_REDFT11=6)
- INTEGER FFTW_RODFT00
- PARAMETER (FFTW_RODFT00=7)
- INTEGER FFTW_RODFT01
- PARAMETER (FFTW_RODFT01=8)
- INTEGER FFTW_RODFT10
- PARAMETER (FFTW_RODFT10=9)
- INTEGER FFTW_RODFT11
- PARAMETER (FFTW_RODFT11=10)
- INTEGER FFTW_FORWARD
- PARAMETER (FFTW_FORWARD=-1)
- INTEGER FFTW_BACKWARD
- PARAMETER (FFTW_BACKWARD=+1)
- INTEGER FFTW_MEASURE
- PARAMETER (FFTW_MEASURE=0)
- INTEGER FFTW_DESTROY_INPUT
- PARAMETER (FFTW_DESTROY_INPUT=1)
- INTEGER FFTW_UNALIGNED
- PARAMETER (FFTW_UNALIGNED=2)
- INTEGER FFTW_CONSERVE_MEMORY
- PARAMETER (FFTW_CONSERVE_MEMORY=4)
- INTEGER FFTW_EXHAUSTIVE
- PARAMETER (FFTW_EXHAUSTIVE=8)
- INTEGER FFTW_PRESERVE_INPUT
- PARAMETER (FFTW_PRESERVE_INPUT=16)
- INTEGER FFTW_PATIENT
- PARAMETER (FFTW_PATIENT=32)
- INTEGER FFTW_ESTIMATE
- PARAMETER (FFTW_ESTIMATE=64)
- INTEGER FFTW_ESTIMATE_PATIENT
- PARAMETER (FFTW_ESTIMATE_PATIENT=128)
- INTEGER FFTW_BELIEVE_PCOST
- PARAMETER (FFTW_BELIEVE_PCOST=256)
- INTEGER FFTW_DFT_R2HC_ICKY
- PARAMETER (FFTW_DFT_R2HC_ICKY=512)
- INTEGER FFTW_NONTHREADED_ICKY
- PARAMETER (FFTW_NONTHREADED_ICKY=1024)
- INTEGER FFTW_NO_BUFFERING
- PARAMETER (FFTW_NO_BUFFERING=2048)
- INTEGER FFTW_NO_INDIRECT_OP
- PARAMETER (FFTW_NO_INDIRECT_OP=4096)
- INTEGER FFTW_ALLOW_LARGE_GENERIC
- PARAMETER (FFTW_ALLOW_LARGE_GENERIC=8192)
- INTEGER FFTW_NO_RANK_SPLITS
- PARAMETER (FFTW_NO_RANK_SPLITS=16384)
- INTEGER FFTW_NO_VRANK_SPLITS
- PARAMETER (FFTW_NO_VRANK_SPLITS=32768)
- INTEGER FFTW_NO_VRECURSE
- PARAMETER (FFTW_NO_VRECURSE=65536)
- INTEGER FFTW_NO_SIMD
- PARAMETER (FFTW_NO_SIMD=131072)
+ INTEGER FFTW_R2HC + PARAMETER (FFTW_R2HC=0) + INTEGER FFTW_HC2R + PARAMETER (FFTW_HC2R=1) + INTEGER FFTW_DHT + PARAMETER (FFTW_DHT=2) + INTEGER FFTW_REDFT00 + PARAMETER (FFTW_REDFT00=3) + INTEGER FFTW_REDFT01 + PARAMETER (FFTW_REDFT01=4) + INTEGER FFTW_REDFT10 + PARAMETER (FFTW_REDFT10=5) + INTEGER FFTW_REDFT11 + PARAMETER (FFTW_REDFT11=6) + INTEGER FFTW_RODFT00 + PARAMETER (FFTW_RODFT00=7) + INTEGER FFTW_RODFT01 + PARAMETER (FFTW_RODFT01=8) + INTEGER FFTW_RODFT10 + PARAMETER (FFTW_RODFT10=9) + INTEGER FFTW_RODFT11 + PARAMETER (FFTW_RODFT11=10) + INTEGER FFTW_FORWARD + PARAMETER (FFTW_FORWARD=-1) + INTEGER FFTW_BACKWARD + PARAMETER (FFTW_BACKWARD=+1) + INTEGER FFTW_MEASURE + PARAMETER (FFTW_MEASURE=0) + INTEGER FFTW_DESTROY_INPUT + PARAMETER (FFTW_DESTROY_INPUT=1) + INTEGER FFTW_UNALIGNED + PARAMETER (FFTW_UNALIGNED=2) + INTEGER FFTW_CONSERVE_MEMORY + PARAMETER (FFTW_CONSERVE_MEMORY=4) + INTEGER FFTW_EXHAUSTIVE + PARAMETER (FFTW_EXHAUSTIVE=8) + INTEGER FFTW_PRESERVE_INPUT + PARAMETER (FFTW_PRESERVE_INPUT=16) + INTEGER FFTW_PATIENT + PARAMETER (FFTW_PATIENT=32) + INTEGER FFTW_ESTIMATE + PARAMETER (FFTW_ESTIMATE=64) + INTEGER FFTW_ESTIMATE_PATIENT + PARAMETER (FFTW_ESTIMATE_PATIENT=128) + INTEGER FFTW_BELIEVE_PCOST + PARAMETER (FFTW_BELIEVE_PCOST=256) + INTEGER FFTW_DFT_R2HC_ICKY + PARAMETER (FFTW_DFT_R2HC_ICKY=512) + INTEGER FFTW_NONTHREADED_ICKY + PARAMETER (FFTW_NONTHREADED_ICKY=1024) + INTEGER FFTW_NO_BUFFERING + PARAMETER (FFTW_NO_BUFFERING=2048) + INTEGER FFTW_NO_INDIRECT_OP + PARAMETER (FFTW_NO_INDIRECT_OP=4096) + INTEGER FFTW_ALLOW_LARGE_GENERIC + PARAMETER (FFTW_ALLOW_LARGE_GENERIC=8192) + INTEGER FFTW_NO_RANK_SPLITS + PARAMETER (FFTW_NO_RANK_SPLITS=16384) + INTEGER FFTW_NO_VRANK_SPLITS + PARAMETER (FFTW_NO_VRANK_SPLITS=32768) + INTEGER FFTW_NO_VRECURSE + PARAMETER (FFTW_NO_VRECURSE=65536) + INTEGER FFTW_NO_SIMD + PARAMETER (FFTW_NO_SIMD=131072) diff --git a/qmap/libqmap/ftninit.f90 b/qmap/libqmap/ftninit.f90 index e126537f..e6871968 100755 --- a/qmap/libqmap/ftninit.f90 +++ b/qmap/libqmap/ftninit.f90 @@ -1,20 +1,20 @@ -subroutine ftninit
-
- use timer_impl, only: init_timer !,fini_timer, limtrace
- use, intrinsic :: iso_c_binding, only: C_NULL_CHAR
- use FFTW3
- character*1 appd
- character addpfx*8
- common/pfxcom/addpfx
-
- lu=8
- call init_timer('./timer.out')
-
- appd='.'
- addpfx=' '
- open(12,file=appd//'/all_qmap.txt',status='unknown',position='append')
- open(17,file=appd//'/red.dat',status='unknown')
- open(19,file=appd//'/livecq.txt',status='unknown')
-
- return
-end subroutine ftninit
+subroutine ftninit + + use timer_impl, only: init_timer !,fini_timer, limtrace + use, intrinsic :: iso_c_binding, only: C_NULL_CHAR + use FFTW3 + character*1 appd + character addpfx*8 + common/pfxcom/addpfx + + lu=8 + call init_timer('./timer.out') + + appd='.' + addpfx=' ' + open(12,file=appd//'/all_qmap.txt',status='unknown',position='append') + open(17,file=appd//'/red.dat',status='unknown') + open(19,file=appd//'/livecq.txt',status='unknown') + + return +end subroutine ftninit diff --git a/qmap/libqmap/ftnquit.f90 b/qmap/libqmap/ftnquit.f90 index 1a329dee..e5e98d1e 100755 --- a/qmap/libqmap/ftnquit.f90 +++ b/qmap/libqmap/ftnquit.f90 @@ -1,8 +1,8 @@ -subroutine ftnquit
-
-! Destroy the FFTW plans
- call four2a(a,-1,1,1,1)
- call fftbig(id,-1)
-
- return
-end subroutine ftnquit
+subroutine ftnquit + +! Destroy the FFTW plans + call four2a(a,-1,1,1,1) + call fftbig(id,-1) + + return +end subroutine ftnquit diff --git a/qmap/libqmap/geocentric.f90 b/qmap/libqmap/geocentric.f90 index 11ea7cb6..59ed90b5 100755 --- a/qmap/libqmap/geocentric.f90 +++ b/qmap/libqmap/geocentric.f90 @@ -1,17 +1,17 @@ -subroutine geocentric(alat,elev,hlt,erad)
-
- implicit real*8 (a-h,o-z)
-
-! IAU 1976 flattening f, equatorial radius a
- f = 1.d0/298.257d0
- a = 6378140.d0
- c = 1.d0/sqrt(1.d0 + (-2.d0 + f)*f*sin(alat)*sin(alat))
- arcf = (a*c + elev)*cos(alat)
- arsf = (a*(1.d0 - f)*(1.d0 - f)*c + elev)*sin(alat)
- hlt = datan2(arsf,arcf)
- erad = sqrt(arcf*arcf + arsf*arsf)
- erad = 0.001d0*erad
-
- return
-end subroutine geocentric
-
+subroutine geocentric(alat,elev,hlt,erad) + + implicit real*8 (a-h,o-z) + +! IAU 1976 flattening f, equatorial radius a + f = 1.d0/298.257d0 + a = 6378140.d0 + c = 1.d0/sqrt(1.d0 + (-2.d0 + f)*f*sin(alat)*sin(alat)) + arcf = (a*c + elev)*cos(alat) + arsf = (a*(1.d0 - f)*(1.d0 - f)*c + elev)*sin(alat) + hlt = datan2(arsf,arcf) + erad = sqrt(arcf*arcf + arsf*arsf) + erad = 0.001d0*erad + + return +end subroutine geocentric + diff --git a/qmap/libqmap/getcand2.f90 b/qmap/libqmap/getcand2.f90 index 08b0acc5..8ebfbb2d 100755 --- a/qmap/libqmap/getcand2.f90 +++ b/qmap/libqmap/getcand2.f90 @@ -1,116 +1,116 @@ -subroutine getcand2(ss,savg0,nts_q65,nagain,nhsym,ntx30a,ntx30b, &
- ntol,f0_selected,bAlso30,cand,ncand2)
-
-! Get candidates for Q65 decodes, based on presence of sync tone.
-
- type candidate
- real :: snr !Relative S/N of sync detection
- real :: f !Freq of sync tone, 0 to 96000 Hz
- real :: xdt !DT of matching sync pattern, -1.0 to +4.0 s
- integer :: ntrperiod !60 for Q65-60x, 30 for Q65-30x
- integer :: iseq !0 for first half-minute, 1 for second half
- end type candidate
-
- parameter (NFFT=32768) !FFTs done in symspec()
- parameter (MAX_CANDIDATES=50)
- type(candidate) :: cand(MAX_CANDIDATES)
- real ss(400,NFFT) !Symbol spectra
- real savg0(NFFT),savg(NFFT) !Average spectra over whole Rx sequence
- integer ipk1(1) !Peak index of local portion of spectrum
- logical sync_ok !True if sync pattern is present
- logical*1 bAlso30
- data nseg/16/,npct/40/
-
- savg=savg0 !Save the original spectrum
- nlen=NFFT/nseg
- do iseg=1,nseg !Normalize spectrum with nearby baseline
- ja=(iseg-1)*nlen + 1
- jb=ja + nlen - 1
- call pctile(savg(ja),nlen,npct,base)
- savg(ja:jb)=savg(ja:jb)/(1.015*base)
- savg0(ja:jb)=savg0(ja:jb)/(1.015*base)
- enddo
-
- df=96000.0/NFFT
- bw=65*nts_q65*1.666666667 !Bandwidth of Q65 signal
- nbw=bw/df + 1 !Bandwidth in bins
- nb0=2*nts_q65 !Range of peak search, in bins
- smin=1.4 !First threshold
- nguard=5 !Guard range in bins
- i1=1
- i2=NFFT-nbw-nguard
- if(nagain.ge.1) then
- i1=nint((1000.0*f0_selected-ntol)/df)
- i2=nint((1000.0*f0_selected+ntol)/df)
- endif
-
- j=0
- do i=i1,i2 !Look for local peaks in average spectrum
- if(savg(i).lt.smin) cycle
- spk=maxval(savg(i:i+nb0))
- ipk1=maxloc(savg(i:i+nb0))
- i0=ipk1(1) + i - 1 !Index of local peak in savg()
- fpk=0.001*i0*df !Frequency of peak (kHz)
-! Check to see if sync tone is present.
- ntrperiod=60
- iseq=0
- if(nhsym.ge.200) then
- call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt)
- if(sync_ok) then
-! Sync tone is present, we have a candidate for decoding
- j=j+1
- cand(j)%f=fpk
- cand(j)%xdt=xdt
- cand(j)%snr=snr_sync
- cand(j)%ntrperiod=ntrperiod
- cand(j)%iseq=iseq
- ia=max(1,min(i,i0-nguard))
- ib=min(i0+nbw+nguard,32768)
- savg(ia:ib)=0.
- if(j.ge.MAX_CANDIDATES) exit
- endif
- endif
-
- if(.not.bAlso30) cycle
- ntrperiod=30
-
- if(nhsym.le.200 .and. ntx30a.le.5) then
- call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt)
- if(sync_ok) then
-! Sync tone is present, we have a candidate for decoding
- j=j+1
- cand(j)%f=fpk
- cand(j)%xdt=xdt
- cand(j)%snr=snr_sync
- cand(j)%ntrperiod=ntrperiod
- cand(j)%iseq=iseq
- ia=max(1,min(i,i0-nguard))
- ib=min(i0+nbw+nguard,32768)
- savg(ia:ib)=0.
- if(j.ge.MAX_CANDIDATES) exit
- endif
- endif
-
- iseq=1
- if(nhsym.ge.330 .and. ntx30b.le.5) then
- call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt)
- if(sync_ok) then
-! Sync tone is present, we have a candidate for decoding
- j=j+1
- cand(j)%f=fpk
- cand(j)%xdt=xdt
- cand(j)%snr=snr_sync
- cand(j)%ntrperiod=ntrperiod
- cand(j)%iseq=iseq
- ia=max(1,min(i,i0-nguard))
- ib=min(i0+nbw+nguard,32768)
- savg(ia:ib)=0.
- if(j.ge.MAX_CANDIDATES) exit
- endif
- endif
-
- enddo
- ncand2=j !Total number of candidates found
-
- return
-end subroutine getcand2
+subroutine getcand2(ss,savg0,nts_q65,nagain,nhsym,ntx30a,ntx30b, & + ntol,f0_selected,bAlso30,cand,ncand2) + +! Get candidates for Q65 decodes, based on presence of sync tone. + + type candidate + real :: snr !Relative S/N of sync detection + real :: f !Freq of sync tone, 0 to 96000 Hz + real :: xdt !DT of matching sync pattern, -1.0 to +4.0 s + integer :: ntrperiod !60 for Q65-60x, 30 for Q65-30x + integer :: iseq !0 for first half-minute, 1 for second half + end type candidate + + parameter (NFFT=32768) !FFTs done in symspec() + parameter (MAX_CANDIDATES=50) + type(candidate) :: cand(MAX_CANDIDATES) + real ss(400,NFFT) !Symbol spectra + real savg0(NFFT),savg(NFFT) !Average spectra over whole Rx sequence + integer ipk1(1) !Peak index of local portion of spectrum + logical sync_ok !True if sync pattern is present + logical*1 bAlso30 + data nseg/16/,npct/40/ + + savg=savg0 !Save the original spectrum + nlen=NFFT/nseg + do iseg=1,nseg !Normalize spectrum with nearby baseline + ja=(iseg-1)*nlen + 1 + jb=ja + nlen - 1 + call pctile(savg(ja),nlen,npct,base) + savg(ja:jb)=savg(ja:jb)/(1.015*base) + savg0(ja:jb)=savg0(ja:jb)/(1.015*base) + enddo + + df=96000.0/NFFT + bw=65*nts_q65*1.666666667 !Bandwidth of Q65 signal + nbw=bw/df + 1 !Bandwidth in bins + nb0=2*nts_q65 !Range of peak search, in bins + smin=1.4 !First threshold + nguard=5 !Guard range in bins + i1=1 + i2=NFFT-nbw-nguard + if(nagain.ge.1) then + i1=nint((1000.0*f0_selected-ntol)/df) + i2=nint((1000.0*f0_selected+ntol)/df) + endif + + j=0 + do i=i1,i2 !Look for local peaks in average spectrum + if(savg(i).lt.smin) cycle + spk=maxval(savg(i:i+nb0)) + ipk1=maxloc(savg(i:i+nb0)) + i0=ipk1(1) + i - 1 !Index of local peak in savg() + fpk=0.001*i0*df !Frequency of peak (kHz) +! Check to see if sync tone is present. + ntrperiod=60 + iseq=0 + if(nhsym.ge.200) then + call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt) + if(sync_ok) then +! Sync tone is present, we have a candidate for decoding + j=j+1 + cand(j)%f=fpk + cand(j)%xdt=xdt + cand(j)%snr=snr_sync + cand(j)%ntrperiod=ntrperiod + cand(j)%iseq=iseq + ia=max(1,min(i,i0-nguard)) + ib=min(i0+nbw+nguard,32768) + savg(ia:ib)=0. + if(j.ge.MAX_CANDIDATES) exit + endif + endif + + if(.not.bAlso30) cycle + ntrperiod=30 + + if(nhsym.le.200 .and. ntx30a.le.5) then + call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt) + if(sync_ok) then +! Sync tone is present, we have a candidate for decoding + j=j+1 + cand(j)%f=fpk + cand(j)%xdt=xdt + cand(j)%snr=snr_sync + cand(j)%ntrperiod=ntrperiod + cand(j)%iseq=iseq + ia=max(1,min(i,i0-nguard)) + ib=min(i0+nbw+nguard,32768) + savg(ia:ib)=0. + if(j.ge.MAX_CANDIDATES) exit + endif + endif + + iseq=1 + if(nhsym.ge.330 .and. ntx30b.le.5) then + call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt) + if(sync_ok) then +! Sync tone is present, we have a candidate for decoding + j=j+1 + cand(j)%f=fpk + cand(j)%xdt=xdt + cand(j)%snr=snr_sync + cand(j)%ntrperiod=ntrperiod + cand(j)%iseq=iseq + ia=max(1,min(i,i0-nguard)) + ib=min(i0+nbw+nguard,32768) + savg(ia:ib)=0. + if(j.ge.MAX_CANDIDATES) exit + endif + endif + + enddo + ncand2=j !Total number of candidates found + + return +end subroutine getcand2 diff --git a/qmap/libqmap/getdphi.f90 b/qmap/libqmap/getdphi.f90 index f44c2d06..e55d7120 100755 --- a/qmap/libqmap/getdphi.f90 +++ b/qmap/libqmap/getdphi.f90 @@ -1,18 +1,18 @@ -subroutine getdphi(qphi)
-
- real qphi(12)
-
- s=0.
- c=0.
- do i=1,12
- th=i*30/57.2957795
- s=s+qphi(i)*sin(th)
- c=c+qphi(i)*cos(th)
- enddo
-
- dphi=57.2957795*atan2(s,c)
- write(*,1010) nint(dphi)
-1010 format('!Best-fit Dphi =',i4,' deg')
-
- return
- end
+subroutine getdphi(qphi) + + real qphi(12) + + s=0. + c=0. + do i=1,12 + th=i*30/57.2957795 + s=s+qphi(i)*sin(th) + c=c+qphi(i)*cos(th) + enddo + + dphi=57.2957795*atan2(s,c) + write(*,1010) nint(dphi) +1010 format('!Best-fit Dphi =',i4,' deg') + + return + end diff --git a/qmap/libqmap/grid2deg.f90 b/qmap/libqmap/grid2deg.f90 index 0c776416..344351dd 100755 --- a/qmap/libqmap/grid2deg.f90 +++ b/qmap/libqmap/grid2deg.f90 @@ -1,38 +1,38 @@ -subroutine grid2deg(grid0,dlong,dlat)
-
-! Converts Maidenhead grid locator to degrees of West longitude
-! and North latitude.
-
- character*6 grid0,grid
- character*1 g1,g2,g3,g4,g5,g6
-
- grid=grid0
- i=ichar(grid(5:5))
- if(grid(5:5).eq.' ' .or. i.le.64 .or. i.ge.128) grid(5:6)='mm'
-
- if(grid(1:1).ge.'a' .and. grid(1:1).le.'z') grid(1:1)= &
- char(ichar(grid(1:1))+ichar('A')-ichar('a'))
- if(grid(2:2).ge.'a' .and. grid(2:2).le.'z') grid(2:2)= &
- char(ichar(grid(2:2))+ichar('A')-ichar('a'))
- if(grid(5:5).ge.'A' .and. grid(5:5).le.'Z') grid(5:5)= &
- char(ichar(grid(5:5))-ichar('A')+ichar('a'))
- if(grid(6:6).ge.'A' .and. grid(6:6).le.'Z') grid(6:6)= &
- char(ichar(grid(6:6))-ichar('A')+ichar('a'))
-
- g1=grid(1:1)
- g2=grid(2:2)
- g3=grid(3:3)
- g4=grid(4:4)
- g5=grid(5:5)
- g6=grid(6:6)
-
- nlong = 180 - 20*(ichar(g1)-ichar('A'))
- n20d = 2*(ichar(g3)-ichar('0'))
- xminlong = 5*(ichar(g5)-ichar('a')+0.5)
- dlong = nlong - n20d - xminlong/60.0
- nlat = -90+10*(ichar(g2)-ichar('A')) + ichar(g4)-ichar('0')
- xminlat = 2.5*(ichar(g6)-ichar('a')+0.5)
- dlat = nlat + xminlat/60.0
-
- return
-end subroutine grid2deg
+subroutine grid2deg(grid0,dlong,dlat) + +! Converts Maidenhead grid locator to degrees of West longitude +! and North latitude. + + character*6 grid0,grid + character*1 g1,g2,g3,g4,g5,g6 + + grid=grid0 + i=ichar(grid(5:5)) + if(grid(5:5).eq.' ' .or. i.le.64 .or. i.ge.128) grid(5:6)='mm' + + if(grid(1:1).ge.'a' .and. grid(1:1).le.'z') grid(1:1)= & + char(ichar(grid(1:1))+ichar('A')-ichar('a')) + if(grid(2:2).ge.'a' .and. grid(2:2).le.'z') grid(2:2)= & + char(ichar(grid(2:2))+ichar('A')-ichar('a')) + if(grid(5:5).ge.'A' .and. grid(5:5).le.'Z') grid(5:5)= & + char(ichar(grid(5:5))-ichar('A')+ichar('a')) + if(grid(6:6).ge.'A' .and. grid(6:6).le.'Z') grid(6:6)= & + char(ichar(grid(6:6))-ichar('A')+ichar('a')) + + g1=grid(1:1) + g2=grid(2:2) + g3=grid(3:3) + g4=grid(4:4) + g5=grid(5:5) + g6=grid(6:6) + + nlong = 180 - 20*(ichar(g1)-ichar('A')) + n20d = 2*(ichar(g3)-ichar('0')) + xminlong = 5*(ichar(g5)-ichar('a')+0.5) + dlong = nlong - n20d - xminlong/60.0 + nlat = -90+10*(ichar(g2)-ichar('A')) + ichar(g4)-ichar('0') + xminlat = 2.5*(ichar(g6)-ichar('a')+0.5) + dlat = nlat + xminlat/60.0 + + return +end subroutine grid2deg diff --git a/qmap/libqmap/indexx.f90 b/qmap/libqmap/indexx.f90 index c14587bb..7a35f53b 100755 --- a/qmap/libqmap/indexx.f90 +++ b/qmap/libqmap/indexx.f90 @@ -1,91 +1,91 @@ -subroutine indexx(arr,n,indx)
-
- parameter (M=7,NSTACK=50)
- integer n,indx(n)
- real arr(n)
- integer i,indxt,ir,itemp,j,jstack,k,l,istack(NSTACK)
- real a
-
- do j=1,n
- indx(j)=j
- enddo
-
- jstack=0
- l=1
- ir=n
-1 if(ir-l.lt.M) then
- do j=l+1,ir
- indxt=indx(j)
- a=arr(indxt)
- do i=j-1,1,-1
- if(arr(indx(i)).le.a) goto 2
- indx(i+1)=indx(i)
- enddo
- i=0
-2 indx(i+1)=indxt
- enddo
- if(jstack.eq.0) return
-
- ir=istack(jstack)
- l=istack(jstack-1)
- jstack=jstack-2
-
- else
- k=(l+ir)/2
- itemp=indx(k)
- indx(k)=indx(l+1)
- indx(l+1)=itemp
-
- if(arr(indx(l+1)).gt.arr(indx(ir))) then
- itemp=indx(l+1)
- indx(l+1)=indx(ir)
- indx(ir)=itemp
- endif
-
- if(arr(indx(l)).gt.arr(indx(ir))) then
- itemp=indx(l)
- indx(l)=indx(ir)
- indx(ir)=itemp
- endif
-
- if(arr(indx(l+1)).gt.arr(indx(l))) then
- itemp=indx(l+1)
- indx(l+1)=indx(l)
- indx(l)=itemp
- endif
-
- i=l+1
- j=ir
- indxt=indx(l)
- a=arr(indxt)
-3 continue
- i=i+1
- if(arr(indx(i)).lt.a) goto 3
-
-4 continue
- j=j-1
- if(arr(indx(j)).gt.a) goto 4
- if(j.lt.i) goto 5
- itemp=indx(i)
- indx(i)=indx(j)
- indx(j)=itemp
- goto 3
-
-5 indx(l)=indx(j)
- indx(j)=indxt
- jstack=jstack+2
- if(jstack.gt.NSTACK) stop 'NSTACK too small in indexx'
- if(ir-i+1.ge.j-l)then
- istack(jstack)=ir
- istack(jstack-1)=i
- ir=j-1
- else
- istack(jstack)=j-1
- istack(jstack-1)=l
- l=i
- endif
- endif
- goto 1
-
-end subroutine indexx
-
+subroutine indexx(arr,n,indx) + + parameter (M=7,NSTACK=50) + integer n,indx(n) + real arr(n) + integer i,indxt,ir,itemp,j,jstack,k,l,istack(NSTACK) + real a + + do j=1,n + indx(j)=j + enddo + + jstack=0 + l=1 + ir=n +1 if(ir-l.lt.M) then + do j=l+1,ir + indxt=indx(j) + a=arr(indxt) + do i=j-1,1,-1 + if(arr(indx(i)).le.a) goto 2 + indx(i+1)=indx(i) + enddo + i=0 +2 indx(i+1)=indxt + enddo + if(jstack.eq.0) return + + ir=istack(jstack) + l=istack(jstack-1) + jstack=jstack-2 + + else + k=(l+ir)/2 + itemp=indx(k) + indx(k)=indx(l+1) + indx(l+1)=itemp + + if(arr(indx(l+1)).gt.arr(indx(ir))) then + itemp=indx(l+1) + indx(l+1)=indx(ir) + indx(ir)=itemp + endif + + if(arr(indx(l)).gt.arr(indx(ir))) then + itemp=indx(l) + indx(l)=indx(ir) + indx(ir)=itemp + endif + + if(arr(indx(l+1)).gt.arr(indx(l))) then + itemp=indx(l+1) + indx(l+1)=indx(l) + indx(l)=itemp + endif + + i=l+1 + j=ir + indxt=indx(l) + a=arr(indxt) +3 continue + i=i+1 + if(arr(indx(i)).lt.a) goto 3 + +4 continue + j=j-1 + if(arr(indx(j)).gt.a) goto 4 + if(j.lt.i) goto 5 + itemp=indx(i) + indx(i)=indx(j) + indx(j)=itemp + goto 3 + +5 indx(l)=indx(j) + indx(j)=indxt + jstack=jstack+2 + if(jstack.gt.NSTACK) stop 'NSTACK too small in indexx' + if(ir-i+1.ge.j-l)then + istack(jstack)=ir + istack(jstack-1)=i + ir=j-1 + else + istack(jstack)=j-1 + istack(jstack-1)=l + l=i + endif + endif + goto 1 + +end subroutine indexx + diff --git a/qmap/libqmap/lorentzian.f90 b/qmap/libqmap/lorentzian.f90 index e1ea9693..cd2257a7 100755 --- a/qmap/libqmap/lorentzian.f90 +++ b/qmap/libqmap/lorentzian.f90 @@ -1,102 +1,102 @@ -subroutine lorentzian(y,npts,a)
-
-! Input: y(npts); assume x(i)=i, i=1,npts
-! Output: a(5)
-! a(1) = baseline
-! a(2) = amplitude
-! a(3) = x0
-! a(4) = width
-! a(5) = chisqr
-
- real y(npts)
- real a(5)
- real deltaa(4)
-
- a=0.
- df=12000.0/8192.0 !df = 1.465 Hz
- width=0.
- ipk=0
- ymax=-1.e30
- do i=1,npts
- if(y(i).gt.ymax) then
- ymax=y(i)
- ipk=i
- endif
-! write(50,3001) i,i*df,y(i)
-!3001 format(i6,2f12.3)
- enddo
-! base=(sum(y(ipk-149:ipk-50)) + sum(y(ipk+51:ipk+150)))/200.0
- base=(sum(y(1:20)) + sum(y(npts-19:npts)))/40.0
- stest=ymax - 0.5*(ymax-base)
- ssum=y(ipk)
- do i=1,50
- if(ipk+i.gt.npts) exit
- if(y(ipk+i).lt.stest) exit
- ssum=ssum + y(ipk+i)
- enddo
- do i=1,50
- if(ipk-i.lt.1) exit
- if(y(ipk-i).lt.stest) exit
- ssum=ssum + y(ipk-i)
- enddo
- ww=ssum/y(ipk)
- width=2
- t=ww*ww - 5.67
- if(t.gt.0.0) width=sqrt(t)
- a(1)=base
- a(2)=ymax-base
- a(3)=ipk
- a(4)=width
-
-! Now find Lorentzian parameters
-
- deltaa(1)=0.1
- deltaa(2)=0.1
- deltaa(3)=1.0
- deltaa(4)=1.0
- nterms=4
-
-! Start the iteration
- chisqr=0.
- chisqr0=1.e6
- do iter=1,5
- do j=1,nterms
- chisq1=fchisq0(y,npts,a)
- fn=0.
- delta=deltaa(j)
-10 a(j)=a(j)+delta
- chisq2=fchisq0(y,npts,a)
- if(chisq2.eq.chisq1) go to 10
- if(chisq2.gt.chisq1) then
- delta=-delta !Reverse direction
- a(j)=a(j)+delta
- tmp=chisq1
- chisq1=chisq2
- chisq2=tmp
- endif
-20 fn=fn+1.0
- a(j)=a(j)+delta
- chisq3=fchisq0(y,npts,a)
- if(chisq3.lt.chisq2) then
- chisq1=chisq2
- chisq2=chisq3
- go to 20
- endif
-
-! Find minimum of parabola defined by last three points
- delta=delta*(1./(1.+(chisq1-chisq2)/(chisq3-chisq2))+0.5)
- a(j)=a(j)-delta
- deltaa(j)=deltaa(j)*fn/3.
-! write(*,4000) iter,j,a,chisq2
-!4000 format(i1,i2,4f10.4,f11.3)
- enddo
- chisqr=fchisq0(y,npts,a)
-! write(*,4000) 0,0,a,chisqr
- if(chisqr/chisqr0.gt.0.99) exit
- chisqr0=chisqr
- enddo
- a(5)=chisqr
-
- return
-end subroutine lorentzian
-
+subroutine lorentzian(y,npts,a) + +! Input: y(npts); assume x(i)=i, i=1,npts +! Output: a(5) +! a(1) = baseline +! a(2) = amplitude +! a(3) = x0 +! a(4) = width +! a(5) = chisqr + + real y(npts) + real a(5) + real deltaa(4) + + a=0. + df=12000.0/8192.0 !df = 1.465 Hz + width=0. + ipk=0 + ymax=-1.e30 + do i=1,npts + if(y(i).gt.ymax) then + ymax=y(i) + ipk=i + endif +! write(50,3001) i,i*df,y(i) +!3001 format(i6,2f12.3) + enddo +! base=(sum(y(ipk-149:ipk-50)) + sum(y(ipk+51:ipk+150)))/200.0 + base=(sum(y(1:20)) + sum(y(npts-19:npts)))/40.0 + stest=ymax - 0.5*(ymax-base) + ssum=y(ipk) + do i=1,50 + if(ipk+i.gt.npts) exit + if(y(ipk+i).lt.stest) exit + ssum=ssum + y(ipk+i) + enddo + do i=1,50 + if(ipk-i.lt.1) exit + if(y(ipk-i).lt.stest) exit + ssum=ssum + y(ipk-i) + enddo + ww=ssum/y(ipk) + width=2 + t=ww*ww - 5.67 + if(t.gt.0.0) width=sqrt(t) + a(1)=base + a(2)=ymax-base + a(3)=ipk + a(4)=width + +! Now find Lorentzian parameters + + deltaa(1)=0.1 + deltaa(2)=0.1 + deltaa(3)=1.0 + deltaa(4)=1.0 + nterms=4 + +! Start the iteration + chisqr=0. + chisqr0=1.e6 + do iter=1,5 + do j=1,nterms + chisq1=fchisq0(y,npts,a) + fn=0. + delta=deltaa(j) +10 a(j)=a(j)+delta + chisq2=fchisq0(y,npts,a) + if(chisq2.eq.chisq1) go to 10 + if(chisq2.gt.chisq1) then + delta=-delta !Reverse direction + a(j)=a(j)+delta + tmp=chisq1 + chisq1=chisq2 + chisq2=tmp + endif +20 fn=fn+1.0 + a(j)=a(j)+delta + chisq3=fchisq0(y,npts,a) + if(chisq3.lt.chisq2) then + chisq1=chisq2 + chisq2=chisq3 + go to 20 + endif + +! Find minimum of parabola defined by last three points + delta=delta*(1./(1.+(chisq1-chisq2)/(chisq3-chisq2))+0.5) + a(j)=a(j)-delta + deltaa(j)=deltaa(j)*fn/3. +! write(*,4000) iter,j,a,chisq2 +!4000 format(i1,i2,4f10.4,f11.3) + enddo + chisqr=fchisq0(y,npts,a) +! write(*,4000) 0,0,a,chisqr + if(chisqr/chisqr0.gt.0.99) exit + chisqr0=chisqr + enddo + a(5)=chisqr + + return +end subroutine lorentzian + diff --git a/qmap/libqmap/moon2.f90 b/qmap/libqmap/moon2.f90 index 3228b902..9fa72f1d 100755 --- a/qmap/libqmap/moon2.f90 +++ b/qmap/libqmap/moon2.f90 @@ -1,163 +1,163 @@ -subroutine moon2(y,m,Day,UT,lon,lat,RA,Dec,topRA,topDec,LST,HA,Az,El,dist)
-
- implicit none
-
- integer y !Year
- integer m !Month
- integer Day !Day
- real*8 UT !UTC in hours
- real*8 RA,Dec !RA and Dec of moon
-
-! NB: Double caps are single caps in the writeup.
-
- real*8 NN !Longitude of ascending node
- real*8 i !Inclination to the ecliptic
- real*8 w !Argument of perigee
- real*8 a !Semi-major axis
- real*8 e !Eccentricity
- real*8 MM !Mean anomaly
-
- real*8 v !True anomaly
- real*8 EE !Eccentric anomaly
- real*8 ecl !Obliquity of the ecliptic
-
- real*8 d !Ephemeris time argument in days
- real*8 r !Distance to sun, AU
- real*8 xv,yv !x and y coords in ecliptic
- real*8 lonecl,latecl !Ecliptic long and lat of moon
- real*8 xg,yg,zg !Ecliptic rectangular coords
- real*8 Ms !Mean anomaly of sun
- real*8 ws !Argument of perihelion of sun
- real*8 Ls !Mean longitude of sun (Ns=0)
- real*8 Lm !Mean longitude of moon
- real*8 DD !Mean elongation of moon
- real*8 FF !Argument of latitude for moon
- real*8 xe,ye,ze !Equatorial geocentric coords of moon
- real*8 mpar !Parallax of moon (r_E / d)
- real*8 lat,lon !Station coordinates on earth
- real*8 gclat !Geocentric latitude
- real*8 rho !Earth radius factor
- real*8 GMST0,LST,HA
- real*8 g
- real*8 topRA,topDec !Topocentric coordinates of Moon
- real*8 Az,El
- real*8 dist
-
- real*8 rad,twopi,pi,pio2
- data rad/57.2957795131d0/,twopi/6.283185307d0/
-
- d=367*y - 7*(y+(m+9)/12)/4 + 275*m/9 + Day - 730530 + UT/24.d0
- ecl = 23.4393d0 - 3.563d-7 * d
-
-! Orbital elements for Moon:
- NN = 125.1228d0 - 0.0529538083d0 * d
- i = 5.1454d0
- w = mod(318.0634d0 + 0.1643573223d0 * d + 360000.d0,360.d0)
- a = 60.2666d0
- e = 0.054900d0
- MM = mod(115.3654d0 + 13.0649929509d0 * d + 360000.d0,360.d0)
-
- EE = MM + e*rad*sin(MM/rad) * (1.d0 + e*cos(MM/rad))
- EE = EE - (EE - e*rad*sin(EE/rad)-MM) / (1.d0 - e*cos(EE/rad))
- EE = EE - (EE - e*rad*sin(EE/rad)-MM) / (1.d0 - e*cos(EE/rad))
-
- xv = a * (cos(EE/rad) - e)
- yv = a * (sqrt(1.d0-e*e) * sin(EE/rad))
-
- v = mod(rad*atan2(yv,xv)+720.d0,360.d0)
- r = sqrt(xv*xv + yv*yv)
-
-! Get geocentric position in ecliptic rectangular coordinates:
-
- xg = r * (cos(NN/rad)*cos((v+w)/rad)-sin(NN/rad)*sin((v+w)/rad)*cos(i/rad))
- yg = r * (sin(NN/rad)*cos((v+w)/rad)+cos(NN/rad)*sin((v+w)/rad)*cos(i/rad))
- zg = r * (sin((v+w)/rad)*sin(i/rad))
-
-! Ecliptic longitude and latitude of moon:
- lonecl = mod(rad*atan2(yg/rad,xg/rad)+720.d0,360.d0)
- latecl = rad*atan2(zg/rad,sqrt(xg*xg + yg*yg)/rad)
-
-! Now include orbital perturbations:
- Ms = mod(356.0470d0 + 0.9856002585d0 * d + 3600000.d0,360.d0)
- ws = 282.9404d0 + 4.70935d-5*d
- Ls = mod(Ms + ws + 720.d0,360.d0)
- Lm = mod(MM + w + NN+720.d0,360.d0)
- DD = mod(Lm - Ls + 360.d0,360.d0)
- FF = mod(Lm - NN + 360.d0,360.d0)
-
- lonecl = lonecl &
- - 1.274d0 * sin((MM-2.d0*DD)/rad) &
- + 0.658d0 * sin(2.d0*DD/rad) &
- - 0.186d0 * sin(Ms/rad) &
- - 0.059d0 * sin((2.d0*MM-2.d0*DD)/rad) &
- - 0.057d0 * sin((MM-2.d0*DD+Ms)/rad) &
- + 0.053d0 * sin((MM+2.d0*DD)/rad) &
- + 0.046d0 * sin((2.d0*DD-Ms)/rad) &
- + 0.041d0 * sin((MM-Ms)/rad) &
- - 0.035d0 * sin(DD/rad) &
- - 0.031d0 * sin((MM+Ms)/rad) &
- - 0.015d0 * sin((2.d0*FF-2.d0*DD)/rad) &
- + 0.011d0 * sin((MM-4.d0*DD)/rad)
-
- latecl = latecl &
- - 0.173d0 * sin((FF-2.d0*DD)/rad) &
- - 0.055d0 * sin((MM-FF-2.d0*DD)/rad) &
- - 0.046d0 * sin((MM+FF-2.d0*DD)/rad) &
- + 0.033d0 * sin((FF+2.d0*DD)/rad) &
- + 0.017d0 * sin((2.d0*MM+FF)/rad)
-
- r = 60.36298d0 &
- - 3.27746d0*cos(MM/rad) &
- - 0.57994d0*cos((MM-2.d0*DD)/rad) &
- - 0.46357d0*cos(2.d0*DD/rad) &
- - 0.08904d0*cos(2.d0*MM/rad) &
- + 0.03865d0*cos((2.d0*MM-2.d0*DD)/rad) &
- - 0.03237d0*cos((2.d0*DD-Ms)/rad) &
- - 0.02688d0*cos((MM+2.d0*DD)/rad) &
- - 0.02358d0*cos((MM-2.d0*DD+Ms)/rad) &
- - 0.02030d0*cos((MM-Ms)/rad) &
- + 0.01719d0*cos(DD/rad) &
- + 0.01671d0*cos((MM+Ms)/rad)
-
- dist=r*6378.140d0
-
-! Geocentric coordinates:
-! Rectangular ecliptic coordinates of the moon:
-
- xg = r * cos(lonecl/rad)*cos(latecl/rad)
- yg = r * sin(lonecl/rad)*cos(latecl/rad)
- zg = r * sin(latecl/rad)
-
-! Rectangular equatorial coordinates of the moon:
- xe = xg
- ye = yg*cos(ecl/rad) - zg*sin(ecl/rad)
- ze = yg*sin(ecl/rad) + zg*cos(ecl/rad)
-
-! Right Ascension, Declination:
- RA = mod(rad*atan2(ye,xe)+360.d0,360.d0)
- Dec = rad*atan2(ze,sqrt(xe*xe + ye*ye))
-
-! Now convert to topocentric system:
- mpar=rad*asin(1.d0/r)
-! alt_topoc = alt_geoc - mpar*cos(alt_geoc)
- gclat = lat - 0.1924d0*sin(2.d0*lat/rad)
- rho = 0.99883d0 + 0.00167d0*cos(2.d0*lat/rad)
- GMST0 = (Ls + 180.d0)/15.d0
- LST = mod(GMST0+UT+lon/15.d0+48.d0,24.d0) !LST in hours
- HA = 15.d0*LST - RA !HA in degrees
- g = rad*atan(tan(gclat/rad)/cos(HA/rad))
- topRA = RA - mpar*rho*cos(gclat/rad)*sin(HA/rad)/cos(Dec/rad)
- topDec = Dec - mpar*rho*sin(gclat/rad)*sin((g-Dec)/rad)/sin(g/rad)
-
- HA = 15.d0*LST - topRA !HA in degrees
- if(HA.gt.180.d0) HA=HA-360.d0
- if(HA.lt.-180.d0) HA=HA+360.d0
-
- pi=0.5d0*twopi
- pio2=0.5d0*pi
- call dcoord(pi,pio2-lat/rad,0.d0,lat/rad,ha*twopi/360,topDec/rad,az,el)
- Az=az*rad
- El=El*rad
-
- return
-end subroutine moon2
+subroutine moon2(y,m,Day,UT,lon,lat,RA,Dec,topRA,topDec,LST,HA,Az,El,dist) + + implicit none + + integer y !Year + integer m !Month + integer Day !Day + real*8 UT !UTC in hours + real*8 RA,Dec !RA and Dec of moon + +! NB: Double caps are single caps in the writeup. + + real*8 NN !Longitude of ascending node + real*8 i !Inclination to the ecliptic + real*8 w !Argument of perigee + real*8 a !Semi-major axis + real*8 e !Eccentricity + real*8 MM !Mean anomaly + + real*8 v !True anomaly + real*8 EE !Eccentric anomaly + real*8 ecl !Obliquity of the ecliptic + + real*8 d !Ephemeris time argument in days + real*8 r !Distance to sun, AU + real*8 xv,yv !x and y coords in ecliptic + real*8 lonecl,latecl !Ecliptic long and lat of moon + real*8 xg,yg,zg !Ecliptic rectangular coords + real*8 Ms !Mean anomaly of sun + real*8 ws !Argument of perihelion of sun + real*8 Ls !Mean longitude of sun (Ns=0) + real*8 Lm !Mean longitude of moon + real*8 DD !Mean elongation of moon + real*8 FF !Argument of latitude for moon + real*8 xe,ye,ze !Equatorial geocentric coords of moon + real*8 mpar !Parallax of moon (r_E / d) + real*8 lat,lon !Station coordinates on earth + real*8 gclat !Geocentric latitude + real*8 rho !Earth radius factor + real*8 GMST0,LST,HA + real*8 g + real*8 topRA,topDec !Topocentric coordinates of Moon + real*8 Az,El + real*8 dist + + real*8 rad,twopi,pi,pio2 + data rad/57.2957795131d0/,twopi/6.283185307d0/ + + d=367*y - 7*(y+(m+9)/12)/4 + 275*m/9 + Day - 730530 + UT/24.d0 + ecl = 23.4393d0 - 3.563d-7 * d + +! Orbital elements for Moon: + NN = 125.1228d0 - 0.0529538083d0 * d + i = 5.1454d0 + w = mod(318.0634d0 + 0.1643573223d0 * d + 360000.d0,360.d0) + a = 60.2666d0 + e = 0.054900d0 + MM = mod(115.3654d0 + 13.0649929509d0 * d + 360000.d0,360.d0) + + EE = MM + e*rad*sin(MM/rad) * (1.d0 + e*cos(MM/rad)) + EE = EE - (EE - e*rad*sin(EE/rad)-MM) / (1.d0 - e*cos(EE/rad)) + EE = EE - (EE - e*rad*sin(EE/rad)-MM) / (1.d0 - e*cos(EE/rad)) + + xv = a * (cos(EE/rad) - e) + yv = a * (sqrt(1.d0-e*e) * sin(EE/rad)) + + v = mod(rad*atan2(yv,xv)+720.d0,360.d0) + r = sqrt(xv*xv + yv*yv) + +! Get geocentric position in ecliptic rectangular coordinates: + + xg = r * (cos(NN/rad)*cos((v+w)/rad)-sin(NN/rad)*sin((v+w)/rad)*cos(i/rad)) + yg = r * (sin(NN/rad)*cos((v+w)/rad)+cos(NN/rad)*sin((v+w)/rad)*cos(i/rad)) + zg = r * (sin((v+w)/rad)*sin(i/rad)) + +! Ecliptic longitude and latitude of moon: + lonecl = mod(rad*atan2(yg/rad,xg/rad)+720.d0,360.d0) + latecl = rad*atan2(zg/rad,sqrt(xg*xg + yg*yg)/rad) + +! Now include orbital perturbations: + Ms = mod(356.0470d0 + 0.9856002585d0 * d + 3600000.d0,360.d0) + ws = 282.9404d0 + 4.70935d-5*d + Ls = mod(Ms + ws + 720.d0,360.d0) + Lm = mod(MM + w + NN+720.d0,360.d0) + DD = mod(Lm - Ls + 360.d0,360.d0) + FF = mod(Lm - NN + 360.d0,360.d0) + + lonecl = lonecl & + - 1.274d0 * sin((MM-2.d0*DD)/rad) & + + 0.658d0 * sin(2.d0*DD/rad) & + - 0.186d0 * sin(Ms/rad) & + - 0.059d0 * sin((2.d0*MM-2.d0*DD)/rad) & + - 0.057d0 * sin((MM-2.d0*DD+Ms)/rad) & + + 0.053d0 * sin((MM+2.d0*DD)/rad) & + + 0.046d0 * sin((2.d0*DD-Ms)/rad) & + + 0.041d0 * sin((MM-Ms)/rad) & + - 0.035d0 * sin(DD/rad) & + - 0.031d0 * sin((MM+Ms)/rad) & + - 0.015d0 * sin((2.d0*FF-2.d0*DD)/rad) & + + 0.011d0 * sin((MM-4.d0*DD)/rad) + + latecl = latecl & + - 0.173d0 * sin((FF-2.d0*DD)/rad) & + - 0.055d0 * sin((MM-FF-2.d0*DD)/rad) & + - 0.046d0 * sin((MM+FF-2.d0*DD)/rad) & + + 0.033d0 * sin((FF+2.d0*DD)/rad) & + + 0.017d0 * sin((2.d0*MM+FF)/rad) + + r = 60.36298d0 & + - 3.27746d0*cos(MM/rad) & + - 0.57994d0*cos((MM-2.d0*DD)/rad) & + - 0.46357d0*cos(2.d0*DD/rad) & + - 0.08904d0*cos(2.d0*MM/rad) & + + 0.03865d0*cos((2.d0*MM-2.d0*DD)/rad) & + - 0.03237d0*cos((2.d0*DD-Ms)/rad) & + - 0.02688d0*cos((MM+2.d0*DD)/rad) & + - 0.02358d0*cos((MM-2.d0*DD+Ms)/rad) & + - 0.02030d0*cos((MM-Ms)/rad) & + + 0.01719d0*cos(DD/rad) & + + 0.01671d0*cos((MM+Ms)/rad) + + dist=r*6378.140d0 + +! Geocentric coordinates: +! Rectangular ecliptic coordinates of the moon: + + xg = r * cos(lonecl/rad)*cos(latecl/rad) + yg = r * sin(lonecl/rad)*cos(latecl/rad) + zg = r * sin(latecl/rad) + +! Rectangular equatorial coordinates of the moon: + xe = xg + ye = yg*cos(ecl/rad) - zg*sin(ecl/rad) + ze = yg*sin(ecl/rad) + zg*cos(ecl/rad) + +! Right Ascension, Declination: + RA = mod(rad*atan2(ye,xe)+360.d0,360.d0) + Dec = rad*atan2(ze,sqrt(xe*xe + ye*ye)) + +! Now convert to topocentric system: + mpar=rad*asin(1.d0/r) +! alt_topoc = alt_geoc - mpar*cos(alt_geoc) + gclat = lat - 0.1924d0*sin(2.d0*lat/rad) + rho = 0.99883d0 + 0.00167d0*cos(2.d0*lat/rad) + GMST0 = (Ls + 180.d0)/15.d0 + LST = mod(GMST0+UT+lon/15.d0+48.d0,24.d0) !LST in hours + HA = 15.d0*LST - RA !HA in degrees + g = rad*atan(tan(gclat/rad)/cos(HA/rad)) + topRA = RA - mpar*rho*cos(gclat/rad)*sin(HA/rad)/cos(Dec/rad) + topDec = Dec - mpar*rho*sin(gclat/rad)*sin((g-Dec)/rad)/sin(g/rad) + + HA = 15.d0*LST - topRA !HA in degrees + if(HA.gt.180.d0) HA=HA-360.d0 + if(HA.lt.-180.d0) HA=HA+360.d0 + + pi=0.5d0*twopi + pio2=0.5d0*pi + call dcoord(pi,pio2-lat/rad,0.d0,lat/rad,ha*twopi/360,topDec/rad,az,el) + Az=az*rad + El=El*rad + + return +end subroutine moon2 diff --git a/qmap/libqmap/moondop.f90 b/qmap/libqmap/moondop.f90 index 72d137a7..096c3128 100755 --- a/qmap/libqmap/moondop.f90 +++ b/qmap/libqmap/moondop.f90 @@ -1,72 +1,72 @@ -subroutine MoonDop(nyear,month,nday,uth4,lon4,lat4,RAMoon4,DecMoon4, &
- LST4,HA4,AzMoon4,ElMoon4,vr4,dist4)
-
- implicit real*8 (a-h,o-z)
- real*4 uth4 !UT in hours
- real*4 lon4 !West longitude, degrees
- real*4 lat4 !Latitude, degrees
- real*4 RAMoon4 !Topocentric RA of moon, hours
- real*4 DecMoon4 !Topocentric Dec of Moon, degrees
- real*4 LST4 !Locat sidereal time, hours
- real*4 HA4 !Local Hour angle, degrees
- real*4 AzMoon4 !Topocentric Azimuth of moon, degrees
- real*4 ElMoon4 !Topocentric Elevation of moon, degrees
- real*4 vr4 !Radial velocity of moon wrt obs, km/s
- real*4 dist4 !Echo time, seconds
-
- real*8 LST
- real*8 RME(6) !Vector from Earth center to Moon
- real*8 RAE(6) !Vector from Earth center to Obs
- real*8 RMA(6) !Vector from Obs to Moon
- real*8 rme0(6)
- logical km
-
- data rad/57.2957795130823d0/,twopi/6.28310530717959d0/
-
- km=.true.
- dlat=lat4/rad
- dlong1=lon4/rad
- elev1=200.d0
- call geocentric(dlat,elev1,dlat1,erad1)
-
- dt=100.d0 !For numerical derivative, in seconds
- UT=uth4
-
-! NB: geodetic latitude used here, but geocentric latitude used when
-! determining Earth-rotation contribution to Doppler.
-
- call moon2(nyear,month,nDay,UT-dt/3600.d0,dlong1*rad,dlat*rad, &
- RA,Dec,topRA,topDec,LST,HA,Az0,El0,dist)
- call toxyz(RA/rad,Dec/rad,dist,rme0) !Convert to rectangular coords
-
- call moon2(nyear,month,nDay,UT,dlong1*rad,dlat*rad, &
- RA,Dec,topRA,topDec,LST,HA,Az,El,dist)
- call toxyz(RA/rad,Dec/rad,dist,rme) !Convert to rectangular coords
-
- phi=LST*twopi/24.d0
- call toxyz(phi,dlat1,erad1,rae) !Gencentric numbers used here!
- radps=twopi/(86400.d0/1.002737909d0)
- rae(4)=-rae(2)*radps !Vel of Obs wrt Earth center
- rae(5)=rae(1)*radps
- rae(6)=0.d0
-
- do i=1,3
- rme(i+3)=(rme(i)-rme0(i))/dt
- rma(i)=rme(i)-rae(i)
- rma(i+3)=rme(i+3)-rae(i+3)
- enddo
-
- call fromxyz(rma,alpha1,delta1,dtopo0) !Get topocentric coords
- vr=dot(rma(4),rma)/dtopo0
-
- RAMoon4=topRA
- DecMoon4=topDec
- LST4=LST
- HA4=HA
- AzMoon4=Az
- ElMoon4=El
- vr4=vr
- dist4=dist
-
- return
-end subroutine MoonDop
+subroutine MoonDop(nyear,month,nday,uth4,lon4,lat4,RAMoon4,DecMoon4, & + LST4,HA4,AzMoon4,ElMoon4,vr4,dist4) + + implicit real*8 (a-h,o-z) + real*4 uth4 !UT in hours + real*4 lon4 !West longitude, degrees + real*4 lat4 !Latitude, degrees + real*4 RAMoon4 !Topocentric RA of moon, hours + real*4 DecMoon4 !Topocentric Dec of Moon, degrees + real*4 LST4 !Locat sidereal time, hours + real*4 HA4 !Local Hour angle, degrees + real*4 AzMoon4 !Topocentric Azimuth of moon, degrees + real*4 ElMoon4 !Topocentric Elevation of moon, degrees + real*4 vr4 !Radial velocity of moon wrt obs, km/s + real*4 dist4 !Echo time, seconds + + real*8 LST + real*8 RME(6) !Vector from Earth center to Moon + real*8 RAE(6) !Vector from Earth center to Obs + real*8 RMA(6) !Vector from Obs to Moon + real*8 rme0(6) + logical km + + data rad/57.2957795130823d0/,twopi/6.28310530717959d0/ + + km=.true. + dlat=lat4/rad + dlong1=lon4/rad + elev1=200.d0 + call geocentric(dlat,elev1,dlat1,erad1) + + dt=100.d0 !For numerical derivative, in seconds + UT=uth4 + +! NB: geodetic latitude used here, but geocentric latitude used when +! determining Earth-rotation contribution to Doppler. + + call moon2(nyear,month,nDay,UT-dt/3600.d0,dlong1*rad,dlat*rad, & + RA,Dec,topRA,topDec,LST,HA,Az0,El0,dist) + call toxyz(RA/rad,Dec/rad,dist,rme0) !Convert to rectangular coords + + call moon2(nyear,month,nDay,UT,dlong1*rad,dlat*rad, & + RA,Dec,topRA,topDec,LST,HA,Az,El,dist) + call toxyz(RA/rad,Dec/rad,dist,rme) !Convert to rectangular coords + + phi=LST*twopi/24.d0 + call toxyz(phi,dlat1,erad1,rae) !Gencentric numbers used here! + radps=twopi/(86400.d0/1.002737909d0) + rae(4)=-rae(2)*radps !Vel of Obs wrt Earth center + rae(5)=rae(1)*radps + rae(6)=0.d0 + + do i=1,3 + rme(i+3)=(rme(i)-rme0(i))/dt + rma(i)=rme(i)-rae(i) + rma(i+3)=rme(i+3)-rae(i+3) + enddo + + call fromxyz(rma,alpha1,delta1,dtopo0) !Get topocentric coords + vr=dot(rma(4),rma)/dtopo0 + + RAMoon4=topRA + DecMoon4=topDec + LST4=LST + HA4=HA + AzMoon4=Az + ElMoon4=El + vr4=vr + dist4=dist + + return +end subroutine MoonDop diff --git a/qmap/libqmap/msgs.txt b/qmap/libqmap/msgs.txt index c38aba97..cb063042 100755 --- a/qmap/libqmap/msgs.txt +++ b/qmap/libqmap/msgs.txt @@ -1,60 +1,60 @@ -W1AAA K2BBB EM00
-W2CCC K3DDD EM01
-W3EEE K4FFF EM02
-W5GGG K6HHH EM03
-W7III K8JJJ EM04
-W9KKK K0LLL EM05
-G0MMM F1NNN JN06
-G2OOO F3PPP JN07
-G4QQQ F5RRR JN08
-G6SSS F7TTT JN09
-W1XAA K2XBB EM10
-W2XCC K3XDD EM11
-W3XEE K4XFF EM12
-W5XGG K6XHH EM13
-W7XII K8XJJ EM14
-W9XKK K0XLL EM15
-G0XMM F1XNN JN16
-G2XOO F3XPP JN17
-G4XQQ F5XRR JN18
-G6XSS F7XTT JN19
-W1YAA K2YBB EM20
-W2YCC K3YDD EM21
-W3YEE K4YFF EM22
-W5YGG K6YHH EM23
-W7YII K8YJJ EM24
-W9YKK K0YLL EM25
-G0YMM F1YNN JN26
-G2YOO F3YPP JN27
-G4YQQ F5YRR JN28
-G6YSS F7YTT JN29
-W1ZAA K2ZBB EM30
-W2ZCC K3ZDD EM31
-W3ZEE K4ZFF EM32
-W5ZGG K6ZHH EM33
-W7ZII K8ZJJ EM34
-W9ZKK K0ZLL EM35
-G0ZMM F1ZNN JN36
-G2ZOO F3ZPP JN37
-G4ZQQ F5ZRR JN38
-G6ZSS F7ZTT JN39
-W1AXA K2BXB EM40
-W2CXC K3DXD EM41
-W3EXE K4FXF EM42
-W5GXG K6HXH EM43
-W7IXI K8JXJ EM44
-W9KXK K0LXL EM45
-G0MXM F1NXN JN46
-G2OXO F3PXP JN47
-G4QXQ F5RXR JN48
-G6SXS F7TXT JN49
-W1AYA K2BYB EM50
-W2CYC K3DYD EM51
-W3EYE K4FYF EM52
-W5GYG K6HYH EM53
-W7IYI K8JYJ EM54
-W9KYK K0LYL EM55
-G0MYM F1NYN JN56
-G2OYO F3PYP JN57
-G4QYQ F5RYR JN58
-G6SYS F7TYT JN59
+W1AAA K2BBB EM00 +W2CCC K3DDD EM01 +W3EEE K4FFF EM02 +W5GGG K6HHH EM03 +W7III K8JJJ EM04 +W9KKK K0LLL EM05 +G0MMM F1NNN JN06 +G2OOO F3PPP JN07 +G4QQQ F5RRR JN08 +G6SSS F7TTT JN09 +W1XAA K2XBB EM10 +W2XCC K3XDD EM11 +W3XEE K4XFF EM12 +W5XGG K6XHH EM13 +W7XII K8XJJ EM14 +W9XKK K0XLL EM15 +G0XMM F1XNN JN16 +G2XOO F3XPP JN17 +G4XQQ F5XRR JN18 +G6XSS F7XTT JN19 +W1YAA K2YBB EM20 +W2YCC K3YDD EM21 +W3YEE K4YFF EM22 +W5YGG K6YHH EM23 +W7YII K8YJJ EM24 +W9YKK K0YLL EM25 +G0YMM F1YNN JN26 +G2YOO F3YPP JN27 +G4YQQ F5YRR JN28 +G6YSS F7YTT JN29 +W1ZAA K2ZBB EM30 +W2ZCC K3ZDD EM31 +W3ZEE K4ZFF EM32 +W5ZGG K6ZHH EM33 +W7ZII K8ZJJ EM34 +W9ZKK K0ZLL EM35 +G0ZMM F1ZNN JN36 +G2ZOO F3ZPP JN37 +G4ZQQ F5ZRR JN38 +G6ZSS F7ZTT JN39 +W1AXA K2BXB EM40 +W2CXC K3DXD EM41 +W3EXE K4FXF EM42 +W5GXG K6HXH EM43 +W7IXI K8JXJ EM44 +W9KXK K0LXL EM45 +G0MXM F1NXN JN46 +G2OXO F3PXP JN47 +G4QXQ F5RXR JN48 +G6SXS F7TXT JN49 +W1AYA K2BYB EM50 +W2CYC K3DYD EM51 +W3EYE K4FYF EM52 +W5GYG K6HYH EM53 +W7IYI K8JYJ EM54 +W9KYK K0LYL EM55 +G0MYM F1NYN JN56 +G2OYO F3PYP JN57 +G4QYQ F5RYR JN58 +G6SYS F7TYT JN59 diff --git a/qmap/libqmap/njunk.f90 b/qmap/libqmap/njunk.f90 index 8fa19aca..c9e70a8d 100755 --- a/qmap/libqmap/njunk.f90 +++ b/qmap/libqmap/njunk.f90 @@ -1 +1 @@ - parameter(NJUNK=42)
+ parameter(NJUNK=42) diff --git a/qmap/libqmap/pfx.f90 b/qmap/libqmap/pfx.f90 index 1e7b2d97..724b0f8a 100755 --- a/qmap/libqmap/pfx.f90 +++ b/qmap/libqmap/pfx.f90 @@ -1,50 +1,50 @@ - parameter (NZ=339) !Total number of prefixes
- parameter (NZ2=12) !Total number of suffixes
- character*1 sfx(NZ2)
- character*5 pfx(NZ)
-
- data sfx/'P','0','1','2','3','4','5','6','7','8','9','A'/
- data pfx/ &
- '1A ','1S ','3A ','3B6 ','3B8 ','3B9 ','3C ','3C0 ', &
- '3D2 ','3D2C ','3D2R ','3DA ','3V ','3W ','3X ','3Y ', &
- '3YB ','3YP ','4J ','4L ','4S ','4U1I ','4U1U ','4W ', &
- '4X ','5A ','5B ','5H ','5N ','5R ','5T ','5U ', &
- '5V ','5W ','5X ','5Z ','6W ','6Y ','7O ','7P ', &
- '7Q ','7X ','8P ','8Q ','8R ','9A ','9G ','9H ', &
- '9J ','9K ','9L ','9M2 ','9M6 ','9N ','9Q ','9U ', &
- '9V ','9X ','9Y ','A2 ','A3 ','A4 ','A5 ','A6 ', &
- 'A7 ','A9 ','AP ','BS7 ','BV ','BV9 ','BY ','C2 ', &
- 'C3 ','C5 ','C6 ','C9 ','CE ','CE0X ','CE0Y ','CE0Z ', &
- 'CE9 ','CM ','CN ','CP ','CT ','CT3 ','CU ','CX ', &
- 'CY0 ','CY9 ','D2 ','D4 ','D6 ','DL ','DU ','E3 ', &
- 'E4 ','EA ','EA6 ','EA8 ','EA9 ','EI ','EK ','EL ', &
- 'EP ','ER ','ES ','ET ','EU ','EX ','EY ','EZ ', &
- 'F ','FG ','FH ','FJ ','FK ','FKC ','FM ','FO ', &
- 'FOA ','FOC ','FOM ','FP ','FR ','FRG ','FRJ ','FRT ', &
- 'FT5W ','FT5X ','FT5Z ','FW ','FY ','M ','MD ','MI ', &
- 'MJ ','MM ', 'MU ','MW ','H4 ','H40 ','HA ', &
- 'HB ','HB0 ','HC ','HC8 ','HH ','HI ','HK ','HK0 ', &
- 'HK0M ','HL ','HM ','HP ','HR ','HS ','HV ','HZ ', &
- 'I ','IS ','IS0 ', 'J2 ','J3 ','J5 ','J6 ', &
- 'J7 ','J8 ','JA ','JDM ','JDO ','JT ','JW ', &
- 'JX ','JY ','K ','KG4 ','KH0 ','KH1 ','KH2 ','KH3 ', &
- 'KH4 ','KH5 ','KH5K ','KH6 ','KH7 ','KH8 ','KH9 ','KL ', &
- 'KP1 ','KP2 ','KP4 ','KP5 ','LA ','LU ','LX ','LY ', &
- 'LZ ','OA ','OD ','OE ','OH ','OH0 ','OJ0 ','OK ', &
- 'OM ','ON ','OX ','OY ','OZ ','P2 ','P4 ','PA ', &
- 'PJ2 ','PJ7 ','PY ','PY0F ','PT0S ','PY0T ','PZ ','R1F ', &
- 'R1M ','S0 ','S2 ','S5 ','S7 ','S9 ','SM ','SP ', &
- 'ST ','SU ','SV ','SVA ','SV5 ','SV9 ','T2 ','T30 ', &
- 'T31 ','T32 ','T33 ','T5 ','T7 ','T8 ','T9 ','TA ', &
- 'TF ','TG ','TI ','TI9 ','TJ ','TK ','TL ', &
- 'TN ','TR ','TT ','TU ','TY ','TZ ','UA ','UA2 ', &
- 'UA9 ','UK ','UN ','UR ','V2 ','V3 ','V4 ','V5 ', &
- 'V6 ','V7 ','V8 ','VE ','VK ','VK0H ','VK0M ','VK9C ', &
- 'VK9L ','VK9M ','VK9N ','VK9W ','VK9X ','VP2E ','VP2M ','VP2V ', &
- 'VP5 ','VP6 ','VP6D ','VP8 ','VP8G ','VP8H ','VP8O ','VP8S ', &
- 'VP9 ','VQ9 ','VR ','VU ','VU4 ','VU7 ','XE ','XF4 ', &
- 'XT ','XU ','XW ','XX9 ','XZ ','YA ','YB ','YI ', &
- 'YJ ','YK ','YL ','YN ','YO ','YS ','YU ','YV ', &
- 'YV0 ','Z2 ','Z3 ','ZA ','ZB ','ZC4 ','ZD7 ','ZD8 ', &
- 'ZD9 ','ZF ','ZK1N ','ZK1S ','ZK2 ','ZK3 ','ZL ','ZL7 ', &
- 'ZL8 ','ZL9 ','ZP ','ZS ','ZS8 ','KC4 ','E5 '/
+ parameter (NZ=339) !Total number of prefixes + parameter (NZ2=12) !Total number of suffixes + character*1 sfx(NZ2) + character*5 pfx(NZ) + + data sfx/'P','0','1','2','3','4','5','6','7','8','9','A'/ + data pfx/ & + '1A ','1S ','3A ','3B6 ','3B8 ','3B9 ','3C ','3C0 ', & + '3D2 ','3D2C ','3D2R ','3DA ','3V ','3W ','3X ','3Y ', & + '3YB ','3YP ','4J ','4L ','4S ','4U1I ','4U1U ','4W ', & + '4X ','5A ','5B ','5H ','5N ','5R ','5T ','5U ', & + '5V ','5W ','5X ','5Z ','6W ','6Y ','7O ','7P ', & + '7Q ','7X ','8P ','8Q ','8R ','9A ','9G ','9H ', & + '9J ','9K ','9L ','9M2 ','9M6 ','9N ','9Q ','9U ', & + '9V ','9X ','9Y ','A2 ','A3 ','A4 ','A5 ','A6 ', & + 'A7 ','A9 ','AP ','BS7 ','BV ','BV9 ','BY ','C2 ', & + 'C3 ','C5 ','C6 ','C9 ','CE ','CE0X ','CE0Y ','CE0Z ', & + 'CE9 ','CM ','CN ','CP ','CT ','CT3 ','CU ','CX ', & + 'CY0 ','CY9 ','D2 ','D4 ','D6 ','DL ','DU ','E3 ', & + 'E4 ','EA ','EA6 ','EA8 ','EA9 ','EI ','EK ','EL ', & + 'EP ','ER ','ES ','ET ','EU ','EX ','EY ','EZ ', & + 'F ','FG ','FH ','FJ ','FK ','FKC ','FM ','FO ', & + 'FOA ','FOC ','FOM ','FP ','FR ','FRG ','FRJ ','FRT ', & + 'FT5W ','FT5X ','FT5Z ','FW ','FY ','M ','MD ','MI ', & + 'MJ ','MM ', 'MU ','MW ','H4 ','H40 ','HA ', & + 'HB ','HB0 ','HC ','HC8 ','HH ','HI ','HK ','HK0 ', & + 'HK0M ','HL ','HM ','HP ','HR ','HS ','HV ','HZ ', & + 'I ','IS ','IS0 ', 'J2 ','J3 ','J5 ','J6 ', & + 'J7 ','J8 ','JA ','JDM ','JDO ','JT ','JW ', & + 'JX ','JY ','K ','KG4 ','KH0 ','KH1 ','KH2 ','KH3 ', & + 'KH4 ','KH5 ','KH5K ','KH6 ','KH7 ','KH8 ','KH9 ','KL ', & + 'KP1 ','KP2 ','KP4 ','KP5 ','LA ','LU ','LX ','LY ', & + 'LZ ','OA ','OD ','OE ','OH ','OH0 ','OJ0 ','OK ', & + 'OM ','ON ','OX ','OY ','OZ ','P2 ','P4 ','PA ', & + 'PJ2 ','PJ7 ','PY ','PY0F ','PT0S ','PY0T ','PZ ','R1F ', & + 'R1M ','S0 ','S2 ','S5 ','S7 ','S9 ','SM ','SP ', & + 'ST ','SU ','SV ','SVA ','SV5 ','SV9 ','T2 ','T30 ', & + 'T31 ','T32 ','T33 ','T5 ','T7 ','T8 ','T9 ','TA ', & + 'TF ','TG ','TI ','TI9 ','TJ ','TK ','TL ', & + 'TN ','TR ','TT ','TU ','TY ','TZ ','UA ','UA2 ', & + 'UA9 ','UK ','UN ','UR ','V2 ','V3 ','V4 ','V5 ', & + 'V6 ','V7 ','V8 ','VE ','VK ','VK0H ','VK0M ','VK9C ', & + 'VK9L ','VK9M ','VK9N ','VK9W ','VK9X ','VP2E ','VP2M ','VP2V ', & + 'VP5 ','VP6 ','VP6D ','VP8 ','VP8G ','VP8H ','VP8O ','VP8S ', & + 'VP9 ','VQ9 ','VR ','VU ','VU4 ','VU7 ','XE ','XF4 ', & + 'XT ','XU ','XW ','XX9 ','XZ ','YA ','YB ','YI ', & + 'YJ ','YK ','YL ','YN ','YO ','YS ','YU ','YV ', & + 'YV0 ','Z2 ','Z3 ','ZA ','ZB ','ZC4 ','ZD7 ','ZD8 ', & + 'ZD9 ','ZF ','ZK1N ','ZK1S ','ZK2 ','ZK3 ','ZL ','ZL7 ', & + 'ZL8 ','ZL9 ','ZP ','ZS ','ZS8 ','KC4 ','E5 '/ diff --git a/qmap/libqmap/q65_sync.f90 b/qmap/libqmap/q65_sync.f90 index 3e20d7a8..f693ab89 100755 --- a/qmap/libqmap/q65_sync.f90 +++ b/qmap/libqmap/q65_sync.f90 @@ -1,68 +1,68 @@ -subroutine q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr,xdt)
-
-! Test for presence of Q65 sync tone
-
- parameter (NFFT=32768)
- parameter (LAGMAX=33)
- real ss(400,NFFT) !Symbol spectra
- real ccf(0:LAGMAX) !The WSJT "blue curve", peak at DT
- logical sync_ok
- integer isync0(22),isync(22),ipk(1)
-
-! Q65 sync symbols
- data isync0/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/
-
- sync_ok=.false.
-! if(ntrperiod.ne.60) return
-
- tstep=0.15 !0.5*tsym_Q65-30x, 0.25*tsys_Q65-60x
- nfac=4
- if(ntrperiod.eq.30) nfac=2
- do i=1,22 !Expand sync stride for Q65-60x
- isync(i)=nfac*(isync0(i)-1) + 1
- enddo
-
- m=nts_q65/2
- if(ntrperiod.eq.30) m=nts_q65/4
- i1=max(1,i0-m)
- i2=min(NFFT,i0+m)
- ccf=0.
- do lag=0,LAGMAX !Search over range of DT
- do j=1,22 !Test for Q65 sync
- k=isync(j) + lag + iseq*200
- if(k.ge.400) cycle
- if(ntrperiod.eq.60) then
- ccf(lag)=ccf(lag) + sum(ss(k,i1:i2)) + sum(ss(k+1,i1:i2)) &
- + sum(ss(k+2,i1:i2)) + sum(ss(k+3,i1:i2))
- else
- ccf(lag)=ccf(lag) + sum(ss(k,i1:i2)) + sum(ss(k+1,i1:i2))
- endif
-! Q: Should we use weighted sums, perhaps a Lorentzian peak?
- enddo
- enddo
- ccfmax=maxval(ccf)
- ipk=maxloc(ccf)
- lagbest=ipk(1)-1
- xdt=lagbest*tstep - 1.0
- if(ntrperiod.eq.30) xd=xdt+0.6 !Why ???
-
- xsum=0.
- sq=0.
- nsum=0
- fpk=0.001*i0*96000.0/32768.0 + 32.0
- do i=0,lagmax !Compute ave and rms of "blue curve"
- if(abs(i-lagbest).gt.2) then
- xsum=xsum+ccf(i)
- sq=sq+ccf(i)**2
- nsum=nsum+1
- endif
-! write(40,3040) i,i*tstep-1.0,ccf(i),fpk
-!3040 format(i5,3f8.2)
- enddo
- ave=xsum/nsum
- rms=sqrt(sq/nsum - ave*ave)
- snr=(ccfmax-ave)/rms
- sync_ok=snr.ge.5.0 !Require snr > 5.0 for sync detection
-
- return
-end subroutine q65_sync
+subroutine q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr,xdt) + +! Test for presence of Q65 sync tone + + parameter (NFFT=32768) + parameter (LAGMAX=33) + real ss(400,NFFT) !Symbol spectra + real ccf(0:LAGMAX) !The WSJT "blue curve", peak at DT + logical sync_ok + integer isync0(22),isync(22),ipk(1) + +! Q65 sync symbols + data isync0/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/ + + sync_ok=.false. +! if(ntrperiod.ne.60) return + + tstep=0.15 !0.5*tsym_Q65-30x, 0.25*tsys_Q65-60x + nfac=4 + if(ntrperiod.eq.30) nfac=2 + do i=1,22 !Expand sync stride for Q65-60x + isync(i)=nfac*(isync0(i)-1) + 1 + enddo + + m=nts_q65/2 + if(ntrperiod.eq.30) m=nts_q65/4 + i1=max(1,i0-m) + i2=min(NFFT,i0+m) + ccf=0. + do lag=0,LAGMAX !Search over range of DT + do j=1,22 !Test for Q65 sync + k=isync(j) + lag + iseq*200 + if(k.ge.400) cycle + if(ntrperiod.eq.60) then + ccf(lag)=ccf(lag) + sum(ss(k,i1:i2)) + sum(ss(k+1,i1:i2)) & + + sum(ss(k+2,i1:i2)) + sum(ss(k+3,i1:i2)) + else + ccf(lag)=ccf(lag) + sum(ss(k,i1:i2)) + sum(ss(k+1,i1:i2)) + endif +! Q: Should we use weighted sums, perhaps a Lorentzian peak? + enddo + enddo + ccfmax=maxval(ccf) + ipk=maxloc(ccf) + lagbest=ipk(1)-1 + xdt=lagbest*tstep - 1.0 + if(ntrperiod.eq.30) xd=xdt+0.6 !Why ??? + + xsum=0. + sq=0. + nsum=0 + fpk=0.001*i0*96000.0/32768.0 + 32.0 + do i=0,lagmax !Compute ave and rms of "blue curve" + if(abs(i-lagbest).gt.2) then + xsum=xsum+ccf(i) + sq=sq+ccf(i)**2 + nsum=nsum+1 + endif +! write(40,3040) i,i*tstep-1.0,ccf(i),fpk +!3040 format(i5,3f8.2) + enddo + ave=xsum/nsum + rms=sqrt(sq/nsum - ave*ave) + snr=(ccfmax-ave)/rms + sync_ok=snr.ge.5.0 !Require snr > 5.0 for sync detection + + return +end subroutine q65_sync diff --git a/qmap/libqmap/q65b.f90 b/qmap/libqmap/q65b.f90 index cd41626b..b4b325ef 100755 --- a/qmap/libqmap/q65b.f90 +++ b/qmap/libqmap/q65b.f90 @@ -1,172 +1,172 @@ -subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
- ntrperiod,iseq,mycall0,hiscall0,hisgrid,mode_q65,f0,fqso,nkhz_center, &
- newdat,nagain,bClickDecode,max_drift,offset,ndepth,datetime,nCFOM, &
- ndop00,nhsym,idec)
-
-! This routine provides an interface between QMAP and the Q65 decoder
-! in WSJT-X. All arguments are input data obtained from the QMAP GUI.
-! Raw Rx data are available as the 96 kHz complex spectrum ca(MAXFFT1)
-! in common/cacb. Decoded messages are sent back to the GUI.
-
- use q65_decode
- use wavhdr
- use timer_module, only: timer
-
- parameter (MAXFFT1=5376000) !56*96000
- parameter (MAXFFT2=336000) !56*6000 (downsampled by 1/16)
- parameter (NMAX=60*12000)
- parameter (RAD=57.2957795)
- type(hdr) h
- integer*2 iwave(60*12000)
- integer offset
- complex ca(MAXFFT1) !FFT of raw I/Q data from Linrad
- complex cx(0:MAXFFT2-1),cz(0:MAXFFT2)
- real*8 fcenter,freq0,freq1
- logical*1 bClickDecode
- character*12 mycall0,hiscall0
- character*12 mycall,hiscall
- character*6 hisgrid
- character*4 grid4
- character*3 csubmode
- character*17 fname
- character*64 result,ctmp
- character*20 datetime,datetime1
- common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, &
- nWTransmitting,kHzRequested,result(50)
- common/cacb/ca
- data ifile/0/
- save
-
- if(mycall0(1:1).ne.' ') mycall=mycall0
- if(hiscall0(1:1).ne.' ') hiscall=hiscall0
- if(hisgrid(1:4).ne.' ') grid4=hisgrid(1:4)
-
-! Find best frequency from sync_dat, the "orange sync curve".
- df3=96000.0/32768.0
- ipk=(1000.0*f0-1.0)/df3
- if(nagain.ge.2) ipk = nint(1000.0*(fqso-nkhz_center+48.0)/df3)
- nfft1=MAXFFT1
- nfft2=MAXFFT2
- df=96000.0/NFFT1
- nh=nfft2/2
- k0=nint((ipk*df3-1000.0)/df)
- if(k0.lt.nh .or. k0.gt.MAXFFT1-nfft2+1) go to 900
- fac=1.0/nfft2
- cx(0:nfft2-1)=fac*ca(k0:k0+nfft2-1)
-
-! Here cx is frequency-domain data around the selected
-! QSO frequency, taken from the full-length FFT computed in fftbig().
-! Values for fsample, nfft1, nfft2, df, and the downsampled data rate
-! are as follows:
-
-! fSample nfft1 df nfft2 fDownSampled
-! (Hz) (Hz) (Hz)
-!----------------------------------------------------
-! 96000 5376000 0.017857143 336000 6000.000
-
- cz(0:MAXFFT2-1)=cx
- cz(MAXFFT2)=0.
-! Roll off below 500 Hz and above 2500 Hz.
- ja=nint(500.0/df)
- jb=nint(2500.0/df)
- do i=0,ja
- r=0.5*(1.0+cos(i*3.14159/ja))
- cz(ja-i)=r*cz(ja-i)
- cz(jb+i)=r*cz(jb+i)
- enddo
- cz(ja+jb+1:)=0.
-
-!Transform to time domain (real), fsample=12000 Hz
- call four2a(cz,2*nfft2,1,1,-1)
- do i=0,nfft2-1
- j=nfft2-1-i
- iwave(2*i+2)=nint(real(cz(j))) !Note the reversed order!
- iwave(2*i+1)=nint(aimag(cz(j)))
- enddo
- iwave(2*nfft2+1:)=0
-
- nsubmode=mode_q65-1
- nfa=990 !Tight limits around ipk for the wideband decode
- nfb=1010
- if(nagain.ge.1) then !For nagain>=1, use limits of +/- ntol
- nfa=max(100,1000-ntol)
- nfb=min(2500,1000+ntol)
- endif
- nsnr0=-99 !Default snr for no decode
-
- if(iseq.eq.1) iwave(1:360000)=iwave(360001:720000)
-
- csubmode(1:2)='60'
- csubmode(3:3)=char(ichar('A')+nsubmode)
- nhhmmss=100*nutc
- nutc1=nutc
- datetime(12:13)='00'
- datetime1=datetime
- if(ntrperiod.eq.30) then
- csubmode(1:2)='30'
- nhhmmss=100*nutc + iseq*30
- nutc1=nhhmmss
- if(iseq.eq.1) datetime1(12:13)='30'
- endif
-
- if(nagain.ge.2) then
- ifile=ifile+1
- write(fname,1000) ifile
-1000 format('000000_',i6.6,'.wav')
- open(27,file=fname,status='unknown',access='stream')
- if(nagain.eq.2) then
- h=default_header(12000,60*12000)
- ia=1
- ib=60*12000
- else if(nagain.eq.3) then
- h=default_header(12000,30*12000)
- ia=1
- ib=30*12000
- else
- h=default_header(12000,30*12000)
- ia=30*12000 + 1
- ib=60*12000
- endif
- write(27) h,iwave(ia:ib)
- close(27)
- go to 900
- endif
-
-! NB: Frequency of ipk is now shifted to 1000 Hz.
- nagain2=0
- call map65_mmdec(nutc1,iwave,nqd,ntrperiod,nsubmode,nfa,nfb,1000,ntol, &
- newdat,nagain2,max_drift,ndepth,mycall,hiscall,hisgrid)
- MHz=fcenter
- freq0=MHz + 0.001d0*ikhz
-
- if(nsnr0.gt.-99) then
-
- do i=1,ndecodes !Check for dupes
- i1=index(result(i)(42:),trim(msg0))
-! If this is a dupe, don't save it again:
- if(i1.gt.0 .and. (.not.bClickDecode .or. nhsym.eq.390)) go to 800
- enddo
-
- nq65df=nint(1000*(0.001*k0*df+nkhz_center-48.0+1.000-1.27046-ikhz))-nfcal
- nq65df=nq65df + nfreq0 - 1000
- ikhz1=ikhz
- ndf=nq65df
- if(ndf.gt.500) ikhz1=ikhz + (nq65df+500)/1000
- if(ndf.lt.-500) ikhz1=ikhz + (nq65df-500)/1000
- ndf=nq65df - 1000*(ikhz1-ikhz)
- freq1=freq0 + 0.001d0*(ikhz1-ikhz)
- frx=0.001*k0*df+nkhz_center-48.0+1.0 - 0.001*nfcal
- fsked=frx - 0.001*ndop00/2.0 - 0.001*offset
- ctmp=csubmode//' '//trim(msg0)
- ndecodes=min(ndecodes+1,50)
- write(result(ndecodes),1120) nhhmmss,frx,fsked,xdt0,nsnr0,trim(ctmp)
-1120 format(i6.6,f9.3,f7.1,f7.2,i5,2x,a)
- write(12,1130) datetime1,trim(result(ndecodes)(7:))
-1130 format(a13,1x,a)
- result(ndecodes)=trim(result(ndecodes))//char(0)
-800 idec=0
- endif
-
-900 flush(12)
- return
-end subroutine q65b
+subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & + ntrperiod,iseq,mycall0,hiscall0,hisgrid,mode_q65,f0,fqso,nkhz_center, & + newdat,nagain,bClickDecode,max_drift,offset,ndepth,datetime,nCFOM, & + ndop00,nhsym,idec) + +! This routine provides an interface between QMAP and the Q65 decoder +! in WSJT-X. All arguments are input data obtained from the QMAP GUI. +! Raw Rx data are available as the 96 kHz complex spectrum ca(MAXFFT1) +! in common/cacb. Decoded messages are sent back to the GUI. + + use q65_decode + use wavhdr + use timer_module, only: timer + + parameter (MAXFFT1=5376000) !56*96000 + parameter (MAXFFT2=336000) !56*6000 (downsampled by 1/16) + parameter (NMAX=60*12000) + parameter (RAD=57.2957795) + type(hdr) h + integer*2 iwave(60*12000) + integer offset + complex ca(MAXFFT1) !FFT of raw I/Q data from Linrad + complex cx(0:MAXFFT2-1),cz(0:MAXFFT2) + real*8 fcenter,freq0,freq1 + logical*1 bClickDecode + character*12 mycall0,hiscall0 + character*12 mycall,hiscall + character*6 hisgrid + character*4 grid4 + character*3 csubmode + character*17 fname + character*64 result,ctmp + character*20 datetime,datetime1 + common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & + nWTransmitting,kHzRequested,result(50) + common/cacb/ca + data ifile/0/ + save + + if(mycall0(1:1).ne.' ') mycall=mycall0 + if(hiscall0(1:1).ne.' ') hiscall=hiscall0 + if(hisgrid(1:4).ne.' ') grid4=hisgrid(1:4) + +! Find best frequency from sync_dat, the "orange sync curve". + df3=96000.0/32768.0 + ipk=(1000.0*f0-1.0)/df3 + if(nagain.ge.2) ipk = nint(1000.0*(fqso-nkhz_center+48.0)/df3) + nfft1=MAXFFT1 + nfft2=MAXFFT2 + df=96000.0/NFFT1 + nh=nfft2/2 + k0=nint((ipk*df3-1000.0)/df) + if(k0.lt.nh .or. k0.gt.MAXFFT1-nfft2+1) go to 900 + fac=1.0/nfft2 + cx(0:nfft2-1)=fac*ca(k0:k0+nfft2-1) + +! Here cx is frequency-domain data around the selected +! QSO frequency, taken from the full-length FFT computed in fftbig(). +! Values for fsample, nfft1, nfft2, df, and the downsampled data rate +! are as follows: + +! fSample nfft1 df nfft2 fDownSampled +! (Hz) (Hz) (Hz) +!---------------------------------------------------- +! 96000 5376000 0.017857143 336000 6000.000 + + cz(0:MAXFFT2-1)=cx + cz(MAXFFT2)=0. +! Roll off below 500 Hz and above 2500 Hz. + ja=nint(500.0/df) + jb=nint(2500.0/df) + do i=0,ja + r=0.5*(1.0+cos(i*3.14159/ja)) + cz(ja-i)=r*cz(ja-i) + cz(jb+i)=r*cz(jb+i) + enddo + cz(ja+jb+1:)=0. + +!Transform to time domain (real), fsample=12000 Hz + call four2a(cz,2*nfft2,1,1,-1) + do i=0,nfft2-1 + j=nfft2-1-i + iwave(2*i+2)=nint(real(cz(j))) !Note the reversed order! + iwave(2*i+1)=nint(aimag(cz(j))) + enddo + iwave(2*nfft2+1:)=0 + + nsubmode=mode_q65-1 + nfa=990 !Tight limits around ipk for the wideband decode + nfb=1010 + if(nagain.ge.1) then !For nagain>=1, use limits of +/- ntol + nfa=max(100,1000-ntol) + nfb=min(2500,1000+ntol) + endif + nsnr0=-99 !Default snr for no decode + + if(iseq.eq.1) iwave(1:360000)=iwave(360001:720000) + + csubmode(1:2)='60' + csubmode(3:3)=char(ichar('A')+nsubmode) + nhhmmss=100*nutc + nutc1=nutc + datetime(12:13)='00' + datetime1=datetime + if(ntrperiod.eq.30) then + csubmode(1:2)='30' + nhhmmss=100*nutc + iseq*30 + nutc1=nhhmmss + if(iseq.eq.1) datetime1(12:13)='30' + endif + + if(nagain.ge.2) then + ifile=ifile+1 + write(fname,1000) ifile +1000 format('000000_',i6.6,'.wav') + open(27,file=fname,status='unknown',access='stream') + if(nagain.eq.2) then + h=default_header(12000,60*12000) + ia=1 + ib=60*12000 + else if(nagain.eq.3) then + h=default_header(12000,30*12000) + ia=1 + ib=30*12000 + else + h=default_header(12000,30*12000) + ia=30*12000 + 1 + ib=60*12000 + endif + write(27) h,iwave(ia:ib) + close(27) + go to 900 + endif + +! NB: Frequency of ipk is now shifted to 1000 Hz. + nagain2=0 + call map65_mmdec(nutc1,iwave,nqd,ntrperiod,nsubmode,nfa,nfb,1000,ntol, & + newdat,nagain2,max_drift,ndepth,mycall,hiscall,hisgrid) + MHz=fcenter + freq0=MHz + 0.001d0*ikhz + + if(nsnr0.gt.-99) then + + do i=1,ndecodes !Check for dupes + i1=index(result(i)(42:),trim(msg0)) +! If this is a dupe, don't save it again: + if(i1.gt.0 .and. (.not.bClickDecode .or. nhsym.eq.390)) go to 800 + enddo + + nq65df=nint(1000*(0.001*k0*df+nkhz_center-48.0+1.000-1.27046-ikhz))-nfcal + nq65df=nq65df + nfreq0 - 1000 + ikhz1=ikhz + ndf=nq65df + if(ndf.gt.500) ikhz1=ikhz + (nq65df+500)/1000 + if(ndf.lt.-500) ikhz1=ikhz + (nq65df-500)/1000 + ndf=nq65df - 1000*(ikhz1-ikhz) + freq1=freq0 + 0.001d0*(ikhz1-ikhz) + frx=0.001*k0*df+nkhz_center-48.0+1.0 - 0.001*nfcal + fsked=frx - 0.001*ndop00/2.0 - 0.001*offset + ctmp=csubmode//' '//trim(msg0) + ndecodes=min(ndecodes+1,50) + write(result(ndecodes),1120) nhhmmss,frx,fsked,xdt0,nsnr0,trim(ctmp) +1120 format(i6.6,f9.3,f7.1,f7.2,i5,2x,a) + write(12,1130) datetime1,trim(result(ndecodes)(7:)) +1130 format(a13,1x,a) + result(ndecodes)=trim(result(ndecodes))//char(0) +800 idec=0 + endif + +900 flush(12) + return +end subroutine q65b diff --git a/qmap/libqmap/q65c.f90 b/qmap/libqmap/q65c.f90 index 42e24900..c714fe90 100755 --- a/qmap/libqmap/q65c.f90 +++ b/qmap/libqmap/q65c.f90 @@ -1,105 +1,105 @@ -subroutine q65c
-
- use timer_module, only: timer
- use timer_impl, only: fini_timer !, limtrace
- use, intrinsic :: iso_c_binding, only: C_NULL_CHAR
- use FFTW3
- use q65
- use q65_decode
-
- parameter (NFFT=32768)
- include 'njunk.f90'
- real*8 fcenter
- real*4 pdb(4)
- integer nparams0(NJUNK+3),nparams(NJUNK+3)
-! integer values(8)
- logical first
- logical*1 bAlso30
- character*120 fname
- character*22 revision
- character*12 mycall,hiscall
- character*6 mygrid,hisgrid
- character*20 datetime
- character*64 result
- common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, &
- nWTransmitting,kHzRequested,result(50)
- common/datcom2/dd(2,5760000),ss(400,NFFT),savg(NFFT),nparams0
- common/savecom/revision,fname
-!### REMEMBER that /npar/ is not updated until nparams=nparams0 is executed. ###
- common/npar/fcenter,nutc,fselected,mousedf,mousefqso,nagain, &
- ndepth,ndiskdat,ntx60,newdat,nn1,nn2,nfcal,nfshift, &
- ntx30a,ntx30b,ntol,n60,nCFOM,nfsample,ndop58,nmode, &
- ndop00,nsave,nn3,nn4,nhsym,mycall,mygrid,hiscall,hisgrid, &
- datetime,junk1,junk2,bAlso30
- equivalence (nparams,fcenter)
- data first/.true./
- save first
-
- nparams=nparams0 !Copy parameters into common/npar/
- datetime(12:)='00 '
- npatience=1
- newdat=1 !Always on ??
-
- if(ndiskdat.eq.1) then
- call chkstat(dd,nhsym,pdb)
- if((abs(pdb(1)-pdb(2)).gt.3.0 .and. pdb(1).gt.1.0) .or. &
- pdb(1).lt.1.0) ntx30a=20 !Tx 1st half
- if((abs(pdb(3)-pdb(4)).gt.3.0 .and. pdb(3).gt.1.0) .or. &
- pdb(3).lt.1.0) ntx30b=20 !Tx 2nd half
- if(pdb(4).lt.0.04) then
- ntx30a=0 !Older 56s files have no Tx
- ntx30b=0 !Older 56s files have no Tx
- endif
- endif
-
- if(ntx30a.gt.5) then
- dd(1:2,1:30*96000)=0.
- ss(1:200,1:NFFT)=0.
- do i=1,NFFT
- savg(i)=sum(ss(201:400,i))
- enddo
- endif
- if(ntx30b.gt.5) then
- dd(1:2,30*96000+1:60*96000)=0.
- ss(201:400,1:NFFT)=0.
- do i=1,NFFT
- savg(i)=sum(ss(1:200,i))
- enddo
- endif
-
- if(nhsym.gt.200 .and. ntx30b.gt.5) go to 10
- call timer('decode0 ',0)
- call decode0(dd,ss,savg)
- call timer('decode0 ',1)
-
-10 continue
-! call date_and_time(VALUES=values)
-! n60b=values(7)
-! nd=n60b-n60
-! if(nd.lt.0) nd=nd+60
-! write(*,3002) nutc,nagain,nhsym,n60,n60b,nd,ntx30a,ntx30b,ndecodes, &
-! nsave,revision
-!3002 format('A',i5.4,i3,i5,7i4,1x,a22)
-! flush(6)
-
- if(ndiskdat.eq.0) then
- if(nhsym.eq.390 .and. &
- (nsave.eq.2 .or. (nsave.eq.1 .and. ndecodes.ge.1))) then
- call save_qm(fname,revision,mycall,mygrid,dd,ntx30a,ntx30b,fcenter, &
- nutc,ndop00,ndop58)
- endif
- endif
-
- return
-end subroutine q65c
-
-subroutine all_done
-
- use timer_module, only: timer
- use timer_impl, only: fini_timer
-
- call timer('decode0 ',101)
- call fini_timer
-
- return
-end subroutine all_done
+subroutine q65c + + use timer_module, only: timer + use timer_impl, only: fini_timer !, limtrace + use, intrinsic :: iso_c_binding, only: C_NULL_CHAR + use FFTW3 + use q65 + use q65_decode + + parameter (NFFT=32768) + include 'njunk.f90' + real*8 fcenter + real*4 pdb(4) + integer nparams0(NJUNK+3),nparams(NJUNK+3) +! integer values(8) + logical first + logical*1 bAlso30 + character*120 fname + character*22 revision + character*12 mycall,hiscall + character*6 mygrid,hisgrid + character*20 datetime + character*64 result + common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & + nWTransmitting,kHzRequested,result(50) + common/datcom2/dd(2,5760000),ss(400,NFFT),savg(NFFT),nparams0 + common/savecom/revision,fname +!### REMEMBER that /npar/ is not updated until nparams=nparams0 is executed. ### + common/npar/fcenter,nutc,fselected,mousedf,mousefqso,nagain, & + ndepth,ndiskdat,ntx60,newdat,nn1,nn2,nfcal,nfshift, & + ntx30a,ntx30b,ntol,n60,nCFOM,nfsample,ndop58,nmode, & + ndop00,nsave,nn3,nn4,nhsym,mycall,mygrid,hiscall,hisgrid, & + datetime,junk1,junk2,bAlso30 + equivalence (nparams,fcenter) + data first/.true./ + save first + + nparams=nparams0 !Copy parameters into common/npar/ + datetime(12:)='00 ' + npatience=1 + newdat=1 !Always on ?? + + if(ndiskdat.eq.1) then + call chkstat(dd,nhsym,pdb) + if((abs(pdb(1)-pdb(2)).gt.3.0 .and. pdb(1).gt.1.0) .or. & + pdb(1).lt.1.0) ntx30a=20 !Tx 1st half + if((abs(pdb(3)-pdb(4)).gt.3.0 .and. pdb(3).gt.1.0) .or. & + pdb(3).lt.1.0) ntx30b=20 !Tx 2nd half + if(pdb(4).lt.0.04) then + ntx30a=0 !Older 56s files have no Tx + ntx30b=0 !Older 56s files have no Tx + endif + endif + + if(ntx30a.gt.5) then + dd(1:2,1:30*96000)=0. + ss(1:200,1:NFFT)=0. + do i=1,NFFT + savg(i)=sum(ss(201:400,i)) + enddo + endif + if(ntx30b.gt.5) then + dd(1:2,30*96000+1:60*96000)=0. + ss(201:400,1:NFFT)=0. + do i=1,NFFT + savg(i)=sum(ss(1:200,i)) + enddo + endif + + if(nhsym.gt.200 .and. ntx30b.gt.5) go to 10 + call timer('decode0 ',0) + call decode0(dd,ss,savg) + call timer('decode0 ',1) + +10 continue +! call date_and_time(VALUES=values) +! n60b=values(7) +! nd=n60b-n60 +! if(nd.lt.0) nd=nd+60 +! write(*,3002) nutc,nagain,nhsym,n60,n60b,nd,ntx30a,ntx30b,ndecodes, & +! nsave,revision +!3002 format('A',i5.4,i3,i5,7i4,1x,a22) +! flush(6) + + if(ndiskdat.eq.0) then + if(nhsym.eq.390 .and. & + (nsave.eq.2 .or. (nsave.eq.1 .and. ndecodes.ge.1))) then + call save_qm(fname,revision,mycall,mygrid,dd,ntx30a,ntx30b,fcenter, & + nutc,ndop00,ndop58) + endif + endif + + return +end subroutine q65c + +subroutine all_done + + use timer_module, only: timer + use timer_impl, only: fini_timer + + call timer('decode0 ',101) + call fini_timer + + return +end subroutine all_done diff --git a/qmap/libqmap/qmapa.f90 b/qmap/libqmap/qmapa.f90 index 8d4f3381..237d4c75 100755 --- a/qmap/libqmap/qmapa.f90 +++ b/qmap/libqmap/qmapa.f90 @@ -1,120 +1,120 @@ -subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, &
- mousedf,mousefqso,nagain,ntx30a,ntx30b,nfshift,max_drift,offset, &
- nfcal,mycall,hiscall,hisgrid,nfsample,nBaseSubmode,ndepth, &
- datetime,ndop00,fselected,bAlso30,nhsym,nCFOM)
-
-! Processes timf2 data received from Linrad to find and decode Q65 signals.
-
- use timer_module, only: timer
-
- type candidate
- real :: snr !Relative S/N of sync detection
- real :: f !Freq of sync tone, 0 to 96000 Hz
- real :: xdt !DT of matching sync pattern, -1.0 to +4.0 s
- integer :: ntrperiod !60 for Q65-60x, 30 for Q65-30x
- integer :: iseq !0 for first half-minute, 1 for second half
- end type candidate
-
- type good_decode
- real :: f !Freq of sync tone, 0 to 96000 Hz
- integer :: ntrperiod !60 for Q65-60x, 30 for Q65-30x
- integer :: iseq !0 for first half-minute, 1 for second half
- end type good_decode
-
- parameter (NFFT=32768) !Size of FFTs done in symspec()
- parameter (MAX_CANDIDATES=50)
- parameter (MAXMSG=1000) !Size of decoded message list
- parameter (NSMAX=60*96000)
- real dd(2,NSMAX) !I/Q data from Linrad
- real ss(400,NFFT) !Symbol spectra
- real savg(NFFT) !Average spectrum
- real*8 fcenter !Center RF frequency, MHz
- logical*1 bAlso30,bClickDecode
- character mycall*12,hiscall*12,hisgrid*6
- type(candidate) :: cand(MAX_CANDIDATES)
- type(good_decode) found(MAX_CANDIDATES)
- character*64 result
- character*20 datetime
- common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, &
- nWTransmitting,kHzRequested,result(50)
- save
-
- tsec0=sec_midn()
- if(nagain.ge.1) ndepth=3 !Use full depth for click-to-decode
- nkhz_center=nint(1000.0*(fcenter-int(fcenter)))
- mfa=nfa-nkhz_center+48
- mfb=nfb-nkhz_center+48
- mode_q65=nBaseSubmode
- nts_q65=2**(mode_q65-1) !Q65 tone separation factor
- f0_selected=fselected - nkhz_center + 48.0
-
- if(nagain.le.1) then
- call timer('get_cand',0)
- ! Get a list of decoding candidates
- call getcand2(ss,savg,nts_q65,nagain,nhsym,ntx30a,ntx30b,ntol, &
- f0_selected,bAlso30,cand,ncand2)
- call timer('get_cand',1)
- endif
-
- nwrite_q65=0
- df=96000.0/NFFT !df = 96000/NFFT = 2.930 Hz
- ftol=0.010 !Frequency tolerance (kHz)
- foffset=0.001*(1270 + nfcal) !Offset from sync tone, plus CAL
- fqso=mousefqso + foffset - 0.5*(nfa+nfb) + nfshift !fqso at baseband (khz)
- nqd=0
- bClickDecode=(nagain.ge.1)
-
- call timer('fftbig ',0)
- call fftbig(dd,NSMAX) !Do the full-length FFT
- call timer('fftbig ',1)
-
- if(nagain.ge.2) then
- ncand2=1
- fqso=fselected
- endif
-
- do icand=1,ncand2 !Attempt to decode each candidate
- tsec=sec_midn() - tsec0
- if(ndiskdat.eq.0) then
- ! No more realtime decode attempts if it's nearly too late, already
- if(nhsym.eq.130 .and. tsec.gt.6.0) exit
- if(nhsym.eq.200 .and. tsec.gt.10.0) exit
- if(nhsym.eq.330 .and. tsec.gt.6.0) exit
- if(nhsym.eq.390 .and. tsec.gt.16.0) exit
- endif
- f0=cand(icand)%f
- ntrperiod=cand(icand)%ntrperiod
- iseq=cand(icand)%iseq
-
- if(nagain.eq.0) then
- ! Skip this candidate if we already decoded it.
- do j=1,ndecodes
- if(abs(f0-found(j)%f).lt.0.005 .and. &
- ntrperiod.eq.found(j)%ntrperiod .and. &
- iseq.eq.found(j)%iseq) go to 10
- enddo
- endif
-
- mode_q65_tmp=mode_q65
- if(ntrperiod.eq.30) mode_q65_tmp=max(1,mode_q65-1)
- freq=f0+nkhz_center-48.0-1.27046
- ikhz=nint(freq)
- idec=-1
- call timer('q65b ',0)
- call q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
- ntrperiod,iseq,mycall,hiscall,hisgrid,mode_q65_tmp,f0,fqso, &
- nkhz_center,newdat,nagain,bClickDecode,max_drift,offset, &
- ndepth,datetime,nCFOM,ndop00,nhsym,idec)
- call timer('q65b ',1)
- if(bClickDecode .and. idec.ge.0) exit
- if(idec.ge.0) then
- ! Save some details on good decodes, to avoid duplicated effort
- found(ndecodes)%f=f0
- found(ndecodes)%ntrperiod=ntrperiod
- found(ndecodes)%iseq=iseq
- end if
-10 continue
- enddo ! icand
-
- return
-end subroutine qmapa
+subroutine qmapa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, & + mousedf,mousefqso,nagain,ntx30a,ntx30b,nfshift,max_drift,offset, & + nfcal,mycall,hiscall,hisgrid,nfsample,nBaseSubmode,ndepth, & + datetime,ndop00,fselected,bAlso30,nhsym,nCFOM) + +! Processes timf2 data received from Linrad to find and decode Q65 signals. + + use timer_module, only: timer + + type candidate + real :: snr !Relative S/N of sync detection + real :: f !Freq of sync tone, 0 to 96000 Hz + real :: xdt !DT of matching sync pattern, -1.0 to +4.0 s + integer :: ntrperiod !60 for Q65-60x, 30 for Q65-30x + integer :: iseq !0 for first half-minute, 1 for second half + end type candidate + + type good_decode + real :: f !Freq of sync tone, 0 to 96000 Hz + integer :: ntrperiod !60 for Q65-60x, 30 for Q65-30x + integer :: iseq !0 for first half-minute, 1 for second half + end type good_decode + + parameter (NFFT=32768) !Size of FFTs done in symspec() + parameter (MAX_CANDIDATES=50) + parameter (MAXMSG=1000) !Size of decoded message list + parameter (NSMAX=60*96000) + real dd(2,NSMAX) !I/Q data from Linrad + real ss(400,NFFT) !Symbol spectra + real savg(NFFT) !Average spectrum + real*8 fcenter !Center RF frequency, MHz + logical*1 bAlso30,bClickDecode + character mycall*12,hiscall*12,hisgrid*6 + type(candidate) :: cand(MAX_CANDIDATES) + type(good_decode) found(MAX_CANDIDATES) + character*64 result + character*20 datetime + common/decodes/ndecodes,ncand2,nQDecoderDone,nWDecoderBusy, & + nWTransmitting,kHzRequested,result(50) + save + + tsec0=sec_midn() + if(nagain.ge.1) ndepth=3 !Use full depth for click-to-decode + nkhz_center=nint(1000.0*(fcenter-int(fcenter))) + mfa=nfa-nkhz_center+48 + mfb=nfb-nkhz_center+48 + mode_q65=nBaseSubmode + nts_q65=2**(mode_q65-1) !Q65 tone separation factor + f0_selected=fselected - nkhz_center + 48.0 + + if(nagain.le.1) then + call timer('get_cand',0) + ! Get a list of decoding candidates + call getcand2(ss,savg,nts_q65,nagain,nhsym,ntx30a,ntx30b,ntol, & + f0_selected,bAlso30,cand,ncand2) + call timer('get_cand',1) + endif + + nwrite_q65=0 + df=96000.0/NFFT !df = 96000/NFFT = 2.930 Hz + ftol=0.010 !Frequency tolerance (kHz) + foffset=0.001*(1270 + nfcal) !Offset from sync tone, plus CAL + fqso=mousefqso + foffset - 0.5*(nfa+nfb) + nfshift !fqso at baseband (khz) + nqd=0 + bClickDecode=(nagain.ge.1) + + call timer('fftbig ',0) + call fftbig(dd,NSMAX) !Do the full-length FFT + call timer('fftbig ',1) + + if(nagain.ge.2) then + ncand2=1 + fqso=fselected + endif + + do icand=1,ncand2 !Attempt to decode each candidate + tsec=sec_midn() - tsec0 + if(ndiskdat.eq.0) then + ! No more realtime decode attempts if it's nearly too late, already + if(nhsym.eq.130 .and. tsec.gt.6.0) exit + if(nhsym.eq.200 .and. tsec.gt.10.0) exit + if(nhsym.eq.330 .and. tsec.gt.6.0) exit + if(nhsym.eq.390 .and. tsec.gt.16.0) exit + endif + f0=cand(icand)%f + ntrperiod=cand(icand)%ntrperiod + iseq=cand(icand)%iseq + + if(nagain.eq.0) then + ! Skip this candidate if we already decoded it. + do j=1,ndecodes + if(abs(f0-found(j)%f).lt.0.005 .and. & + ntrperiod.eq.found(j)%ntrperiod .and. & + iseq.eq.found(j)%iseq) go to 10 + enddo + endif + + mode_q65_tmp=mode_q65 + if(ntrperiod.eq.30) mode_q65_tmp=max(1,mode_q65-1) + freq=f0+nkhz_center-48.0-1.27046 + ikhz=nint(freq) + idec=-1 + call timer('q65b ',0) + call q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, & + ntrperiod,iseq,mycall,hiscall,hisgrid,mode_q65_tmp,f0,fqso, & + nkhz_center,newdat,nagain,bClickDecode,max_drift,offset, & + ndepth,datetime,nCFOM,ndop00,nhsym,idec) + call timer('q65b ',1) + if(bClickDecode .and. idec.ge.0) exit + if(idec.ge.0) then + ! Save some details on good decodes, to avoid duplicated effort + found(ndecodes)%f=f0 + found(ndecodes)%ntrperiod=ntrperiod + found(ndecodes)%iseq=iseq + end if +10 continue + enddo ! icand + + return +end subroutine qmapa diff --git a/qmap/libqmap/read_qm.f90 b/qmap/libqmap/read_qm.f90 index 52479918..67e3a0cd 100755 --- a/qmap/libqmap/read_qm.f90 +++ b/qmap/libqmap/read_qm.f90 @@ -1,44 +1,44 @@ -subroutine read_qm(fname,iret)
-
- include 'njunk.f90'
- parameter(NMAX=60*96000,NFFT=32768)
- character*(*) fname
- character prog_id*24,mycall*12,mygrid*6
- real*8 fcenter
- integer nxtra(15) !For possible future additions
- integer*1 id1(2,NMAX)
- common/datcom/dd(2,5760000),ss(400,NFFT),savg(NFFT), &
- fcenter,nutc,fselected,mousedf,mousefqso,nagain, &
- ndepth,ndiskdat,ntx60,newdat,nn1,nn2,nfcal,nfshift, &
- ntx30a,ntx30b !...
-
- open(28,file=trim(fname),status='old',access='stream',err=900)
- read(28,end=910) prog_id,mycall,mygrid,fcenter,nutc,ntx30a, &
- ntx30b,ndop00,ndop58,ia,ib,fac0,nxtra
- iret=3
- if(ib.eq.NMAX/2) iret=1
- if(ia.eq.NMAX/2+1) iret=2
- fac=1.0
- if(fac0.gt.0.0) fac=1.0/fac0
- id1=0
- read(28,end=910) id1(1:2,ia:ib)
- dd=0.
- dd(1:2,ia:ib)=fac*id1(1:2,ia:ib) !Boost back to previous level
- go to 999
-
-900 iret=-1; go to 999
-910 iret=-2
-
-999 close(28)
-
-! sq1=0.
-! sq2=0.
-! NH=NMAX/2
-! do i=1,NMAX
-! if(i.le.NH) sq1=sq1 + dd(1,i)*dd(1,i) + dd(2,i)*dd(2,i)
-! if(i.gt.NH) sq2=sq2 + dd(1,i)*dd(1,i) + dd(2,i)*dd(2,i)
-! enddo
-! print*,'B',sqrt(sq1/NMAX),sqrt(sq2/NMAX)
-
- return
-end subroutine read_qm
+subroutine read_qm(fname,iret) + + include 'njunk.f90' + parameter(NMAX=60*96000,NFFT=32768) + character*(*) fname + character prog_id*24,mycall*12,mygrid*6 + real*8 fcenter + integer nxtra(15) !For possible future additions + integer*1 id1(2,NMAX) + common/datcom/dd(2,5760000),ss(400,NFFT),savg(NFFT), & + fcenter,nutc,fselected,mousedf,mousefqso,nagain, & + ndepth,ndiskdat,ntx60,newdat,nn1,nn2,nfcal,nfshift, & + ntx30a,ntx30b !... + + open(28,file=trim(fname),status='old',access='stream',err=900) + read(28,end=910) prog_id,mycall,mygrid,fcenter,nutc,ntx30a, & + ntx30b,ndop00,ndop58,ia,ib,fac0,nxtra + iret=3 + if(ib.eq.NMAX/2) iret=1 + if(ia.eq.NMAX/2+1) iret=2 + fac=1.0 + if(fac0.gt.0.0) fac=1.0/fac0 + id1=0 + read(28,end=910) id1(1:2,ia:ib) + dd=0. + dd(1:2,ia:ib)=fac*id1(1:2,ia:ib) !Boost back to previous level + go to 999 + +900 iret=-1; go to 999 +910 iret=-2 + +999 close(28) + +! sq1=0. +! sq2=0. +! NH=NMAX/2 +! do i=1,NMAX +! if(i.le.NH) sq1=sq1 + dd(1,i)*dd(1,i) + dd(2,i)*dd(2,i) +! if(i.gt.NH) sq2=sq2 + dd(1,i)*dd(1,i) + dd(2,i)*dd(2,i) +! enddo +! print*,'B',sqrt(sq1/NMAX),sqrt(sq2/NMAX) + + return +end subroutine read_qm diff --git a/qmap/libqmap/recvpkt.f90 b/qmap/libqmap/recvpkt.f90 index fd5e888f..043c8bdd 100755 --- a/qmap/libqmap/recvpkt.f90 +++ b/qmap/libqmap/recvpkt.f90 @@ -1,54 +1,54 @@ -subroutine recvpkt(nsam,nblock2,userx_no,k,buf4,buf8,ndb)
-
-! Reformat timf2 data from Linrad and stuff data into r*4 array dd().
-
- include 'njunk.f90'
- parameter (NSMAX=60*96000) !Total sample intervals per minute
- parameter (NFFT=32768)
- integer*1 userx_no
- real*4 d4,buf4(*) !(348)
- real*8 d8,buf8(*) !(174)
- integer*2 jd(4),kd(2),nblock2
- real*4 yd(2)
- real*8 fcenter
- common/datcom/dd(2,5760000),ss(400,NFFT),savg(NFFT),fcenter,nutc, &
- junk(NJUNK)
- equivalence (kd,d4)
- equivalence (jd,d8,yd)
-
- gain=10.0**(0.05*ndb)
- if(nblock2.eq.-9999) nblock2=-9998 !Silence a compiler warning
- if(nsam.eq.-1) then
-! Move data from the UDP packet buffer into array dd().
- if(userx_no.eq.-1) then
- do i=1,174 !One RF channel, r*4 data
- k=k+1
- d8=buf8(i)
- dd(1,k)=yd(1)*gain
- dd(2,k)=yd(2)*gain
- enddo
- else if(userx_no.eq.1) then
- do i=1,348 !One RF channel, i*2 data
- k=k+1
- d4=buf4(i)
- dd(1,k)=kd(1)*gain
- dd(2,k)=kd(2)*gain
- enddo
- endif
- else
- if(userx_no.eq.1) then
- do i=1,nsam !One RF channel, r*4 data
- k=k+1
- d4=buf4(i)
- dd(1,k)=kd(1)*gain
- dd(2,k)=kd(2)*gain
-
- k=k+1
- dd(1,k)=kd(1)*gain
- dd(2,k)=kd(2)*gain
- enddo
- endif
- endif
-
- return
-end subroutine recvpkt
+subroutine recvpkt(nsam,nblock2,userx_no,k,buf4,buf8,ndb) + +! Reformat timf2 data from Linrad and stuff data into r*4 array dd(). + + include 'njunk.f90' + parameter (NSMAX=60*96000) !Total sample intervals per minute + parameter (NFFT=32768) + integer*1 userx_no + real*4 d4,buf4(*) !(348) + real*8 d8,buf8(*) !(174) + integer*2 jd(4),kd(2),nblock2 + real*4 yd(2) + real*8 fcenter + common/datcom/dd(2,5760000),ss(400,NFFT),savg(NFFT),fcenter,nutc, & + junk(NJUNK) + equivalence (kd,d4) + equivalence (jd,d8,yd) + + gain=10.0**(0.05*ndb) + if(nblock2.eq.-9999) nblock2=-9998 !Silence a compiler warning + if(nsam.eq.-1) then +! Move data from the UDP packet buffer into array dd(). + if(userx_no.eq.-1) then + do i=1,174 !One RF channel, r*4 data + k=k+1 + d8=buf8(i) + dd(1,k)=yd(1)*gain + dd(2,k)=yd(2)*gain + enddo + else if(userx_no.eq.1) then + do i=1,348 !One RF channel, i*2 data + k=k+1 + d4=buf4(i) + dd(1,k)=kd(1)*gain + dd(2,k)=kd(2)*gain + enddo + endif + else + if(userx_no.eq.1) then + do i=1,nsam !One RF channel, r*4 data + k=k+1 + d4=buf4(i) + dd(1,k)=kd(1)*gain + dd(2,k)=kd(2)*gain + + k=k+1 + dd(1,k)=kd(1)*gain + dd(2,k)=kd(2)*gain + enddo + endif + endif + + return +end subroutine recvpkt diff --git a/qmap/libqmap/rfile3a.f90 b/qmap/libqmap/rfile3a.f90 index db12e4df..7e226651 100755 --- a/qmap/libqmap/rfile3a.f90 +++ b/qmap/libqmap/rfile3a.f90 @@ -1,14 +1,14 @@ -subroutine rfile3a(infile,ibuf,n,fcenter,ierr)
-
- character*(*) infile
- integer*8 ibuf(n)
- real*8 fcenter
-
- open(10,file=infile,access='stream',status='old',err=998)
- read(10,end=998) (ibuf(i),i=1,n/8),fcenter
- ierr=0
- go to 999
-998 ierr=1002
-999 close(10)
- return
-end subroutine rfile3a
+subroutine rfile3a(infile,ibuf,n,fcenter,ierr) + + character*(*) infile + integer*8 ibuf(n) + real*8 fcenter + + open(10,file=infile,access='stream',status='old',err=998) + read(10,end=998) (ibuf(i),i=1,n/8),fcenter + ierr=0 + go to 999 +998 ierr=1002 +999 close(10) + return +end subroutine rfile3a diff --git a/qmap/libqmap/save_qm.f90 b/qmap/libqmap/save_qm.f90 index 9d636755..282f29b8 100755 --- a/qmap/libqmap/save_qm.f90 +++ b/qmap/libqmap/save_qm.f90 @@ -1,63 +1,63 @@ -subroutine save_qm(fname,revision,mycall,mygrid,dd,ntx30a,ntx30b,fcenter, &
- nutc,ndop00,ndop58)
-
- parameter(NMAX=60*96000)
- character*120 fname
- character*22 revision
- character*12 mycall
- character*6 mygrid
- real*4 dd(2,NMAX)
- real*8 fcenter
- integer nxtra(15) !For possible future additions
- integer*1,allocatable :: id1(:,:)
-
- ia=1
- ib=NMAX
- if(ntx30a.gt.5) ia=NMAX/2+1
- if(ntx30b.gt.5) ib=NMAX/2
-
- sq=0.
- do i=ia,ib
- x=dd(1,i)
- y=dd(2,i)
- sq=sq + x*x + y*y
- enddo
- nsum=2*(ib-ia+1)
- rms=sqrt(sq/nsum)
-
- nbad=0
- dmax=0.
- fac0=10.0/rms
- allocate(id1(1:2,1:NMAX))
-
- do i=ia,ib
- x=fac0*dd(1,i)
- y=fac0*dd(2,i)
- ax=abs(x)
- ay=abs(y)
- dmax=max(dmax,ax,ay)
- if(ax.gt.127.0) then
- x=0.
- nbad=nbad+1
- endif
- if(ay.gt.127.0) then
- y=0.
- nbad=nbad+1
- endif
- id1(1,i)=nint(x)
- id1(2,i)=nint(y)
- enddo
- if(ia.gt.30*96000) id1(1:2,1:ia-1)=0
- if(ib.eq.30*96000) id1(1:2,ib+1:60*96000)=0
-
- open(29,file=trim(fname),status='unknown',access='stream')
- nxtra=0
- write(29) revision//' ',mycall,mygrid,fcenter,nutc,ntx30a,ntx30b, &
- ndop00,ndop58,ia,ib,fac0,nxtra !Write header to disk
- write(29) id1(1:2,ia:ib) !Write 8-bit data to disk
- close(29)
- deallocate(id1)
-
- return
-end subroutine save_qm
-
+subroutine save_qm(fname,revision,mycall,mygrid,dd,ntx30a,ntx30b,fcenter, & + nutc,ndop00,ndop58) + + parameter(NMAX=60*96000) + character*120 fname + character*22 revision + character*12 mycall + character*6 mygrid + real*4 dd(2,NMAX) + real*8 fcenter + integer nxtra(15) !For possible future additions + integer*1,allocatable :: id1(:,:) + + ia=1 + ib=NMAX + if(ntx30a.gt.5) ia=NMAX/2+1 + if(ntx30b.gt.5) ib=NMAX/2 + + sq=0. + do i=ia,ib + x=dd(1,i) + y=dd(2,i) + sq=sq + x*x + y*y + enddo + nsum=2*(ib-ia+1) + rms=sqrt(sq/nsum) + + nbad=0 + dmax=0. + fac0=10.0/rms + allocate(id1(1:2,1:NMAX)) + + do i=ia,ib + x=fac0*dd(1,i) + y=fac0*dd(2,i) + ax=abs(x) + ay=abs(y) + dmax=max(dmax,ax,ay) + if(ax.gt.127.0) then + x=0. + nbad=nbad+1 + endif + if(ay.gt.127.0) then + y=0. + nbad=nbad+1 + endif + id1(1,i)=nint(x) + id1(2,i)=nint(y) + enddo + if(ia.gt.30*96000) id1(1:2,1:ia-1)=0 + if(ib.eq.30*96000) id1(1:2,ib+1:60*96000)=0 + + open(29,file=trim(fname),status='unknown',access='stream') + nxtra=0 + write(29) revision//' ',mycall,mygrid,fcenter,nutc,ntx30a,ntx30b, & + ndop00,ndop58,ia,ib,fac0,nxtra !Write header to disk + write(29) id1(1:2,ia:ib) !Write 8-bit data to disk + close(29) + deallocate(id1) + + return +end subroutine save_qm + diff --git a/qmap/libqmap/set.f90 b/qmap/libqmap/set.f90 index 8b2e5760..ff767988 100755 --- a/qmap/libqmap/set.f90 +++ b/qmap/libqmap/set.f90 @@ -1,31 +1,31 @@ -subroutine set(a,y,n)
- real y(n)
- do i=1,n
- y(i)=a
- enddo
- return
-end subroutine set
-
-subroutine move(x,y,n)
- real x(n),y(n)
- do i=1,n
- y(i)=x(i)
- enddo
- return
-end subroutine move
-
-subroutine zero(x,n)
- real x(n)
- do i=1,n
- x(i)=0.0
- enddo
- return
-end subroutine zero
-
-subroutine add(a,b,c,n)
- real a(n),b(n),c(n)
- do i=1,n
- c(i)=a(i)+b(i)
- enddo
- return
-end subroutine add
+subroutine set(a,y,n) + real y(n) + do i=1,n + y(i)=a + enddo + return +end subroutine set + +subroutine move(x,y,n) + real x(n),y(n) + do i=1,n + y(i)=x(i) + enddo + return +end subroutine move + +subroutine zero(x,n) + real x(n) + do i=1,n + x(i)=0.0 + enddo + return +end subroutine zero + +subroutine add(a,b,c,n) + real a(n),b(n),c(n) + do i=1,n + c(i)=a(i)+b(i) + enddo + return +end subroutine add diff --git a/qmap/libqmap/shell.f90 b/qmap/libqmap/shell.f90 index 1e9b4488..d7365bfc 100755 --- a/qmap/libqmap/shell.f90 +++ b/qmap/libqmap/shell.f90 @@ -1,27 +1,27 @@ -subroutine shell(n,a)
- integer n
- real a(n)
- integer i,j,inc
- real v
-
- inc=1
-1 inc=3*inc+1
- if(inc.le.n) go to 1
-2 inc=inc/3
-
- do i=inc+1,n
- v=a(i)
- j=i
-3 if(a(j-inc).gt.v) then
- a(j)=a(j-inc)
- j=j-inc
- if(j.le.inc) go to 4
- go to 3
- endif
-4 a(j)=v
- enddo
-
- if(inc.gt.1) go to 2
-
- return
-end subroutine shell
+subroutine shell(n,a) + integer n + real a(n) + integer i,j,inc + real v + + inc=1 +1 inc=3*inc+1 + if(inc.le.n) go to 1 +2 inc=inc/3 + + do i=inc+1,n + v=a(i) + j=i +3 if(a(j-inc).gt.v) then + a(j)=a(j-inc) + j=j-inc + if(j.le.inc) go to 4 + go to 3 + endif +4 a(j)=v + enddo + + if(inc.gt.1) go to 2 + + return +end subroutine shell diff --git a/qmap/libqmap/sleep_msec.f90 b/qmap/libqmap/sleep_msec.f90 index 21ab6182..1a8dbe4f 100755 --- a/qmap/libqmap/sleep_msec.f90 +++ b/qmap/libqmap/sleep_msec.f90 @@ -1,4 +1,4 @@ -subroutine sleep_msec(n)
- call usleep(n*1000)
- return
-end subroutine sleep_msec
+subroutine sleep_msec(n) + call usleep(n*1000) + return +end subroutine sleep_msec diff --git a/qmap/libqmap/smo.f90 b/qmap/libqmap/smo.f90 index 87994310..c42de7c6 100755 --- a/qmap/libqmap/smo.f90 +++ b/qmap/libqmap/smo.f90 @@ -1,19 +1,19 @@ -subroutine smo(x,npts,y,nadd)
-
- real x(npts)
- real y(npts)
-
- nh=nadd/2
- do i=1+nh,npts-nh
- sum=0.
- do j=-nh,nh
- sum=sum + x(i+j)
- enddo
- y(i)=sum
- enddo
- x=y
- x(:nh)=0.
- x(npts-nh+1:)=0.
-
- return
-end subroutine smo
+subroutine smo(x,npts,y,nadd) + + real x(npts) + real y(npts) + + nh=nadd/2 + do i=1+nh,npts-nh + sum=0. + do j=-nh,nh + sum=sum + x(i+j) + enddo + y(i)=sum + enddo + x=y + x(:nh)=0. + x(npts-nh+1:)=0. + + return +end subroutine smo diff --git a/qmap/libqmap/sort.f90 b/qmap/libqmap/sort.f90 index eadf6939..8a05da28 100755 --- a/qmap/libqmap/sort.f90 +++ b/qmap/libqmap/sort.f90 @@ -1,6 +1,6 @@ -subroutine sort(n,arr)
-
- call ssort(arr,tmp,n,1)
-
- return
-end subroutine sort
+subroutine sort(n,arr) + + call ssort(arr,tmp,n,1) + + return +end subroutine sort diff --git a/qmap/libqmap/ssort.f b/qmap/libqmap/ssort.f index cea0c2d4..fa508ace 100755 --- a/qmap/libqmap/ssort.f +++ b/qmap/libqmap/ssort.f @@ -1,287 +1,287 @@ - subroutine ssort (x,y,n,kflag)
-c***purpose sort an array and optionally make the same interchanges in
-c an auxiliary array. the array may be sorted in increasing
-c or decreasing order. a slightly modified quicksort
-c algorithm is used.
-c
-c ssort sorts array x and optionally makes the same interchanges in
-c array y. the array x may be sorted in increasing order or
-c decreasing order. a slightly modified quicksort algorithm is used.
-c
-c description of parameters
-c x - array of values to be sorted
-c y - array to be (optionally) carried along
-c n - number of values in array x to be sorted
-c kflag - control parameter
-c = 2 means sort x in increasing order and carry y along.
-c = 1 means sort x in increasing order (ignoring y)
-c = -1 means sort x in decreasing order (ignoring y)
-c = -2 means sort x in decreasing order and carry y along.
-
- integer kflag, n
-! real x(n), y(n)
-! real r, t, tt, tty, ty
- integer x(n), y(n)
- integer r, t, tt, tty, ty
- integer i, ij, j, k, kk, l, m, nn
- integer il(21), iu(21)
-
- nn = n
- if (nn .lt. 1) then
-! print*,'ssort: The number of sort elements is not positive.'
-! print*,'ssort: n = ',nn,' kflag = ',kflag
- return
- endif
-c
- kk = abs(kflag)
- if (kk.ne.1 .and. kk.ne.2) then
- print *,
- + 'the sort control parameter, k, is not 2, 1, -1, or -2.'
- return
- endif
-c
-c alter array x to get decreasing order if needed
-c
- if (kflag .le. -1) then
- do 10 i=1,nn
- x(i) = -x(i)
- 10 continue
- endif
-c
- if (kk .eq. 2) go to 100
-c
-c sort x only
-c
- m = 1
- i = 1
- j = nn
- r = 0.375e0
-c
- 20 if (i .eq. j) go to 60
- if (r .le. 0.5898437e0) then
- r = r+3.90625e-2
- else
- r = r-0.21875e0
- endif
-c
- 30 k = i
-c
-c select a central element of the array and save it in location t
-c
- ij = i + int((j-i)*r)
- t = x(ij)
-c
-c if first element of array is greater than t, interchange with t
-c
- if (x(i) .gt. t) then
- x(ij) = x(i)
- x(i) = t
- t = x(ij)
- endif
- l = j
-c
-c if last element of array is less than than t, interchange with t
-c
- if (x(j) .lt. t) then
- x(ij) = x(j)
- x(j) = t
- t = x(ij)
-c
-c if first element of array is greater than t, interchange with t
-c
- if (x(i) .gt. t) then
- x(ij) = x(i)
- x(i) = t
- t = x(ij)
- endif
- endif
-c
-c find an element in the second half of the array which is smaller
-c than t
-c
- 40 l = l-1
- if (x(l) .gt. t) go to 40
-c
-c find an element in the first half of the array which is greater
-c than t
-c
- 50 k = k+1
- if (x(k) .lt. t) go to 50
-c
-c interchange these elements
-c
- if (k .le. l) then
- tt = x(l)
- x(l) = x(k)
- x(k) = tt
- go to 40
- endif
-c
-c save upper and lower subscripts of the array yet to be sorted
-c
- if (l-i .gt. j-k) then
- il(m) = i
- iu(m) = l
- i = k
- m = m+1
- else
- il(m) = k
- iu(m) = j
- j = l
- m = m+1
- endif
- go to 70
-c
-c begin again on another portion of the unsorted array
-c
- 60 m = m-1
- if (m .eq. 0) go to 190
- i = il(m)
- j = iu(m)
-c
- 70 if (j-i .ge. 1) go to 30
- if (i .eq. 1) go to 20
- i = i-1
-c
- 80 i = i+1
- if (i .eq. j) go to 60
- t = x(i+1)
- if (x(i) .le. t) go to 80
- k = i
-c
- 90 x(k+1) = x(k)
- k = k-1
- if (t .lt. x(k)) go to 90
- x(k+1) = t
- go to 80
-c
-c sort x and carry y along
-c
- 100 m = 1
- i = 1
- j = nn
- r = 0.375e0
-c
- 110 if (i .eq. j) go to 150
- if (r .le. 0.5898437e0) then
- r = r+3.90625e-2
- else
- r = r-0.21875e0
- endif
-c
- 120 k = i
-c
-c select a central element of the array and save it in location t
-c
- ij = i + int((j-i)*r)
- t = x(ij)
- ty = y(ij)
-c
-c if first element of array is greater than t, interchange with t
-c
- if (x(i) .gt. t) then
- x(ij) = x(i)
- x(i) = t
- t = x(ij)
- y(ij) = y(i)
- y(i) = ty
- ty = y(ij)
- endif
- l = j
-c
-c if last element of array is less than t, interchange with t
-c
- if (x(j) .lt. t) then
- x(ij) = x(j)
- x(j) = t
- t = x(ij)
- y(ij) = y(j)
- y(j) = ty
- ty = y(ij)
-c
-c if first element of array is greater than t, interchange with t
-c
- if (x(i) .gt. t) then
- x(ij) = x(i)
- x(i) = t
- t = x(ij)
- y(ij) = y(i)
- y(i) = ty
- ty = y(ij)
- endif
- endif
-c
-c find an element in the second half of the array which is smaller
-c than t
-c
- 130 l = l-1
- if (x(l) .gt. t) go to 130
-c
-c find an element in the first half of the array which is greater
-c than t
-c
- 140 k = k+1
- if (x(k) .lt. t) go to 140
-c
-c interchange these elements
-c
- if (k .le. l) then
- tt = x(l)
- x(l) = x(k)
- x(k) = tt
- tty = y(l)
- y(l) = y(k)
- y(k) = tty
- go to 130
- endif
-c
-c save upper and lower subscripts of the array yet to be sorted
-c
- if (l-i .gt. j-k) then
- il(m) = i
- iu(m) = l
- i = k
- m = m+1
- else
- il(m) = k
- iu(m) = j
- j = l
- m = m+1
- endif
- go to 160
-c
-c begin again on another portion of the unsorted array
-c
- 150 m = m-1
- if (m .eq. 0) go to 190
- i = il(m)
- j = iu(m)
-c
- 160 if (j-i .ge. 1) go to 120
- if (i .eq. 1) go to 110
- i = i-1
-c
- 170 i = i+1
- if (i .eq. j) go to 150
- t = x(i+1)
- ty = y(i+1)
- if (x(i) .le. t) go to 170
- k = i
-c
- 180 x(k+1) = x(k)
- y(k+1) = y(k)
- k = k-1
- if (t .lt. x(k)) go to 180
- x(k+1) = t
- y(k+1) = ty
- go to 170
-c
-c clean up
-c
- 190 if (kflag .le. -1) then
- do 200 i=1,nn
- x(i) = -x(i)
- 200 continue
- endif
- return
- end
+ subroutine ssort (x,y,n,kflag) +c***purpose sort an array and optionally make the same interchanges in +c an auxiliary array. the array may be sorted in increasing +c or decreasing order. a slightly modified quicksort +c algorithm is used. +c +c ssort sorts array x and optionally makes the same interchanges in +c array y. the array x may be sorted in increasing order or +c decreasing order. a slightly modified quicksort algorithm is used. +c +c description of parameters +c x - array of values to be sorted +c y - array to be (optionally) carried along +c n - number of values in array x to be sorted +c kflag - control parameter +c = 2 means sort x in increasing order and carry y along. +c = 1 means sort x in increasing order (ignoring y) +c = -1 means sort x in decreasing order (ignoring y) +c = -2 means sort x in decreasing order and carry y along. + + integer kflag, n +! real x(n), y(n) +! real r, t, tt, tty, ty + integer x(n), y(n) + integer r, t, tt, tty, ty + integer i, ij, j, k, kk, l, m, nn + integer il(21), iu(21) + + nn = n + if (nn .lt. 1) then +! print*,'ssort: The number of sort elements is not positive.' +! print*,'ssort: n = ',nn,' kflag = ',kflag + return + endif +c + kk = abs(kflag) + if (kk.ne.1 .and. kk.ne.2) then + print *, + + 'the sort control parameter, k, is not 2, 1, -1, or -2.' + return + endif +c +c alter array x to get decreasing order if needed +c + if (kflag .le. -1) then + do 10 i=1,nn + x(i) = -x(i) + 10 continue + endif +c + if (kk .eq. 2) go to 100 +c +c sort x only +c + m = 1 + i = 1 + j = nn + r = 0.375e0 +c + 20 if (i .eq. j) go to 60 + if (r .le. 0.5898437e0) then + r = r+3.90625e-2 + else + r = r-0.21875e0 + endif +c + 30 k = i +c +c select a central element of the array and save it in location t +c + ij = i + int((j-i)*r) + t = x(ij) +c +c if first element of array is greater than t, interchange with t +c + if (x(i) .gt. t) then + x(ij) = x(i) + x(i) = t + t = x(ij) + endif + l = j +c +c if last element of array is less than than t, interchange with t +c + if (x(j) .lt. t) then + x(ij) = x(j) + x(j) = t + t = x(ij) +c +c if first element of array is greater than t, interchange with t +c + if (x(i) .gt. t) then + x(ij) = x(i) + x(i) = t + t = x(ij) + endif + endif +c +c find an element in the second half of the array which is smaller +c than t +c + 40 l = l-1 + if (x(l) .gt. t) go to 40 +c +c find an element in the first half of the array which is greater +c than t +c + 50 k = k+1 + if (x(k) .lt. t) go to 50 +c +c interchange these elements +c + if (k .le. l) then + tt = x(l) + x(l) = x(k) + x(k) = tt + go to 40 + endif +c +c save upper and lower subscripts of the array yet to be sorted +c + if (l-i .gt. j-k) then + il(m) = i + iu(m) = l + i = k + m = m+1 + else + il(m) = k + iu(m) = j + j = l + m = m+1 + endif + go to 70 +c +c begin again on another portion of the unsorted array +c + 60 m = m-1 + if (m .eq. 0) go to 190 + i = il(m) + j = iu(m) +c + 70 if (j-i .ge. 1) go to 30 + if (i .eq. 1) go to 20 + i = i-1 +c + 80 i = i+1 + if (i .eq. j) go to 60 + t = x(i+1) + if (x(i) .le. t) go to 80 + k = i +c + 90 x(k+1) = x(k) + k = k-1 + if (t .lt. x(k)) go to 90 + x(k+1) = t + go to 80 +c +c sort x and carry y along +c + 100 m = 1 + i = 1 + j = nn + r = 0.375e0 +c + 110 if (i .eq. j) go to 150 + if (r .le. 0.5898437e0) then + r = r+3.90625e-2 + else + r = r-0.21875e0 + endif +c + 120 k = i +c +c select a central element of the array and save it in location t +c + ij = i + int((j-i)*r) + t = x(ij) + ty = y(ij) +c +c if first element of array is greater than t, interchange with t +c + if (x(i) .gt. t) then + x(ij) = x(i) + x(i) = t + t = x(ij) + y(ij) = y(i) + y(i) = ty + ty = y(ij) + endif + l = j +c +c if last element of array is less than t, interchange with t +c + if (x(j) .lt. t) then + x(ij) = x(j) + x(j) = t + t = x(ij) + y(ij) = y(j) + y(j) = ty + ty = y(ij) +c +c if first element of array is greater than t, interchange with t +c + if (x(i) .gt. t) then + x(ij) = x(i) + x(i) = t + t = x(ij) + y(ij) = y(i) + y(i) = ty + ty = y(ij) + endif + endif +c +c find an element in the second half of the array which is smaller +c than t +c + 130 l = l-1 + if (x(l) .gt. t) go to 130 +c +c find an element in the first half of the array which is greater +c than t +c + 140 k = k+1 + if (x(k) .lt. t) go to 140 +c +c interchange these elements +c + if (k .le. l) then + tt = x(l) + x(l) = x(k) + x(k) = tt + tty = y(l) + y(l) = y(k) + y(k) = tty + go to 130 + endif +c +c save upper and lower subscripts of the array yet to be sorted +c + if (l-i .gt. j-k) then + il(m) = i + iu(m) = l + i = k + m = m+1 + else + il(m) = k + iu(m) = j + j = l + m = m+1 + endif + go to 160 +c +c begin again on another portion of the unsorted array +c + 150 m = m-1 + if (m .eq. 0) go to 190 + i = il(m) + j = iu(m) +c + 160 if (j-i .ge. 1) go to 120 + if (i .eq. 1) go to 110 + i = i-1 +c + 170 i = i+1 + if (i .eq. j) go to 150 + t = x(i+1) + ty = y(i+1) + if (x(i) .le. t) go to 170 + k = i +c + 180 x(k+1) = x(k) + y(k+1) = y(k) + k = k-1 + if (t .lt. x(k)) go to 180 + x(k+1) = t + y(k+1) = ty + go to 170 +c +c clean up +c + 190 if (kflag .le. -1) then + do 200 i=1,nn + x(i) = -x(i) + 200 continue + endif + return + end diff --git a/qmap/libqmap/sun.f90 b/qmap/libqmap/sun.f90 index e74ac0b8..ec011b66 100755 --- a/qmap/libqmap/sun.f90 +++ b/qmap/libqmap/sun.f90 @@ -1,88 +1,88 @@ -subroutine sun(y,m,DD,UT,lon,lat,RA,Dec,LST,Az,El,mjd,day)
-
- implicit none
-
- integer y !Year
- integer m !Month
- integer DD !Day
- integer mjd !Modified Julian Date
- real UT !UTC in hours
- real RA,Dec !RA and Dec of sun
-
-! NB: Double caps here are single caps in the writeup.
-
-! Orbital elements of the Sun (also N=0, i=0, a=1):
- real w !Argument of perihelion
- real e !Eccentricity
- real MM !Mean anomaly
- real Ls !Mean longitude
-
-! Other standard variables:
- real v !True anomaly
- real EE !Eccentric anomaly
- real ecl !Obliquity of the ecliptic
- real d !Ephemeris time argument in days
- real r !Distance to sun, AU
- real xv,yv !x and y coords in ecliptic
- real lonsun !Ecliptic long and lat of sun
-! Ecliptic coords of sun (geocentric)
- real xs,ys
-! Equatorial coords of sun (geocentric)
- real xe,ye,ze
- real lon,lat
- real GMST0,LST,HA
- real xx,yy,zz
- real xhor,yhor,zhor
- real Az,El
-
- real day
- real rad
- data rad/57.2957795/
-
-! Time in days, with Jan 0, 2000 equal to 0.0:
- d=367*y - 7*(y+(m+9)/12)/4 + 275*m/9 + DD - 730530 + UT/24.0
- mjd=d + 51543
- ecl = 23.4393 - 3.563e-7 * d
-
-! Compute updated orbital elements for Sun:
- w = 282.9404 + 4.70935e-5 * d
- e = 0.016709 - 1.151e-9 * d
- MM = mod(356.0470d0 + 0.9856002585d0 * d + 360000.d0,360.d0)
- Ls = mod(w+MM+720.0,360.0)
-
- EE = MM + e*rad*sin(MM/rad) * (1.0 + e*cos(M/rad))
- EE = EE - (EE - e*rad*sin(EE/rad)-MM) / (1.0 - e*cos(EE/rad))
-
- xv = cos(EE/rad) - e
- yv = sqrt(1.0-e*e) * sin(EE/rad)
- v = rad*atan2(yv,xv)
- r = sqrt(xv*xv + yv*yv)
- lonsun = mod(v + w + 720.0,360.0)
-! Ecliptic coordinates of sun (rectangular):
- xs = r * cos(lonsun/rad)
- ys = r * sin(lonsun/rad)
-
-! Equatorial coordinates of sun (rectangular):
- xe = xs
- ye = ys * cos(ecl/rad)
- ze = ys * sin(ecl/rad)
-
-! RA and Dec in degrees:
- RA = rad*atan2(ye,xe)
- Dec = rad*atan2(ze,sqrt(xe*xe + ye*ye))
-
- GMST0 = (Ls + 180.0)/15.0
- LST = mod(GMST0+UT+lon/15.0+48.0,24.0) !LST in hours
- HA = 15.0*LST - RA !HA in degrees
- xx = cos(HA/rad)*cos(Dec/rad)
- yy = sin(HA/rad)*cos(Dec/rad)
- zz = sin(Dec/rad)
- xhor = xx*sin(lat/rad) - zz*cos(lat/rad)
- yhor = yy
- zhor = xx*cos(lat/rad) + zz*sin(lat/rad)
- Az = mod(rad*atan2(yhor,xhor) + 180.0 + 360.0,360.0)
- El = rad*asin(zhor)
- day=d-1.5
-
- return
-end subroutine sun
+subroutine sun(y,m,DD,UT,lon,lat,RA,Dec,LST,Az,El,mjd,day) + + implicit none + + integer y !Year + integer m !Month + integer DD !Day + integer mjd !Modified Julian Date + real UT !UTC in hours + real RA,Dec !RA and Dec of sun + +! NB: Double caps here are single caps in the writeup. + +! Orbital elements of the Sun (also N=0, i=0, a=1): + real w !Argument of perihelion + real e !Eccentricity + real MM !Mean anomaly + real Ls !Mean longitude + +! Other standard variables: + real v !True anomaly + real EE !Eccentric anomaly + real ecl !Obliquity of the ecliptic + real d !Ephemeris time argument in days + real r !Distance to sun, AU + real xv,yv !x and y coords in ecliptic + real lonsun !Ecliptic long and lat of sun +! Ecliptic coords of sun (geocentric) + real xs,ys +! Equatorial coords of sun (geocentric) + real xe,ye,ze + real lon,lat + real GMST0,LST,HA + real xx,yy,zz + real xhor,yhor,zhor + real Az,El + + real day + real rad + data rad/57.2957795/ + +! Time in days, with Jan 0, 2000 equal to 0.0: + d=367*y - 7*(y+(m+9)/12)/4 + 275*m/9 + DD - 730530 + UT/24.0 + mjd=d + 51543 + ecl = 23.4393 - 3.563e-7 * d + +! Compute updated orbital elements for Sun: + w = 282.9404 + 4.70935e-5 * d + e = 0.016709 - 1.151e-9 * d + MM = mod(356.0470d0 + 0.9856002585d0 * d + 360000.d0,360.d0) + Ls = mod(w+MM+720.0,360.0) + + EE = MM + e*rad*sin(MM/rad) * (1.0 + e*cos(M/rad)) + EE = EE - (EE - e*rad*sin(EE/rad)-MM) / (1.0 - e*cos(EE/rad)) + + xv = cos(EE/rad) - e + yv = sqrt(1.0-e*e) * sin(EE/rad) + v = rad*atan2(yv,xv) + r = sqrt(xv*xv + yv*yv) + lonsun = mod(v + w + 720.0,360.0) +! Ecliptic coordinates of sun (rectangular): + xs = r * cos(lonsun/rad) + ys = r * sin(lonsun/rad) + +! Equatorial coordinates of sun (rectangular): + xe = xs + ye = ys * cos(ecl/rad) + ze = ys * sin(ecl/rad) + +! RA and Dec in degrees: + RA = rad*atan2(ye,xe) + Dec = rad*atan2(ze,sqrt(xe*xe + ye*ye)) + + GMST0 = (Ls + 180.0)/15.0 + LST = mod(GMST0+UT+lon/15.0+48.0,24.0) !LST in hours + HA = 15.0*LST - RA !HA in degrees + xx = cos(HA/rad)*cos(Dec/rad) + yy = sin(HA/rad)*cos(Dec/rad) + zz = sin(Dec/rad) + xhor = xx*sin(lat/rad) - zz*cos(lat/rad) + yhor = yy + zhor = xx*cos(lat/rad) + zz*sin(lat/rad) + Az = mod(rad*atan2(yhor,xhor) + 180.0 + 360.0,360.0) + El = rad*asin(zhor) + day=d-1.5 + + return +end subroutine sun diff --git a/qmap/libqmap/symspec.f90 b/qmap/libqmap/symspec.f90 index b07cfa5b..ae00cc59 100755 --- a/qmap/libqmap/symspec.f90 +++ b/qmap/libqmap/symspec.f90 @@ -1,123 +1,123 @@ -subroutine symspec(k,ndiskdat,nb,nbslider,nfsample, &
- pxdb,ssz5a,nkhz,ihsym,nzap,slimit,lstrong)
-
-! k pointer to the most recent new data
-! ndiskdat 0/1 to indicate if data from disk
-! nb 0/1 status of noise blanker
-! nfsample sample rate (Hz)
-! pxdb power in x channel (0-60 dB)
-! ssz5a polarized spectrum, for waterfall display
-! nkhz integer kHz portion of center frequency, e.g., 125 for 144.125
-! ihsym index number of this half-symbol (1-400)
-! nzap number of samples zero'ed by noise blanker
-
- include 'njunk.f90'
- parameter (NSMAX=60*96000) !Total sample intervals per minute
- parameter (NFFT=32768) !Length of FFTs
- real*8 ts,hsym
- real*8 fcenter
- common/datcom/dd(2,5760000),ss(400,NFFT),savg(NFFT),fcenter,nutc, &
- junk(NJUNK)
- real*4 ssz5a(NFFT),w(NFFT)
- complex cx(NFFT)
- complex cx00(NFFT)
- complex cx0(0:1023),cx1(0:1023)
- logical*1 lstrong(0:1023)
- data rms/999.0/,k0/99999999/,nadjx/0/,nadjy/0/
- save
-
- hsym=0.15d0*96000.d0 !Samples per Q65-30x half-symbol
- npts=2*hsym !Full Q65-30x symbol
- if(k.gt.5751000) go to 999
- if(k.lt.npts) then
- ihsym=0
- go to 999 !Wait for enough samples to start
- endif
- if(k0.eq.99999999) then
-! pi=4.0*atan(1.0)
-! do i=1,NFFT
-! w(i)=(sin(i*pi/NFFT))**2 !Window
-! enddo
- w=0.7 !Flat window
- endif
-
- if(k.lt.k0) then
- ts=1.d0 - hsym
- ss=0.
- savg=0.
- ihsym=0
- k1=0
- if(ndiskdat.eq.0) dd(1:2,k+1:5760000)=0. !### Should not be needed ??? ###
- endif
- k0=k
-
- nzap=0
- sigmas=1.5*(10.0**(0.01*nbslider)) + 0.7
- peaklimit=sigmas*max(10.0,rms)
- faclim=3.0
- px=0.
-
- nwindow=2
- nfft2=1024
- kstep=nfft2
- if(nwindow.ne.0) kstep=nfft2/2
- nblks=(k-k1)/kstep
- do nblk=1,nblks
- j=k1+1
- do i=0,nfft2-1
- cx0(i)=cmplx(dd(1,j+i),dd(2,j+i))
- enddo
- call timf2(k,nfft2,nwindow,nb,peaklimit, &
- faclim,cx0,cx1,slimit,lstrong, &
- px,nzap)
-
- do i=0,kstep-1
- dd(1,j+i)=real(cx1(i))
- dd(2,j+i)=aimag(cx1(i))
- enddo
- k1=k1+kstep
- enddo
-
- ts=ts+hsym
- ja=ts !Index of first sample
- jb=ja+npts-1 !Last sample
- i=0
- fac=0.0002
- do j=ja,jb !Copy data into cx
- x1=dd(1,j)
- x2=dd(2,j)
- i=i+1
- cx(i)=fac*cmplx(x1,x2)
- enddo
- cx(npts+1:)=0.
-
- if(nzap/178.lt.50 .and. (ndiskdat.eq.0 .or. ihsym.lt.280)) then
- nsum=nblks*kstep - nzap
- if(nsum.le.0) nsum=1
- rmsx=sqrt(px/nsum)
- rms=rmsx
- endif
- pxdb=0.
- if(rmsx.gt.1.0) pxdb=20.0*log10(rmsx)
- if(pxdb.gt.60.0) pxdb=60.0
-
- cx00=cx
-
- ihsym=ihsym+1
- cx=w*cx00 !Apply window for 2nd forward FFT
- call four2a(cx,NFFT,1,1,1) !Second forward FFT (X)
- n=min(400,ihsym)
- do i=1,NFFT
- sx=real(cx(i))**2 + aimag(cx(i))**2
- ss(n,i)=sx ! Pol = 0
- savg(i)=savg(i) + sx
- ssz5a(i)=sx
- enddo
-
- nkhz=nint(1000.d0*(fcenter-int(fcenter)))
- if(fcenter.eq.0.d0) nkhz=125
-! write(*,3001) hsym,ts,ja,jb,ihsym
-!3001 format(2f12.3,3i10)
-
-999 return
-end subroutine symspec
+subroutine symspec(k,ndiskdat,nb,nbslider,nfsample, & + pxdb,ssz5a,nkhz,ihsym,nzap,slimit,lstrong) + +! k pointer to the most recent new data +! ndiskdat 0/1 to indicate if data from disk +! nb 0/1 status of noise blanker +! nfsample sample rate (Hz) +! pxdb power in x channel (0-60 dB) +! ssz5a polarized spectrum, for waterfall display +! nkhz integer kHz portion of center frequency, e.g., 125 for 144.125 +! ihsym index number of this half-symbol (1-400) +! nzap number of samples zero'ed by noise blanker + + include 'njunk.f90' + parameter (NSMAX=60*96000) !Total sample intervals per minute + parameter (NFFT=32768) !Length of FFTs + real*8 ts,hsym + real*8 fcenter + common/datcom/dd(2,5760000),ss(400,NFFT),savg(NFFT),fcenter,nutc, & + junk(NJUNK) + real*4 ssz5a(NFFT),w(NFFT) + complex cx(NFFT) + complex cx00(NFFT) + complex cx0(0:1023),cx1(0:1023) + logical*1 lstrong(0:1023) + data rms/999.0/,k0/99999999/,nadjx/0/,nadjy/0/ + save + + hsym=0.15d0*96000.d0 !Samples per Q65-30x half-symbol + npts=2*hsym !Full Q65-30x symbol + if(k.gt.5751000) go to 999 + if(k.lt.npts) then + ihsym=0 + go to 999 !Wait for enough samples to start + endif + if(k0.eq.99999999) then +! pi=4.0*atan(1.0) +! do i=1,NFFT +! w(i)=(sin(i*pi/NFFT))**2 !Window +! enddo + w=0.7 !Flat window + endif + + if(k.lt.k0) then + ts=1.d0 - hsym + ss=0. + savg=0. + ihsym=0 + k1=0 + if(ndiskdat.eq.0) dd(1:2,k+1:5760000)=0. !### Should not be needed ??? ### + endif + k0=k + + nzap=0 + sigmas=1.5*(10.0**(0.01*nbslider)) + 0.7 + peaklimit=sigmas*max(10.0,rms) + faclim=3.0 + px=0. + + nwindow=2 + nfft2=1024 + kstep=nfft2 + if(nwindow.ne.0) kstep=nfft2/2 + nblks=(k-k1)/kstep + do nblk=1,nblks + j=k1+1 + do i=0,nfft2-1 + cx0(i)=cmplx(dd(1,j+i),dd(2,j+i)) + enddo + call timf2(k,nfft2,nwindow,nb,peaklimit, & + faclim,cx0,cx1,slimit,lstrong, & + px,nzap) + + do i=0,kstep-1 + dd(1,j+i)=real(cx1(i)) + dd(2,j+i)=aimag(cx1(i)) + enddo + k1=k1+kstep + enddo + + ts=ts+hsym + ja=ts !Index of first sample + jb=ja+npts-1 !Last sample + i=0 + fac=0.0002 + do j=ja,jb !Copy data into cx + x1=dd(1,j) + x2=dd(2,j) + i=i+1 + cx(i)=fac*cmplx(x1,x2) + enddo + cx(npts+1:)=0. + + if(nzap/178.lt.50 .and. (ndiskdat.eq.0 .or. ihsym.lt.280)) then + nsum=nblks*kstep - nzap + if(nsum.le.0) nsum=1 + rmsx=sqrt(px/nsum) + rms=rmsx + endif + pxdb=0. + if(rmsx.gt.1.0) pxdb=20.0*log10(rmsx) + if(pxdb.gt.60.0) pxdb=60.0 + + cx00=cx + + ihsym=ihsym+1 + cx=w*cx00 !Apply window for 2nd forward FFT + call four2a(cx,NFFT,1,1,1) !Second forward FFT (X) + n=min(400,ihsym) + do i=1,NFFT + sx=real(cx(i))**2 + aimag(cx(i))**2 + ss(n,i)=sx ! Pol = 0 + savg(i)=savg(i) + sx + ssz5a(i)=sx + enddo + + nkhz=nint(1000.d0*(fcenter-int(fcenter))) + if(fcenter.eq.0.d0) nkhz=125 +! write(*,3001) hsym,ts,ja,jb,ihsym +!3001 format(2f12.3,3i10) + +999 return +end subroutine symspec diff --git a/qmap/libqmap/synctst.f90 b/qmap/libqmap/synctst.f90 index b9137300..248c7e19 100755 --- a/qmap/libqmap/synctst.f90 +++ b/qmap/libqmap/synctst.f90 @@ -1,84 +1,84 @@ -program synctst
-
-! Tests JT65B2 sync patterns
-
- parameter (LAGMAX=20)
- real ccf0(0:LAGMAX),ccf2(0:LAGMAX),ccf3(0:LAGMAX)
- character*12 arg
- integer npr(126),np0(126),np1(126),npr2(126)
- data npr/1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
- 0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, &
- 0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, &
- 0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, &
- 1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, &
- 0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, &
- 1,1,1,1,1,1/
-
- nargs=iargc()
- if(nargs.ne.1) then
- print*,'Usage: synctst iters'
- go to 999
- endif
- call getarg(1,arg)
- read(arg,*) iters
-
- worst=0.
- do lag=0,LAGMAX
- nsum=0
- do i=1,126-lag
- nsum=nsum + npr(i)*npr(lag+i)
- enddo
- ccf0(lag)=2.0*nsum/(126.0-lag)
- if(lag.ge.1 .and. ccf0(lag).gt.worst) worst=ccf0(lag)
- enddo
-
- best2=1.0
- do iter=1,iters
-
-10 np0=0
- np1=0
- n0=0
- do i=1,126
- if(npr(i).eq.1) then
- call random_number(r)
- if(r.lt.0.5) then
- np0(i)=1
- n0=n0+1
- else
- np1(i)=1
- endif
- endif
- enddo
- if(n0.ne.31 .and. n0.ne.32) go to 10
-
- worst2=0.
- do lag=0,LAGMAX
- nsum=0
- do i=1,126-lag
- nsum=nsum + np0(i)*np0(lag+i) + np1(i)*np1(lag+i)
- enddo
- ccf2(lag)=2.0*nsum/(126.0-lag)
- if(lag.ge.1 .and. ccf2(lag).gt.worst2) then
- worst2=ccf2(lag)
- lagbad=lag
- endif
- enddo
- if(worst2.lt.best2) then
- best2=worst2
- lagbest=lagbad
- n0best=n0
- ccf3=ccf2
- npr2=np0 + 2*np1
- endif
- enddo
-
- do lag=0,LAGMAX
- write(13,1100) lag,ccf0(lag),ccf3(lag)
-1100 format(i3,2f10.3)
- enddo
-
- print*,worst,best2,n0best,lagbest
- write(*,1110) npr2
-1110 format((8x,20(i1,',')))
-
-999 end program synctst
+program synctst + +! Tests JT65B2 sync patterns + + parameter (LAGMAX=20) + real ccf0(0:LAGMAX),ccf2(0:LAGMAX),ccf3(0:LAGMAX) + character*12 arg + integer npr(126),np0(126),np1(126),npr2(126) + data npr/1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, & + 0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, & + 0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, & + 0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, & + 1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, & + 0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, & + 1,1,1,1,1,1/ + + nargs=iargc() + if(nargs.ne.1) then + print*,'Usage: synctst iters' + go to 999 + endif + call getarg(1,arg) + read(arg,*) iters + + worst=0. + do lag=0,LAGMAX + nsum=0 + do i=1,126-lag + nsum=nsum + npr(i)*npr(lag+i) + enddo + ccf0(lag)=2.0*nsum/(126.0-lag) + if(lag.ge.1 .and. ccf0(lag).gt.worst) worst=ccf0(lag) + enddo + + best2=1.0 + do iter=1,iters + +10 np0=0 + np1=0 + n0=0 + do i=1,126 + if(npr(i).eq.1) then + call random_number(r) + if(r.lt.0.5) then + np0(i)=1 + n0=n0+1 + else + np1(i)=1 + endif + endif + enddo + if(n0.ne.31 .and. n0.ne.32) go to 10 + + worst2=0. + do lag=0,LAGMAX + nsum=0 + do i=1,126-lag + nsum=nsum + np0(i)*np0(lag+i) + np1(i)*np1(lag+i) + enddo + ccf2(lag)=2.0*nsum/(126.0-lag) + if(lag.ge.1 .and. ccf2(lag).gt.worst2) then + worst2=ccf2(lag) + lagbad=lag + endif + enddo + if(worst2.lt.best2) then + best2=worst2 + lagbest=lagbad + n0best=n0 + ccf3=ccf2 + npr2=np0 + 2*np1 + endif + enddo + + do lag=0,LAGMAX + write(13,1100) lag,ccf0(lag),ccf3(lag) +1100 format(i3,2f10.3) + enddo + + print*,worst,best2,n0best,lagbest + write(*,1110) npr2 +1110 format((8x,20(i1,','))) + +999 end program synctst diff --git a/qmap/libqmap/synctst2.f90 b/qmap/libqmap/synctst2.f90 index 34893f96..8ff4971a 100755 --- a/qmap/libqmap/synctst2.f90 +++ b/qmap/libqmap/synctst2.f90 @@ -1,91 +1,91 @@ -program synctst2
-
-! Tests JT65B2 sync patterns
-
- parameter (LAGMAX=20)
- real ccf0(0:LAGMAX),ccf1(0:LAGMAX),ccf2(0:LAGMAX),ccf3(0:LAGMAX)
- character arg*12,line*64
- integer*8 n8
- integer npr(126),np0(126),np1(126),npr1(126),npr2(126)
- data npr/1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, &
- 0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, &
- 0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, &
- 0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, &
- 1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, &
- 0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, &
- 1,1,1,1,1,1/
-
- data npr2/1,0,0,1,2,0,0,0,2,1,1,2,2,2,0,2,0,2,0,0, &
- 0,1,0,2,1,0,0,1,0,0,0,2,1,1,0,0,1,1,2,2, &
- 0,2,2,0,2,1,1,1,0,0,0,1,2,0,1,0,2,0,1,1, &
- 0,0,2,2,0,1,0,1,0,2,0,0,2,0,0,0,0,0,0,1, &
- 1,0,0,0,0,0,0,0,1,2,0,2,0,0,2,0,2,1,0,1, &
- 0,2,0,1,0,0,2,2,0,0,1,0,0,2,0,0,0,0,1,1, &
- 1,2,1,2,1,2/
-
- data n8/x'4314f4725bb357e0'/
-
- write(*,1102) n8
- write(line,1102) n8
-1102 format(b63)
- read(line,1104) npr1(1:63)
-1104 format(63i1)
- npr1(64:126)=npr1(1:63)
-
- worst=0.
- do lag=0,LAGMAX
- nsum=0
- do i=1,126-lag
- nsum=nsum + npr(i)*npr(lag+i)
- enddo
- ccf0(lag)=2.0*nsum/(126.0-lag)
- if(lag.ge.1 .and. ccf0(lag).gt.worst) worst=ccf0(lag)
- enddo
-
-
- worst1=0.
- do lag=0,LAGMAX
- nsum=0
- do i=1,126-lag
- nsum=nsum + npr1(i)*npr1(lag+i)
- enddo
- ccf1(lag)=(63.0/64.0)*2.0*nsum/(126.0-lag)
- if(lag.ge.1 .and. ccf1(lag).gt.worst1) worst1=ccf1(lag)
- enddo
- ccf1=ccf1/ccf1(0)
- worst1=worst1/ccf1(0)
-
- np0=0
- np1=0
- n0=0
- do i=1,126
- if(npr2(i).eq.1) then
- np0(i)=1
- n0=n0+1
- else if(npr2(i).eq.2) then
- np1(i)=1
- endif
- enddo
-
- worst2=0.
- do lag=0,LAGMAX
- nsum=0
- do i=1,126-lag
- nsum=nsum + np0(i)*np0(lag+i) + np1(i)*np1(lag+i)
- enddo
- ccf2(lag)=2.0*nsum/(126.0-lag)
- if(lag.ge.1 .and. ccf2(lag).gt.worst2) then
- worst2=ccf2(lag)
- lagbad=lag
- endif
- enddo
-
- do lag=0,LAGMAX
- write(13,1100) lag,ccf0(lag),ccf1(lag),ccf2(lag)
-1100 format(i3,3f10.3)
- enddo
-
- print*,worst,worst1,worst2,n0,lagbad
-
-
-999 end program synctst2
+program synctst2 + +! Tests JT65B2 sync patterns + + parameter (LAGMAX=20) + real ccf0(0:LAGMAX),ccf1(0:LAGMAX),ccf2(0:LAGMAX),ccf3(0:LAGMAX) + character arg*12,line*64 + integer*8 n8 + integer npr(126),np0(126),np1(126),npr1(126),npr2(126) + data npr/1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, & + 0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, & + 0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, & + 0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, & + 1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, & + 0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, & + 1,1,1,1,1,1/ + + data npr2/1,0,0,1,2,0,0,0,2,1,1,2,2,2,0,2,0,2,0,0, & + 0,1,0,2,1,0,0,1,0,0,0,2,1,1,0,0,1,1,2,2, & + 0,2,2,0,2,1,1,1,0,0,0,1,2,0,1,0,2,0,1,1, & + 0,0,2,2,0,1,0,1,0,2,0,0,2,0,0,0,0,0,0,1, & + 1,0,0,0,0,0,0,0,1,2,0,2,0,0,2,0,2,1,0,1, & + 0,2,0,1,0,0,2,2,0,0,1,0,0,2,0,0,0,0,1,1, & + 1,2,1,2,1,2/ + + data n8/x'4314f4725bb357e0'/ + + write(*,1102) n8 + write(line,1102) n8 +1102 format(b63) + read(line,1104) npr1(1:63) +1104 format(63i1) + npr1(64:126)=npr1(1:63) + + worst=0. + do lag=0,LAGMAX + nsum=0 + do i=1,126-lag + nsum=nsum + npr(i)*npr(lag+i) + enddo + ccf0(lag)=2.0*nsum/(126.0-lag) + if(lag.ge.1 .and. ccf0(lag).gt.worst) worst=ccf0(lag) + enddo + + + worst1=0. + do lag=0,LAGMAX + nsum=0 + do i=1,126-lag + nsum=nsum + npr1(i)*npr1(lag+i) + enddo + ccf1(lag)=(63.0/64.0)*2.0*nsum/(126.0-lag) + if(lag.ge.1 .and. ccf1(lag).gt.worst1) worst1=ccf1(lag) + enddo + ccf1=ccf1/ccf1(0) + worst1=worst1/ccf1(0) + + np0=0 + np1=0 + n0=0 + do i=1,126 + if(npr2(i).eq.1) then + np0(i)=1 + n0=n0+1 + else if(npr2(i).eq.2) then + np1(i)=1 + endif + enddo + + worst2=0. + do lag=0,LAGMAX + nsum=0 + do i=1,126-lag + nsum=nsum + np0(i)*np0(lag+i) + np1(i)*np1(lag+i) + enddo + ccf2(lag)=2.0*nsum/(126.0-lag) + if(lag.ge.1 .and. ccf2(lag).gt.worst2) then + worst2=ccf2(lag) + lagbad=lag + endif + enddo + + do lag=0,LAGMAX + write(13,1100) lag,ccf0(lag),ccf1(lag),ccf2(lag) +1100 format(i3,3f10.3) + enddo + + print*,worst,worst1,worst2,n0,lagbad + + +999 end program synctst2 diff --git a/qmap/libqmap/tastro.f90 b/qmap/libqmap/tastro.f90 index d9ede4a6..fac5c800 100755 --- a/qmap/libqmap/tastro.f90 +++ b/qmap/libqmap/tastro.f90 @@ -1,35 +1,35 @@ -program tastro
-
- implicit real*8 (a-h,o-z)
-
- character grid*6
- character*9 cauxra,cauxdec
-
- character*12 clock(3)
- integer nt(8)
- equivalence (nt(1),nyear)
-
- grid='FN20qi'
- nfreq=144
- cauxra='00:00:00'
-
-10 call date_and_time(clock(1),clock(2),clock(3),nt)
- ih=ihour-ntz/60
- if(ih.le.0) then
- ih=ih+24
- nday=nday+1
- endif
- uth8=ih + imin/60.d0 + isec/3600.d0 + ims/3600000.d0
- call astro0(nyear,month,nday,uth8,nfreq,grid,cauxra,cauxdec, &
- AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8,ntsky,ndop,ndop00, &
- dbMoon8,RAMoon8,DecMoon8,HA8,Dgrd8,sd8,poloffset8,xnr8,dfdt,dfdt0, &
- RaAux8,DecAux8,AzAux8,ElAux8,width1,width2,w501,w502,xlst8)
-
- write(*,1010) nyear,month,nday,ih,imin,isec,AzMoon8,ElMoon8, &
- AzSun8,ElSun8,ndop,dgrd8,ntsky
-1010 format(i4,i3,i3,i4.2,':',i2.2,':',i2.2,4f8.1,i6,f6.1,i6)
-
- call system('sleep 1')
- go to 10
-
-end program tastro
+program tastro + + implicit real*8 (a-h,o-z) + + character grid*6 + character*9 cauxra,cauxdec + + character*12 clock(3) + integer nt(8) + equivalence (nt(1),nyear) + + grid='FN20qi' + nfreq=144 + cauxra='00:00:00' + +10 call date_and_time(clock(1),clock(2),clock(3),nt) + ih=ihour-ntz/60 + if(ih.le.0) then + ih=ih+24 + nday=nday+1 + endif + uth8=ih + imin/60.d0 + isec/3600.d0 + ims/3600000.d0 + call astro0(nyear,month,nday,uth8,nfreq,grid,cauxra,cauxdec, & + AzSun8,ElSun8,AzMoon8,ElMoon8,AzMoonB8,ElMoonB8,ntsky,ndop,ndop00, & + dbMoon8,RAMoon8,DecMoon8,HA8,Dgrd8,sd8,poloffset8,xnr8,dfdt,dfdt0, & + RaAux8,DecAux8,AzAux8,ElAux8,width1,width2,w501,w502,xlst8) + + write(*,1010) nyear,month,nday,ih,imin,isec,AzMoon8,ElMoon8, & + AzSun8,ElSun8,ndop,dgrd8,ntsky +1010 format(i4,i3,i3,i4.2,':',i2.2,':',i2.2,4f8.1,i6,f6.1,i6) + + call system('sleep 1') + go to 10 + +end program tastro diff --git a/qmap/libqmap/timf2.f90 b/qmap/libqmap/timf2.f90 index 55985ab6..c22f3ce0 100755 --- a/qmap/libqmap/timf2.f90 +++ b/qmap/libqmap/timf2.f90 @@ -1,140 +1,140 @@ -subroutine timf2(k,nfft,nwindow,nb,peaklimit,faclim, &
- cx0,cx1,slimit,lstrong,px,nzap)
-
-! Sequential processing of time-domain I/Q data, using Linrad-like
-! "first FFT" and "first backward FFT".
-
-! cx0 - complex input data
-! nfft - length of FFTs
-! nwindow - 0 for no window, 2 for sin^2 window
-! cx1 - output data
-
-! Non-windowed processing means no overlap, so kstep=nfft.
-! Sin^2 window has 50% overlap, kstep=nfft/2.
-
-! Frequencies with strong signals are identified and separated. The back
-! transforms are done separately for weak and strong signals, so that
-! noise blanking can be applied to the weak-signal portion. Strong and
-! weak are finally re-combined in the time domain.
-
- parameter (MAXFFT=1024,MAXNH=MAXFFT/2)
- parameter (MAXSIGS=100)
- complex cx0(0:nfft-1),cx1(0:nfft-1)
- complex cx(0:MAXFFT-1),cxt(0:MAXFFT-1)
- complex cxs(0:MAXFFT-1),covxs(0:MAXNH-1) !Strong X signals
- complex cxw(0:MAXFFT-1),covxw(0:MAXNH-1) !Weak X signals
- real*4 w(0:MAXFFT-1)
- real*4 s(0:MAXFFT-1)
- logical*1 lstrong(0:MAXFFT-1),lprev
- integer ia(MAXSIGS),ib(MAXSIGS)
- logical first
- data first/.true./
- data k0/99999999/
- save
-
- if(faclim.eq.-9999.0) stop !Silence compiler warning.
- if(first) then
- pi=4.0*atan(1.0)
- do i=0,nfft-1
- w(i)=(sin(i*pi/nfft))**2
- enddo
- s=0.
- nh=nfft/2
- kstep=nfft
- if(nwindow.eq.2) kstep=nh
- fac=1.0/nfft
- slimit=1.e30
- first=.false.
- endif
-
- if(k.lt.k0) then
- covxs=0.
- covxw=0.
- covys=0.
- covyw=0.
- endif
- k0=k
-
- cx(0:nfft-1)=cx0
- if(nwindow.eq.2) cx(0:nfft-1)=w(0:nfft-1)*cx(0:nfft-1)
- call four2a(cx,nfft,1,1,1) !First forward FFT (X)
- cxt(0:nfft-1)=cx(0:nfft-1)
-
-! Identify frequencies with strong signals, copy frequency-domain
-! data into array cs (strong) or cw (weak).
-
- do i=0,nfft-1
- p=real(cxt(i))**2 + aimag(cxt(i))**2
- s(i)=p
- enddo
- ave=sum(s(0:nfft-1))/nfft
- lstrong(0:nfft-1)=s(0:nfft-1).gt.10.0*ave
-
- nsigs=0
- lprev=.false.
- iwid=1
- ib=-99
- do i=0,nfft-1
- if(lstrong(i) .and. (.not.lprev)) then
- if(nsigs.lt.MAXSIGS) nsigs=nsigs+1
- ia(nsigs)=i-iwid
- if(ia(nsigs).lt.0) ia(nsigs)=0
- endif
- if(.not.lstrong(i) .and. lprev) then
- ib(nsigs)=i-1+iwid
- if(ib(nsigs).gt.nfft-1) ib(nsigs)=nfft-1
- endif
- lprev=lstrong(i)
- enddo
-
- if(nsigs.gt.0) then
- do i=1,nsigs
- ja=ia(i)
- jb=ib(i)
- if(ja.lt.0 .or. ja.gt.nfft-1 .or. jb.lt.0 .or. jb.gt.nfft-1) then
- cycle
- endif
- if(jb.eq.-99) jb=ja + min(2*iwid,nfft-1)
- lstrong(ja:jb)=.true.
- enddo
- endif
-
- do i=0,nfft-1
- if(lstrong(i)) then
- cxs(i)=fac*cxt(i)
- cxw(i)=0.
- else
- cxw(i)=fac*cxt(i)
- cxs(i)=0.
- endif
- enddo
-
- call four2a(cxw,nfft,1,-1,1) !Transform weak and strong X
- call four2a(cxs,nfft,1,-1,1) !back to time domain, separately
-
- if(nwindow.eq.2) then
- cxw(0:nh-1)=cxw(0:nh-1)+covxw(0:nh-1) !Add previous segment's 2nd half
- covxw(0:nh-1)=cxw(nh:nfft-1) !Save 2nd half
- cxs(0:nh-1)=cxs(0:nh-1)+covxs(0:nh-1) !Ditto for strong signals
- covxs(0:nh-1)=cxs(nh:nfft-1)
- endif
-
-! Apply noise blanking to weak data
- if(nb.ne.0) then
- do i=0,kstep-1
- peak=abs(cxw(i))
- if(peak.gt.peaklimit) then
- cxw(i)=0.
- nzap=nzap+1
- endif
- enddo
- endif
-
-! Compute power levels from weak data only
- do i=0,kstep-1
- px=px + real(cxw(i))**2 + aimag(cxw(i))**2
- enddo
- cx1(0:kstep-1)=cxw(0:kstep-1) + cxs(0:kstep-1) !Weak + strong (X)
-
- return
-end subroutine timf2
+subroutine timf2(k,nfft,nwindow,nb,peaklimit,faclim, & + cx0,cx1,slimit,lstrong,px,nzap) + +! Sequential processing of time-domain I/Q data, using Linrad-like +! "first FFT" and "first backward FFT". + +! cx0 - complex input data +! nfft - length of FFTs +! nwindow - 0 for no window, 2 for sin^2 window +! cx1 - output data + +! Non-windowed processing means no overlap, so kstep=nfft. +! Sin^2 window has 50% overlap, kstep=nfft/2. + +! Frequencies with strong signals are identified and separated. The back +! transforms are done separately for weak and strong signals, so that +! noise blanking can be applied to the weak-signal portion. Strong and +! weak are finally re-combined in the time domain. + + parameter (MAXFFT=1024,MAXNH=MAXFFT/2) + parameter (MAXSIGS=100) + complex cx0(0:nfft-1),cx1(0:nfft-1) + complex cx(0:MAXFFT-1),cxt(0:MAXFFT-1) + complex cxs(0:MAXFFT-1),covxs(0:MAXNH-1) !Strong X signals + complex cxw(0:MAXFFT-1),covxw(0:MAXNH-1) !Weak X signals + real*4 w(0:MAXFFT-1) + real*4 s(0:MAXFFT-1) + logical*1 lstrong(0:MAXFFT-1),lprev + integer ia(MAXSIGS),ib(MAXSIGS) + logical first + data first/.true./ + data k0/99999999/ + save + + if(faclim.eq.-9999.0) stop !Silence compiler warning. + if(first) then + pi=4.0*atan(1.0) + do i=0,nfft-1 + w(i)=(sin(i*pi/nfft))**2 + enddo + s=0. + nh=nfft/2 + kstep=nfft + if(nwindow.eq.2) kstep=nh + fac=1.0/nfft + slimit=1.e30 + first=.false. + endif + + if(k.lt.k0) then + covxs=0. + covxw=0. + covys=0. + covyw=0. + endif + k0=k + + cx(0:nfft-1)=cx0 + if(nwindow.eq.2) cx(0:nfft-1)=w(0:nfft-1)*cx(0:nfft-1) + call four2a(cx,nfft,1,1,1) !First forward FFT (X) + cxt(0:nfft-1)=cx(0:nfft-1) + +! Identify frequencies with strong signals, copy frequency-domain +! data into array cs (strong) or cw (weak). + + do i=0,nfft-1 + p=real(cxt(i))**2 + aimag(cxt(i))**2 + s(i)=p + enddo + ave=sum(s(0:nfft-1))/nfft + lstrong(0:nfft-1)=s(0:nfft-1).gt.10.0*ave + + nsigs=0 + lprev=.false. + iwid=1 + ib=-99 + do i=0,nfft-1 + if(lstrong(i) .and. (.not.lprev)) then + if(nsigs.lt.MAXSIGS) nsigs=nsigs+1 + ia(nsigs)=i-iwid + if(ia(nsigs).lt.0) ia(nsigs)=0 + endif + if(.not.lstrong(i) .and. lprev) then + ib(nsigs)=i-1+iwid + if(ib(nsigs).gt.nfft-1) ib(nsigs)=nfft-1 + endif + lprev=lstrong(i) + enddo + + if(nsigs.gt.0) then + do i=1,nsigs + ja=ia(i) + jb=ib(i) + if(ja.lt.0 .or. ja.gt.nfft-1 .or. jb.lt.0 .or. jb.gt.nfft-1) then + cycle + endif + if(jb.eq.-99) jb=ja + min(2*iwid,nfft-1) + lstrong(ja:jb)=.true. + enddo + endif + + do i=0,nfft-1 + if(lstrong(i)) then + cxs(i)=fac*cxt(i) + cxw(i)=0. + else + cxw(i)=fac*cxt(i) + cxs(i)=0. + endif + enddo + + call four2a(cxw,nfft,1,-1,1) !Transform weak and strong X + call four2a(cxs,nfft,1,-1,1) !back to time domain, separately + + if(nwindow.eq.2) then + cxw(0:nh-1)=cxw(0:nh-1)+covxw(0:nh-1) !Add previous segment's 2nd half + covxw(0:nh-1)=cxw(nh:nfft-1) !Save 2nd half + cxs(0:nh-1)=cxs(0:nh-1)+covxs(0:nh-1) !Ditto for strong signals + covxs(0:nh-1)=cxs(nh:nfft-1) + endif + +! Apply noise blanking to weak data + if(nb.ne.0) then + do i=0,kstep-1 + peak=abs(cxw(i)) + if(peak.gt.peaklimit) then + cxw(i)=0. + nzap=nzap+1 + endif + enddo + endif + +! Compute power levels from weak data only + do i=0,kstep-1 + px=px + real(cxw(i))**2 + aimag(cxw(i))**2 + enddo + cx1(0:kstep-1)=cxw(0:kstep-1) + cxs(0:kstep-1) !Weak + strong (X) + + return +end subroutine timf2 diff --git a/qmap/libqmap/tm2.f90 b/qmap/libqmap/tm2.f90 index cf110783..fb831fab 100755 --- a/qmap/libqmap/tm2.f90 +++ b/qmap/libqmap/tm2.f90 @@ -1,14 +1,14 @@ -subroutine tm2(day,xlat4,xlon4,xl4,b4)
-
- implicit real*8 (a-h,o-z)
- parameter (RADS=0.0174532925199433d0)
-
- real*4 xlat4,xlon4,xl4,b4
-
- glat=xlat4*RADS
- glong=xlon4*RADS
- call tmoonsub(day,glat,glong,el,rv,xl,b,pax)
- xl4=xl
- b4=b
-
-end subroutine tm2
+subroutine tm2(day,xlat4,xlon4,xl4,b4) + + implicit real*8 (a-h,o-z) + parameter (RADS=0.0174532925199433d0) + + real*4 xlat4,xlon4,xl4,b4 + + glat=xlat4*RADS + glong=xlon4*RADS + call tmoonsub(day,glat,glong,el,rv,xl,b,pax) + xl4=xl + b4=b + +end subroutine tm2 diff --git a/qmap/libqmap/toxyz.f90 b/qmap/libqmap/toxyz.f90 index 82b8f851..aef160c9 100755 --- a/qmap/libqmap/toxyz.f90 +++ b/qmap/libqmap/toxyz.f90 @@ -1,25 +1,25 @@ -subroutine toxyz(alpha,delta,r,vec)
-
- implicit real*8 (a-h,o-z)
- real*8 vec(3)
-
- vec(1)=r*cos(delta)*cos(alpha)
- vec(2)=r*cos(delta)*sin(alpha)
- vec(3)=r*sin(delta)
-
- return
-end subroutine toxyz
-
-subroutine fromxyz(vec,alpha,delta,r)
-
- implicit real*8 (a-h,o-z)
- real*8 vec(3)
- data twopi/6.283185307d0/
-
- r=sqrt(vec(1)**2 + vec(2)**2 + vec(3)**2)
- alpha=atan2(vec(2),vec(1))
- if(alpha.lt.0.d0) alpha=alpha+twopi
- delta=asin(vec(3)/r)
-
- return
-end subroutine fromxyz
+subroutine toxyz(alpha,delta,r,vec) + + implicit real*8 (a-h,o-z) + real*8 vec(3) + + vec(1)=r*cos(delta)*cos(alpha) + vec(2)=r*cos(delta)*sin(alpha) + vec(3)=r*sin(delta) + + return +end subroutine toxyz + +subroutine fromxyz(vec,alpha,delta,r) + + implicit real*8 (a-h,o-z) + real*8 vec(3) + data twopi/6.283185307d0/ + + r=sqrt(vec(1)**2 + vec(2)**2 + vec(3)**2) + alpha=atan2(vec(2),vec(1)) + if(alpha.lt.0.d0) alpha=alpha+twopi + delta=asin(vec(3)/r) + + return +end subroutine fromxyz diff --git a/qmap/libqmap/twkfreq.f90 b/qmap/libqmap/twkfreq.f90 index 7c240d52..be1fef0f 100755 --- a/qmap/libqmap/twkfreq.f90 +++ b/qmap/libqmap/twkfreq.f90 @@ -1,26 +1,26 @@ -subroutine twkfreq(c3,c4,npts,fsample,a)
-
- complex c3(npts)
- complex c4(npts)
- complex w,wstep
- real a(3)
- data twopi/6.283185307/
-
-! Mix the complex signal
- w=1.0
- wstep=1.0
- x0=0.5*(npts+1)
- s=2.0/npts
- do i=1,npts
- x=s*(i-x0)
- p2=1.5*x*x - 0.5
-! p3=2.5*(x**3) - 1.5*x
-! p4=4.375*(x**4) - 3.75*(x**2) + 0.375
- dphi=(a(1) + x*a(2) + p2*a(3)) * (twopi/fsample)
- wstep=cmplx(cos(dphi),sin(dphi))
- w=w*wstep
- c4(i)=w*c3(i)
- enddo
-
- return
-end subroutine twkfreq
+subroutine twkfreq(c3,c4,npts,fsample,a) + + complex c3(npts) + complex c4(npts) + complex w,wstep + real a(3) + data twopi/6.283185307/ + +! Mix the complex signal + w=1.0 + wstep=1.0 + x0=0.5*(npts+1) + s=2.0/npts + do i=1,npts + x=s*(i-x0) + p2=1.5*x*x - 0.5 +! p3=2.5*(x**3) - 1.5*x +! p4=4.375*(x**4) - 3.75*(x**2) + 0.375 + dphi=(a(1) + x*a(2) + p2*a(3)) * (twopi/fsample) + wstep=cmplx(cos(dphi),sin(dphi)) + w=w*wstep + c4(i)=w*c3(i) + enddo + + return +end subroutine twkfreq diff --git a/qmap/libqmap/twkfreq_xy.f90 b/qmap/libqmap/twkfreq_xy.f90 index 1d79c973..a5cc3769 100755 --- a/qmap/libqmap/twkfreq_xy.f90 +++ b/qmap/libqmap/twkfreq_xy.f90 @@ -1,29 +1,29 @@ -subroutine twkfreq_xy(c4aa,c4bb,n5,a)
-
- complex c4aa(n5)
- complex c4bb(n5)
- real a(5)
- complex w,wstep
- data twopi/6.283185307/
-
-! Apply AFC corrections to the c4aa and c4bb data
- w=1.0
- wstep=1.0
- x0=0.5*(n5+1)
- s=2.0/n5
- do i=1,n5
- x=s*(i-x0)
- if(mod(i,1000).eq.1) then
- p2=1.5*x*x - 0.5
-! p3=2.5*(x**3) - 1.5*x
-! p4=4.375*(x**4) - 3.75*(x**2) + 0.375
- dphi=(a(1) + x*a(2) + p2*a(3)) * (twopi/1378.125)
- wstep=cmplx(cos(dphi),sin(dphi))
- endif
- w=w*wstep
- c4aa(i)=w*c4aa(i)
- c4bb(i)=w*c4bb(i)
- enddo
-
- return
-end subroutine twkfreq_xy
+subroutine twkfreq_xy(c4aa,c4bb,n5,a) + + complex c4aa(n5) + complex c4bb(n5) + real a(5) + complex w,wstep + data twopi/6.283185307/ + +! Apply AFC corrections to the c4aa and c4bb data + w=1.0 + wstep=1.0 + x0=0.5*(n5+1) + s=2.0/n5 + do i=1,n5 + x=s*(i-x0) + if(mod(i,1000).eq.1) then + p2=1.5*x*x - 0.5 +! p3=2.5*(x**3) - 1.5*x +! p4=4.375*(x**4) - 3.75*(x**2) + 0.375 + dphi=(a(1) + x*a(2) + p2*a(3)) * (twopi/1378.125) + wstep=cmplx(cos(dphi),sin(dphi)) + endif + w=w*wstep + c4aa(i)=w*c4aa(i) + c4bb(i)=w*c4bb(i) + enddo + + return +end subroutine twkfreq_xy diff --git a/qmap/libqmap/zaptx.f90 b/qmap/libqmap/zaptx.f90 index 6ddbd364..36d18d48 100755 --- a/qmap/libqmap/zaptx.f90 +++ b/qmap/libqmap/zaptx.f90 @@ -1,9 +1,9 @@ -subroutine zaptx(dd,k0,k)
-
- parameter(NMAX=60*96000)
- real dd(2,NMAX)
-
- dd(1:2,k0+1:k)=0.
-
- return
-end subroutine zaptx
+subroutine zaptx(dd,k0,k) + + parameter(NMAX=60*96000) + real dd(2,NMAX) + + dd(1:2,k0+1:k)=0. + + return +end subroutine zaptx diff --git a/qmap/libqmap/zplot.f90 b/qmap/libqmap/zplot.f90 index a10c85c8..55aa3c6f 100755 --- a/qmap/libqmap/zplot.f90 +++ b/qmap/libqmap/zplot.f90 @@ -1,34 +1,34 @@ -subroutine zplot(amp,nz,jj,ave,rms)
-
- real amp(nz)
- character*1 line(100),mark(0:6)
- data mark/' ',' ','.','-','+','X','$'/
-
- sum=0.
- smax=0.
- do i=1,nz
- sum=sum+amp(i)
- if(amp(i).gt.smax) then
- smax=amp(i)
- ipk=i
- endif
- enddo
- ave=(sum-smax)/(nz-1)
- sq=0.
- do i=1,nz
- if(i.ne.ipk) sq=sq+(amp(i)-ave)**2
- enddo
- rms=sqrt(sq/(nz-2))
-
- do i=1,nz
- n=(amp(i)-ave)/rms
-! n=(amp(i)-ave)/0.33
- if(n.lt.0) n=0
- if(n.gt.6) n=6
- line(i)=mark(n)
- enddo
- write(89,1010) jj,0.01*ave,0.01*rms,(line(i),i=1,nz)
-1010 format(i3,2f6.1,1x,100a1)
-
- return
-end subroutine zplot
+subroutine zplot(amp,nz,jj,ave,rms) + + real amp(nz) + character*1 line(100),mark(0:6) + data mark/' ',' ','.','-','+','X','$'/ + + sum=0. + smax=0. + do i=1,nz + sum=sum+amp(i) + if(amp(i).gt.smax) then + smax=amp(i) + ipk=i + endif + enddo + ave=(sum-smax)/(nz-1) + sq=0. + do i=1,nz + if(i.ne.ipk) sq=sq+(amp(i)-ave)**2 + enddo + rms=sqrt(sq/(nz-2)) + + do i=1,nz + n=(amp(i)-ave)/rms +! n=(amp(i)-ave)/0.33 + if(n.lt.0) n=0 + if(n.gt.6) n=6 + line(i)=mark(n) + enddo + write(89,1010) jj,0.01*ave,0.01*rms,(line(i),i=1,nz) +1010 format(i3,2f6.1,1x,100a1) + + return +end subroutine zplot |
