lsst.jointcal  15.0-11-gda8ddd7+1
Chi2.cc
Go to the documentation of this file.
1 /*
2  * LSST Data Management System
3  *
4  * This product includes software developed by the
5  * LSST Project (http://www.lsst.org/).
6  * See the COPYRIGHT file
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the LSST License Statement and
19  * the GNU General Public License along with this program. If not,
20  * see <https://www.lsstcorp.org/LegalNotices/>.
21  */
22 
23 #include <utility>
24 #include <iostream>
25 
26 #include "lsst/jointcal/Chi2.h"
27 
28 namespace lsst {
29 namespace jointcal {
30 
32  double sum = 0;
33  double sum2 = 0;
34  for (auto i : *this) {
35  sum += i.chi2;
36  sum2 += std::pow(i.chi2, 2);
37  }
38  double average = sum / size();
39  double sigma = sqrt(sum2 / size() - std::pow(average, 2));
40  return std::make_pair(average, sigma);
41 }
42 
44  s << "chi2 per star : ";
45  for (auto chi2 : chi2List) {
46  s << *(chi2.star) << " chi2: " << chi2.chi2 << " ; ";
47  }
48  s << std::endl;
49  return s;
50 }
51 
52 } // namespace jointcal
53 } // namespace lsst
friend std::ostream & operator<<(std::ostream &s, Chi2List const &chi2List)
Definition: Chi2.cc:43
T endl(T... args)
afw::table::Key< double > sigma
Structure to accumulate the chi2 contributions per each star (to help find outliers).
Definition: Chi2.h:77
Class for a simple mapping implementing a generic Gtransfo.
T make_pair(T... args)
Chi2Star size(Chi2Star ... args)
T pow(T... args)
T sqrt(T... args)
STL class.
std::pair< double, double > computeAverageAndSigma()
Compute the average and std-deviation of these chisq values.
Definition: Chi2.cc:31