LSSTApplications  10.0+286,10.0+36,10.0+46,10.0-2-g4f67435,10.1+152,10.1+37,11.0,11.0+1,11.0-1-g47edd16,11.0-1-g60db491,11.0-1-g7418c06,11.0-2-g04d2804,11.0-2-g68503cd,11.0-2-g818369d,11.0-2-gb8b8ce7
LSSTDataManagementBasePackage
SizeMagnitudeStarSelectorAlgo.h
Go to the documentation of this file.
1 #ifndef MeasAlgoShapeletSizeMagnitudeStarSelectorAlgo_H
2 #define MeasAlgoShapeletSizeMagnitudeStarSelectorAlgo_H
3 
4 #include <vector>
5 #include <stdexcept>
9 
10 namespace lsst {
11 namespace meas {
12 namespace algorithms {
13 namespace shapelet {
14 
16  public std::runtime_error
17  {
18  public:
19  SizeMagnitudeStarSelectorException(const std::string& m) : std::runtime_error(m) {};
20  };
21 
23  {
24  public :
25  SizeMagnitudeStarSelectorAlgo(const ConfigFile& params, std::string keyPrefix);
26 
27  std::vector<PotentialStar*> findStars(
28  std::vector<PotentialStar*>& allObj);
29 
30  void findMinMax(
31  const std::vector<PotentialStar*>& list,
32  double *min, double *max, const Function2D& f);
33 
34  void rejectOutliers(
35  std::vector<PotentialStar*>& list,
36  double nSigma, double minSigma, const Function2D& f);
37 
38  std::vector<PotentialStar*> getPeakList(
39  const std::vector<PotentialStar*>& objList,
40  double binSize, double minSize, double maxSize,
41  int nStart, int minIter, double magStep, double maxSignifRatio,
42  bool isFirstPass, const Function2D& f);
43 
44  void fitStellarSizes(
45  Function2D *f, int order, double sigClip,
46  const std::vector<PotentialStar*>& starList, double *outSigma);
47 
49  const std::vector<PotentialStar*>& objList,
50  Function2D *f,double *outSigma);
51 
52  void setParams(
53  const ConfigFile& params, std::string keyPrefix,
54  bool mustExist=false);
55 
56  bool isOkSize(const double size)
57  { return size >= _minSize && size <= _maxSize; }
58 
59  bool isOkMag(const double mag)
60  { return mag >= _minMag && mag <= _maxMag; }
61 
62  bool isOkOutputMag(const double mag)
63  { return mag >= _minMag && mag <= _maxOutMag; }
64 
65  double convertToLogSize(const double size)
66  { return _isSizeLog ? size : std::log(size); }
67 
68  double getMinSize() const { return _minSize; }
69  double getMaxSize() const { return _maxSize; }
70  double getMinMag() const { return _minMag; }
71  double getMaxMag() const { return _maxMag; }
72 
73  private :
74 
75  double _minSize; // The min and max size to consider
76  double _maxSize;
77  bool _isSizeLog; // true if sizes are already log(size)
78  double _minMag; // The min and max magnitude to consider
79  double _maxMag;
80  double _maxOutMag;
81  int _nDivX; // Divide the image into nx by ny subsections
82  int _nDivY;
83 
84  // Parameters when finding stars in each subdivision
85  double _nStart1; // # objects to start with on first pass
86  double _starFrac; // Of these, how many are probably stars?
87  double _magStep1; // Step size in mag for each successive pass
88  double _reject1; // nsigma rejection. (actually n x quartile size)
89  double _maxRatio1; // max ratio of count in valley / count in peak
90  double _binSize1; // binsize of histogram
91  int _okValCount; // if valley count <= this, ok no matter what peak is
92  int _minIter1; // min number of mag steps to take
93  double _maxRms; // in initial linear fit, max rms to allow
94 
95  // Parameters for last pass of whole image
96  double _nStart2; // # objects to start with
97  double _magStep2; // Step size in mag
98  double _minBinSize; // Min width of histogram bins
99  double _reject2; // n quartile rejection
100  double _purityRatio; // max ratio of count in valley / count in peak
101  int _minIter2; // min number of mag steps to take
102 
103  // Parameters for fitting results of subsections
104  int _starsPerBin; // How many stars per subsection?
105  int _fitOrder; // order of fit for size(x,y)
106  double _fitSigClip; // nsigma rejection in this fit
107  int _maxRefitIter; // max number of times to refit whole image
108 
109  bool _shouldOutputDesQa; // Output warnings in DES QA format
110 
111  };
112 
113 }}}}
114 #endif
void setParams(const ConfigFile &params, std::string keyPrefix, bool mustExist=false)
void fitStellarSizes(Function2D *f, int order, double sigClip, const std::vector< PotentialStar * > &starList, double *outSigma)
std::vector< PotentialStar * > findStars(std::vector< PotentialStar * > &allObj)
SizeMagnitudeStarSelectorAlgo(const ConfigFile &params, std::string keyPrefix)
std::vector< PotentialStar * > getPeakList(const std::vector< PotentialStar * > &objList, double binSize, double minSize, double maxSize, int nStart, int minIter, double magStep, double maxSignifRatio, bool isFirstPass, const Function2D &f)
void rejectOutliers(std::vector< PotentialStar * > &list, double nSigma, double minSigma, const Function2D &f)
def log
Definition: log.py:85
tuple m
Definition: lsstimport.py:48
void roughlyFitBrightStars(const std::vector< PotentialStar * > &objList, Function2D *f, double *outSigma)
void findMinMax(const std::vector< PotentialStar * > &list, double *min, double *max, const Function2D &f)