mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-31 13:52:27 -04:00
Work in progress on Total Power plots...
This commit is contained in:
parent
b73120dd48
commit
04cad09683
@ -8,7 +8,7 @@ program echosim
|
|||||||
character arg*12,fname*17
|
character arg*12,fname*17
|
||||||
complex c0(0:NMAX-1)
|
complex c0(0:NMAX-1)
|
||||||
complex c(0:NMAX-1)
|
complex c(0:NMAX-1)
|
||||||
! complex cwave(0:NWAVE-1)
|
real*4 level_1,level_2
|
||||||
real*8 f0,dt,twopi,phi,dphi
|
real*8 f0,dt,twopi,phi,dphi
|
||||||
real wave(NZ)
|
real wave(NZ)
|
||||||
integer*2 iwave(NZ) !Generated full-length waveform
|
integer*2 iwave(NZ) !Generated full-length waveform
|
||||||
@ -20,9 +20,11 @@ program echosim
|
|||||||
|
|
||||||
! Get command-line argument(s)
|
! Get command-line argument(s)
|
||||||
nargs=iargc()
|
nargs=iargc()
|
||||||
if(nargs.ne.5) then
|
if(nargs.ne.3 .and. nargs.ne.5) then
|
||||||
print*,'Usage: echosim f0 fdop fspread nfiles snr'
|
print*,'Usage 1: echosim f0 fdop fspread nfiles snr'
|
||||||
print*,'Examples: echosim 1500 0.0 4.0 10 -22'
|
print*,'Example: echosim 1500 0.0 4.0 10 -22'
|
||||||
|
print*,'Usage 2: echosim level_1 level_2 nfiles'
|
||||||
|
print*,'Example: echosim 30.0 40.0 100'
|
||||||
go to 999
|
go to 999
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -32,12 +34,21 @@ program echosim
|
|||||||
read(arg,*) fdop !Doppler shift (Hz)
|
read(arg,*) fdop !Doppler shift (Hz)
|
||||||
call getarg(3,arg)
|
call getarg(3,arg)
|
||||||
read(arg,*) fspread !Frequency spread (Hz) (JHT Lorentzian model)
|
read(arg,*) fspread !Frequency spread (Hz) (JHT Lorentzian model)
|
||||||
|
|
||||||
|
if(nargs.eq.3) then
|
||||||
|
level_1=f0
|
||||||
|
level_2=fdop
|
||||||
|
nfiles=fspread
|
||||||
|
snrdb=0.
|
||||||
|
go to 10
|
||||||
|
endif
|
||||||
|
|
||||||
call getarg(4,arg)
|
call getarg(4,arg)
|
||||||
read(arg,*) nfiles !Number of files
|
read(arg,*) nfiles !Number of files
|
||||||
call getarg(5,arg)
|
call getarg(5,arg)
|
||||||
read(arg,*) snrdb !SNR_2500
|
read(arg,*) snrdb !SNR_2500
|
||||||
|
|
||||||
twopi=8.d0*atan(1.d0)
|
10 twopi=8.d0*atan(1.d0)
|
||||||
fs=12000.0 !Sample rate (Hz)
|
fs=12000.0 !Sample rate (Hz)
|
||||||
dt=1.d0/fs !Sample interval (s)
|
dt=1.d0/fs !Sample interval (s)
|
||||||
bandwidth_ratio=2500.0/(fs/2.0)
|
bandwidth_ratio=2500.0/(fs/2.0)
|
||||||
@ -49,18 +60,23 @@ program echosim
|
|||||||
1000 format(' N f0 fDop fSpread SNR File name'/51('-'))
|
1000 format(' N f0 fDop fSpread SNR File name'/51('-'))
|
||||||
|
|
||||||
do ifile=1,nfiles
|
do ifile=1,nfiles
|
||||||
phi=0.d0
|
wave=0.
|
||||||
do i=0,NWAVE-1
|
|
||||||
phi=phi + dphi
|
if(nargs.eq.5) then
|
||||||
if(phi.gt.twopi) phi=phi-twopi
|
phi=0.d0
|
||||||
xphi=phi
|
do i=0,NWAVE-1
|
||||||
c0(i)=cmplx(cos(xphi),sin(xphi))
|
phi=phi + dphi
|
||||||
enddo
|
if(phi.gt.twopi) phi=phi-twopi
|
||||||
c0(NWAVE:)=0.
|
xphi=phi
|
||||||
if(fspread.gt.0.0) call fspread_lorentz(c0,fspread)
|
c0(i)=cmplx(cos(xphi),sin(xphi))
|
||||||
c=sig*c0
|
enddo
|
||||||
wave(1:NWAVE)=imag(c(1:NWAVE))
|
c0(NWAVE:)=0.
|
||||||
peak=maxval(abs(wave))
|
if(fspread.gt.0.0) call fspread_lorentz(c0,fspread)
|
||||||
|
c=sig*c0
|
||||||
|
wave(1:NWAVE)=imag(c(1:NWAVE))
|
||||||
|
peak=maxval(abs(wave))
|
||||||
|
endif
|
||||||
|
|
||||||
if(snrdb.lt.90) then
|
if(snrdb.lt.90) then
|
||||||
do i=1,NWAVE !Add gaussian noise at specified SNR
|
do i=1,NWAVE !Add gaussian noise at specified SNR
|
||||||
xnoise=gran()
|
xnoise=gran()
|
||||||
@ -73,6 +89,10 @@ program echosim
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
gain=100.0
|
gain=100.0
|
||||||
|
if(nargs.eq.3) then
|
||||||
|
gain=10.0**(0.05*level_1)
|
||||||
|
if(mod((ifile-1)/10,2).eq.1) gain=10.0**(0.05*level_2)
|
||||||
|
endif
|
||||||
if(snrdb.lt.90.0) then
|
if(snrdb.lt.90.0) then
|
||||||
wave=gain*wave
|
wave=gain*wave
|
||||||
else
|
else
|
||||||
|
@ -66,6 +66,7 @@ subroutine symspec(shared_data,k,TRperiod,nsps,ingain,bLowSidelobes, &
|
|||||||
pxmax=0.;
|
pxmax=0.;
|
||||||
|
|
||||||
do i=k0+1,k
|
do i=k0+1,k
|
||||||
|
if(k0.eq.0 .and. i.le.10) cycle
|
||||||
x1=shared_data%id2(i)
|
x1=shared_data%id2(i)
|
||||||
if (abs(x1).gt.pxmax) pxmax = abs(x1);
|
if (abs(x1).gt.pxmax) pxmax = abs(x1);
|
||||||
sq=sq + x1*x1
|
sq=sq + x1*x1
|
||||||
|
@ -325,7 +325,7 @@ void CPlotter::draw(float swide[], bool bScroll, bool bRed)
|
|||||||
|
|
||||||
if(m_bTotalPower) {
|
if(m_bTotalPower) {
|
||||||
painter2D.setPen(Qt::green);
|
painter2D.setPen(Qt::green);
|
||||||
int yy=m_h2 - 10*(m_pdB-20);
|
int yy=m_h2 - 10*(m_pdB - m_plot2dZero - 20);
|
||||||
LineBuf4[m_x].setX(m_x);
|
LineBuf4[m_x].setX(m_x);
|
||||||
LineBuf4[m_x].setY(yy);
|
LineBuf4[m_x].setY(yy);
|
||||||
painter2D.drawPolyline(LineBuf4,m_x);
|
painter2D.drawPolyline(LineBuf4,m_x);
|
||||||
|
@ -481,6 +481,7 @@ void WideGraph::on_zeroSlider_valueChanged(int value) //Zero
|
|||||||
void WideGraph::on_gain2dSlider_valueChanged(int value) //Gain2
|
void WideGraph::on_gain2dSlider_valueChanged(int value) //Gain2
|
||||||
{
|
{
|
||||||
ui->widePlot->setPlot2dGain(value);
|
ui->widePlot->setPlot2dGain(value);
|
||||||
|
if(ui->widePlot->TotalPower()) return;
|
||||||
if(ui->widePlot->scaleOK ()) {
|
if(ui->widePlot->scaleOK ()) {
|
||||||
ui->widePlot->draw(m_swide,false,false);
|
ui->widePlot->draw(m_swide,false,false);
|
||||||
if(m_mode=="Q65") ui->widePlot->draw(m_swide,false,true);
|
if(m_mode=="Q65") ui->widePlot->draw(m_swide,false,true);
|
||||||
@ -490,9 +491,15 @@ void WideGraph::on_gain2dSlider_valueChanged(int value) //Gain2
|
|||||||
void WideGraph::on_zero2dSlider_valueChanged(int value) //Zero2
|
void WideGraph::on_zero2dSlider_valueChanged(int value) //Zero2
|
||||||
{
|
{
|
||||||
ui->widePlot->setPlot2dZero(value);
|
ui->widePlot->setPlot2dZero(value);
|
||||||
if(ui->widePlot->scaleOK ()) {
|
if(ui->widePlot->TotalPower()) {
|
||||||
|
// float dummy[1];
|
||||||
|
// dummy[0]=-99.0;
|
||||||
ui->widePlot->draw(m_swide,false,false);
|
ui->widePlot->draw(m_swide,false,false);
|
||||||
if(m_mode=="Q65") ui->widePlot->draw(m_swide,false,true);
|
} else {
|
||||||
|
if(ui->widePlot->scaleOK ()) {
|
||||||
|
ui->widePlot->draw(m_swide,false,false);
|
||||||
|
if(m_mode=="Q65") ui->widePlot->draw(m_swide,false,true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user