From 0d4f7df6ca8b671ec1d207ced5eaf93cc5eb7da5 Mon Sep 17 00:00:00 2001 From: gehelem Date: Tue, 10 Dec 2024 13:46:56 +0100 Subject: [PATCH 1/2] add this to allow stats calculations when fits is loaded from file --- libs/fileio.cpp | 2 +- libs/fileio.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libs/fileio.cpp b/libs/fileio.cpp index c9748c9a..41bad9b9 100644 --- a/libs/fileio.cpp +++ b/libs/fileio.cpp @@ -171,7 +171,7 @@ bool fileio::loadFits(QString fileName) debayer(); getSolverOptionsFromFITS(); - + CalcStats(127); parseHeader(); } diff --git a/libs/fileio.h b/libs/fileio.h index 3a208d08..ab060dee 100644 --- a/libs/fileio.h +++ b/libs/fileio.h @@ -104,6 +104,7 @@ class fileio : public QObject return m_HistogramFrequency[channel]; } OST::ImgData ImgStats(); + void generateQImage(); private: QString file; @@ -121,7 +122,6 @@ class fileio : public QObject QImage rawImage; void CalcStats(int size); - void generateQImage(); template QPair getParitionMinMax(uint32_t start, uint32_t stride); From 0ddc35ba559be854591745f6be984a442a95cb75 Mon Sep 17 00:00:00 2001 From: gehelem Date: Tue, 10 Dec 2024 13:47:17 +0100 Subject: [PATCH 2/2] Add theta stats --- libs/solver.cpp | 36 ++++++++++++++++++++++++++++++++++++ libs/solver.h | 5 +++++ 2 files changed, 41 insertions(+) diff --git a/libs/solver.cpp b/libs/solver.cpp index 1317837f..a2260248 100644 --- a/libs/solver.cpp +++ b/libs/solver.cpp @@ -19,11 +19,21 @@ void Solver::ResetSolver(FITSImage::Statistic &stats, uint8_t *m_ImageBuffer) HFRavg = 99; HFRavgZone.clear(); + thetaAvgZone.clear(); + thetaDevAvgZone.clear(); + aAxeAvgZone.clear(); + bAxeAvgZone.clear(); + eAxeAvgZone.clear(); HFRavgCount.clear(); for (int i = 0; i < HFRZones * HFRZones; i++ ) { HFRavgCount.append(0); HFRavgZone.append(99); + thetaAvgZone.append(99); + thetaDevAvgZone.append(99); + aAxeAvgZone.append(99); + bAxeAvgZone.append(99); + eAxeAvgZone.append(99); } //delete stellarSolver; stellarSolver.loadNewImageBuffer(stats, m_ImageBuffer); @@ -143,8 +153,34 @@ void Solver::ssReadySEP() int starLine = HFRZones * stars[i].y / mImgHeight; int zone = starLine * HFRZones + starColumn; HFRavgZone[zone] = (HFRavgCount[zone] * HFRavgZone[zone] + stars[i].HFR) / (HFRavgCount[zone] + 1); + thetaAvgZone[zone] = (HFRavgCount[zone] * thetaAvgZone[zone] + stars[i].theta) / (HFRavgCount[zone] + 1); + aAxeAvgZone[zone] = (HFRavgCount[zone] * aAxeAvgZone[zone] + stars[i].a) / (HFRavgCount[zone] + 1); + bAxeAvgZone[zone] = (HFRavgCount[zone] * bAxeAvgZone[zone] + stars[i].b) / (HFRavgCount[zone] + 1); + eAxeAvgZone[zone] = aAxeAvgZone[zone] / bAxeAvgZone[zone]; HFRavgCount[zone]++; } + //theta dev + HFRavgCount.clear(); + for (int i = 0; i < HFRZones * HFRZones; i++ ) + { + HFRavgCount.append(0); + } + for (int i = 0; i < stars.size(); i++) + { + int starColumn = HFRZones * stars[i].x / mImgWidth; + int starLine = HFRZones * stars[i].y / mImgHeight; + int zone = starLine * HFRZones + starColumn; + + thetaDevAvgZone[zone] = (HFRavgCount[zone] * thetaDevAvgZone[zone] + (stars[i].theta - thetaAvgZone[zone]) * + (stars[i].theta - thetaAvgZone[zone])) / + (HFRavgCount[zone] + 1); + + HFRavgCount[zone]++; + } + for (int i = 0; i < HFRZones * HFRZones; i++ ) + { + thetaDevAvgZone[i] = sqrt(thetaDevAvgZone[i]); + } //sendMessage( "SSolver Ready : HFRavg = " + QString::number(HFRavg)); disconnect(&stellarSolver, &StellarSolver::ready, this, &Solver::ssReadySEP); emit successSEP(); diff --git a/libs/solver.h b/libs/solver.h index 662ad636..2574462d 100644 --- a/libs/solver.h +++ b/libs/solver.h @@ -25,6 +25,11 @@ class Solver : public QObject int HFRZones = 1; /* default 1 : 1x1 - 2: 2x2 - 3: 3x3 ... */ QList HFRavgZone; QList HFRavgCount; + QList thetaAvgZone; + QList thetaDevAvgZone; // theta deviation + QList aAxeAvgZone; + QList bAxeAvgZone; + QList eAxeAvgZone; // a/b void ResetSolver(FITSImage::Statistic &stats, uint8_t *m_ImageBuffer); void ResetSolver(FITSImage::Statistic &stats, uint8_t *m_ImageBuffer, int zones); void FindStars(Parameters param);