File indexing completed on 2024-03-24 03:46:42
0001 /* 0002 SPDX-FileCopyrightText: 2004 Jasem Mutlaq 0003 SPDX-FileCopyrightText: 2020 Eric Dejouhanet <eric.dejouhanet@gmail.com> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 0007 Some code fragments were adapted from Peter Kirchgessner's FITS plugin 0008 SPDX-FileCopyrightText: Peter Kirchgessner <http://members.aol.com/pkirchg> 0009 */ 0010 0011 #pragma once 0012 0013 class SkyBackground 0014 { 0015 public: 0016 // Must call initialize() if using the default constructor; 0017 SkyBackground() {} 0018 SkyBackground(double m, double sig, double np); 0019 virtual ~SkyBackground() = default; 0020 0021 // Mean of the background level (ADUs). 0022 double mean {0}; 0023 // Standard deviation of the background level. 0024 double sigma {0}; 0025 // Number of pixels used to estimate the background level. 0026 int numPixelsInSkyEstimate {0}; 0027 0028 // Number of stars detected in the sky. A relative measure of sky quality 0029 // (compared with the same part of the sky at a different time). 0030 int starsDetected {0}; 0031 0032 // Given a source with flux spread over numPixels, and a CCD with gain = ADU/#electron) 0033 // returns an SNR estimate. 0034 double SNR(double flux, double numPixels, double gain = 0.5) const; 0035 void initialize(double mean_, double sigma_, double numPixelsInSkyEstimate_, int numStars_ = 0); 0036 void setStarsDetected(int numStars) 0037 { 0038 starsDetected = numStars; 0039 } 0040 0041 private: 0042 double varSky = 0; 0043 }; 0044