DSCAnalysisTool/src/data/pointcalculate.h

105 lines
3.7 KiB
C
Raw Normal View History

2025-04-03 09:24:29 +00:00
#ifndef POINTCALCULATE_H
#define POINTCALCULATE_H
2025-03-26 09:30:02 +00:00
#include <QPointF>
#include "filemanager.h"
2025-05-16 09:28:45 +00:00
#include "global.h"
2025-03-26 09:30:02 +00:00
2025-04-03 09:24:29 +00:00
namespace PointCalculate{
2025-05-23 05:52:14 +00:00
using namespace Global;
2025-05-21 08:36:47 +00:00
void setAnalysisData(const QVector<Global::ExperimentData>&);
2025-04-01 09:25:12 +00:00
2025-05-22 09:31:38 +00:00
//QPair<QPointF,QPointF> getStartAndEndPoint();
QPair<float,float> getMinAndMaxOfSampleTemp();
QPair<float,float> getMinAndMaxOfRunTime();
QPair<float,float> getMinAndMaxOfDSC();
QPair<float,float> getMinAndMaxOfAxis(const float min,const float max);
2025-04-17 09:31:46 +00:00
QVector<Global::ExperimentData> getDataInXRange(const float, const float);
2025-04-21 09:31:38 +00:00
QVector<QPointF> getPointVtrInXRange(const float, const float);
2025-04-03 09:24:29 +00:00
2025-03-27 09:31:19 +00:00
void setRegionPointX(const float,const float);
2025-04-21 09:31:38 +00:00
2025-05-23 05:52:14 +00:00
ExperimentData getClosestDataByTemperature(const float);
2025-04-03 09:24:29 +00:00
QPointF getClosestPointByX(const float);
2025-04-21 09:31:38 +00:00
QVector<QPointF> getNearbyPointGroupByX(const float);
2025-04-22 03:35:39 +00:00
QPointF getClosestPointByY(const double left,const double right,const double valueY);
2025-04-03 09:24:29 +00:00
QPointF getPeakPoint();
2025-04-16 09:10:35 +00:00
QPair<float, float> getMaxMinValue();
2025-04-08 09:30:33 +00:00
2025-05-22 09:31:38 +00:00
// According to the value of plot x axis witch of temperature value.
QPair<float, float> getTheMaximumAndMinimumValuesOfTime(
const double min,const double max);
2025-04-08 09:30:33 +00:00
QPair<QPointF,QPointF> calculateStartAndEndPoint();
2025-05-23 05:52:14 +00:00
QPair<ExperimentData,ExperimentData> calculateStartAndEndData();
2025-04-08 09:30:33 +00:00
float calculateArea();
2025-04-30 02:59:08 +00:00
double obtainTimeValueBasedOnTemperatureValue(const double sampleTemp);
2025-04-08 09:30:33 +00:00
2025-05-26 06:32:01 +00:00
ExperimentData findOnSetDataByTemperature(const double x1,const double x2);
ExperimentData findEndSetDataByTemperature(const double x1,const double x2);
2025-06-12 09:27:45 +00:00
ExperimentData findOnSetDataByTime(const double x1,const double x2);
2025-05-26 06:32:01 +00:00
2025-04-08 09:30:33 +00:00
// text format
2025-04-01 09:25:12 +00:00
QString textFormatPeakPoint(const float enthalpyValue,
2025-04-16 09:10:35 +00:00
const float peakValue,
const float startPoint,
const float endPoint);
2025-04-30 02:59:08 +00:00
QString textFormatPeakPointWithTime(const float enthalpyValue,
const float peakValue,
const float startPoint,
const float endPoint);
2025-05-23 05:52:14 +00:00
2025-04-01 09:25:12 +00:00
QString textFormatNumbericalLabel(const QPointF);
2025-05-23 05:52:14 +00:00
QString textFormatNumbericalLabelWithTime(const QPointF);
2025-04-03 09:24:29 +00:00
QString textFormatStartPoint(const QPointF);
2025-05-23 05:52:14 +00:00
QString textFormatStartPointWithTime(const QPointF);
2025-04-03 09:24:29 +00:00
QString textFormatEndPoint(const QPointF);
2025-05-23 05:52:14 +00:00
QString textFormatEndPointWithTime(const QPointF);
2025-04-09 05:58:05 +00:00
QString textFormatGlassTranstion(const float t1,const float tg,const float t2);
2025-05-23 05:52:14 +00:00
QString textFormatGlassTranstionWithTime(const float t1,const float tg,const float t2);
2025-04-03 09:24:29 +00:00
2025-04-08 09:30:33 +00:00
// glass transition
QPair<float,float> getCurveInflectionPointTangent(const float,const float);
2025-04-21 09:31:38 +00:00
struct Line {
double slope; //
double intercept; //
2025-04-08 09:30:33 +00:00
};
2025-04-21 09:31:38 +00:00
QPointF getIntersection(const Line& line1, const Line& line2);
double calculateSlope(double x1, double y1, double x2, double y2) ;
QVector<double> findInflectionPoints(const QVector<double>& x, const QVector<double>& y) ;
QMap<double, Line> calculateTangentLine(const QVector<double>& x, const QVector<double>& y) ;
2025-03-31 05:19:02 +00:00
2025-03-26 09:30:02 +00:00
//private
2025-03-27 09:31:19 +00:00
void updateStartEndPoint();
2025-03-26 09:30:02 +00:00
QPair<QPointF,QPointF> calculateMaxDiffPointLeft();
QPair<QPointF,QPointF> calculateMaxDiffPointRight();
enum MaxDiffPointDetailType{
Left,
Right
};
QPair<QPointF,QPointF> calculateMaxDiffPointDetail(const MaxDiffPointDetailType type);
QPointF calculateIntersection(const QPointF p1,const QPointF p2,
const QPointF p3, const QPointF p4);
2025-03-27 09:31:19 +00:00
QVector<QPointF> getPeakPointGroup();
2025-04-03 09:24:29 +00:00
std::vector<float> movingAverage(const std::vector<float>& data, int windowSize);
2025-04-22 03:35:39 +00:00
QVector<QPointF> movingAveragePoint(const QVector<QPointF>& data, int windowSize);
2025-03-26 09:30:02 +00:00
2025-04-12 13:02:37 +00:00
extern QVector<Global::ExperimentData> _dataVtr;
2025-03-26 09:30:02 +00:00
extern QPointF _peakPoint;
extern QPointF _leftSelectedPoint,_rightSelectedPoint;
}
2025-04-03 09:24:29 +00:00
#endif // POINTCALCULATE_H