2025-06-17T17:28:21
This commit is contained in:
parent
bfbf12cf2e
commit
08c7f5147b
Binary file not shown.
BIN
experiment_data/analysis_state/6174-new.xlsx
Normal file
BIN
experiment_data/analysis_state/6174-new.xlsx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -395,6 +395,8 @@ void XlsxHandler::readAnalysisOperation(
|
|||||||
ao.mode = AnalysisMode::OnsetTemperaturePoint;
|
ao.mode = AnalysisMode::OnsetTemperaturePoint;
|
||||||
}else if(modeStr == AnaOpRecorder::EndsetTemperaturePointStr){
|
}else if(modeStr == AnaOpRecorder::EndsetTemperaturePointStr){
|
||||||
ao.mode = AnalysisMode::EndsetTemperaturePoint;
|
ao.mode = AnalysisMode::EndsetTemperaturePoint;
|
||||||
|
}else if(modeStr == AnaOpRecorder::OITStr){
|
||||||
|
ao.mode = AnalysisMode::OIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
ao.x1 = sheet->cellAt(startLineIndex, 2)->value().toDouble();
|
ao.x1 = sheet->cellAt(startLineIndex, 2)->value().toDouble();
|
||||||
@ -464,6 +466,11 @@ void XlsxHandler::writeAnalysisOperationDetail(QXlsx::Document *xlsx, const int
|
|||||||
analysisOpName = AnalysisOperationRecorder::EndsetTemperaturePointStr;
|
analysisOpName = AnalysisOperationRecorder::EndsetTemperaturePointStr;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AnalysisMode::OIT:
|
||||||
|
{
|
||||||
|
analysisOpName = AnalysisOperationRecorder::OITStr;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:break;
|
default:break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -696,8 +703,8 @@ int XlsxHandler::deleteInvalidRow(QXlsx::Document *doc)
|
|||||||
|| cellValue == AnaOpRecorder::EndsetTemperaturePointStr
|
|| cellValue == AnaOpRecorder::EndsetTemperaturePointStr
|
||||||
) {
|
) {
|
||||||
qDebug() << "Row" << row << "is empty or contains specified string. Deleting row.";
|
qDebug() << "Row" << row << "is empty or contains specified string. Deleting row.";
|
||||||
// sheet->deleteRows(row, 1); // 删除当前行
|
// sheet->deleteRows(row, 1); // 删除当前行
|
||||||
// sheet->deleteRow(row);
|
// sheet->deleteRow(row);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,7 +122,6 @@ private:
|
|||||||
void smoothness(const int level);
|
void smoothness(const int level);
|
||||||
QVector<Global::ExperimentData> smoothnessDetail(const int level,const QVector<Global::ExperimentData>&);
|
QVector<Global::ExperimentData> smoothnessDetail(const int level,const QVector<Global::ExperimentData>&);
|
||||||
void smoothnessExperimentData(const int level);
|
void smoothnessExperimentData(const int level);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool _manuallyStopTheExperimentFlag;
|
bool _manuallyStopTheExperimentFlag;
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
|
|||||||
@ -9,8 +9,8 @@ const QString PeakSynthesisAnalysisStr("PeakSynthesisAnalysis");
|
|||||||
const QString GlassTransitionStr("GlassTransition");
|
const QString GlassTransitionStr("GlassTransition");
|
||||||
const QString OnsetTemperaturePointStr("OnsetTemperaturePoint");
|
const QString OnsetTemperaturePointStr("OnsetTemperaturePoint");
|
||||||
const QString EndsetTemperaturePointStr("EndsetTemperaturePoint");
|
const QString EndsetTemperaturePointStr("EndsetTemperaturePoint");
|
||||||
|
const QString OITStr("OIT");
|
||||||
|
|
||||||
#if 1
|
|
||||||
enum AnalysisMode{
|
enum AnalysisMode{
|
||||||
Null,
|
Null,
|
||||||
NumericalLabel,
|
NumericalLabel,
|
||||||
@ -22,7 +22,6 @@ enum AnalysisMode{
|
|||||||
EndsetTemperaturePoint,
|
EndsetTemperaturePoint,
|
||||||
OIT
|
OIT
|
||||||
};
|
};
|
||||||
#endif
|
|
||||||
|
|
||||||
struct AnalysisOperation{
|
struct AnalysisOperation{
|
||||||
QString filePath;
|
QString filePath;
|
||||||
@ -39,7 +38,6 @@ extern QVector<AnalysisOperation> _analysisOperationVtr;
|
|||||||
void removeTheLastAnalysisOperation();
|
void removeTheLastAnalysisOperation();
|
||||||
|
|
||||||
void removeAnalysisOperationByObjectName(const QString objectName);
|
void removeAnalysisOperationByObjectName(const QString objectName);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -331,6 +331,7 @@ void CentralWidget::slotAnalysisSettingApply()
|
|||||||
QString selectedCurveObjectName = _currentCurve->objectName();
|
QString selectedCurveObjectName = _currentCurve->objectName();
|
||||||
|
|
||||||
// Set curve data to PointCalculate.
|
// Set curve data to PointCalculate.
|
||||||
|
QVector<ExperimentData> totalDataVtr;
|
||||||
if(Global::_curveFileDataVtr.empty()){
|
if(Global::_curveFileDataVtr.empty()){
|
||||||
// Load experiment data.
|
// Load experiment data.
|
||||||
logde<<"experiment vtr size:"<<Global::_curveExperimentDataVtr.size();
|
logde<<"experiment vtr size:"<<Global::_curveExperimentDataVtr.size();
|
||||||
@ -339,15 +340,19 @@ void CentralWidget::slotAnalysisSettingApply()
|
|||||||
if(ced.curve == _currentCurve){
|
if(ced.curve == _currentCurve){
|
||||||
logde<<"load experiment data.";
|
logde<<"load experiment data.";
|
||||||
if(ced.smoothDataVtr.empty()){
|
if(ced.smoothDataVtr.empty()){
|
||||||
PointCalculate::setAnalysisData(ced.dataVtr);
|
// PointCalculate::setAnalysisData(ced.dataVtr);
|
||||||
|
totalDataVtr.append(ced.dataVtr);
|
||||||
}else{
|
}else{
|
||||||
PointCalculate::setAnalysisData(ced.smoothDataVtr);
|
// PointCalculate::setAnalysisData(ced.smoothDataVtr);
|
||||||
|
totalDataVtr.append(ced.smoothDataVtr);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
// Load xlsx file data.
|
// Load xlsx file data.
|
||||||
|
#if 0
|
||||||
for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){
|
for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){
|
||||||
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
||||||
if(pti.curve == _currentCurve){
|
if(pti.curve == _currentCurve){
|
||||||
@ -360,7 +365,27 @@ void CentralWidget::slotAnalysisSettingApply()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){
|
||||||
|
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
||||||
|
if(pti.curve == _currentCurve){
|
||||||
|
|
||||||
|
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
||||||
|
if(pti.smoothDataVtr.empty()){
|
||||||
|
totalDataVtr.append(pti.dataVtr);
|
||||||
|
}else{
|
||||||
|
totalDataVtr.append(pti.smoothDataVtr);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
PointCalculate::setAnalysisData(totalDataVtr);
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
// Load smoothness data.
|
// Load smoothness data.
|
||||||
@ -602,6 +627,7 @@ void CentralWidget::uiLoadXlsxFileData()
|
|||||||
|
|
||||||
_currentCurve->setObjectName(cfd.filePath);
|
_currentCurve->setObjectName(cfd.filePath);
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Set axis range.
|
// Set axis range.
|
||||||
QPair<float, float> minMaxXAxisPair;
|
QPair<float, float> minMaxXAxisPair;
|
||||||
if(_axisMode == AxisMode::SingleY){
|
if(_axisMode == AxisMode::SingleY){
|
||||||
@ -620,14 +646,37 @@ void CentralWidget::uiLoadXlsxFileData()
|
|||||||
minMaxYAxisPair.first,minMaxYAxisPair.second);
|
minMaxYAxisPair.first,minMaxYAxisPair.second);
|
||||||
_customPlot->yAxis->setRange(newYAxisPair.first ,
|
_customPlot->yAxis->setRange(newYAxisPair.first ,
|
||||||
newYAxisPair.second);
|
newYAxisPair.second);
|
||||||
|
#endif
|
||||||
//
|
//
|
||||||
pti.curve = _currentCurve;
|
pti.curve = _currentCurve;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Axis setting.
|
||||||
PointCalculate::setAnalysisData(allDataVtr);
|
PointCalculate::setAnalysisData(allDataVtr);
|
||||||
|
// Set axis range.
|
||||||
|
QPair<float, float> minMaxXAxisPair;
|
||||||
|
if(_axisMode == AxisMode::SingleY){
|
||||||
|
// Axis x is temperature value.
|
||||||
|
minMaxXAxisPair = PointCalculate::getMinAndMaxOfSampleTemp();
|
||||||
|
}else{
|
||||||
|
// Axis x is time value.
|
||||||
|
minMaxXAxisPair = PointCalculate::getMinAndMaxOfRunTime();
|
||||||
|
}
|
||||||
|
QPair<float, float>newXAxisPair = PointCalculate::getMinAndMaxOfAxis(
|
||||||
|
minMaxXAxisPair.first,minMaxXAxisPair.second);
|
||||||
|
_customPlot->xAxis->setRange(newXAxisPair.first, newXAxisPair.second);
|
||||||
|
|
||||||
|
QPair<float, float> minMaxYAxisPair = PointCalculate::getMinAndMaxOfDSC();
|
||||||
|
QPair<float, float>newYAxisPair = PointCalculate::getMinAndMaxOfAxis(
|
||||||
|
minMaxYAxisPair.first,minMaxYAxisPair.second);
|
||||||
|
_customPlot->yAxis->setRange(newYAxisPair.first ,
|
||||||
|
newYAxisPair.second);
|
||||||
|
|
||||||
// Add analysis operation data.
|
// Add analysis operation data.
|
||||||
if(cfd.analysisOperationVtr.size() > 0){
|
logde<<"analysis operation vtr size:"
|
||||||
|
<<cfd.analysisOperationVtr.size();
|
||||||
|
|
||||||
|
if(!cfd.analysisOperationVtr.empty()){
|
||||||
for(AnaOpRecorder::AnalysisOperation& ao
|
for(AnaOpRecorder::AnalysisOperation& ao
|
||||||
:cfd.analysisOperationVtr){
|
:cfd.analysisOperationVtr){
|
||||||
loadAnalysisData(ao.mode,ao.x1,ao.x2,cfd.filePath);
|
loadAnalysisData(ao.mode,ao.x1,ao.x2,cfd.filePath);
|
||||||
@ -1085,7 +1134,7 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
|
|||||||
|
|
||||||
_currentCurve = nullptr;
|
_currentCurve = nullptr;
|
||||||
|
|
||||||
// Global::_smoothnessFlag = false;
|
setAxisMode(Global::AxisMode::SingleY);
|
||||||
case ClearDataMode::JustUi:
|
case ClearDataMode::JustUi:
|
||||||
//ui
|
//ui
|
||||||
clearAllUiData();
|
clearAllUiData();
|
||||||
@ -1409,21 +1458,30 @@ void CentralWidget::loadAnalysisData(
|
|||||||
case AnalysisMode::OIT:{
|
case AnalysisMode::OIT:{
|
||||||
logde<<"oit x1,x2:"<<x1<<","<<x2;
|
logde<<"oit x1,x2:"<<x1<<","<<x2;
|
||||||
|
|
||||||
|
//
|
||||||
|
QVector<double> tickPositions = _customPlot->yAxis->tickVector();
|
||||||
|
// qDebug() << "Y-axis tick positions:";
|
||||||
|
// for (double pos : tickPositions) {
|
||||||
|
// qDebug() << pos;
|
||||||
|
// }
|
||||||
|
double step = tickPositions.at(1) - tickPositions.at(0);
|
||||||
|
|
||||||
|
//
|
||||||
Global::ExperimentData ed = PointCalculate::findOnSetDataByTime(x1,x2);
|
Global::ExperimentData ed = PointCalculate::findOnSetDataByTime(x1,x2);
|
||||||
|
|
||||||
// Global::ExperimentData ed = PointCalculate::findOnSetDataByTemperature(x1,x2);
|
// Global::ExperimentData ed = PointCalculate::findOnSetDataByTemperature(x1,x2);
|
||||||
|
|
||||||
// PointCalculate::setRegionPointX(x1,x2);
|
// PointCalculate::setRegionPointX(x1,x2);
|
||||||
|
|
||||||
Global::ExperimentData startData = PointCalculate::_dataVtr.first();
|
Global::ExperimentData startData = PointCalculate::_dataVtr.first();
|
||||||
|
|
||||||
// QPair<Global::ExperimentData,Global::ExperimentData>
|
// QPair<Global::ExperimentData,Global::ExperimentData>
|
||||||
// startEndDataPair = PointCalculate::calculateStartAndEndData();
|
// startEndDataPair = PointCalculate::calculateStartAndEndData();
|
||||||
|
|
||||||
logde<<"start data time:"<<startData.runTime;
|
logde<<"start data time:"<<startData.runTime;
|
||||||
logde<<"end data time:"<<ed.runTime;
|
logde<<"end data time:"<<ed.runTime;
|
||||||
|
|
||||||
drawOITLine(startData,ed);
|
drawOITLine(startData,ed,step,objectName);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1432,69 +1490,80 @@ void CentralWidget::loadAnalysisData(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CentralWidget::drawOITLine(const Global::ExperimentData startData,const Global::ExperimentData endData)
|
void CentralWidget::drawOITLine(
|
||||||
|
const Global::ExperimentData startData,
|
||||||
|
const Global::ExperimentData endData,
|
||||||
|
const int step,
|
||||||
|
const QString objectName)
|
||||||
{
|
{
|
||||||
#if 0
|
logde << "step:"<<step;
|
||||||
// Draw start vertical line.
|
|
||||||
QVector<double> xVtr,yVtr;
|
|
||||||
xVtr.push_back(startData.runTime);
|
|
||||||
xVtr.push_back(startData.runTime);
|
|
||||||
|
|
||||||
yVtr.push_back(startData.dsc - 10);
|
double localStep = static_cast<double>(step) / 5 / 2;
|
||||||
yVtr.push_back(startData.dsc - 20);
|
|
||||||
|
|
||||||
QCPGraph *startLine = _customPlot->addGraph();
|
double startOffset = localStep ;
|
||||||
startLine->setData(xVtr, yVtr);
|
double endOffset = localStep * 2;
|
||||||
startLine->setPen(QPen(Qt::red, 1));
|
|
||||||
|
|
||||||
// Draw end vertical line.
|
logde<<"start/end offset:"
|
||||||
xVtr.clear();
|
<<startOffset<<","<<endOffset;
|
||||||
yVtr.clear();
|
|
||||||
xVtr.push_back(endData.runTime);
|
|
||||||
xVtr.push_back(endData.runTime);
|
|
||||||
|
|
||||||
yVtr.push_back(endData.dsc - 10);
|
|
||||||
yVtr.push_back(endData.dsc - 20);
|
|
||||||
|
|
||||||
QCPGraph *endLine = _customPlot->addGraph();
|
double verticalLineStartY = startData.dsc - startOffset;
|
||||||
endLine->setData(xVtr, yVtr);
|
double verticalLineEndY = startData.dsc - endOffset;
|
||||||
endLine->setPen(QPen(Qt::red, 1));
|
|
||||||
#endif
|
double totalLineDsc = startData.dsc - (endOffset - startOffset) * 1.5;
|
||||||
|
|
||||||
// Draw start line.
|
// Draw start line.
|
||||||
QCPItemLine *startLine = new QCPItemLine(_customPlot);
|
QCPItemLine *startLine = new QCPItemLine(_customPlot);
|
||||||
startLine->start->setCoords(startData.runTime,startData.dsc - 10);
|
startLine->start->setCoords(startData.runTime,verticalLineStartY);
|
||||||
startLine->end->setCoords(startData.runTime,startData.dsc - 20);
|
startLine->end->setCoords(startData.runTime,verticalLineEndY);
|
||||||
startLine->setPen(QPen(Qt::red, 1));
|
startLine->setPen(QPen(Qt::red, 1));
|
||||||
|
ItemManager::addTemporaryQCPItemLine(startLine,objectName);
|
||||||
|
|
||||||
// Draw end line.
|
// Draw end line.
|
||||||
QCPItemLine *endLine = new QCPItemLine(_customPlot);
|
QCPItemLine *endLine = new QCPItemLine(_customPlot);
|
||||||
endLine->start->setCoords(endData.runTime,endData.dsc - 10);
|
endLine->start->setCoords(endData.runTime,verticalLineStartY);
|
||||||
endLine->end->setCoords(endData.runTime,endData.dsc - 20);
|
endLine->end->setCoords(endData.runTime,verticalLineEndY);
|
||||||
endLine->setPen(QPen(Qt::red, 1));
|
endLine->setPen(QPen(Qt::red, 1));
|
||||||
|
ItemManager::addTemporaryQCPItemLine(endLine,objectName);
|
||||||
|
|
||||||
// Draw total line.
|
// Draw total line.
|
||||||
QCPItemLine *totalLine = new QCPItemLine(_customPlot);
|
QCPItemLine *totalLine = new QCPItemLine(_customPlot);
|
||||||
totalLine->start->setCoords(startData.runTime,startData.dsc - 15);
|
totalLine->start->setCoords(startData.runTime,totalLineDsc);
|
||||||
totalLine->end->setCoords(endData.runTime,endData.dsc - 15);
|
totalLine->end->setCoords(endData.runTime,totalLineDsc);
|
||||||
totalLine->setPen(QPen(Qt::red, 1));
|
totalLine->setPen(QPen(Qt::red, 1));
|
||||||
|
ItemManager::addTemporaryQCPItemLine(totalLine,objectName);
|
||||||
|
|
||||||
// Draw title.
|
// Draw title.
|
||||||
double textX = (endData.runTime - startData.runTime) / 2 + endData.runTime;
|
double textX = (endData.runTime - startData.runTime) / 3 + startData.runTime;
|
||||||
|
double textY = verticalLineEndY;
|
||||||
|
|
||||||
QCPItemText *textLabel = new QCPItemText(_customPlot);
|
QCPItemText *textLabel = new QCPItemText(_customPlot);
|
||||||
textLabel->setPositionAlignment(Qt::AlignCenter); // 对齐方式
|
textLabel->setPositionAlignment(Qt::AlignLeft); // 对齐方式
|
||||||
textLabel->position->setType(QCPItemPosition::ptPlotCoords); // 使用数据坐标
|
textLabel->position->setType(QCPItemPosition::ptPlotCoords); // 使用数据坐标
|
||||||
textLabel->position->setCoords(textX,startData.dsc - 20); // 设置文本位置在指定点上方
|
textLabel->position->setCoords(textX,textY); // 设置文本位置在指定点上方
|
||||||
|
|
||||||
textLabel->setText("OIT:123.44"); // 设置文本内容
|
double elapseMin = endData.runTime - startData.runTime;
|
||||||
|
QString elapseMinStr = QString("OIT: ") + Global::converDoubleToStr(elapseMin)
|
||||||
|
+ QString(" min");
|
||||||
|
textLabel->setText(elapseMinStr); // 设置文本内容
|
||||||
QFont font(QFont("Arial", 10));
|
QFont font(QFont("Arial", 10));
|
||||||
textLabel->setFont(font);
|
textLabel->setFont(font);
|
||||||
textLabel->setSelectedFont(font);
|
textLabel->setSelectedFont(font);
|
||||||
textLabel->setSelectable(true); // 设置为可选
|
textLabel->setSelectable(true); // 设置为可选
|
||||||
|
ItemManager::addTemporaryQCPItemText(textLabel,objectName);
|
||||||
|
|
||||||
|
|
||||||
_customPlot->replot();
|
_customPlot->replot();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CentralWidget::setAxisMode(AxisMode mode)
|
||||||
|
{
|
||||||
|
if(_axisMode != mode){
|
||||||
|
_axisMode = mode;
|
||||||
|
uiLoadXlsxFileData();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CentralWidget::clearAllData()
|
void CentralWidget::clearAllData()
|
||||||
{
|
{
|
||||||
Global::_mode = Global::Mode::Analysis;
|
Global::_mode = Global::Mode::Analysis;
|
||||||
|
|||||||
@ -112,11 +112,13 @@ private:
|
|||||||
void clearData(const ClearDataMode);
|
void clearData(const ClearDataMode);
|
||||||
void clearAllUiData();
|
void clearAllUiData();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void loadAnalysisData(const AnalysisMode mode,const double x1,const double x2,const QString objectName);
|
void loadAnalysisData(const AnalysisMode mode,const double x1,const double x2,const QString objectName);
|
||||||
|
|
||||||
void drawOITLine(const Global::ExperimentData startData,const Global::ExperimentData endData);
|
void drawOITLine(const Global::ExperimentData startData,
|
||||||
|
const Global::ExperimentData endData,
|
||||||
|
const int step,const QString objectName);
|
||||||
|
|
||||||
|
void setAxisMode(Global::AxisMode mode);
|
||||||
private:
|
private:
|
||||||
AnalysisOperationRecorder::AnalysisMode _analysisMode;
|
AnalysisOperationRecorder::AnalysisMode _analysisMode;
|
||||||
LocalCustomPlot *_customPlot;
|
LocalCustomPlot *_customPlot;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user