From 160009e6218306442b21db0902f334412bcbd7ad Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 19 Jul 2012 12:16:29 +0000 Subject: [PATCH] Are these properly registered, finally? git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/jtms3@2528 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- libm65/alignmsg.f90 | 38 ++++++++++++++++++++++++++++++++++++++ libm65/hipass.f90 | 23 +++++++++++++++++++++++ libm65/match.f90 | 28 ++++++++++++++++++++++++++++ libm65/tweak1.f90 | 24 ++++++++++++++++++++++++ mainwindow.cpp | 2 +- 5 files changed, 114 insertions(+), 1 deletion(-) create mode 100644 libm65/alignmsg.f90 create mode 100644 libm65/hipass.f90 create mode 100644 libm65/match.f90 create mode 100644 libm65/tweak1.f90 diff --git a/libm65/alignmsg.f90 b/libm65/alignmsg.f90 new file mode 100644 index 000000000..4608c2da3 --- /dev/null +++ b/libm65/alignmsg.f90 @@ -0,0 +1,38 @@ +subroutine alignmsg(word0,nmin,msg,msglen,idone) + + character*(*) word0 + character*29 msg,word + + word=word0//' ' + idone=0 + +! Test for two (or more) characters + if(word(1:2).eq.' ' .and. len(word).eq.2) then + i2=index(msg,' ') + if((i2.ge.1.and.i2.lt.msglen) .or. & + (msg(1:1).eq.' '.and.msg(msglen:msglen).eq.' ')) then + if(i2.eq.1) msg=msg(i2+2:msglen) !Align on EOM + if(i2.ge.2) msg=msg(i2+2:msglen)//msg(1:i2-1) + idone=1 + endif + +! Align on single (as last resort) + else if(word(1:1).eq.' ' .and. len(word).eq.1) then + i3=index(msg,' ') + if(i3.ge.1 .and. i3.lt.msglen) msg=msg(i3+1:msglen)//msg(1:i3) + if(i3.eq.msglen) msg=msg(1:msglen) + msg=msg(1:msglen)//msg(1:msglen) + idone=1 + +! Align on specified word + else + call match(word,msg(1:msglen),nstart,nmatch) + if(nmatch.ge.nmin) then + if(nstart.eq.1) msg=msg(nstart:msglen) + if(nstart.gt.1) msg=msg(nstart:msglen)//msg(1:nstart-1) + idone=1 + endif + endif + + return +end subroutine alignmsg diff --git a/libm65/hipass.f90 b/libm65/hipass.f90 new file mode 100644 index 000000000..9a24fa89a --- /dev/null +++ b/libm65/hipass.f90 @@ -0,0 +1,23 @@ +subroutine hipass(y,npts,nwidth) + +! Hipass filter for time-domain data. Removes an RC-type running +! mean (time constant nwidth) from array y(1:npts). + + real y(npts) + + c1=1.0/nwidth + c2=1.0-c1 + s=0. + do i=1,nwidth !Get initial average + s=s+y(i) + enddo + ave=c1*s + + do i=1,npts !Do the filtering + y0=y(i) + y(i)=y0-ave !Remove the mean + ave=c1*y0 + c2*ave !Update the mean + enddo + +return +end subroutine hipass diff --git a/libm65/match.f90 b/libm65/match.f90 new file mode 100644 index 000000000..e9570dabc --- /dev/null +++ b/libm65/match.f90 @@ -0,0 +1,28 @@ +subroutine match(s1,s2,nstart,nmatch) + + character*(*) s1,s2 + character s1a*29 + + nstart=-1 + nmatch=0 + n1=len_trim(s1)+1 + n2=len(s2) + s1a=s1//' ' + if(n2.ge.n1) then + do j=1,n2 + n=0 + do i=1,n1 + k=j+i-1 + if(k.gt.n2) k=k-n2 + if(s2(k:k).eq.s1a(i:i)) n=n+1 + enddo + if(n.gt.nmatch) then + nmatch=n + nstart=j + endif + enddo + endif + + return +end subroutine match + diff --git a/libm65/tweak1.f90 b/libm65/tweak1.f90 new file mode 100644 index 000000000..f6799dae4 --- /dev/null +++ b/libm65/tweak1.f90 @@ -0,0 +1,24 @@ +subroutine tweak1(ca,jz,f0,cb) + +! Shift frequency of analytic signal ca, with output to cb + + complex ca(jz),cb(jz) + real*8 twopi + complex*16 w,wstep + data twopi/0.d0/ + save twopi + + if(twopi.eq.0.d0) twopi=8.d0*atan(1.d0) + w=1.d0 + dphi=twopi*f0/11025.d0 + wstep=cmplx(cos(dphi),sin(dphi)) + x0=0.5*(jz+1) + s=2.0/jz + do i=1,jz + x=s*(i-x0) + w=w*wstep + cb(i)=w*ca(i) + enddo + + return +end subroutine tweak1 diff --git a/mainwindow.cpp b/mainwindow.cpp index 8b017971d..ce23348e6 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,4 @@ -//---------------------------------------------------------------- MainWindow +//--------------------------------------------------------------- MainWindow #include "mainwindow.h" #include "ui_mainwindow.h" #include "devsetup.h"