Kstars

aberrationinspectorplot.h
1/*
2 SPDX-FileCopyrightText: 2023 John Evans <john.e.evans.email@googlemail.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "aberrationinspectorutils.h"
10#include "qcustomplot.h"
11
12// AberrationInspectorPlot manages the QCustomPlot graph of focus position vs measure for the 9 mosaic tiles
13// Each tile has its own curve. The legend shows which curve refers to which tile. The maximum or minimum of each
14// curve is also displayed. The tooltip of each max / min gives more info. Optionally, a label describing the max / min
15// can be displayed; and the CFZ can be displayed around the centre tile max / min.
16//
17namespace Ekos
18{
19
20class CurveFitting;
21
22class AberrationInspectorPlot : public QCustomPlot
23{
24 public:
25 /**
26 * @brief create an AberrationInspectorPlot graph
27 * @param parent widget
28 */
29 AberrationInspectorPlot(QWidget *parent = nullptr);
30
31 /**
32 * @brief add all data for all datapoints for all curves
33 * @param position focuser position
34 * @param measure for the associated position
35 * @param weight for the associated measure
36 * @param outlier or not
37 */
38 void addData(QVector<int> position, QVector<double> measure, QVector<double> weight, QVector<bool> outlier);
39
40 /**
41 * @brief Add the max / min solution to the plot
42 * @param tile number
43 * @param solution position
44 * @param solution value
45 */
46 void drawMaxMin(int tile, double solutionPosition, double solutionValue);
47
48 /**
49 * @brief Draw the Critical Focus Zone centred on solution
50 * @param solution position
51 * @param solution measure
52 * @param CFZ size in steps
53 */
54 void drawCFZ(double solutionPosition, double solutionMeasure, int cfzSteps);
55
56 /**
57 * @brief Draw the curve
58 * @param tile
59 * @param curveFit pointer to generate data points
60 * @param maxmin is the curve max or min
61 * @param measure of the curve, e.g. HFR
62 * @param fit is whether a curve fit was achieved
63 * @param R2 of the curve fit
64 */
65 void drawCurve(int tile, Ekos::CurveFitting *curveFit, int maxmin, double measure, bool fit, double R2);
66
67 /**
68 * @brief Refresh the entire graph
69 * @param useTile array indicating which tiles to show/hide
70 */
71 void redrawCurve(bool useTile[NUM_TILES]);
72
73 /**
74 * @brief Initialize the plot
75 * @param yAxisLabel is the label to display
76 * @param starUnits the units multiplier to display the pixel data
77 * @param useWeights whether or not weights have been used
78 * @param show labels on the plot
79 * @param show CFZ on the plot
80 */
81 void init(QString yAxisLabel, double starUnits, bool useWeights, bool showLabels, bool showCFZ);
82
83 /**
84 * @brief show / hide labels on plot
85 * @return setting
86 */
87 void setShowLabels(bool setting);
88
89 /**
90 * @brief show / hide CFZ on plot
91 * @return setting
92 */
93 void setShowCFZ(bool setting);
94
95 private:
96 /**
97 * @brief return font size
98 * @return font size
99 */
100 int basicFontSize() const
101 {
102 return m_basicFontSize;
103 }
104
105 /**
106 * @brief set font size
107 * @param font size
108 */
109 void setBasicFontSize(int fontSize);
110
111 /**
112 * @brief Setup the axes based on the data
113 * @param tile to process
114 */
115 void setAxes(const int tile);
116
117 /**
118 * @brief Convert input measure to output display measure
119 * @param measure to convert
120 * @return converted measure
121 */
122 double getDisplayMeasure(const double measure);
123
124 QVector<int> m_positions;
125 QVector<QVector<double>> m_measures;
126
127 // Legend items for the plot
128 QCPAbstractLegendItem *m_legendItems[NUM_TILES] { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
129
130 // Text items highlighting the max / min of each curve
131 bool m_showLabels = false;
132 QCPItemText *m_labelItems[NUM_TILES] { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
133
134 // CFZ
135 bool m_showCFZ = false;
136 QCPItemBracket *m_CFZ = nullptr;
137
138 // V curves
139 QCPGraph *m_graph[NUM_TILES] { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
140 // Focus points plotted as graphs
141 QCPGraph *focusPoint[NUM_TILES] { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
142
143 // basic font size from which all others are derived
144 int m_basicFontSize = 10;
145 // Units multiplier for star measure value
146 double m_starUnits = 1.0;
147
148 // Max / Mins used to set the graph axes
149 int m_minPosition = -1;
150 int m_maxPosition = -1;
151 double m_minMeasure = -1.0;
152 double m_maxMeasure = -1.0;
153};
154
155}
The abstract base class for all entries in a QCPLegend.
A plottable representing a graph in a plot.
A bracket for referencing/highlighting certain parts in the plot.
A text label.
The central class of the library. This is the QWidget which displays the plot and interacts with the ...
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.