WSJT-X/pix2d.f90
Joe Taylor e7c1d178b3 get_fname: If entry in ToRadio is blank, use Mon_ as prefix of recorded
file names.
decode2:   Corrected starting locations of mouse-picked decodes in JT6M mode
decode3, pix2d: Put yellow tick marks at frequency of JT6M sync tone.
wsjtgen:   Remove diagnostic print statement associated with Tx of test files.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/trunk@230 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2006-08-02 18:51:08 +00:00

129 lines
2.8 KiB
Fortran

subroutine pix2d(d2,jz,mousebutton,mode,s2,nchan,nz,b)
! Compute pixels to represent the 2-d spectrum s2(nchan,nz), and the
! green line.
integer*2 d2(jz) !Raw input data
character*6 mode
real s2(nchan,nz) !2-d spectrum
integer*2 b(60000) !Pixels corresponding to 2-d spectrum
data nx0/0/
save
tbest=s2(2,1)
s2(1,1)=s2(3,1)
s2(2,1)=s2(3,1)
gain=100.
offset=0.0
if(mousebutton.eq.0) then
k=0
do i=54,7,-1
do j=1,nz
k=k+1
n=0
if(s2(i,j).gt.0) n=gain*log10(s2(i,j)) + offset
n=min(252,max(0,n))
b(k)=n
enddo
k=k+500-nz
enddo
do i=k+1,60000
b(i)=0
enddo
else
! This is a mouse-picked decode, so we compute the "zoomed" region.
k=50*500
do i=54,7,-1
do j=1,nz
k=k+1
n=0
if(s2(i,j).gt.0) n=gain*log10(s2(i,j)) + offset
n=min(252,max(0,n))
b(k)=n
enddo
k=k+500-nz
enddo
endif
if(mousebutton.eq.0) then
! Compute the green curve
sum=0.
do i=1,jz
sum=sum+d2(i)
enddo
nave=nint(sum/jz)
nadd=661
ngreen=min(jz/nadd,500)
k=0
j=0
do i=1,ngreen
sq=0.
do n=1,nadd
k=k+1
d2(k)=d2(k)-nave
x=d2(k)
sq=sq + x*x
enddo
x=0.0001*sq/nadd
j=j+1
x=120.0-40.0*log10(0.01*x)
if(x.lt.1.0) x=1.0
if(x.gt.119.) x=119.
ng=nint(x)
ng=min(ng,120)
nx=i
if(nx.eq.1) ng0=ng
if(abs(ng-ng0).le.1) then
b((ng-1)*500+nx)=255
else
ist=1
if(ng.lt.ng0) ist=-1
jmid=(ng+ng0)/2
ii=max(1,nx-1)
do j=ng0+ist,ng,ist
b((j-1)*500+ii)=255
if(j.eq.jmid) ii=ii+1
enddo
ng0=ng
endif
enddo
if(mode.eq.'FSK441') then
! Insert yellow tick marks at frequencies of the FSK441 tones
do i=2,5
f=441*i
ich=58-nint(f/43.066)
do j=1,5
b((ich-1)*500+j+2)=254
b((ich-1)*500+j+248)=254
b((ich-1)*500+j+495)=254
enddo
enddo
else if(mode.eq.'JT6M') then
! Insert yellow tick marks at frequencies of the JT6M sync tone
f=1076.66
ich=60-nint(f/43.066) !Why 58 for FSK441, above?
do j=1,5
b((ich-1)*500+j+2)=254
b((ich-1)*500+j+248)=254
b((ich-1)*500+j+495)=254
enddo
endif
! Mark the best ping with a red tick
if(tbest.gt.0.0) then
nx=tbest/0.060 + 1
do j=110,120
b((j-1)*500+nx0)=0
b((j-1)*500+nx)=253
enddo
nx0=nx
endif
endif
return
end subroutine pix2d