Implement "orange sync curve", useful for multi-signal situation.

This commit is contained in:
Joe Taylor 2021-01-04 14:38:02 -05:00
parent 662a43d3dd
commit ea271152b8
5 changed files with 43 additions and 11 deletions

View File

@ -30,6 +30,7 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
real, allocatable :: s3(:,:) !Data-symbol energies s3(LL,63)
real, allocatable :: ccf(:,:) !CCF(freq,lag)
real, allocatable :: ccf1(:) !CCF(freq) at best lag
real, allocatable :: ccf2(:) !CCF(freq) at any lag
real sync(85) !sync vector
complex, allocatable :: c0(:) !Complex spectrum of symbol
data isync/1,9,12,13,15,22,23,26,27,33,35,38,46,50,55,60,62,66,69,74,76,85/
@ -57,6 +58,7 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
allocate(c0(0:nfft-1))
allocate(ccf(-ia2:ia2,-53:214))
allocate(ccf1(-ia2:ia2))
allocate(ccf2(-ia2:ia2))
if(sync(1).eq.99.0) then !Generate the sync vector
sync=-22.0/63.0 !Sync tone OFF
@ -156,6 +158,10 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
endif
enddo ! imsg
do i=-ia2,ia2
ccf2(i)=maxval(ccf(i,:))
enddo
i1=i0+ipk-64
i2=i1+LL-1
j=j0+jpk-7
@ -197,6 +203,10 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
ccf1=ccf1-base
smax=maxval(ccf1)
if(smax.gt.10.0) ccf1=10.0*ccf1/smax
base=(sum(ccf2(-ia2:-ia2+ic)) + sum(ccf2(ia2-ic:ia2)))/(2.0+2.0*ic);
ccf2=ccf2-base
smax=maxval(ccf2)
if(smax.gt.10.0) ccf2=10.0*ccf2/smax
go to 200
endif
enddo
@ -223,6 +233,11 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
jpk=ijpk(2)-53-1
f0=nfqso + ipk*df
xdt=jpk*dtstep
do i=-ia2,ia2
ccf2(i)=maxval(ccf(i,:))
enddo
sq=0.
nsq=0
jd=(lag2-lag1)/4
@ -239,6 +254,8 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
snr1=smax/rms
ccf1=ccf(:,jpk)/rms
if(snr1.gt.10.0) ccf1=(10.0/snr1)*ccf1
ccf2=ccf2/rms
if(snr1.gt.10.0) ccf2=(10.0/snr1)*ccf2
if(iand(ndepth,16).eq.16) then
! Fill s3() from s1() here, then call q65_avg().
@ -270,8 +287,8 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
enddo
do i=-ia2,ia2
freq=nfqso + i*df
write(17,1100) freq,ccf1(i),xdt
1100 format(3f10.3)
write(17,1100) freq,ccf1(i),xdt,ccf2(i)
1100 format(4f10.3)
enddo
close(17)
width=df*(i2-i1)

View File

@ -141,7 +141,7 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
//move current data down one line (must do this before attaching a QPainter object)
if(bScroll and !m_bReplot) m_WaterfallPixmap.scroll(0,1,0,0,m_w,m_h1);
QPainter painter1(&m_WaterfallPixmap);
if(m_bFirst or bRed or !m_bQ65_Sync or m_mode!=m_mode0 or m_bResized) {
if(m_bFirst or bRed or (!m_bQ65_Sync and !m_bQ65_MultiSync) or m_mode!=m_mode0 or m_bResized) {
m_2DPixmap = m_OverlayPixmap.copy(0,0,m_w,m_h2);
m_bFirst=false;
m_bResized=false;
@ -227,7 +227,7 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
}
if(i==iz-1 and !m_bQ65_Sync) {
if(i==iz-1 and !m_bQ65_Sync and !m_bQ65_MultiSync) {
painter2D.drawPolyline(LineBuf,j);
}
LineBuf[j].setX(i);
@ -271,25 +271,26 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
painter2D.drawText(x1-4,y,"73");
}
if(bRed and m_bQ65_Sync) {
if(bRed and (m_bQ65_Sync or m_bQ65_MultiSync)) { //Plot the Q65 red or orange sync curve
int k=0;
std::ifstream f;
f.open(m_redFile.toLatin1());
if(f) {
int x,y;
float freq,sync,xdt;
float freq,sync,xdt,sync2;
for(int i=0; i<99999; i++) {
f >> freq >> sync >> xdt;
f >> freq >> sync >> xdt >> sync2;
if(f.eof()) break;
x=XfromFreq(freq);
if(m_bQ65_MultiSync) sync=sync2;
y=m_h2*(0.9 - 0.09*gain2d*sync) - m_plot2dZero;
LineBuf2[k].setX(x);
LineBuf2[k].setY(y);
k++;
}
f.close();
QPen pen0(Qt::red,2);
QPen pen0(Qt::red,2);
if(m_bQ65_MultiSync) pen0.setColor("orange");
painter2D.setPen(pen0);
painter2D.drawPolyline(LineBuf2,k);
QString t;

View File

@ -82,7 +82,8 @@ public:
bool Reference() const {return m_bReference;}
void setQ65_Sync(bool b) {m_bQ65_Sync = b;}
bool Q65_Sync() const {return m_bQ65_Sync;}
void drawRed(int ia, int ib, float swide[]);
void setQ65_MultiSync(bool b) {m_bQ65_MultiSync = b;}
bool Q65_MultiSync() const {return m_bQ65_MultiSync;} void drawRed(int ia, int ib, float swide[]);
void setVHF(bool bVHF);
void setRedFile(QString fRed);
void setFST4_FreqRange(int fLow,int fHigh);
@ -116,6 +117,7 @@ private:
bool m_bReference;
bool m_bReference0;
bool m_bQ65_Sync;
bool m_bQ65_MultiSync;
bool m_bVHF;
bool m_bSingleDecode;
bool m_bFirst=true;

View File

@ -71,11 +71,13 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) :
ui->widePlot->setLinearAvg(m_settings->value("LinearAvg",false).toBool());
ui->widePlot->setReference(m_settings->value("Reference",false).toBool());
ui->widePlot->setQ65_Sync(m_settings->value("Q65_Sync",false).toBool());
ui->widePlot->setQ65_MultiSync(m_settings->value("Q65_MultiSync",false).toBool());
if(ui->widePlot->current()) ui->spec2dComboBox->setCurrentIndex(0);
if(ui->widePlot->cumulative()) ui->spec2dComboBox->setCurrentIndex(1);
if(ui->widePlot->linearAvg()) ui->spec2dComboBox->setCurrentIndex(2);
if(ui->widePlot->Reference()) ui->spec2dComboBox->setCurrentIndex(3);
if(ui->widePlot->Q65_Sync()) ui->spec2dComboBox->setCurrentIndex(4);
if(ui->widePlot->Q65_MultiSync()) ui->spec2dComboBox->setCurrentIndex(5);
int nbpp=m_settings->value("BinsPerPixel",2).toInt();
ui->widePlot->setBinsPerPixel(nbpp);
ui->sbPercent2dPlot->setValue(m_Percent2DScreen);
@ -133,6 +135,7 @@ void WideGraph::saveSettings() //saveS
m_settings->setValue ("LinearAvg", ui->widePlot->linearAvg());
m_settings->setValue ("Reference", ui->widePlot->Reference());
m_settings->setValue ("Q65_Sync", ui->widePlot->Q65_Sync());
m_settings->setValue ("Q65_MultiSync", ui->widePlot->Q65_MultiSync());
m_settings->setValue ("BinsPerPixel", ui->widePlot->binsPerPixel ());
m_settings->setValue ("StartFreq", ui->widePlot->startFreq ());
m_settings->setValue ("WaterfallPalette", m_waterfallPalette);
@ -320,6 +323,7 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(int index)
ui->widePlot->setLinearAvg(false);
ui->widePlot->setReference(false);
ui->widePlot->setQ65_Sync(false);
ui->widePlot->setQ65_MultiSync(false);
ui->smoSpinBox->setEnabled(false);
switch (index)
{
@ -339,7 +343,10 @@ void WideGraph::on_spec2dComboBox_currentIndexChanged(int index)
case 4:
ui->widePlot->setQ65_Sync(true);
break;
}
case 5:
ui->widePlot->setQ65_MultiSync(true);
break;
}
replot();
}

View File

@ -340,6 +340,11 @@
<string>Q65_Sync</string>
</property>
</item>
<item>
<property name="text">
<string>Q65_MultiSync</string>
</property>
</item>
</widget>
</item>
<item row="0" column="2">