Calibration of the "Degrade S/N of .wav file" requires knowledge of receiver bandwidth.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6491 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2016-02-23 19:37:38 +00:00
parent 1ec6d07e8f
commit a0318d3a0a
5 changed files with 50 additions and 8 deletions

View File

@ -524,6 +524,7 @@ private:
qint32 id_interval_;
qint32 ntrials_;
qint32 aggressive_;
qint32 RxBandwidth_;
double degrade_;
bool id_after_73_;
bool tx_QSY_allowed_;
@ -606,6 +607,7 @@ qint32 Configuration::id_interval () const {return m_->id_interval_;}
qint32 Configuration::ntrials() const {return m_->ntrials_;}
qint32 Configuration::aggressive() const {return m_->aggressive_;}
double Configuration::degrade() const {return m_->degrade_;}
qint32 Configuration::RxBandwidth() const {return m_->RxBandwidth_;}
bool Configuration::id_after_73 () const {return m_->id_after_73_;}
bool Configuration::tx_QSY_allowed () const {return m_->tx_QSY_allowed_;}
bool Configuration::spot_to_psk_reporter () const {return m_->spot_to_psk_reporter_;}
@ -1051,6 +1053,7 @@ void Configuration::impl::initialize_models ()
ui_->sbNtrials->setValue (ntrials_);
ui_->sbAggressive->setValue (aggressive_);
ui_->sbDegrade->setValue (degrade_);
ui_->sbBandwidth->setValue (RxBandwidth_);
ui_->PTT_method_button_group->button (rig_params_.ptt_type)->setChecked (true);
ui_->save_path_display_label->setText (save_directory_.absolutePath ());
ui_->azel_path_display_label->setText (azel_directory_.absolutePath ());
@ -1181,6 +1184,7 @@ void Configuration::impl::read_settings ()
id_interval_ = settings_->value ("IDint", 0).toInt ();
ntrials_ = settings_->value ("nTrials", 6).toInt ();
aggressive_ = settings_->value ("Aggressive", 0).toInt ();
RxBandwidth_ = settings_->value ("RxBandwidth", 2500).toInt ();
save_directory_ = settings_->value ("SaveDir", default_save_directory_.absolutePath ()).toString ();
azel_directory_ = settings_->value ("AzElDir", default_azel_directory_.absolutePath ()).toString ();
@ -1335,6 +1339,7 @@ void Configuration::impl::write_settings ()
settings_->setValue ("IDint", id_interval_);
settings_->setValue ("nTrials", ntrials_);
settings_->setValue ("Aggressive", aggressive_);
settings_->setValue ("RxBandwidth", RxBandwidth_);
settings_->setValue ("PTTMethod", QVariant::fromValue (rig_params_.ptt_type));
settings_->setValue ("PTTport", rig_params_.ptt_port);
settings_->setValue ("SaveDir", save_directory_.absolutePath ());
@ -1768,6 +1773,7 @@ void Configuration::impl::accept ()
ntrials_ = ui_->sbNtrials->value ();
aggressive_ = ui_->sbAggressive->value ();
degrade_ = ui_->sbDegrade->value ();
RxBandwidth_ = ui_->sbBandwidth->value ();
id_after_73_ = ui_->CW_id_after_73_check_box->isChecked ();
tx_QSY_allowed_ = ui_->tx_QSY_check_box->isChecked ();
monitor_off_at_startup_ = ui_->monitor_off_check_box->isChecked ();

View File

@ -93,6 +93,7 @@ public:
qint32 id_interval () const;
qint32 ntrials() const;
qint32 aggressive() const;
qint32 RxBandwidth() const;
double degrade() const;
bool id_after_73 () const;
bool tx_QSY_allowed () const;

View File

@ -2,6 +2,14 @@
<ui version="4.0">
<class>configuration_dialog</class>
<widget class="QDialog" name="configuration_dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>545</width>
<height>614</height>
</rect>
</property>
<property name="windowTitle">
<string>Settings</string>
</property>
@ -2296,6 +2304,29 @@ Right click for insert and delete options.</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Receiver bandwidth:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QSpinBox" name="sbBandwidth">
<property name="suffix">
<string> Hz</string>
</property>
<property name="maximum">
<number>6000</number>
</property>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>2500</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
@ -2496,12 +2527,12 @@ soundcard changes</string>
</connection>
</connections>
<buttongroups>
<buttongroup name="CAT_stop_bits_button_group"/>
<buttongroup name="PTT_method_button_group"/>
<buttongroup name="TX_mode_button_group"/>
<buttongroup name="split_mode_button_group"/>
<buttongroup name="TX_audio_source_button_group"/>
<buttongroup name="PTT_method_button_group"/>
<buttongroup name="CAT_stop_bits_button_group"/>
<buttongroup name="CAT_data_bits_button_group"/>
<buttongroup name="CAT_handshake_button_group"/>
<buttongroup name="TX_mode_button_group"/>
<buttongroup name="TX_audio_source_button_group"/>
</buttongroups>
</ui>

View File

@ -1,10 +1,11 @@
subroutine degrade_snr(d2,npts,db)
subroutine degrade_snr(d2,npts,db,bw)
integer*2 d2(npts)
real dat(60*12000)
dat(1:npts)=d2
p0=dot_product(dat(1:npts),dat(1:npts))/npts
if(bw.gt.0.0) p0=p0*6000.0/bw
s=sqrt(p0*(10.0**(0.1*db) - 1.0))
do i=1,npts
d2(i)=nint(dat(i) + s*gran())
@ -12,7 +13,9 @@ subroutine degrade_snr(d2,npts,db)
! dat(1:npts)=d2
! p1=dot_product(dat(1:npts),dat(1:npts))/npts
! print*,db,p0,s,10.0*log10(p1/p0)
! if(bw.gt.0.0) p1=p1*6000.0/bw
! write(*,3001) db,bw,p0,s,10.0*log10(p1/p0)
!3001 format(5f10.3)
return
end subroutine degrade_snr

View File

@ -98,7 +98,7 @@ extern "C" {
void fast_decode_(short id2[], int narg[], char msg[], int len);
void hash_calls_(char calls[], int* ih9, int len);
void degrade_snr_(short d2[], int* n, float* db);
void degrade_snr_(short d2[], int* n, float* db, float* bandwidth);
void wav12_(short d2[], short d1[], int* nbytes, short* nbitsam2);
}
@ -1662,7 +1662,8 @@ void MainWindow::diskDat() //diskDat()
m_diskData=true;
float db=m_config.degrade();
if(db > 0.0) degrade_snr_(dec_data.d2,&dec_data.params.kin,&db);
float bw=m_config.RxBandwidth();
if(db > 0.0) degrade_snr_(dec_data.d2,&dec_data.params.kin,&db,&bw);
for(int n=1; n<=m_hsymStop; n++) { // Do the waterfall spectra
k=(n+1)*kstep;