Calculate correct FWHM statistic and draw circles at 1/20 of max
This commit is contained in:
+7
-1
@@ -49,7 +49,7 @@ void drawStars(QImage &img, const std::vector<Star> &stars)
|
|||||||
painter.setPen(Qt::red);
|
painter.setPen(Qt::red);
|
||||||
for(auto star : stars)
|
for(auto star : stars)
|
||||||
{
|
{
|
||||||
painter.drawEllipse(QPointF(star.m_x, star.m_y), star.m_sx, star.m_sy);
|
painter.drawEllipse(QPointF(star.m_x, star.m_y), star.hw20X(), star.hw20Y());
|
||||||
}
|
}
|
||||||
img = pix.toImage();
|
img = pix.toImage();
|
||||||
}
|
}
|
||||||
@@ -319,6 +319,8 @@ void LoadRunable::run()
|
|||||||
|
|
||||||
if(m_analyzeLevel>= Stars)
|
if(m_analyzeLevel>= Stars)
|
||||||
{
|
{
|
||||||
|
double fwhmX = 0;
|
||||||
|
double fwhmY = 0;
|
||||||
const int radius = 13;
|
const int radius = 13;
|
||||||
StarFit starFit(radius);
|
StarFit starFit(radius);
|
||||||
std::vector<Star> stars;
|
std::vector<Star> stars;
|
||||||
@@ -335,10 +337,14 @@ void LoadRunable::run()
|
|||||||
//printStarModel(radius, r, star);
|
//printStarModel(radius, r, star);
|
||||||
star.m_x += x;
|
star.m_x += x;
|
||||||
star.m_y += y;
|
star.m_y += y;
|
||||||
|
fwhmX += star.fwhmX();
|
||||||
|
fwhmY += star.fwhmY();
|
||||||
stars.push_back(star);
|
stars.push_back(star);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
drawStars(img, stars);
|
drawStars(img, stars);
|
||||||
|
info.append(StringPair(QObject::tr("FWHM X"), QString::number(fwhmX/stars.size())));
|
||||||
|
info.append(StringPair(QObject::tr("FWHM Y"), QString::number(fwhmY/stars.size())));
|
||||||
}
|
}
|
||||||
qDebug() << "Star fit" << timer.restart();
|
qDebug() << "Star fit" << timer.restart();
|
||||||
}
|
}
|
||||||
|
|||||||
+38
@@ -182,6 +182,44 @@ bool Star::valid() const
|
|||||||
return !isnan(m_am);
|
return !isnan(m_am);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//half width at half maximum = sqrt(2*ln(2))
|
||||||
|
double Star::hwhmX() const
|
||||||
|
{
|
||||||
|
return 1.177410023*m_sx;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Star::hwhmY() const
|
||||||
|
{
|
||||||
|
return 1.177410023*m_sy;
|
||||||
|
}
|
||||||
|
|
||||||
|
// half width at 1/20 maximum
|
||||||
|
double Star::hw20X() const
|
||||||
|
{
|
||||||
|
return 2.447746831*m_sx;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Star::hw20Y() const
|
||||||
|
{
|
||||||
|
return 2.447746831*m_sy;
|
||||||
|
}
|
||||||
|
|
||||||
|
// full width at half maximum
|
||||||
|
double Star::fwhmX() const
|
||||||
|
{
|
||||||
|
return 2.354820045*m_sx;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Star::fwhmY() const
|
||||||
|
{
|
||||||
|
return 2.354820045*m_sy;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Star::operator<(const Star &d) const
|
||||||
|
{
|
||||||
|
return m_am < d.m_am;
|
||||||
|
}
|
||||||
|
|
||||||
StarFit::StarFit(int size)
|
StarFit::StarFit(int size)
|
||||||
{
|
{
|
||||||
m_size = size;
|
m_size = size;
|
||||||
|
|||||||
@@ -14,6 +14,13 @@ struct Star
|
|||||||
double m_theta;
|
double m_theta;
|
||||||
Star();
|
Star();
|
||||||
bool valid() const;
|
bool valid() const;
|
||||||
|
double hwhmX() const;
|
||||||
|
double hwhmY() const;
|
||||||
|
double hw20X() const;
|
||||||
|
double hw20Y() const;
|
||||||
|
double fwhmX() const;
|
||||||
|
double fwhmY() const;
|
||||||
|
bool operator<(const Star &d) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class StarFit
|
class StarFit
|
||||||
|
|||||||
Reference in New Issue
Block a user