Fixing variable initializations part 1
This commit is contained in:
parent
796a8cb3f9
commit
3a9d169d46
@ -24,6 +24,7 @@ AmplitudeCalDialog::AmplitudeCalDialog(Device *dev, ModeHandler *handler, QWidge
|
||||
dev(dev),
|
||||
modeHandler(handler),
|
||||
model(this),
|
||||
edited(false),
|
||||
mode(CalibrationMode::BothPorts)
|
||||
{
|
||||
activeMode = modeHandler->getActiveMode();
|
||||
@ -350,6 +351,7 @@ void AmplitudeCalDialog::AddPointDialog()
|
||||
|
||||
void AmplitudeCalDialog::AutomaticMeasurementDialog()
|
||||
{
|
||||
automatic = {};
|
||||
automatic.isSourceCal = pointType() == Protocol::PacketType::SourceCalPoint;
|
||||
const QString ownCal = automatic.isSourceCal ? "Source" : "Receiver";
|
||||
const QString otherCal = automatic.isSourceCal ? "Receiver" : "Source";
|
||||
|
@ -684,16 +684,16 @@ Calibration::Point Calibration::createInitializedPoint(double f) {
|
||||
Point point;
|
||||
point.frequency = f;
|
||||
// resize vectors
|
||||
point.D.resize(caltype.usedPorts.size());
|
||||
point.R.resize(caltype.usedPorts.size());
|
||||
point.S.resize(caltype.usedPorts.size());
|
||||
point.D.resize(caltype.usedPorts.size(), 0.0);
|
||||
point.R.resize(caltype.usedPorts.size(), 0.0);
|
||||
point.S.resize(caltype.usedPorts.size(), 0.0);
|
||||
|
||||
point.L.resize(caltype.usedPorts.size());
|
||||
point.T.resize(caltype.usedPorts.size());
|
||||
point.I.resize(caltype.usedPorts.size());
|
||||
fill(point.L.begin(), point.L.end(), vector<complex<double>>(caltype.usedPorts.size()));
|
||||
fill(point.T.begin(), point.T.end(), vector<complex<double>>(caltype.usedPorts.size()));
|
||||
fill(point.I.begin(), point.I.end(), vector<complex<double>>(caltype.usedPorts.size()));
|
||||
fill(point.L.begin(), point.L.end(), vector<complex<double>>(caltype.usedPorts.size(), 0.0));
|
||||
fill(point.T.begin(), point.T.end(), vector<complex<double>>(caltype.usedPorts.size(), 0.0));
|
||||
fill(point.I.begin(), point.I.end(), vector<complex<double>>(caltype.usedPorts.size(), 0.0));
|
||||
return point;
|
||||
}
|
||||
|
||||
@ -802,7 +802,7 @@ Calibration::Point Calibration::computeThroughNormalization(double f)
|
||||
// grab measurement and calkit through definitions
|
||||
auto throughForward = static_cast<CalibrationMeasurement::Through*>(findMeasurement(CalibrationMeasurement::Base::Type::Through, p1, p2));
|
||||
auto throughReverse = static_cast<CalibrationMeasurement::Through*>(findMeasurement(CalibrationMeasurement::Base::Type::Through, p2, p1));
|
||||
complex<double> S21;
|
||||
complex<double> S21 = 0.0;
|
||||
Sparam Sideal;
|
||||
if(throughForward) {
|
||||
S21 = throughForward->getMeasured(f).m21;
|
||||
@ -1761,35 +1761,35 @@ Calibration::Point Calibration::Point::interpolate(const Calibration::Point &to,
|
||||
{
|
||||
Point ret;
|
||||
ret.frequency = frequency * (1.0-alpha) + to.frequency * alpha;
|
||||
ret.D.resize(D.size());
|
||||
ret.D.resize(D.size(), 0.0);
|
||||
for(unsigned int i=0;i<D.size();i++) {
|
||||
ret.D[i] = D[i] * (1.0-alpha) + to.D[i] * alpha;
|
||||
}
|
||||
ret.R.resize(R.size());
|
||||
ret.R.resize(R.size(), 0.0);
|
||||
for(unsigned int i=0;i<R.size();i++) {
|
||||
ret.R[i] = R[i] * (1.0-alpha) + to.R[i] * alpha;
|
||||
}
|
||||
ret.S.resize(S.size());
|
||||
ret.S.resize(S.size(), 0.0);
|
||||
for(unsigned int i=0;i<S.size();i++) {
|
||||
ret.S[i] = S[i] * (1.0-alpha) + to.S[i] * alpha;
|
||||
}
|
||||
ret.T.resize(T.size());
|
||||
for(unsigned int i=0;i<T.size();i++) {
|
||||
ret.T[i].resize(T[i].size());
|
||||
ret.T[i].resize(T[i].size(), 0.0);
|
||||
for(unsigned int j=0;j<T[i].size();j++) {
|
||||
ret.T[i][j] = T[i][j] * (1.0 - alpha) + to.T[i][j] * alpha;
|
||||
}
|
||||
}
|
||||
ret.L.resize(L.size());
|
||||
for(unsigned int i=0;i<L.size();i++) {
|
||||
ret.L[i].resize(L[i].size());
|
||||
ret.L[i].resize(L[i].size(), 0.0);
|
||||
for(unsigned int j=0;j<L[i].size();j++) {
|
||||
ret.L[i][j] = L[i][j] * (1.0 - alpha) + to.L[i][j] * alpha;
|
||||
}
|
||||
}
|
||||
ret.I.resize(I.size());
|
||||
for(unsigned int i=0;i<I.size();i++) {
|
||||
ret.I[i].resize(I[i].size());
|
||||
ret.I[i].resize(I[i].size(), 0.0);
|
||||
for(unsigned int j=0;j<I[i].size();j++) {
|
||||
ret.I[i][j] = I[i][j] * (1.0 - alpha) + to.I[i][j] * alpha;
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ private slots:
|
||||
private:
|
||||
void evaluateFile();
|
||||
Ui::csvimport *ui;
|
||||
int required_ports;
|
||||
CSV csv;
|
||||
bool status;
|
||||
};
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
TileWidget::TileWidget(TraceModel &model, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
fullScreenPlot(nullptr),
|
||||
ui(new Ui::TileWidget),
|
||||
splitter(0),
|
||||
isSplit(false),
|
||||
|
@ -13,7 +13,10 @@ using namespace std;
|
||||
|
||||
CompoundDeviceEditDialog::CompoundDeviceEditDialog(CompoundDevice *cdev, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CompoundDeviceEditDialog)
|
||||
ui(new Ui::CompoundDeviceEditDialog),
|
||||
dropPending(false),
|
||||
dragFrame(nullptr),
|
||||
dropFrame(nullptr)
|
||||
{
|
||||
ldev = *cdev;
|
||||
ui->setupUi(this);
|
||||
|
@ -28,7 +28,6 @@ private:
|
||||
static constexpr int frameSize = 350;
|
||||
QComboBox *serial;
|
||||
QComboBox *port1, *port2;
|
||||
QLabel *image;
|
||||
|
||||
unsigned int position;
|
||||
CompoundDevice *dev;
|
||||
|
@ -11,7 +11,8 @@ FirmwareUpdateDialog::FirmwareUpdateDialog(Device *dev, QWidget *parent) :
|
||||
dev(dev),
|
||||
file(),
|
||||
timer(),
|
||||
state(State::Idle)
|
||||
state(State::Idle),
|
||||
transferredBytes(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ui->bFile->setIcon(this->style()->standardPixmap(QStyle::SP_FileDialogStart));
|
||||
|
@ -105,7 +105,6 @@ VirtualDevice::VirtualDevice(QString serial)
|
||||
info{},
|
||||
status{}
|
||||
{
|
||||
cdev = nullptr;
|
||||
cdev = nullptr;
|
||||
zerospan = false;
|
||||
|
||||
|
@ -5,6 +5,7 @@
|
||||
SignalgeneratorWidget::SignalgeneratorWidget(AppWindow *window, QWidget *parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::SignalgeneratorWidget),
|
||||
m_timerId(0),
|
||||
window(window)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
@ -46,8 +46,10 @@
|
||||
|
||||
SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name)
|
||||
: Mode(window, name, "SA"),
|
||||
central(new TileWidget(traceModel, window))
|
||||
central(new TileWidget(traceModel, window)),
|
||||
firstPointTime(0)
|
||||
{
|
||||
changingSettings = false;
|
||||
averages = 1;
|
||||
singleSweep = false;
|
||||
settings = {};
|
||||
@ -55,6 +57,12 @@ SpectrumAnalyzer::SpectrumAnalyzer(AppWindow *window, QString name)
|
||||
normalize.measuring = false;
|
||||
normalize.points = 0;
|
||||
normalize.dialog.reset();
|
||||
normalize.f_start = 0;
|
||||
normalize.f_stop = 0;
|
||||
normalize.points = 0;
|
||||
normalize.Level = nullptr;
|
||||
normalize.measure = nullptr;
|
||||
normalize.enable = nullptr;
|
||||
|
||||
traceModel.setSource(TraceModel::DataSource::SA);
|
||||
|
||||
|
@ -11,7 +11,7 @@ class Parameters : public Savable {
|
||||
public:
|
||||
Parameters(Type m11, Type m12, Type m21, Type m22)
|
||||
: m11(m11), m12(m12), m21(m21), m22(m22){}
|
||||
Parameters(){}
|
||||
Parameters() : m11(0.0),m12(0.0),m21(0.0),m22(0.0){}
|
||||
|
||||
Type m11, m12, m21, m22;
|
||||
|
||||
@ -131,62 +131,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
//template<typename T>
|
||||
//class Tparam {
|
||||
//public:
|
||||
// Tparam(){};
|
||||
// Tparam(T t11, T t12, T t21, T t22)
|
||||
// : t11(t11), t12(t12), t21(t21), t22(t22){};
|
||||
// void fromSparam(T S11, T S21, T S12, T S22) {
|
||||
// t11 = -(S11*S22 - S12*S21) / S21;
|
||||
// t12 = S11 / S21;
|
||||
// t21 = -S22 / S21;
|
||||
// t22 = 1.0 / S21;
|
||||
// }
|
||||
// void toSparam(T &S11, T &S21, T &S12, T &S22) {
|
||||
// S11 = t12 / t22;
|
||||
// S21 = T(1) / t22;
|
||||
// S12 = (t11*t22 - t12*t21) / t22;
|
||||
// S22 = -t21 / t22;
|
||||
// }
|
||||
// Tparam inverse() {
|
||||
// Tparam i;
|
||||
// T det = t11*t22 - t12*t21;
|
||||
// i.t11 = t22 / det;
|
||||
// i.t12 = -t12 / det;
|
||||
// i.t21 = -t21 / det;
|
||||
// i.t22 = t11 / det;
|
||||
// return i;
|
||||
// }
|
||||
// Tparam root() {
|
||||
// // calculate root of 2x2 matrix, according to https://en.wikipedia.org/wiki/Square_root_of_a_2_by_2_matrix (choose positive roots)
|
||||
// auto tau = t11 + t22;
|
||||
// auto sigma = t11*t22 - t12*t21;
|
||||
// auto s = sqrt(sigma);
|
||||
// auto t = sqrt(tau + 2.0*s);
|
||||
// Tparam r = *this;
|
||||
// r.t11 += s;
|
||||
// r.t22 += s;
|
||||
// r = r * (1.0/t);
|
||||
// return r;
|
||||
// }
|
||||
// Tparam operator*(const Tparam &r) {
|
||||
// Tparam p;
|
||||
// p.t11 = t11*r.t11 + t12*r.t21;
|
||||
// p.t12 = t11*r.t12 + t12*r.t22;
|
||||
// p.t21 = t21*r.t11 + t22*r.t21;
|
||||
// p.t22 = t21*r.t12 + t22*r.t22;
|
||||
// return p;
|
||||
// }
|
||||
// Tparam operator*(const T &r) {
|
||||
// Tparam p;
|
||||
// p.t11 = t11 * r;
|
||||
// p.t12 = t12 * r;
|
||||
// p.t21 = t21 * r;
|
||||
// p.t22 = t22 * r;
|
||||
// return p;
|
||||
// }
|
||||
// T t11, t12, t21, t22;
|
||||
//};
|
||||
|
||||
#endif // TPARAM_H
|
||||
|
@ -212,10 +212,10 @@ void Math::DFTThread::run()
|
||||
dft.data.clear();
|
||||
int DCbin = timeDomain.size() / 2, startBin = 0;
|
||||
if(DC > 0) {
|
||||
dft.data.resize(timeDomain.size());
|
||||
dft.data.resize(timeDomain.size(), TraceMath::Data());
|
||||
} else {
|
||||
startBin = (timeDomain.size()+1) / 2;
|
||||
dft.data.resize(timeDomain.size()/2);
|
||||
dft.data.resize(timeDomain.size()/2, TraceMath::Data());
|
||||
}
|
||||
|
||||
// reverse effect of frequency domain window function from TDR (if available)
|
||||
|
@ -53,7 +53,7 @@ public:
|
||||
|
||||
class Data {
|
||||
public:
|
||||
Data() : x(){}
|
||||
Data() : x(0){}
|
||||
double x;
|
||||
std::complex<double> y;
|
||||
};
|
||||
|
@ -825,13 +825,13 @@ void EyeDiagramPlot::updateThread(unsigned int xSamples)
|
||||
|
||||
setStatus("Generating PRBS sequence...");
|
||||
|
||||
auto prbs = new PRBS(patternbits);
|
||||
auto prbs = PRBS(patternbits);
|
||||
|
||||
auto getNextLevel = [&]() -> unsigned int {
|
||||
unsigned int level = 0;
|
||||
for(unsigned int i=0;i<bitsPerSymbol;i++) {
|
||||
level <<= 1;
|
||||
if(prbs->next()) {
|
||||
if(prbs.next()) {
|
||||
level |= 0x01;
|
||||
}
|
||||
}
|
||||
|
@ -289,25 +289,25 @@ void TracePlot::finishContextMenu()
|
||||
contextmenu->addSeparator();
|
||||
if(parentTile) {
|
||||
auto add = new QMenu("Add tile...", contextmenu);
|
||||
auto left = new QAction("to the left");
|
||||
auto left = new QAction("to the left", contextmenu);
|
||||
connect(left, &QAction::triggered, [=](){
|
||||
// split, keep current graph on the right
|
||||
parentTile->splitHorizontally(true);
|
||||
});
|
||||
add->addAction(left);
|
||||
auto right = new QAction("to the right");
|
||||
auto right = new QAction("to the right", contextmenu);
|
||||
connect(right, &QAction::triggered, [=](){
|
||||
// split, keep current graph on the left
|
||||
parentTile->splitHorizontally(false);
|
||||
});
|
||||
add->addAction(right);
|
||||
auto above = new QAction("above");
|
||||
auto above = new QAction("above", contextmenu);
|
||||
connect(above, &QAction::triggered, [=](){
|
||||
// split, keep current graph on the bottom
|
||||
parentTile->splitVertically(true);
|
||||
});
|
||||
add->addAction(above);
|
||||
auto below = new QAction("below");
|
||||
auto below = new QAction("below", contextmenu);
|
||||
connect(below, &QAction::triggered, [=](){
|
||||
// split, keep current graph on the top
|
||||
parentTile->splitVertically(false);
|
||||
|
@ -8,7 +8,9 @@
|
||||
|
||||
ModeHandler::ModeHandler(AppWindow *aw):
|
||||
QObject(),
|
||||
aw(aw)
|
||||
currentModeIndex(0),
|
||||
aw(aw),
|
||||
activeMode(nullptr)
|
||||
{}
|
||||
|
||||
void ModeHandler::shutdown()
|
||||
|
@ -49,7 +49,7 @@ private:
|
||||
int createMode(Mode *mode);
|
||||
Mode *createNew(AppWindow *window, QString name, Mode::Type t);
|
||||
AppWindow *aw;
|
||||
Mode *activeMode = nullptr;
|
||||
Mode *activeMode;
|
||||
|
||||
private slots:
|
||||
void setStatusBarMessageChanged(const QString &msg);
|
||||
|
@ -10,6 +10,6 @@ namespace Unit
|
||||
// prefixed need to be in ascending order (e.g. "m kMG" is okay, whjle "MkG" does not work)
|
||||
QString ToString(double value, QString unit = QString(), QString prefixes = " ", int precision = 6);
|
||||
double SIPrefixToFactor(char prefix);
|
||||
};
|
||||
}
|
||||
|
||||
#endif // UNIT_H
|
||||
|
Loading…
Reference in New Issue
Block a user