2025-06-06T17:17:30
This commit is contained in:
parent
1a5e49bbfe
commit
23667e3f8a
BIN
AnalysisTool-release/bin/DSCAnalysisTool_1.0.2.exe
Normal file
BIN
AnalysisTool-release/bin/DSCAnalysisTool_1.0.2.exe
Normal file
Binary file not shown.
24
AnalysisTool-release/bin/log/20250605.log
Normal file
24
AnalysisTool-release/bin/log/20250605.log
Normal file
@ -0,0 +1,24 @@
|
||||
[2025-06-05 14:26:20,323] main...
|
||||
[2025-06-05 14:26:20,325] config file existed.
|
||||
[2025-06-05 14:26:20,363] version:1.0.2.0
|
||||
[2025-06-05 14:26:20,396] setEventHandlerEnable...0
|
||||
[2025-06-05 14:27:13,511] main...
|
||||
[2025-06-05 14:27:13,511] config file existed.
|
||||
[2025-06-05 14:27:13,520] version:1.0.2.0
|
||||
[2025-06-05 14:27:13,529] setEventHandlerEnable...0
|
||||
[2025-06-05 14:27:17,437] xlsx sample weight:8.17
|
||||
[2025-06-05 14:27:17,437] startLineIndex:11
|
||||
[2025-06-05 14:27:17,437] data size:6930
|
||||
[2025-06-05 14:27:17,442] ana op size:0
|
||||
[2025-06-05 14:27:22,232] setEventHandlerEnable...1
|
||||
[2025-06-05 14:27:31,300] dataVtr size:6929
|
||||
[2025-06-05 14:27:31,300] select point param left,right:226.746,248.46
|
||||
[2025-06-05 14:27:31,300] peakPoint:232.533,11.7595
|
||||
[2025-06-05 14:27:31,300] peak point:232.533,11.7595
|
||||
[2025-06-05 14:27:31,300] select point left:232.479,11.745
|
||||
[2025-06-05 14:27:31,300] select point right:232.593,11.7372
|
||||
[2025-06-05 14:27:31,300] coefficient:1
|
||||
[2025-06-05 14:27:31,300] area:0.00856458
|
||||
[2025-06-05 14:27:31,300] peakPoint:232.533,11.7595
|
||||
[2025-06-05 14:27:31,300] start,end:0,0
|
||||
[2025-06-05 14:27:31,300] xMax:332.214
|
BIN
AnalysisTool-release/experiment_data/sample_data/锡铜炉实验.xlsx
Normal file
BIN
AnalysisTool-release/experiment_data/sample_data/锡铜炉实验.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/1434-new.xlsx
Normal file
BIN
experiment_data/analysis_state/1434-new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/1625-new.xlsx
Normal file
BIN
experiment_data/analysis_state/1625-new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/1637-new.xlsx
Normal file
BIN
experiment_data/analysis_state/1637-new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/6-1-new.xlsx
Normal file
BIN
experiment_data/analysis_state/6-1-new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/6-155new.xlsx
Normal file
BIN
experiment_data/analysis_state/6-155new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/6-15new.xlsx
Normal file
BIN
experiment_data/analysis_state/6-15new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/6-new.xlsx
Normal file
BIN
experiment_data/analysis_state/6-new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/63-new.xlsx
Normal file
BIN
experiment_data/analysis_state/63-new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/64-new.xlsx
Normal file
BIN
experiment_data/analysis_state/64-new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/65-new.xlsx
Normal file
BIN
experiment_data/analysis_state/65-new.xlsx
Normal file
Binary file not shown.
BIN
experiment_data/analysis_state/~$1637-new.xlsx
Normal file
BIN
experiment_data/analysis_state/~$1637-new.xlsx
Normal file
Binary file not shown.
@ -1,4 +1,4 @@
|
||||
#include "LowessSmoother.h"
|
||||
#include "lowesssmoother.h"
|
||||
#include <numeric>
|
||||
|
||||
namespace Lowess {
|
||||
|
@ -892,3 +892,4 @@ QString PointCalculate::textFormatGlassTranstionWithTime(const float t1, const f
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -20,7 +20,7 @@ void XlsxHandler::test()
|
||||
#endif
|
||||
|
||||
QString sourceFilePath = QDir::currentPath() + "/sample-save.xlsx";
|
||||
writeFile(sourceFilePath);
|
||||
writeExperimentFile(sourceFilePath);
|
||||
}
|
||||
|
||||
int XlsxHandler::readFile(const QString filePath, Global::CurveFileData &cfd)
|
||||
@ -79,11 +79,11 @@ int XlsxHandler::readFile(const QString filePath, Global::CurveFileData &cfd)
|
||||
phaseTotalVtr.push_back(phaseTotal);
|
||||
|
||||
// print
|
||||
// logde<<"index:"<<i<<",phase cut off temp:"<<phaseTotal.phase.cutoff_temp;
|
||||
// logde<<"index:"<<i<<",phase cut off temp:"<<phaseTotal.phase.cutoff_temp;
|
||||
}
|
||||
|
||||
// logde<<"index:"<<cfd.phaseTotalVtr.first().phaseIndex
|
||||
// <<",phase cut off temp:"<<cfd.phaseTotalVtr.first().phase.cutoff_temp;
|
||||
// logde<<"index:"<<cfd.phaseTotalVtr.first().phaseIndex
|
||||
// <<",phase cut off temp:"<<cfd.phaseTotalVtr.first().phase.cutoff_temp;
|
||||
|
||||
readAnalysisOperation(workSheet,dataIndex,cfd);
|
||||
|
||||
@ -125,12 +125,15 @@ void XlsxHandler::readPhaseData(QXlsx::Worksheet *workSheet, int &startLineIndex
|
||||
}
|
||||
}
|
||||
|
||||
void XlsxHandler::writeFile(const QString filePath)
|
||||
void XlsxHandler::writeExperimentFile(const QString filePath)
|
||||
{
|
||||
logde<<"write file...";
|
||||
#if 0
|
||||
if(Global::_curveExperimentDataVtr.empty()){
|
||||
logde<<"_curveExperimentDataVtr empty...";
|
||||
return;
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
Global::ExperimentInfo& ei = Global::_experimentInfo;
|
||||
|
||||
@ -198,7 +201,7 @@ void XlsxHandler::writeFile(const QString filePath)
|
||||
const Phase& phase = ei.phaseVtr.at(i);
|
||||
|
||||
if(phase.onoff == 0){
|
||||
// logde<<"onoff == 0.";
|
||||
// logde<<"onoff == 0.";
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -247,8 +250,8 @@ void XlsxHandler::writeFile(const QString filePath)
|
||||
row++;
|
||||
|
||||
// phase data.
|
||||
// logde<<"Global::_curveExperimentDataVtr size:"
|
||||
// <<Global::_curveExperimentDataVtr.size();
|
||||
// logde<<"Global::_curveExperimentDataVtr size:"
|
||||
// <<Global::_curveExperimentDataVtr.size();
|
||||
|
||||
const QVector<Global::ExperimentData>& edVtr =
|
||||
Global::_curveExperimentDataVtr.at(i).dataVtr;
|
||||
@ -258,10 +261,10 @@ void XlsxHandler::writeFile(const QString filePath)
|
||||
xlsx.write(row , 2, edVtr.size());
|
||||
row++;
|
||||
|
||||
// logde<<"edVtr size:"<<edVtr.size();
|
||||
// logde<<"edVtr size:"<<edVtr.size();
|
||||
|
||||
for(int index = 0;index < edVtr.size();index++){
|
||||
// logde<<"index :"<<index;
|
||||
// logde<<"index :"<<index;
|
||||
const Global::ExperimentData & ed = edVtr.at(index);
|
||||
|
||||
xlsx.write(row , 1, index);
|
||||
@ -286,7 +289,7 @@ void XlsxHandler::writeFile(const QString filePath)
|
||||
|
||||
}
|
||||
|
||||
void XlsxHandler::writeAnalysisOperation(const QString filePath)
|
||||
void XlsxHandler:: appendAnalysisOperation(const QString filePath)
|
||||
{
|
||||
QXlsx::Document* xlsx = openXlsxFile(_currentFilePath);
|
||||
if(!xlsx){
|
||||
@ -466,6 +469,10 @@ void XlsxHandler::writeAnalysisOperationDetail(QXlsx::Document *xlsx, const int
|
||||
QVector<AnalysisOperationRecorder::AnalysisOperation>& aoVtr =
|
||||
AnalysisOperationRecorder::_analysisOperationVtr;
|
||||
|
||||
if(aoVtr.empty()){
|
||||
return;
|
||||
}
|
||||
|
||||
xlsx->write(localRow , 1, ConAnalysisOperationCount);
|
||||
xlsx->write(localRow , 2, aoVtr.size());
|
||||
localRow++;
|
||||
@ -518,3 +525,56 @@ void XlsxHandler::writeAnalysisOperationDetail(QXlsx::Document *xlsx, const int
|
||||
localRow++;
|
||||
}
|
||||
}
|
||||
|
||||
void XlsxHandler::writeSmoothnessFile(const QString filePath)
|
||||
{
|
||||
#if 0
|
||||
if(Global::_curveFileDataVtr.empty()){
|
||||
// Load experiment data.
|
||||
logde<<"experiment vtr size:"<<Global::_curveExperimentDataVtr.size();
|
||||
for(Global::CurveExperimentData& ced:Global::_curveExperimentDataVtr){
|
||||
if(_centralWidget->isCurrentCurve(ced.curve)){
|
||||
logde<<"load experiment data.";
|
||||
// PointCalculate::setAnalysisData(ced.dataVtr);
|
||||
dataVtr = ced.dataVtr;
|
||||
Global::_smoothnessFileName = ced.fileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// Load xlsx file data.
|
||||
for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){
|
||||
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
||||
if(_centralWidget->isCurrentCurve(pti.curve)){
|
||||
// PointCalculate::setAnalysisData(pti.dataVtr);
|
||||
dataVtr = pti.dataVtr;
|
||||
Global::_smoothnessFileName = cfd.fileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void XlsxHandler::writeAnalysisiFile(const QString filePath)
|
||||
{
|
||||
QXlsx::Document* xlsx = openXlsxFile(_currentFilePath);
|
||||
if(!xlsx){
|
||||
logde<<"xlsx is nullptr." ;
|
||||
return;
|
||||
}
|
||||
|
||||
QXlsx::Worksheet *sheet = xlsx->currentWorksheet();
|
||||
if(!sheet)
|
||||
{
|
||||
logde << "current sheet is empty.";
|
||||
return;
|
||||
}
|
||||
int index = sheet->dimension().lastRow();
|
||||
logde<<"lastRow:"<<index;
|
||||
|
||||
int row = index + 1;
|
||||
|
||||
writeAnalysisOperationDetail(xlsx,row);
|
||||
}
|
||||
|
@ -24,10 +24,13 @@ namespace XlsxHandler {
|
||||
void readPhaseData(QXlsx::Worksheet*,int& startLineIndex,Global::PhaseTotalInfo&);
|
||||
void readAnalysisOperation(QXlsx::Worksheet*,int& startLineIndex,Global::CurveFileData&);
|
||||
|
||||
void writeFile(const QString filePath);
|
||||
void writeAnalysisOperation(const QString filePath);
|
||||
void writeExperimentFile(const QString filePath);
|
||||
void appendAnalysisOperation(const QString filePath);
|
||||
void writeAnalysisiFile(const QString filePath);
|
||||
void writeAnalysisOperationDetail(QXlsx::Document*doc,const int row);
|
||||
|
||||
void writeSmoothnessFile(const QString filePath);
|
||||
|
||||
extern QString _currentFilePath;
|
||||
|
||||
const QString ConUnitMg = "mg";
|
||||
|
@ -6,6 +6,8 @@
|
||||
namespace Global {
|
||||
Mode _mode = Mode::Analysis;
|
||||
|
||||
AxisMode _axisMode = AxisMode::SingleY;
|
||||
|
||||
QVector<CurveFileData> _curveFileDataVtr;
|
||||
|
||||
int _currentPhase = 0;
|
||||
@ -13,6 +15,10 @@ ExperimentInfo _experimentInfo;
|
||||
QVector<CurveExperimentData> _curveExperimentDataVtr;
|
||||
CurveExperimentData* _currentCurveExperimentDataPtr = nullptr;
|
||||
|
||||
bool _smoothnessFlag = false;
|
||||
QVector<CurveExperimentData> _curveSmoothnessDataVtr;
|
||||
QString _smoothnessFileName;
|
||||
|
||||
bool _enthalpyCoefficientEnableFlag = false;
|
||||
QVector<double> _enthalpyCoefficientVtr;
|
||||
|
||||
|
14
src/global.h
14
src/global.h
@ -34,12 +34,18 @@ const double OnsetAndEndSetRate = 0.01;
|
||||
|
||||
//curve object name
|
||||
const QString objectNameExperiemnt("experiment");
|
||||
//const QString objectNameSmoothness("smoothness");
|
||||
//
|
||||
enum LanguageType{
|
||||
Chinese,
|
||||
English
|
||||
};
|
||||
|
||||
enum AxisMode{
|
||||
SingleY,
|
||||
DoubleY
|
||||
};
|
||||
|
||||
const QString EnglishStr("English");
|
||||
const QString ChineseStr("中文");
|
||||
|
||||
@ -111,6 +117,12 @@ extern int _currentPhase;
|
||||
extern ExperimentInfo _experimentInfo;
|
||||
extern QVector<CurveExperimentData> _curveExperimentDataVtr;
|
||||
extern CurveExperimentData* _currentCurveExperimentDataPtr;
|
||||
extern bool _smoothnessFlag;
|
||||
#if 0
|
||||
// Smoothness data
|
||||
extern QVector<CurveExperimentData> _curveSmoothnessDataVtr;
|
||||
extern QString _smoothnessFileName;
|
||||
#endif
|
||||
|
||||
// Call clear function at the right time.
|
||||
void clearExperimentData();
|
||||
@ -124,6 +136,8 @@ extern bool _displayTimeValue;
|
||||
//
|
||||
extern LanguageType _languageType;
|
||||
|
||||
extern AxisMode _axisMode;
|
||||
|
||||
// common func
|
||||
QString converDoubleToStr(const double);
|
||||
void quadraticLeastSquaresFit(double x[], double y[], int n, double coeff[]);
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
system("chcp 65001");
|
||||
// system("chcp 65001");
|
||||
QTextCodec *codec = QTextCodec::codecForName("UTF-8");
|
||||
QTextCodec::setCodecForLocale(codec);
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include <qmessagebox.h>
|
||||
|
||||
#include "lowesssmoother.h"
|
||||
#include "mainwindow.h"
|
||||
#include "ui_mainwindow.h"
|
||||
#include "global.h"
|
||||
@ -269,18 +270,24 @@ bool MainWindow::saveFile(const QString fileName,const Global::Mode mode)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Save file.
|
||||
if(mode == Global::Mode::Analysis){
|
||||
if(Global::_curveFileDataVtr.empty()){
|
||||
logde<<"analysis experiemt data...";
|
||||
XlsxHandler::writeFile(filePath);
|
||||
// XlsxHandler::writeAnalysisOperation(filePath);
|
||||
XlsxHandler::writeExperimentFile(filePath);
|
||||
// XlsxHandler::writeAnalysisOperation(filePath);
|
||||
}else{
|
||||
logde<<"analysis xlsx data...";
|
||||
XlsxHandler::writeAnalysisOperation(filePath);
|
||||
if(Global::_smoothnessFlag){
|
||||
|
||||
}else{
|
||||
XlsxHandler::appendAnalysisOperation(filePath);
|
||||
}
|
||||
}
|
||||
}else if(mode == Global::Mode::Experiment){
|
||||
logde<<"writeFile...";
|
||||
XlsxHandler::writeFile(filePath);
|
||||
XlsxHandler::writeExperimentFile(filePath);
|
||||
|
||||
#if 0
|
||||
// Clear data.
|
||||
Global::clearExperimentData();
|
||||
@ -290,9 +297,203 @@ bool MainWindow::saveFile(const QString fileName,const Global::Mode mode)
|
||||
return true;
|
||||
}
|
||||
|
||||
void MainWindow::smoothness(const int level)
|
||||
{
|
||||
Global::_smoothnessFlag = true;
|
||||
// process data.
|
||||
QVector<Global::ExperimentData> targetDataVtr;
|
||||
QString objectName;
|
||||
QCPCurve ** curvePtrPtr;
|
||||
|
||||
if(!Global::_curveExperimentDataVtr.empty()){
|
||||
for(auto & item:Global::_curveExperimentDataVtr){
|
||||
if(_centralWidget->isCurrentCurve(item.curve)){
|
||||
smoothnessDetail(level,item.dataVtr);
|
||||
|
||||
targetDataVtr = item.dataVtr;
|
||||
objectName = Global::objectNameExperiemnt;
|
||||
curvePtrPtr = &item.curve;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
for(Global::CurveFileData &cfd :Global::_curveFileDataVtr){
|
||||
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
||||
if(_centralWidget->isCurrentCurve(pti.curve)){
|
||||
smoothnessDetail(level,pti.dataVtr);
|
||||
|
||||
targetDataVtr = pti.dataVtr;
|
||||
objectName = cfd.fileName;
|
||||
curvePtrPtr = &pti.curve;
|
||||
|
||||
//
|
||||
#if 0
|
||||
Global::ExperimentData ed;
|
||||
ed.sampleTemp = 2222;
|
||||
ed.dsc = 2222;
|
||||
|
||||
pti.dataVtr.push_back(ed);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
_centralWidget->deleteCurrentCurve();
|
||||
|
||||
//
|
||||
_centralWidget->addSmoothnessCurveData(targetDataVtr,objectName);
|
||||
|
||||
*curvePtrPtr = _centralWidget->getCurrentCurve();
|
||||
|
||||
|
||||
#if 0
|
||||
// Get current data vtr;
|
||||
QVector<Global::ExperimentData> dataVtr;
|
||||
|
||||
if(Global::_curveFileDataVtr.empty()){
|
||||
// Load experiment data.
|
||||
logde<<"experiment vtr size:"<<Global::_curveExperimentDataVtr.size();
|
||||
for(Global::CurveExperimentData& ced:Global::_curveExperimentDataVtr){
|
||||
if(_centralWidget->isCurrentCurve(ced.curve)){
|
||||
logde<<"load experiment data.";
|
||||
// PointCalculate::setAnalysisData(ced.dataVtr);
|
||||
dataVtr = ced.dataVtr;
|
||||
Global::_smoothnessFileName = ced.fileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
// Load xlsx file data.
|
||||
for(Global::CurveFileData& cfd:Global::_curveFileDataVtr){
|
||||
for(Global::PhaseTotalInfo& pti:cfd.phaseTotalVtr){
|
||||
if(_centralWidget->isCurrentCurve(pti.curve)){
|
||||
// PointCalculate::setAnalysisData(pti.dataVtr);
|
||||
dataVtr = pti.dataVtr;
|
||||
Global::_smoothnessFileName = cfd.fileName;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(dataVtr.empty()){
|
||||
return;
|
||||
}
|
||||
|
||||
// smoothness.
|
||||
Lowess::Config config;
|
||||
config.smoothingFactor = level * 0.1;
|
||||
config.robustnessIterations = 3;
|
||||
|
||||
std::vector<double> x;
|
||||
std::vector<double> y;
|
||||
|
||||
for(Global::ExperimentData& ed:dataVtr) {
|
||||
if(Global::_axisMode == Global::AxisMode::SingleY){
|
||||
x.push_back(ed.sampleTemp);
|
||||
}else{
|
||||
x.push_back(ed.runTime);
|
||||
}
|
||||
|
||||
y.push_back(ed.dsc);
|
||||
}
|
||||
|
||||
logde<<"smooth start...";
|
||||
std::vector<double> yest = Lowess::smooth(x, y, config);
|
||||
logde<<"smooth end...";
|
||||
|
||||
// Delete current curve;
|
||||
_centralWidget->deleteCurrentCurve();
|
||||
|
||||
// Add new Curve.
|
||||
QVector<Global::ExperimentData> newCurveDataVtr;
|
||||
for(int i = 0; i < x.size();i++){
|
||||
Global::ExperimentData ed;
|
||||
if(Global::_axisMode == Global::AxisMode::SingleY){
|
||||
ed.sampleTemp = x.at(i);
|
||||
ed.runTime = dataVtr.at(i).runTime;
|
||||
}else{
|
||||
ed.runTime = x.at(i);
|
||||
ed.sampleTemp = dataVtr.at(i).sampleTemp;
|
||||
}
|
||||
|
||||
ed.dsc = yest.at(i);
|
||||
ed.constantTempTime = dataVtr.at(i).constantTempTime;
|
||||
|
||||
newCurveDataVtr.push_back(ed);
|
||||
}
|
||||
_centralWidget->addSmoothnessCurveData(newCurveDataVtr);
|
||||
#endif
|
||||
}
|
||||
|
||||
QVector<Global::ExperimentData> MainWindow::smoothnessDetail(const int level,QVector<Global::ExperimentData>& dataVtr)
|
||||
{
|
||||
Lowess::Config config;
|
||||
config.smoothingFactor = level * 0.1;
|
||||
config.robustnessIterations = 3;
|
||||
|
||||
std::vector<double> x;
|
||||
std::vector<double> y;
|
||||
|
||||
for(const Global::ExperimentData& ed:dataVtr) {
|
||||
if(Global::_axisMode == Global::AxisMode::SingleY){
|
||||
x.push_back(ed.sampleTemp);
|
||||
}else{
|
||||
x.push_back(ed.runTime);
|
||||
}
|
||||
|
||||
y.push_back(ed.dsc);
|
||||
}
|
||||
|
||||
logde<<"smooth start...";
|
||||
std::vector<double> yest = Lowess::smooth(x, y, config);
|
||||
logde<<"smooth end...";
|
||||
|
||||
// target data vector.
|
||||
QVector<Global::ExperimentData> targetVtr;
|
||||
|
||||
for(int i = 0; i < x.size();i++){
|
||||
Global::ExperimentData ed;
|
||||
if(Global::_axisMode == Global::AxisMode::SingleY){
|
||||
ed.sampleTemp = x.at(i);
|
||||
ed.runTime = dataVtr.at(i).runTime;
|
||||
}else{
|
||||
ed.runTime = x.at(i);
|
||||
ed.sampleTemp = dataVtr.at(i).sampleTemp;
|
||||
}
|
||||
|
||||
ed.dsc = yest.at(i);
|
||||
ed.constantTempTime = dataVtr.at(i).constantTempTime;
|
||||
|
||||
targetVtr.push_back(ed);
|
||||
}
|
||||
|
||||
dataVtr.clear();
|
||||
dataVtr = targetVtr;
|
||||
|
||||
return targetVtr;
|
||||
}
|
||||
|
||||
void MainWindow::smoothnessExperimentData(const int level)
|
||||
{
|
||||
#if 0
|
||||
for(int i = 0;i < Global::_curveExperimentDataVtr.size();i++){
|
||||
Global::CurveExperimentData ced = Global::_curveExperimentDataVtr.at(i);
|
||||
smoothnessDetail()
|
||||
}
|
||||
#endif
|
||||
|
||||
for(auto & item:Global::_curveExperimentDataVtr){
|
||||
smoothnessDetail(level,item.dataVtr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::on_actionStop_triggered()
|
||||
{
|
||||
logde<<" Stop experiment ...";
|
||||
|
||||
if(Global::_mode == Global::Mode::Experiment)
|
||||
{
|
||||
QByteArray ba = DataParser::setDeviceStartStop(DeviceStartMode::Stop);
|
||||
@ -303,6 +504,7 @@ void MainWindow::on_actionStop_triggered()
|
||||
// if(saveExperimentFile(Global::_experimentInfo.sampleName)){
|
||||
// _leftWidget->reloadFileName();
|
||||
// }
|
||||
|
||||
if(saveFile(Global::_experimentInfo.sampleName,Global::Mode::Experiment)){
|
||||
_leftWidget->reloadFileName();
|
||||
}
|
||||
@ -365,6 +567,7 @@ void MainWindow::slotSaveExperimentalDataMsgBox()
|
||||
} else {
|
||||
on_actionClearAllData_triggered();
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Clear data.
|
||||
logde<<"save mesg box.clearExperimentData...";
|
||||
@ -548,5 +751,47 @@ void MainWindow::on_actionLanguage_triggered()
|
||||
Global::_languageType = Global::LanguageType::Chinese;
|
||||
ui->actionLanguage->setText(Global::ChineseStr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSmoothness1_triggered()
|
||||
{
|
||||
smoothness(1);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionSmoothness2_triggered()
|
||||
{
|
||||
smoothness(2);
|
||||
}
|
||||
void MainWindow::on_actionSmoothness3_triggered()
|
||||
{
|
||||
smoothness(3);
|
||||
}
|
||||
void MainWindow::on_actionSmoothness4_triggered()
|
||||
{
|
||||
smoothness(4);
|
||||
}
|
||||
void MainWindow::on_actionSmoothness5_triggered()
|
||||
{
|
||||
smoothness(5);
|
||||
}
|
||||
void MainWindow::on_actionSmoothness6_triggered()
|
||||
{
|
||||
smoothness(6);
|
||||
}
|
||||
void MainWindow::on_actionSmoothness7_triggered()
|
||||
{
|
||||
smoothness(7);
|
||||
}
|
||||
void MainWindow::on_actionSmoothness8_triggered()
|
||||
{
|
||||
smoothness(8);
|
||||
}
|
||||
void MainWindow::on_actionSmoothness9_triggered()
|
||||
{
|
||||
smoothness(9);
|
||||
}
|
||||
void MainWindow::on_actionSmoothness10_triggered()
|
||||
{
|
||||
smoothness(10);
|
||||
}
|
||||
|
||||
|
@ -98,12 +98,29 @@ private slots:
|
||||
|
||||
void on_actionLanguage_triggered();
|
||||
|
||||
void on_actionSmoothness1_triggered();
|
||||
void on_actionSmoothness2_triggered();
|
||||
void on_actionSmoothness3_triggered();
|
||||
void on_actionSmoothness4_triggered();
|
||||
void on_actionSmoothness5_triggered();
|
||||
void on_actionSmoothness6_triggered();
|
||||
void on_actionSmoothness7_triggered();
|
||||
void on_actionSmoothness8_triggered();
|
||||
void on_actionSmoothness9_triggered();
|
||||
void on_actionSmoothness10_triggered();
|
||||
|
||||
private:
|
||||
void setAnalysisData();
|
||||
void connections();
|
||||
void setActionEnable(const bool);
|
||||
void setSubWidgetAttribute(QWidget *);
|
||||
|
||||
bool saveFile(const QString fileName,const Global::Mode);
|
||||
|
||||
void smoothness(const int level);
|
||||
QVector<Global::ExperimentData> smoothnessDetail(const int level,QVector<Global::ExperimentData>&);
|
||||
void smoothnessExperimentData(const int level);
|
||||
|
||||
private:
|
||||
bool _manuallyStopTheExperimentFlag;
|
||||
Ui::MainWindow *ui;
|
||||
|
@ -75,16 +75,16 @@
|
||||
<property name="title">
|
||||
<string>平滑</string>
|
||||
</property>
|
||||
<addaction name="action1"/>
|
||||
<addaction name="action2"/>
|
||||
<addaction name="action3"/>
|
||||
<addaction name="action4"/>
|
||||
<addaction name="action5"/>
|
||||
<addaction name="action6"/>
|
||||
<addaction name="action7"/>
|
||||
<addaction name="action9"/>
|
||||
<addaction name="action9_2"/>
|
||||
<addaction name="action10"/>
|
||||
<addaction name="actionSmoothness1"/>
|
||||
<addaction name="actionSmoothness2"/>
|
||||
<addaction name="actionSmoothness3"/>
|
||||
<addaction name="actionSmoothness4"/>
|
||||
<addaction name="actionSmoothness5"/>
|
||||
<addaction name="actionSmoothness6"/>
|
||||
<addaction name="actionSmoothness7"/>
|
||||
<addaction name="actionSmoothness8"/>
|
||||
<addaction name="actionSmoothness9"/>
|
||||
<addaction name="actionSmoothness10"/>
|
||||
</widget>
|
||||
<addaction name="actionEnthalpyCorrectionEdit"/>
|
||||
<addaction name="actionEnthalpyCorrectionSelection"/>
|
||||
@ -360,52 +360,52 @@
|
||||
<string>language</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action1">
|
||||
<action name="actionSmoothness1">
|
||||
<property name="text">
|
||||
<string>1级</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action2">
|
||||
<action name="actionSmoothness2">
|
||||
<property name="text">
|
||||
<string>2级</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action3">
|
||||
<action name="actionSmoothness3">
|
||||
<property name="text">
|
||||
<string>3级</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action4">
|
||||
<action name="actionSmoothness4">
|
||||
<property name="text">
|
||||
<string>4级</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action5">
|
||||
<action name="actionSmoothness5">
|
||||
<property name="text">
|
||||
<string>5级</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action6">
|
||||
<action name="actionSmoothness6">
|
||||
<property name="text">
|
||||
<string>6级</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action7">
|
||||
<action name="actionSmoothness7">
|
||||
<property name="text">
|
||||
<string>7级</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action9">
|
||||
<action name="actionSmoothness8">
|
||||
<property name="text">
|
||||
<string>8级</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action9_2">
|
||||
<action name="actionSmoothness9">
|
||||
<property name="text">
|
||||
<string>9级</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="action10">
|
||||
<action name="actionSmoothness10">
|
||||
<property name="text">
|
||||
<string>10级</string>
|
||||
</property>
|
||||
|
@ -15,6 +15,7 @@
|
||||
|
||||
namespace AnaOpRecorder = AnalysisOperationRecorder;
|
||||
using AnaOpRecorderOperation = AnalysisOperationRecorder::AnalysisOperation;
|
||||
using namespace Global;
|
||||
|
||||
CentralWidget::CentralWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
@ -22,7 +23,6 @@ CentralWidget::CentralWidget(QWidget *parent)
|
||||
// ,_customPlot(new QCustomPlot(this))
|
||||
,_analysisMode(AnalysisMode::Null)
|
||||
,_currentCurve(nullptr)
|
||||
,_axisMode(AxisMode::SingleY)
|
||||
{
|
||||
setMouseTracking(true);
|
||||
|
||||
@ -119,6 +119,87 @@ void CentralWidget::switchAxisMode()
|
||||
uiLoadXlsxFileData();
|
||||
}
|
||||
|
||||
bool CentralWidget::isCurrentCurve(QCPCurve *curve)
|
||||
{
|
||||
return _currentCurve == curve;
|
||||
}
|
||||
|
||||
void CentralWidget::deleteCurrentCurve()
|
||||
{
|
||||
slotDelCurve(_currentCurve);
|
||||
}
|
||||
|
||||
void CentralWidget::addSmoothnessCurveData(
|
||||
const QVector<ExperimentData> &dataVtr,const QString objectName)
|
||||
{
|
||||
PointCalculate::setAnalysisData(dataVtr);
|
||||
|
||||
// Load data.
|
||||
// QVector<Global::ExperimentData> dataVtr;
|
||||
QVector<double> tVtr,xVtr, yVtr;
|
||||
int index = 0;
|
||||
for (const Global::ExperimentData &ed : dataVtr)
|
||||
{
|
||||
tVtr.push_back(index++);
|
||||
if(_axisMode == AxisMode::SingleY){
|
||||
xVtr.push_back(ed.sampleTemp);
|
||||
}else{
|
||||
xVtr.push_back(ed.runTime);
|
||||
}
|
||||
yVtr.push_back(ed.dsc);
|
||||
}
|
||||
|
||||
_currentCurve = new QCPCurve(_customPlot->xAxis, _customPlot->yAxis);
|
||||
_currentCurve->setData(tVtr, xVtr, yVtr);
|
||||
_currentCurve->setSelectable(QCP::stWhole); // 设置曲线可选
|
||||
_currentCurve->setLineStyle(QCPCurve::lsLine); // 线性连接
|
||||
|
||||
_currentCurve->setObjectName(objectName);
|
||||
|
||||
// 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);
|
||||
//
|
||||
// pti.curve = _currentCurve;
|
||||
|
||||
// Add analysis operation data.
|
||||
#if 0
|
||||
if(cfd.analysisOperationVtr.size() > 0){
|
||||
for(AnaOpRecorder::AnalysisOperation& ao
|
||||
:cfd.analysisOperationVtr){
|
||||
loadAnalysisData(ao.mode,ao.x1,ao.x2,cfd.fileName);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// Refresh ui.
|
||||
_customPlot->replot();
|
||||
|
||||
#if 0
|
||||
// Save data.
|
||||
CurveExperimentData ced;
|
||||
ced.curve = _currentCurve;
|
||||
ced.dataVtr = dataVtr;
|
||||
|
||||
// Global::_curveSmoothnessDataVtr.push_back(ced);
|
||||
#endif
|
||||
}
|
||||
|
||||
void CentralWidget::setAnalysisMode(const AnalysisMode mode)
|
||||
{
|
||||
_analysisMode = mode;
|
||||
@ -241,6 +322,7 @@ void CentralWidget::slotAnalysisSettingApply()
|
||||
return;
|
||||
}
|
||||
|
||||
// Set curve data to PointCalculate.
|
||||
if(Global::_curveFileDataVtr.empty()){
|
||||
// Load experiment data.
|
||||
logde<<"experiment vtr size:"<<Global::_curveExperimentDataVtr.size();
|
||||
@ -248,6 +330,7 @@ void CentralWidget::slotAnalysisSettingApply()
|
||||
if(ced.curve == _currentCurve){
|
||||
logde<<"load experiment data.";
|
||||
PointCalculate::setAnalysisData(ced.dataVtr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@ -261,6 +344,17 @@ void CentralWidget::slotAnalysisSettingApply()
|
||||
}
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
// Load smoothness data.
|
||||
for(Global::CurveExperimentData& ced:Global::_curveSmoothnessDataVtr){
|
||||
if(ced.curve == _currentCurve){
|
||||
logde<<"load smoothness data.";
|
||||
PointCalculate::setAnalysisData(ced.dataVtr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
//
|
||||
double x1 = _line1->point1->coords().x();
|
||||
double x2 = _line2->point1->coords().x();
|
||||
@ -349,6 +443,7 @@ void CentralWidget::slotDrawCustomText(const QString str)
|
||||
void CentralWidget::slotDelCurve(QCPCurve *curve)
|
||||
{
|
||||
if(!curve){
|
||||
logde<<"current curve is nullptr.";
|
||||
return;
|
||||
}
|
||||
|
||||
@ -490,7 +585,6 @@ void CentralWidget::uiLoadXlsxFileData()
|
||||
_currentCurve->setObjectName(cfd.fileName);
|
||||
|
||||
// Set axis range.
|
||||
|
||||
QPair<float, float> minMaxXAxisPair;
|
||||
if(_axisMode == AxisMode::SingleY){
|
||||
// Axis x is temperature value.
|
||||
@ -703,7 +797,7 @@ void CentralWidget::glassTransitionHandle(const double x1,const double x2,const
|
||||
QString str = PointCalculate::textFormatGlassTranstion(intersection1.x(),
|
||||
averagePoint.x(),
|
||||
intersection2.x());
|
||||
if(_axisMode == AxisMode::DoubleY){
|
||||
if(Global::_axisMode == Global::AxisMode::DoubleY){
|
||||
Global::ExperimentData intersection1Ed =
|
||||
PointCalculate::getClosestDataByTemperature(intersection1.x());
|
||||
Global::ExperimentData averageEd =
|
||||
@ -750,10 +844,10 @@ QPointF CentralWidget::onsetTemperaturePointHandle(const double x1,const double
|
||||
{
|
||||
Global::ExperimentData ed = PointCalculate::findOnSetDataByTemperature(x1,x2);
|
||||
|
||||
if(_axisMode == AxisMode::SingleY){
|
||||
return QPointF(ed.sampleTemp,ed.dsc);
|
||||
if(Global::_axisMode == Global::AxisMode::SingleY){
|
||||
return QPointF(ed.sampleTemp,ed.dsc);
|
||||
}else{
|
||||
return QPointF(ed.runTime,ed.dsc);
|
||||
return QPointF(ed.runTime,ed.dsc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -761,10 +855,10 @@ QPointF CentralWidget::endSetTemperaturePointHandle(const double x1, const doubl
|
||||
{
|
||||
Global::ExperimentData ed = PointCalculate::findEndSetDataByTemperature(x1,x2);
|
||||
|
||||
if(_axisMode == AxisMode::SingleY){
|
||||
return QPointF(ed.sampleTemp,ed.dsc);
|
||||
if(Global::_axisMode == Global::AxisMode::SingleY){
|
||||
return QPointF(ed.sampleTemp,ed.dsc);
|
||||
}else{
|
||||
return QPointF(ed.runTime,ed.dsc);
|
||||
return QPointF(ed.runTime,ed.dsc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -848,7 +942,7 @@ QPointF CentralWidget::getTheCoordinatesOfTheTextBox(const QPointF point)
|
||||
|
||||
QVector<double> ticks = _customPlot->xAxis->tickVector();
|
||||
int numTicks = ticks.size();
|
||||
// logde<<"ticks:"<<numTicks;
|
||||
// logde<<"ticks:"<<numTicks;
|
||||
|
||||
double distance = (xMax - xMin) / ticks.size();
|
||||
|
||||
@ -970,6 +1064,8 @@ void CentralWidget::clearData(const CentralWidget::ClearDataMode mode)
|
||||
_line2->setVisible(false);
|
||||
|
||||
_currentCurve = nullptr;
|
||||
|
||||
Global::_smoothnessFlag = false;
|
||||
case ClearDataMode::JustUi:
|
||||
//ui
|
||||
clearAllUiData();
|
||||
@ -1317,3 +1413,6 @@ void CentralWidget::slotAxisModify(const float temp)
|
||||
_customPlot->xAxis->setRange(10,value);
|
||||
_customPlot->yAxis->setRange(-5,5);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -31,16 +31,20 @@ public:
|
||||
|
||||
QPixmap getPixMap();
|
||||
|
||||
enum AxisMode{
|
||||
SingleY,
|
||||
DoubleY
|
||||
};
|
||||
void switchAxisMode();
|
||||
|
||||
struct AxisInfo{
|
||||
bool visiable;
|
||||
double lower;
|
||||
double upper;
|
||||
};
|
||||
|
||||
bool isCurrentCurve(QCPCurve* curve);
|
||||
|
||||
void deleteCurrentCurve();
|
||||
void addSmoothnessCurveData(const QVector<Global::ExperimentData> &,const QString objectName);
|
||||
|
||||
QCPCurve * getCurrentCurve(){return _currentCurve;}
|
||||
signals:
|
||||
void sigContextMenuShow(const QPoint);
|
||||
void sigSendLineXCoord(const int,const double);
|
||||
@ -109,11 +113,10 @@ private:
|
||||
private:
|
||||
AnalysisOperationRecorder::AnalysisMode _analysisMode;
|
||||
LocalCustomPlot *_customPlot;
|
||||
QCPCurve *_currentCurve;
|
||||
QCPCurve * _currentCurve;
|
||||
EventHandler* _eventHandler;
|
||||
QCPItemStraightLine *_line1,*_line2;
|
||||
QVector<QCPItemStraightLine*> _lineVtr;
|
||||
AxisMode _axisMode;
|
||||
QVector<QString> _analysisFilePathVtr;
|
||||
|
||||
double _x1Record;
|
||||
|
Loading…
Reference in New Issue
Block a user