PCL
FluxCalibrationData.h
Go to the documentation of this file.
1 // ____ ______ __
2 // / __ \ / ____// /
3 // / /_/ // / / /
4 // / ____// /___ / /___ PixInsight Class Library
5 // /_/ \____//_____/ PCL 2.8.4
6 // ----------------------------------------------------------------------------
7 // pcl/FluxCalibrationData.h - Released 2024-12-23T11:32:56Z
8 // ----------------------------------------------------------------------------
9 // This file is part of the PixInsight Class Library (PCL).
10 // PCL is a multiplatform C++ framework for development of PixInsight modules.
11 //
12 // Copyright (c) 2003-2024 Pleiades Astrophoto S.L. All Rights Reserved.
13 //
14 // Redistribution and use in both source and binary forms, with or without
15 // modification, is permitted provided that the following conditions are met:
16 //
17 // 1. All redistributions of source code must retain the above copyright
18 // notice, this list of conditions and the following disclaimer.
19 //
20 // 2. All redistributions in binary form must reproduce the above copyright
21 // notice, this list of conditions and the following disclaimer in the
22 // documentation and/or other materials provided with the distribution.
23 //
24 // 3. Neither the names "PixInsight" and "Pleiades Astrophoto", nor the names
25 // of their contributors, may be used to endorse or promote products derived
26 // from this software without specific prior written permission. For written
27 // permission, please contact info@pixinsight.com.
28 //
29 // 4. All products derived from this software, in any form whatsoever, must
30 // reproduce the following acknowledgment in the end-user documentation
31 // and/or other materials provided with the product:
32 //
33 // "This product is based on software from the PixInsight project, developed
34 // by Pleiades Astrophoto and its contributors (https://pixinsight.com/)."
35 //
36 // Alternatively, if that is where third-party acknowledgments normally
37 // appear, this acknowledgment must be reproduced in the product itself.
38 //
39 // THIS SOFTWARE IS PROVIDED BY PLEIADES ASTROPHOTO AND ITS CONTRIBUTORS
40 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
41 // TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PLEIADES ASTROPHOTO OR ITS
43 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
44 // EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, BUSINESS
45 // INTERRUPTION; PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; AND LOSS OF USE,
46 // DATA OR PROFITS) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
47 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
49 // POSSIBILITY OF SUCH DAMAGE.
50 // ----------------------------------------------------------------------------
51 
52 #ifndef __PCL_FluxCalibrationData_h
53 #define __PCL_FluxCalibrationData_h
54 
56 
57 #include <pcl/Defs.h>
58 
59 #include <pcl/File.h>
60 #include <pcl/TimePoint.h>
61 #include <pcl/Vector.h>
62 
63 /*
64  * Normalization factor applied to all SPFC flux samples. This allows us to
65  * generate scale factors within manageable ranges for typical deep-sky images,
66  * i.e., in [100,0.001] instead of [1e-7,1e-12], for example.
67  */
68 #define __PCL_SPFC_NORMALIZATION_FACTOR 1.0e+08
69 
70 namespace pcl
71 {
72 
73 // ----------------------------------------------------------------------------
74 
75 class PCL_CLASS XMLDocument;
76 class PCL_CLASS XMLElement;
77 
99 class PCL_CLASS FluxCalibrationData
100 {
101 public:
102 
106  FluxCalibrationData() = default;
107 
112 
117 
130  FluxCalibrationData( const String& filePath )
131  {
132  Parse( filePath );
133  }
134 
148  {
149  Parse( xml );
150  }
151 
163  FluxCalibrationData( const XMLElement& element )
164  {
165  Parse( element );
166  }
167 
172  {
173  }
174 
178  FluxCalibrationData& operator =( const FluxCalibrationData& ) = default;
179 
183  FluxCalibrationData& operator =( FluxCalibrationData&& ) = default;
184 
195  const String& TargetFilePath() const
196  {
197  return m_targetFilePath;
198  }
199 
206  void SetTargetFilePath( const String& filePath )
207  {
208  m_targetFilePath = File::FullPath( filePath );
209  }
210 
220  const DVector& FluxScaleFactors() const
221  {
222  return m_fluxScaleFactors;
223  }
224 
231  void SetFluxScaleFactors( const DVector& v )
232  {
233  m_fluxScaleFactors = v;
234  }
235 
245  const DVector& FluxScaleSigmas() const
246  {
247  return m_fluxScaleSigmas;
248  }
249 
256  void SetFluxScaleSigmas( const DVector& v )
257  {
258  m_fluxScaleSigmas = v;
259  }
260 
276  const FVector& MeanFWHMx() const
277  {
278  return m_fwhmx;
279  }
280 
288  void SetMeanFWHMx( const FVector& v )
289  {
290  m_fwhmx = v;
291  }
292 
308  const FVector& MeanFWHMy() const
309  {
310  return m_fwhmy;
311  }
312 
320  void SetMeanFWHMy( const FVector& v )
321  {
322  m_fwhmy = v;
323  }
324 
340  const IVector& StarCounts() const
341  {
342  return m_counts;
343  }
344 
351  void SetStarCounts( const IVector& v )
352  {
353  m_counts = v;
354  }
355 
371  {
372  return m_normalizationFactor;
373  }
374 
386  {
387  PCL_PRECONDITION( k > 0 )
388  m_normalizationFactor = k;
389  }
390 
401  uint32 Version() const
402  {
403  return m_version;
404  }
405 
411  void SetVersion( uint32 v )
412  {
413  m_version = v;
414  }
415 
421  {
422  return m_creationTime;
423  }
424 
429  void Clear();
430 
444  void Parse( const String& filePath );
445 
460  void Parse( const XMLDocument& xml );
461 
475  void Parse( const XMLElement& element );
476 
485 
494  void SerializeToFile( const String& path ) const;
495 
496 private:
497 
498  String m_targetFilePath;
499  Vector m_fluxScaleFactors;
500  Vector m_fluxScaleSigmas;
501  FVector m_fwhmx;
502  FVector m_fwhmy;
503  IVector m_counts;
504  double m_normalizationFactor = __PCL_SPFC_NORMALIZATION_FACTOR;
505  uint32 m_version;
506  TimePoint m_creationTime;
507 
508  friend class FluxCalibrationDataPrivate;
509 };
510 
511 // ----------------------------------------------------------------------------
512 
513 } // pcl
514 
515 #endif // __PCL_FluxCalibrationData_h
516 
517 // ----------------------------------------------------------------------------
518 // EOF pcl/FluxCalibrationData.h - Released 2024-12-23T11:32:56Z
static String FullPath(const String &path)
Flux calibration data parser and generator.
void Parse(const String &filePath)
TimePoint CreationTime() const
void SetFluxScaleSigmas(const DVector &v)
void SetStarCounts(const IVector &v)
void SerializeToFile(const String &path) const
const FVector & MeanFWHMy() const
const String & TargetFilePath() const
XMLDocument * Serialize() const
void Parse(const XMLDocument &xml)
void Parse(const XMLElement &element)
double ScaleNormalizationFactor() const
const DVector & FluxScaleFactors() const
FluxCalibrationData(FluxCalibrationData &&)=default
const IVector & StarCounts() const
void SetMeanFWHMy(const FVector &v)
FluxCalibrationData(const XMLDocument &xml)
FluxCalibrationData(const FluxCalibrationData &)=default
void SetMeanFWHMx(const FVector &v)
FluxCalibrationData(const String &filePath)
void SetTargetFilePath(const String &filePath)
FluxCalibrationData(const XMLElement &element)
const DVector & FluxScaleSigmas() const
void SetScaleNormalizationFactor(double k)
const FVector & MeanFWHMx() const
void SetFluxScaleFactors(const DVector &v)
Generic vector of arbitrary length.
Definition: Vector.h:107
Unicode (UTF-16) string.
Definition: String.h:8146
An instant in any timescale.
Definition: TimePoint.h:103
XML document parsing and generation
Definition: XML.h:2745
XML element
Definition: XML.h:1177
unsigned int uint32
Definition: Defs.h:666
PCL root namespace.
Definition: AbstractImage.h:77