CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
Measure.h
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2010 by Federico Marulli *
3  * federico.marulli3@unibo.it *
4  * *
5  * This program is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU General Public License as *
7  * published by the Free Software Foundation; either version 2 of *
8  * the License, or (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public *
16  * License along with this program; if not, write to the Free *
17  * Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ********************************************************************/
20 
34 #ifndef __MEASURE__
35 #define __MEASURE__
36 
37 
38 #include "Catalogue.h"
39 
40 
41 // ===================================================================================================
42 
43 
44 namespace cbl {
45 
53  namespace measure {
54 
59  enum class ErrorType {
60 
62  _Poisson_,
63 
66 
69 
72 
75 
78 
81 
83  _None_
84  };
85 
92  inline std::vector<std::string> ErrorTypeNames ()
93  { return {"Poisson", "Jackknife", "Bootstrap", "JackknifeTest", "BootstrapTest", "JackknifeObject", "BootstrapObject", "None"}; }
94 
102  inline ErrorType ErrorTypeCast (const int errorTypeIndex)
103  { return castFromValue<ErrorType>(errorTypeIndex); }
104 
111  inline ErrorType ErrorTypeCast (const std::string errorTypeName)
112  { return castFromName<ErrorType>(errorTypeName, ErrorTypeNames()); }
113 
120  inline std::vector<ErrorType> ErrorTypeCast (const std::vector<int> errorTypeIndeces)
121  { return castFromValues<ErrorType>(errorTypeIndeces); }
122 
129  inline std::vector<ErrorType> ErrorTypeCast (const std::vector<std::string> errorTypeNames)
130  { return castFromNames<ErrorType>(errorTypeNames, ErrorTypeNames()); }
131 
142  class Measure {
143 
144  protected:
145 
147  std::shared_ptr<data::Data> m_dataset;
148 
149  public:
150 
155 
159  Measure () = default;
160 
165  virtual ~Measure () = default;
166 
168 
169 
174 
179  virtual std::shared_ptr<data::Data> dataset () const { return m_dataset; }
180 
182 
183  };
184  }
185 }
186 
187 #endif
The class Catalogue
The class Measure.
Definition: Measure.h:142
Measure()=default
default constructor
virtual std::shared_ptr< data::Data > dataset() const
get the protected member dataset
Definition: Measure.h:179
std::shared_ptr< data::Data > m_dataset
the dataset of the measure
Definition: Measure.h:147
virtual ~Measure()=default
default destructor
std::vector< std::string > ErrorTypeNames()
return a vector containing the ErrorType names
Definition: Measure.h:92
ErrorType
the two-point correlation function error type
Definition: Measure.h:59
@ _Bootstrap_
Bootstrap resampling.
@ _BootstrapObjects_
Bootstrap resampling, by objects.
@ _None_
No error computed.
@ _BootstrapTest_
Bootstrap resampling, test.
@ _Poisson_
Poissonian error.
@ _Jackknife_
Jackknife resampling.
@ _JackknifeObjects_
Jackknife resampling, by objects.
@ _JackknifeTest_
Jackknife resampling, test.
ErrorType ErrorTypeCast(const int errorTypeIndex)
cast an enum of type ErrorType from its index
Definition: Measure.h:102
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38