Skip to content

Commit

Permalink
Merge pull request #154 from gehelem/153-zoning-add-stars-deformation…
Browse files Browse the repository at this point in the history
…s-stats

153 zoning add stars deformations stats
  • Loading branch information
gehelem authored Dec 10, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 65afe7d + 0ddc35b commit 082b80e
Showing 4 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion libs/fileio.cpp
Original file line number Diff line number Diff line change
@@ -171,7 +171,7 @@ bool fileio::loadFits(QString fileName)
debayer();

getSolverOptionsFromFITS();

CalcStats(127);
parseHeader();
}

2 changes: 1 addition & 1 deletion libs/fileio.h
Original file line number Diff line number Diff line change
@@ -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 <typename T>
QPair<T, T> getParitionMinMax(uint32_t start, uint32_t stride);
36 changes: 36 additions & 0 deletions libs/solver.cpp
Original file line number Diff line number Diff line change
@@ -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();
5 changes: 5 additions & 0 deletions libs/solver.h
Original file line number Diff line number Diff line change
@@ -25,6 +25,11 @@ class Solver : public QObject
int HFRZones = 1; /* default 1 : 1x1 - 2: 2x2 - 3: 3x3 ... */
QList<float> HFRavgZone;
QList<int> HFRavgCount;
QList<float> thetaAvgZone;
QList<float> thetaDevAvgZone; // theta deviation
QList<float> aAxeAvgZone;
QList<float> bAxeAvgZone;
QList<float> 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);

0 comments on commit 082b80e

Please sign in to comment.