60 : start(s), end(e), offset(o), rect(r) {}
62 Session() : start(0), end(0), offset(0), rect(
nullptr) {}
71 bool isTemporary()
const;
80 class CaptureSession :
public Session
88 CaptureSession(
double start_,
double end_,
QCPItemRect *rect,
89 bool aborted_,
const QString &filename_,
90 double duration_,
const QString &filter_)
91 : Session(start_, end_, CAPTURE_Y, rect),
92 aborted(aborted_), filename(filename_),
93 duration(duration_), filter(filter_), hfr(0) {}
94 CaptureSession() : Session(0, 0, CAPTURE_Y,
nullptr) {}
100 G_IDLE, G_GUIDING, G_CALIBRATING, G_SUSPENDED, G_DITHERING, G_IGNORE
102 class GuideSession :
public Session
105 SimpleGuideState simpleState;
106 GuideSession(
double start_,
double end_,
QCPItemRect *rect, SimpleGuideState state_)
107 : Session(start_, end_, GUIDE_Y, rect), simpleState(state_) {}
108 GuideSession() : Session(0, 0, GUIDE_Y,
nullptr) {}
110 class AlignSession :
public Session
115 : Session(start_, end_, ALIGN_Y, rect), state(state_) {}
116 AlignSession() : Session(0, 0, ALIGN_Y,
nullptr) {}
118 class MountSession :
public Session
121 ISD::Mount::Status state;
122 MountSession(
double start_,
double end_,
QCPItemRect *rect, ISD::Mount::Status state_)
123 : Session(start_, end_, MOUNT_Y, rect), state(state_) {}
124 MountSession() : Session(0, 0, MOUNT_Y,
nullptr) {}
126 class MountFlipSession :
public Session
129 MeridianFlipState::MeridianFlipMountState state;
130 MountFlipSession(
double start_,
double end_,
QCPItemRect *rect, MeridianFlipState::MeridianFlipMountState state_)
131 : Session(start_, end_, MERIDIAN_MOUNT_FLIP_Y, rect), state(state_) {}
132 MountFlipSession() : Session(0, 0, MERIDIAN_MOUNT_FLIP_Y,
nullptr) {}
134 class SchedulerJobSession :
public Session
137 SchedulerJobSession(
double start_,
double end_,
QCPItemRect *rect,
139 : Session(start_, end_, SCHEDULER_Y, rect), jobName(jobName_), reason(reason_) {}
140 SchedulerJobSession() : Session(0, 0, SCHEDULER_Y,
nullptr) {}
144 class FocusSession :
public Session
152 AutofocusReason reason;
158 AutofocusFailReason failCode;
166 double tempTicks, altitude, altTicks;
167 int prevPosError, thisPosError, totalTicks, adaptedPosition;
170 bool standardSession =
true;
172 FocusSession() : Session(0, 0, FOCUS_Y,
nullptr) {}
173 FocusSession(
double start_,
double end_,
QCPItemRect *rect,
bool ok,
double temperature_,
175 FocusSession(
double start_,
double end_,
QCPItemRect *rect,
bool ok,
double temperature_,
176 const QString &filter_,
const AutofocusReason reason_,
const QString &reasonInfo_,
const QString &points_,
const bool useWeights_,
177 const QString &curve_,
const QString &title_,
const AutofocusFailReason failCode_,
const QString failCodeInfo_);
178 FocusSession(
double start_,
double end_,
QCPItemRect *rect,
179 const QString &filter_,
double temperature_,
double tempTicks_,
double altitude_,
180 double altTicks_,
int prevPosError,
int thisPosError,
int totalTicks_,
int position_);
181 double focusPosition();
196 return m_LogText.
join(
"\n");
204 void captureComplete(
const QVariantMap &metadata);
205 void captureStarting(
double exposureSeconds,
const QString &filter);
206 void captureAborted(
double exposureSeconds);
209 void guideState(Ekos::GuideState status);
210 void guideStats(
double raError,
double decError,
int raPulse,
int decPulse,
211 double snr,
double skyBg,
int numStars);
214 void autofocusStarting(
double temperature,
const QString &filter,
const AutofocusReason reason,
const QString &reasonInfo);
215 void autofocusComplete(
const double temperature,
const QString &filter,
const QString &points,
const bool useWeights,
217 void adaptiveFocusComplete(
const QString &filter,
double temperature,
double tempTicks,
218 double altitude,
double altTicks,
int prevPosError,
int thisPosError,
int totalTicks,
219 int position,
bool focuserMoved);
220 void autofocusAborted(
const QString &filter,
const QString &points,
const bool useWeights,
221 const AutofocusFailReason failCode,
const QString failCodeInfo);
222 void newTemperature(
double temperatureDelta,
double temperature);
228 void mountState(ISD::Mount::Status status);
229 void mountCoords(
const SkyPoint &position, ISD::Mount::PierSide pierSide,
const dms &haValue);
230 void mountFlipStatus(Ekos::MeridianFlipState::MeridianFlipMountState status);
232 void schedulerJobStarted(
const QString &jobName);
233 void schedulerJobEnded(
const QString &jobName,
const QString &endReason);
234 void newTargetDistance(
double targetDistance);
238 void userSetLeftAxis(
QCPAxis *axis);
241 void yAxisRangeChanged(
const QCPRange &newRange);
243 void appendLogText(
const QString &);
248 void newLog(
const QString &text);
256 void processCaptureStarting(
double time,
double exposureSeconds,
const QString &filter);
257 void processCaptureComplete(
double time,
const QString &filename,
double exposureSeconds,
const QString &filter,
258 double hfr,
int numStars,
int median,
double eccentricity,
bool batchMode =
false);
259 void processCaptureAborted(
double time,
double exposureSeconds,
bool batchMode =
false);
260 void processAutofocusStarting(
double time,
double temperature,
const QString &filter,
const AutofocusReason reason,
const QString &reasonInfo);
261 void processAutofocusComplete(
double time,
const QString &filter,
const QString &points,
const QString &curve,
const QString &title,
bool batchMode);
262 void processAutofocusCompleteV2(
double time,
double temperature,
const QString &filter,
const AutofocusReason reason,
const QString &reasonInfo,
263 const QString &points,
const bool useWeights,
const QString &curve,
const QString &title,
bool batchMode =
false);
264 void processAutofocusAborted(
double time,
const QString &filter,
const QString &points,
bool batchMode);
265 void processAutofocusAbortedV2(
double time,
double temperature,
const QString &filter,
const AutofocusReason reason,
const QString &reasonInfo,
266 const QString &points,
const bool useWeights,
const AutofocusFailReason failCode,
const QString failCodeInfo,
bool batchMode =
false);
267 void processAdaptiveFocusComplete(
double time,
const QString &filter,
double temperature,
double tempTicks,
268 double altitude,
double altTicks,
int prevPosError,
int thisPosError,
int totalTicks,
269 int position,
bool focuserMoved,
bool batchMode =
false);
270 void processTemperature(
double time,
double temperature,
bool batchMode =
false);
271 void processGuideState(
double time,
const QString &state,
bool batchMode =
false);
272 void processGuideStats(
double time,
double raError,
double decError,
int raPulse,
273 int decPulse,
double snr,
double skyBg,
int numStars,
bool batchMode =
false);
274 void processMountCoords(
double time,
double ra,
double dec,
double az,
double alt,
275 int pierSide,
double ha,
bool batchMode =
false);
277 void processMountState(
double time,
const QString &statusString,
bool batchMode =
false);
278 void processAlignState(
double time,
const QString &statusString,
bool batchMode =
false);
279 void processMountFlipState(
double time,
const QString &statusString,
bool batchMode =
false);
281 void processSchedulerJobStarted(
double time,
const QString &jobName);
282 void processSchedulerJobEnded(
double time,
const QString &jobName,
const QString &reason,
bool batchMode =
false);
283 void checkForMissingSchedulerJobEnd(
double time);
284 void processTargetDistance(
double time,
double targetDistance,
bool batchMode =
false);
287 void replot(
bool adjustSlider =
true);
290 void scroll(
int value);
293 void statsYZoom(
double zoomAmount);
295 void statsYZoomOut();
299 void adjustView(
double time);
306 void updateMaxX(
double time);
312 void captureSessionClicked(CaptureSession &c,
bool doubleClick);
313 void focusSessionClicked(FocusSession &c,
bool doubleClick);
314 void guideSessionClicked(GuideSession &c,
bool doubleClick);
315 void mountSessionClicked(MountSession &c,
bool doubleClick);
316 void alignSessionClicked(AlignSession &c,
bool doubleClick);
317 void mountFlipSessionClicked(MountFlipSession &c,
bool doubleClick);
318 void schedulerSessionClicked(SchedulerJobSession &c,
bool doubleClick);
327 void setVisibility();
333 void setupKeyboardShortcuts(
QWidget *plot);
338 void highlightTimelineItem(
const Session &session);
339 void unhighlightTimelineItem();
343 void changeTimelineItem(
bool next);
345 void nextTimelineItem();
346 void previousTimelineItem();
362 QCPItemRect * addSession(
double start,
double end,
double y,
363 const QBrush &brush,
const QBrush *stripeBrush =
nullptr);
369 void addTemporarySession(Session *session,
double time,
double duration,
370 int y_offset,
const QBrush &brush);
371 void removeTemporarySession(Session *session);
372 void removeTemporarySessions();
373 void adjustTemporarySession(Session *session);
374 void adjustTemporarySessions();
377 void addGuideStats(
double raDrift,
double decDrift,
int raPulse,
int decPulse,
378 double snr,
int numStars,
double skyBackground,
double time);
379 void addGuideStatsInternal(
double raDrift,
double decDrift,
double raPulse,
380 double decPulse,
double snr,
double numStars,
381 double skyBackground,
double drift,
double rms,
double time);
382 void addMountCoords(
double ra,
double dec,
double az,
double alt,
int pierSide,
383 double ha,
double time);
384 void addHFR(
double hfr,
int numCaptureStars,
int median,
double eccentricity,
385 const double time,
double startTime);
386 void addTemperature(
double temperature,
const double time);
387 void addFocusPosition(
double focusPosition,
double time);
388 void addTargetDistance(
double targetDistance,
const double time);
394 template <
typename Func>
400 void toggleGraph(
int graph_id,
bool show);
403 void initStatsPlot();
404 void initTimelinePlot();
405 void initGraphicsPlot();
406 void initInputSelection();
412 void displayGuideGraphics(
double start,
double end,
double *raRMS,
413 double *decRMS,
double *totalRMS,
int *numSamples);
416 void updateStatsValues();
418 void setStatsCursor(
double time);
419 void removeStatsCursor();
420 void keepCurrent(
int state);
423 void initStatsCheckboxes();
427 void resetGraphicsPlot();
430 void resetCaptureState();
431 void resetAutofocusState();
432 void resetGuideState();
433 void resetGuideStats();
434 void resetAlignState();
435 void resetMountState();
436 void resetMountCoords();
437 void resetMountFlipState();
438 void resetSchedulerJob();
439 void resetTemperature();
442 double readDataFromFile(
const QString &filename);
443 double processInputLine(
const QString &line);
446 void displayFITS(
const QString &filename);
455 void appendToLog(
const QString &lines);
464 double upper = YAxisInfo::UPPER_RESCALE);
468 bool restoreYAxes(
const QString &encoding);
471 void setLeftAxis(
QCPAxis *axis);
478 QCPAxis *activeYAxis {
nullptr };
484 std::map<QObject*, YAxisInfo> yAxisMap;
489 bool logInitialized {
false };
494 double plotStart { 0.0 };
495 double plotWidth { 10.0 };
496 double maxXValue { 10.0 };
501 QString analyzeTimeZone {
"" };
502 bool startTimeInitialized {
false };
511 std::unique_ptr<RmsFilter> guiderRms;
512 std::unique_ptr<RmsFilter> captureRms;
515 double yAxisInitialPos = { 0 };
526 int fitsViewerTabID { 0 };
531 double statsCursorTime { -1 };
536 QUrl displayedSession;
537 QString getNextFile(
bool after);
542 void displayFile(
const QUrl &url,
bool forceCurrentSession =
false);
546 bool runtimeDisplay {
true };
550 CaptureSession temporaryCaptureSession;
551 FocusSession temporaryFocusSession;
552 GuideSession temporaryGuideSession;
553 AlignSession temporaryAlignSession;
554 MountSession temporaryMountSession;
555 MountFlipSession temporaryMountFlipSession;
556 SchedulerJobSession temporarySchedulerJobSession;
559 double captureStartedTime { -1 };
560 double previousCaptureStartedTime { 1 };
561 double previousCaptureCompletedTime { 1 };
562 QString captureStartedFilter {
"" };
565 double autofocusStartedTime { -1 };
566 QString autofocusStartedFilter {
"" };
567 double autofocusStartedTemperature { 0 };
568 AutofocusReason autofocusStartedReason { AutofocusReason::FOCUS_NONE};
569 QString autofocusStartedReasonInfo {
"" };
572 SimpleGuideState lastGuideStateStarted { G_IDLE };
573 double guideStateStartedTime { -1 };
576 double lastGuideStatsTime { -1 };
577 double lastCaptureRmsTime { -1 };
578 int numStarsMax { 0 };
580 double skyBgMax { 0 };
582 int numCaptureStarsMax { 0 };
583 double lastTemperature { -1000 };
588 double lastAlignStateStartedTime { -1 };
591 double mountStateStartedTime { -1 };
592 ISD::Mount::Status lastMountState { ISD::Mount::Status::MOUNT_IDLE };
597 double lastMountRa { -1 };
598 double lastMountDec { -1 };
599 double lastMountHa { -1 };
600 double lastMountAz { -1 };
601 double lastMountAlt { -1 };
602 int lastMountPierSide { -1 };
605 MeridianFlipState::MeridianFlipMountState lastMountFlipStateReceived { MeridianFlipState::MOUNT_FLIP_NONE};
606 MeridianFlipState::MeridianFlipMountState lastMountFlipStateStarted { MeridianFlipState::MOUNT_FLIP_NONE };
607 double mountFlipStateStartedTime { -1 };
610 double schedulerJobStartedTime;
611 QString schedulerJobStartedJobName;
614 QBrush schedulerJobBrush(
const QString &jobName,
bool temporary);
616 void setSelectedSession(
const Session &s);
617 void clearSelectedSession();
618 Session m_selectedSession;
624 static constexpr int CAPTURE_Y = 1;
625 static constexpr int FOCUS_Y = 2;
626 static constexpr int ALIGN_Y = 3;
627 static constexpr int GUIDE_Y = 4;
628 static constexpr int MERIDIAN_MOUNT_FLIP_Y = 5;
629 static constexpr int MOUNT_Y = 6;
630 static constexpr int SCHEDULER_Y = 7;
631 static constexpr int LAST_Y = 8;