summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJasem Mutlaq <[email protected]>2017-03-20 08:34:50 +0300
committerJasem Mutlaq <[email protected]>2017-03-20 08:34:50 +0300
commit390c59f8f14b2928e5c69c073ceaad1d593d4b67 (patch)
treef06f864a5e6285999cae4b6dd36a42d917c19b4f
parent7b79d868d70a7492c11029b90d91974bbf3a5693 (diff)
Add more debug logging to flat ADU calculations
-rw-r--r--kstars/ekos/capture/capture.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/kstars/ekos/capture/capture.cpp b/kstars/ekos/capture/capture.cpp
index 99209bf..287f993 100644
--- a/kstars/ekos/capture/capture.cpp
+++ b/kstars/ekos/capture/capture.cpp
@@ -3432,6 +3432,9 @@ double Capture::setCurrentADU(double value)
ExpRaw.append(activeJob->getExposure());
ADURaw.append(value);
+ if (Options::captureLogging())
+ qDebug() << "Capture: Current ADU = " << value << " targetADU = " << targetADU << " Exposure Count: " << ExpRaw.count();
+
// Most CCDs are quite linear so 1st degree polynomial is quite sufficient
// But DSLRs can exhibit non-linear response curve and so a 2nd degree polynomial is more appropiate
if (ExpRaw.count() >= 2)
@@ -3441,14 +3444,25 @@ double Capture::setCurrentADU(double value)
// But it _could_ also fail for 3 or more points as well and as a precaution we will fall back
// to llsq in both cases.
coeff = gsl_polynomial_fit(ADURaw.data(), ExpRaw.data(), ExpRaw.count(), 2, chisq);
+ if (Options::captureLogging())
+ {
+ qDebug() << "Capture: Running polynomial fitting. Found " << coeff.size() << " coefficients.";
+ for (size_t i=0; i < coeff.size(); i++)
+ qDebug() << "Capture: Coeff #" << i << "=" << coeff[i];
+ }
+
if (coeff.size() == 3)
{
// If we get invalid data, let's fall back to llsq
if (std::isnan(coeff[0]) || std::isinf(coeff[0]))
{
+
double a=0, b=0;
llsq(ExpRaw, ADURaw, a, b);
+ if (Options::captureLogging())
+ qDebug() << "Capture: polynomial fitting invalid, faling back to llsq. a=" << a << " b=" << b;
+
// If we have valid results, let's calculate next exposure
if (a != 0)
nextExposure = (targetADU - b) / a;
@@ -3466,7 +3480,8 @@ double Capture::setCurrentADU(double value)
nextExposure = activeJob->getExposure()*.75;
}
- //qDebug() << "Next Exposure: " << nextExposure;
+ if (Options::captureLogging())
+ qDebug() << "Capture: next FLAT exposure is " << nextExposure;
return nextExposure;
}