From b0406681c37458ea1c8adc318f259c989182f54d Mon Sep 17 00:00:00 2001 From: Bruce Waddington Date: Tue, 5 Nov 2024 18:31:19 -0800 Subject: [PATCH 1/4] Cleanup of MultiStar processing and UI if subframes enabled --- src/guider_multistar.cpp | 5 +++-- src/star.cpp | 36 +++++++++++++++++++++++------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/guider_multistar.cpp b/src/guider_multistar.cpp index 075d2399a..a6a7b9684 100644 --- a/src/guider_multistar.cpp +++ b/src/guider_multistar.cpp @@ -466,7 +466,8 @@ bool GuiderMultiStar::AutoSelect(const wxRect& roi) edgeAllowance = wxMax(edgeAllowance, pSecondaryMount->CalibrationTotDistance()); GuideStar newStar; - if (!newStar.AutoFind(*image, edgeAllowance, m_searchRegion, roi, m_guideStars, MAX_LIST_SIZE)) + if (!newStar.AutoFind(*image, edgeAllowance, m_searchRegion, roi, m_guideStars, + (pCamera->UseSubframes || !m_multiStarMode) ? 1 : MAX_LIST_SIZE)) { throw ERROR_INFO("Unable to AutoFind"); } @@ -1213,7 +1214,7 @@ void GuiderMultiStar::OnPaint(wxPaintEvent& event) } // show in-use secondary stars - if (m_multiStarMode && m_guideStars.size() > 1) + if (m_multiStarMode && m_guideStars.size() > 1 && !pCamera->UseSubframes) { if (m_primaryStar.WasFound()) dc.SetPen(wxPen(wxColour(0, 255, 0), 1, wxPENSTYLE_SOLID)); diff --git a/src/star.cpp b/src/star.cpp index 7dc9275f8..472f1d967 100644 --- a/src/star.cpp +++ b/src/star.cpp @@ -1021,22 +1021,26 @@ bool GuideStar::AutoFind(const usImage& image, int extraEdgeAllowance, int searc double minSNR = pFrame->pGuider->GetAFMinStarSNR(); double maxHFD = pFrame->pGuider->GetMaxStarHFD(); foundStars.clear(); - for (std::set::reverse_iterator it = stars.rbegin(); it != stars.rend(); ++it) + if (maxStars > 1) { - GuideStar tmp; - tmp.Find(&image, searchRegion, it->x, it->y, FIND_CENTROID, pFrame->pGuider->GetMinStarHFD(), maxHFD, - pCamera->GetSaturationADU(), FIND_LOGGING_VERBOSE); - // We're repeating the find, so we're vulnerable to hot pixels and creation of unwanted duplicates - if (tmp.WasFound() && tmp.SNR >= minSNR) + for (std::set::reverse_iterator it = stars.rbegin(); it != stars.rend(); ++it) { - bool duplicate = std::find_if(foundStars.begin(), foundStars.end(), [&tmp](const GuideStar& other) - { return CloseToReference(tmp, other); }) != foundStars.end(); - - if (!duplicate) + GuideStar tmp; + tmp.Find(&image, searchRegion, it->x, it->y, FIND_CENTROID, pFrame->pGuider->GetMinStarHFD(), maxHFD, + pCamera->GetSaturationADU(), FIND_LOGGING_VERBOSE); + // We're repeating the find, so we're vulnerable to hot pixels and creation of unwanted duplicates + if (tmp.WasFound() && tmp.SNR >= minSNR) { - tmp.referencePoint.X = tmp.X; - tmp.referencePoint.Y = tmp.Y; - foundStars.push_back(tmp); + bool duplicate = + std::find_if(foundStars.begin(), foundStars.end(), + [&tmp](const GuideStar& other) { return CloseToReference(tmp, other); }) != foundStars.end(); + + if (!duplicate) + { + tmp.referencePoint.X = tmp.X; + tmp.referencePoint.Y = tmp.Y; + foundStars.push_back(tmp); + } } } } @@ -1118,6 +1122,12 @@ bool GuideStar::AutoFind(const usImage& image, int extraEdgeAllowance, int searc Debug.Write("MultiStar: primary star forcibly inserted in list\n"); } } + else + { + tmp.referencePoint.X = tmp.X; + tmp.referencePoint.Y = tmp.Y; + foundStars.push_back(tmp); + } return true; } } From 0017d773dc05cbca0ca233fb2c58b3c74e636a44 Mon Sep 17 00:00:00 2001 From: Bruce Waddington Date: Sat, 9 Nov 2024 09:58:07 -0800 Subject: [PATCH 2/4] Force rebuild of MultiStar list when subframes are disabled --- src/camera.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/camera.cpp b/src/camera.cpp index 6931eaa41..16061c4f5 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -1185,8 +1185,14 @@ void CameraConfigDialogCtrlSet::UnloadValues() if (m_pCamera->HasSubframes) { - m_pCamera->UseSubframes = m_pUseSubframes->GetValue(); - pConfig->Profile.SetBoolean("/camera/UseSubframes", m_pCamera->UseSubframes); + bool oldVal = m_pCamera->UseSubframes; + bool newVal = m_pUseSubframes->GetValue(); + m_pCamera->UseSubframes = newVal; + pConfig->Profile.SetBoolean("/camera/UseSubframes", newVal); + // MultiStar can't track secondary star locations during periods when subframes are used + if (oldVal && !newVal) + if (pFrame->pGuider->GetMultiStarMode()) + pFrame->pGuider->SetMultiStarMode(true); // Will force a refresh of secondary stars } if (m_pCamera->HasGainControl) From 4d74a8a6fdfc5b4523eb130e51627071b244f154 Mon Sep 17 00:00:00 2001 From: Bruce Waddington Date: Mon, 23 Dec 2024 13:31:43 -0800 Subject: [PATCH 3/4] Fix star.cpp clang regression --- src/star.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/star.cpp b/src/star.cpp index 472f1d967..d7aa5bec5 100644 --- a/src/star.cpp +++ b/src/star.cpp @@ -1031,9 +1031,8 @@ bool GuideStar::AutoFind(const usImage& image, int extraEdgeAllowance, int searc // We're repeating the find, so we're vulnerable to hot pixels and creation of unwanted duplicates if (tmp.WasFound() && tmp.SNR >= minSNR) { - bool duplicate = - std::find_if(foundStars.begin(), foundStars.end(), - [&tmp](const GuideStar& other) { return CloseToReference(tmp, other); }) != foundStars.end(); + bool duplicate = std::find_if(foundStars.begin(), foundStars.end(), [&tmp](const GuideStar& other) + { return CloseToReference(tmp, other); }) != foundStars.end(); if (!duplicate) { From 6abfb6bf2dd31b5c5d1b243810bccecd0516415b Mon Sep 17 00:00:00 2001 From: bwdev01 Date: Tue, 7 Jan 2025 13:31:13 -0800 Subject: [PATCH 4/4] Help and tooltip changes for Dev6 release --- help/Darks_BadPixel_Maps.htm | 43 ++++++++++++++++++++++++++++++------ src/darks_dialog.cpp | 8 +++++++ src/scope.cpp | 3 ++- 3 files changed, 46 insertions(+), 8 deletions(-) diff --git a/help/Darks_BadPixel_Maps.htm b/help/Darks_BadPixel_Maps.htm index 1f75ab62c..8935d3261 100644 --- a/help/Darks_BadPixel_Maps.htm +++ b/help/Darks_BadPixel_Maps.htm @@ -2,16 +2,45 @@ Darks_BadPixel_Maps

Dark Frames and Bad-pixel Maps


Introduction

Cameras used for guiding are typically not temperature-regulated and may -produce images that appear quite noisy.  As a result, guide +produce images that appear quite noisy. This is particularly +true of older CCD-based guide cameras.  As a result, guide exposures frequently show obvious defects in the form of  hot -(or "warm") pixels or regions with spurious brightness levels.  If +(or "warm") pixels or regions with spurious brightness levels. + For convenience, we refer to these areas of sensor noise as "hot +pixels" but they may be larger than 1 pixel in size and have arbitrary +brightness levels.  If there are too many of these defects, PHD2 may have trouble identifying -and selecting guide stars.  Even after guiding has begun, a -spurious hot pixel close to the guide star can disrupt the calculations -needed for smooth guiding and may cause the software to "jump" between +and selecting guide stars.  This is especially true when sky +conditions are poor and there are few or even zero actual guide stars +available. The "MinHFD" and "MaxHFD" settings provide the best defense +against mistaking sensor noise for stars, but a dark library or +bad-pixel map provides an extra level of protection.  Even after +guiding has begun, a +spurious hot pixel close to the guide star can disrupt the calculation +of the guide star position and may cause the guiding  to "jump" +between the real star and the hot pixel.  These sorts of problems can be -mitigated by using either of two approaches in PHD2: dark frames and -bad pixel maps.  All functions related to dark frames and bad-pixel maps are located under the top-level 'Darks' menu.

  

Dark Frames

PHD2 will +mitigated by using either of two approaches in PHD2: dark frames or +bad pixel maps.  All functions related to dark frames and +bad-pixel maps are located under the top-level 'Darks' menu.

Since +the dark libraries and bad pixel maps rely on raw ADU values returned +by the camera driver, they are implicitly dependent on camera +settings that affect these ADU levels.  These include the camera +bit-depth and the camera gain.  Bit-depth is the term used to +indicate whether the driver returns image data in 8-bit or 16-bit +format.  Even though some camera electronics may use 10, 12, or +14-bit values internally, the image data will be scaled and delivered +to PHD2 as 16-bit data. Many cameras operate in only one bit-depth +mode, in which case you don't need to think about it.  But some +guide cameras support either mode and you will need to choose or +at least be aware of which mode is active before building a dark +library or a bad-pixel map.  If you subsequently change bit-depth +settings, you will need to repeat the process of building them. + The camera gain setting is a bit different in that it scales +the ADU levels in an arbitrary way.  Small changes in gain are +unlikely to have much effect on the dark library/bad-pix map data but +large changes will invalidate them.  For this reason, we +discourage people from making frequent adjustments to the camera gain.

  

Dark Frames

PHD2 will build and use a library of dark frames that match the range of exposures you use for guiding.  Once the library is built, it will be saved automatically and will be available for use across multiple diff --git a/src/darks_dialog.cpp b/src/darks_dialog.cpp index 69bf61daa..7e993ca0b 100644 --- a/src/darks_dialog.cpp +++ b/src/darks_dialog.cpp @@ -207,6 +207,14 @@ DarksDialog::DarksDialog(wxWindow *parent, bool darkLib) pvSizer->Add(phSizer, wxSizerFlags().Border(wxALL, 5)); pvSizer->Add(m_pProgress, wxSizerFlags().Border(wxLEFT, 60)); + wxStaticText *bppWarning = + new wxStaticText(this, wxID_ANY, _("Be sure camera bit-depth is already set to desired value (8-bit or 16-bit)"), + wxPoint(-1, -1), wxSize(-1, -1)); + wxFont font = bppWarning->GetFont(); + font.SetWeight(wxFONTWEIGHT_BOLD); + bppWarning->SetFont(font); + pvSizer->Add(bppWarning, wxSizerFlags().Center().Border(wxALL, 4)); + // Buttons wxBoxSizer *pButtonSizer = new wxBoxSizer(wxHORIZONTAL); m_pResetBtn = new wxButton(this, wxID_ANY, _("Reset")); diff --git a/src/scope.cpp b/src/scope.cpp index 816bea3f2..e6b041ac3 100644 --- a/src/scope.cpp +++ b/src/scope.cpp @@ -2088,7 +2088,8 @@ ScopeConfigDialogCtrlSet::ScopeConfigDialogCtrlSet(wxWindow *pParent, Scope *pSc wxDefaultPosition, wxSize(width, -1), wxSP_ARROW_KEYS, MAX_DURATION_MIN, MAX_DURATION_MAX, 150, _T("MaxDec_Dur")); AddLabeledCtrl(CtrlMap, AD_szMaxDecAmt, _("Max Dec duration"), m_pMaxDecDuration, - _("Longest length of pulse to send in declination\nDefault = 2500 ms. Increase if drift is fast.")); + _("Longest length of pulse to send in declination\nDefault = 2500 ms. NOTE: this will be ignored if " + "backlash compensation is enabled")); wxString dec_choices[] = { Scope::DecGuideModeLocaleStr(DEC_NONE),