|
|
|
@ -482,6 +482,9 @@ ScopePart::ScopePart( TQWidget *parentWidget, const char *widgetName, TQObject *
|
|
|
|
|
m_availableMathOperators.append(MathOperator("-", 2));
|
|
|
|
|
m_availableMathOperators.append(MathOperator("*", 2));
|
|
|
|
|
m_availableMathOperators.append(MathOperator("/", 2));
|
|
|
|
|
m_availableMathOperators.append(MathOperator("Average", 1));
|
|
|
|
|
m_availableMathOperators.append(MathOperator("Integral", 1));
|
|
|
|
|
m_availableMathOperators.append(MathOperator("Derivative", 1));
|
|
|
|
|
#ifdef ENABLE_FFT
|
|
|
|
|
m_availableMathOperators.append(MathOperator("FFT", 1));
|
|
|
|
|
#endif // ENABLE_FFT
|
|
|
|
@ -2569,7 +2572,10 @@ void ScopePart::updateMathTraceAllowedVoltsPerDivList(int traceno) {
|
|
|
|
|
if ((m_mathOperator[traceno] == "+")
|
|
|
|
|
|| (m_mathOperator[traceno] == "-")
|
|
|
|
|
|| (m_mathOperator[traceno] == "*")
|
|
|
|
|
|| (m_mathOperator[traceno] == "/")) {
|
|
|
|
|
|| (m_mathOperator[traceno] == "/")
|
|
|
|
|
|| (m_mathOperator[traceno] == "Average")
|
|
|
|
|
|| (m_mathOperator[traceno] == "Integral")
|
|
|
|
|
|| (m_mathOperator[traceno] == "Derivative")) {
|
|
|
|
|
// Compute intersection of both trace operand volt/div lists
|
|
|
|
|
m_mathTraceAllowedVoltsDiv[traceno].clear();
|
|
|
|
|
TQDoubleList::iterator it;
|
|
|
|
@ -2679,6 +2685,65 @@ void ScopePart::processMathTraces() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_traceWidget->setSamples(m_maxNumberOfTraces-1+traceno, outputValues);
|
|
|
|
|
m_traceWidget->setPositions(m_maxNumberOfTraces-1+traceno, outputPositions);
|
|
|
|
|
m_base->traceZoomWidget->setSamples(m_maxNumberOfTraces-1+traceno, outputValues);
|
|
|
|
|
m_base->traceZoomWidget->setPositions(m_maxNumberOfTraces-1+traceno, outputPositions);
|
|
|
|
|
}
|
|
|
|
|
else if (m_mathOperator[traceno] == "Average") {
|
|
|
|
|
TQDoubleArray outputValues;
|
|
|
|
|
TQDoubleArray outputPositions;
|
|
|
|
|
TQDoubleArray inputValues = m_traceWidget->samples(m_mathFirstOperand[traceno]-1);
|
|
|
|
|
TQDoubleArray inputPositions = m_traceWidget->positions(m_mathFirstOperand[traceno]-1);
|
|
|
|
|
outputValues.resize(m_samplesInMathTrace[traceno]);
|
|
|
|
|
outputPositions = inputPositions;
|
|
|
|
|
|
|
|
|
|
double accumulator = 0;
|
|
|
|
|
for (int i=0; i < m_samplesInMathTrace[traceno]; i++) {
|
|
|
|
|
accumulator += inputValues[i];
|
|
|
|
|
}
|
|
|
|
|
accumulator /= m_samplesInMathTrace[traceno];
|
|
|
|
|
for (int i=0; i < m_samplesInMathTrace[traceno]; i++) {
|
|
|
|
|
outputValues[i] = accumulator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_traceWidget->setSamples(m_maxNumberOfTraces-1+traceno, outputValues);
|
|
|
|
|
m_traceWidget->setPositions(m_maxNumberOfTraces-1+traceno, outputPositions);
|
|
|
|
|
m_base->traceZoomWidget->setSamples(m_maxNumberOfTraces-1+traceno, outputValues);
|
|
|
|
|
m_base->traceZoomWidget->setPositions(m_maxNumberOfTraces-1+traceno, outputPositions);
|
|
|
|
|
}
|
|
|
|
|
else if (m_mathOperator[traceno] == "Integral") {
|
|
|
|
|
TQDoubleArray outputValues;
|
|
|
|
|
TQDoubleArray outputPositions;
|
|
|
|
|
TQDoubleArray inputValues = m_traceWidget->samples(m_mathFirstOperand[traceno]-1);
|
|
|
|
|
TQDoubleArray inputPositions = m_traceWidget->positions(m_mathFirstOperand[traceno]-1);
|
|
|
|
|
outputValues.resize(m_samplesInMathTrace[traceno]);
|
|
|
|
|
outputPositions = inputPositions;
|
|
|
|
|
|
|
|
|
|
double accumulator = 0;
|
|
|
|
|
for (int i=0; i < m_samplesInMathTrace[traceno]; i++) {
|
|
|
|
|
accumulator += inputValues[i];
|
|
|
|
|
outputValues[i] = accumulator;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_traceWidget->setSamples(m_maxNumberOfTraces-1+traceno, outputValues);
|
|
|
|
|
m_traceWidget->setPositions(m_maxNumberOfTraces-1+traceno, outputPositions);
|
|
|
|
|
m_base->traceZoomWidget->setSamples(m_maxNumberOfTraces-1+traceno, outputValues);
|
|
|
|
|
m_base->traceZoomWidget->setPositions(m_maxNumberOfTraces-1+traceno, outputPositions);
|
|
|
|
|
}
|
|
|
|
|
else if (m_mathOperator[traceno] == "Derivative") {
|
|
|
|
|
TQDoubleArray outputValues;
|
|
|
|
|
TQDoubleArray outputPositions;
|
|
|
|
|
TQDoubleArray inputValues = m_traceWidget->samples(m_mathFirstOperand[traceno]-1);
|
|
|
|
|
TQDoubleArray inputPositions = m_traceWidget->positions(m_mathFirstOperand[traceno]-1);
|
|
|
|
|
outputValues.resize(m_samplesInMathTrace[traceno]);
|
|
|
|
|
outputPositions = inputPositions;
|
|
|
|
|
|
|
|
|
|
outputValues[0] = 0;
|
|
|
|
|
for (int i=1; i < m_samplesInMathTrace[traceno]; i++) {
|
|
|
|
|
outputValues[i] = inputValues[i] - inputValues[i-1];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_traceWidget->setSamples(m_maxNumberOfTraces-1+traceno, outputValues);
|
|
|
|
|
m_traceWidget->setPositions(m_maxNumberOfTraces-1+traceno, outputPositions);
|
|
|
|
|
m_base->traceZoomWidget->setSamples(m_maxNumberOfTraces-1+traceno, outputValues);
|
|
|
|
|