Finish implementing bins/Pixel on EchoGraph.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@5563 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2015-06-09 16:15:35 +00:00
parent 83c237cafd
commit 6f9c9b8072
3 changed files with 47 additions and 49 deletions

View File

@ -47,8 +47,8 @@ extern struct {
extern struct {
int nclearave;
int nsum;
float blue[2000];
float red[2000];
float blue[4096];
float red[4096];
} echocom_;
}

View File

@ -80,7 +80,7 @@ void EPlotter::paintEvent(QPaintEvent *) // paintEvent()
void EPlotter::draw() //draw()
{
int i,j,y;
float blue[2000],red[2000];
float blue[4096],red[4096];
float gain = pow(10.0,(m_plotGain/20.0));
if(m_2DPixmap.size().width()==0) return;
@ -88,40 +88,35 @@ void EPlotter::draw() //draw()
QRect tmp(0,0,m_w,m_h2);
painter2D.fillRect(tmp,Qt::black);
if(echocom_.nclearave==0) {
QPoint LineBuf[MAX_SCREENSIZE];
QPen penBlue(QColor(0,255,255),1);
QPen penRed(Qt::red,1);
j=0;
int i0=1000 + int(m_StartFreq/(m_fftBinWidth*m_binsPerPixel));
for(i=0; i<2000; i++) {
blue[i]=echocom_.blue[i];
red[i]=echocom_.red[i];
}
if(m_smooth>0) {
for(i=0; i<m_smooth; i++) {
int n2000=2000;
smo121_(blue,&n2000);
smo121_(red,&n2000);
}
}
QPoint LineBuf[MAX_SCREENSIZE];
QPen penBlue(QColor(0,255,255),1);
QPen penRed(Qt::red,1);
if(m_blue) {
painter2D.setPen(penBlue);
j=0;
for(i=0; i<m_w; i++) {
y = 0.9*m_h2 - gain*(m_h/10.0)*(blue[i0+i]-1.0) - 0.01*m_h2*m_plotZero;
LineBuf[j].setX(i);
LineBuf[j].setY(y);
j++;
}
painter2D.drawPolyline(LineBuf,j);
j=0;
for(i=0; i<4096/m_binsPerPixel; i++) {
blue[i]=0.0;
red[i]=0.0;
for(int k=0; k<m_binsPerPixel; k++) {
blue[i]+=echocom_.blue[j];
red[i]+=echocom_.red[j];
j++;
}
}
if(m_smooth>0) {
for(i=0; i<m_smooth; i++) {
int n4096=4096;
smo121_(blue,&n4096);
smo121_(red,&n4096);
}
}
painter2D.setPen(penRed);
// check i0 value! ...
int i0=2048/m_binsPerPixel + int(m_StartFreq/(m_fftBinWidth*m_binsPerPixel));
if(m_blue) {
painter2D.setPen(penBlue);
j=0;
for(int i=0; i<m_w; i++) {
y = 0.9*m_h2 - gain*(m_h/10.0)*(red[i0+i]-1.0) - 0.01*m_h2*m_plotZero;
for(i=0; i<m_w; i++) {
y = 0.9*m_h2 - gain*(m_h/10.0)*(blue[i0+i]-1.0) - 0.01*m_h2*m_plotZero;
LineBuf[j].setX(i);
LineBuf[j].setY(y);
j++;
@ -129,6 +124,15 @@ void EPlotter::draw() //draw()
painter2D.drawPolyline(LineBuf,j);
}
painter2D.setPen(penRed);
j=0;
for(int i=0; i<m_w; i++) {
y = 0.9*m_h2 - gain*(m_h/10.0)*(red[i0+i]-1.0) - 0.01*m_h2*m_plotZero;
LineBuf[j].setX(i);
LineBuf[j].setY(y);
j++;
}
painter2D.drawPolyline(LineBuf,j);
update(); //trigger a new paintEvent
}
@ -158,8 +162,6 @@ void EPlotter::DrawOverlay() //DrawOverlay()
// m_StartFreq=50 * int((-0.5*m_fSpan)/50.0 - 0.5);
m_StartFreq=m_freqPerDiv * int((-0.5*m_fSpan)/m_freqPerDiv - 0.5);
qDebug() << m_fSpan << m_freqPerDiv << m_StartFreq;
float pixPerHdiv = m_freqPerDiv/(m_fftBinWidth*m_binsPerPixel);
float pixPerVdiv = float(m_h2)/float(VERT_DIVS);

View File

@ -4,8 +4,8 @@ subroutine avecho(id2,ndop,nfrit,nqual,f1,rms0,sigdb,snr,dfreq,width)
parameter (TXLENGTH=27648) !27*1024
parameter (NFFT=32768,NH=NFFT/2)
integer*2 id2(34560) !Buffer for Rx data
real sa(2000) !Avg spectrum relative to initial Doppler echo freq
real sb(2000) !Avg spectrum with Dither and changing Doppler removed
real sa(4096) !Avg spectrum relative to initial Doppler echo freq
real sb(4096) !Avg spectrum with Dither and changing Doppler removed
integer nsum !Number of integrations
real dop0 !Doppler shift for initial integration (Hz)
real doppler !Doppler shift for current integration (Hz)
@ -14,7 +14,7 @@ subroutine avecho(id2,ndop,nfrit,nqual,f1,rms0,sigdb,snr,dfreq,width)
integer ipkv(1)
complex c(0:NH)
equivalence (x,c),(ipk,ipkv)
common/echocom/nclearave,nsum,blue(2000),red(2000)
common/echocom/nclearave,nsum,blue(4096),red(4096)
save dop0,sa,sb
dop=ndop
@ -48,9 +48,9 @@ subroutine avecho(id2,ndop,nfrit,nqual,f1,rms0,sigdb,snr,dfreq,width)
nsum=nsum+1
do i=1,2000
sa(i)=sa(i) + s(ia+i-1000) !Center at initial doppler freq
sb(i)=sb(i) + s(ib+i-1000) !Center at expected echo freq
do i=1,4096
sa(i)=sa(i) + s(ia+i-2048) !Center at initial doppler freq
sb(i)=sb(i) + s(ib+i-2048) !Center at expected echo freq
enddo
call pctile(sb,200,50,r0)
@ -58,7 +58,7 @@ subroutine avecho(id2,ndop,nfrit,nqual,f1,rms0,sigdb,snr,dfreq,width)
sum=0.
sq=0.
do i=1,2000
do i=1,4096
y=r0 + (r1-r0)*(i-100.0)/1800.0
blue(i)=sa(i)/y
red(i)=sb(i)/y
@ -105,13 +105,9 @@ subroutine avecho(id2,ndop,nfrit,nqual,f1,rms0,sigdb,snr,dfreq,width)
nsmo=max(0.0,0.25*bins)
do i=1,nsmo
call smo121(red,2000)
call smo121(blue,2000)
call smo121(red,4096)
call smo121(blue,4096)
enddo
900 continue
write(*,3001) ia*df,ib*df,dop,r0,r1,nfrit,nclearave,nsum
3001 format(5f10.1,3i6)
return
900 return
end subroutine avecho