CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
NumberCounts2D.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 __NCOUNTS2D__
35 #define __NCOUNTS2D__
36 
37 
38 #include "NumberCounts.h"
39 
40 
41 // ===================================================================================================
42 
43 
44 namespace cbl {
45 
46  namespace measure {
47 
55  namespace numbercounts {
56 
67  class NumberCounts2D : public NumberCounts {
68 
69  protected:
70 
73 
76 
81 
88  std::shared_ptr<data::Data> m_measurePoisson () override;
89 
99  std::shared_ptr<data::Data> m_measureJackknife (const std::string dir_output_resample=par::defaultString) override;
100 
114  std::shared_ptr<data::Data> m_measureBootstrap (const std::string dir_output_resample=par::defaultString, const int nResamplings=0, const int seed=3213) override;
115 
117 
118  public:
119 
124 
131 
136  virtual ~NumberCounts2D () = default;
137 
171  NumberCounts2D (const catalogue::Var var1, const BinType bin_type1, const catalogue::Var var2, const BinType bin_type2, const catalogue::Catalogue data, const size_t nbins1, const size_t nbins2, const double minVar1=par::defaultDouble, const double maxVar1=par::defaultDouble, const double minVar2=par::defaultDouble, const double maxVar2=par::defaultDouble, const double shift1=0.5, const double shift2=0.5, const glob::HistogramType hist_type=glob::HistogramType::_N_V_, const double fact = 1.);
172 
190  NumberCounts2D (const catalogue::Var var1, const catalogue::Var var2, const std::vector<double> vec_edges1, const std::vector<double> vec_edges2, const catalogue::Catalogue data, const glob::HistogramType hist_type=glob::HistogramType::_N_V_, const double fact = 1.);
191 
193 
194 
199 
219  void measure (const ErrorType errorType=ErrorType::_Poisson_, const std::string dir_output_resample=par::defaultString, const int nResamplings=0, const int seed=3213, const bool conv=false, const double sigma=0.) override;
220 
221 
230  void compute_covariance (const std::vector<std::shared_ptr<glob::Histogram>> histo, const bool JK) override;
231 
237  std::shared_ptr<data::Data> Gaussian_smoothing (const double sigma) override;
238 
240 
245 
252  void write (const std::string dir=par::defaultString, const std::string file=par::defaultString, const int rank=0) const override;
253 
259  void write_covariance (const std::string dir, const std::string file) const override;
260 
262 
263  };
264  }
265  }
266 }
267 
268 #endif
The class NumberCounts.
The class Catalogue.
Definition: Catalogue.h:654
catalogue::Var m_Var1
the first catalogue variable to bin
void compute_covariance(const std::vector< std::shared_ptr< glob::Histogram >> histo, const bool JK) override
compute the covariance matrix
virtual ~NumberCounts2D()=default
default destructor
void write_covariance(const std::string dir, const std::string file) const override
write measured covariance matrix
void write(const std::string dir=par::defaultString, const std::string file=par::defaultString, const int rank=0) const override
write the measured number counts
std::shared_ptr< data::Data > Gaussian_smoothing(const double sigma) override
apply a Gaussian filter to the distribution
void measure(const ErrorType errorType=ErrorType::_Poisson_, const std::string dir_output_resample=par::defaultString, const int nResamplings=0, const int seed=3213, const bool conv=false, const double sigma=0.) override
measure the number counts
std::shared_ptr< data::Data > m_measurePoisson() override
measure the number counts with Poisson errors
std::shared_ptr< data::Data > m_measureBootstrap(const std::string dir_output_resample=par::defaultString, const int nResamplings=0, const int seed=3213) override
measure the number counts with Bootstrap covariance matrix
std::shared_ptr< data::Data > m_measureJackknife(const std::string dir_output_resample=par::defaultString) override
measure the number counts with Jackknife covariance matrix
catalogue::Var m_Var2
the second catalogue variable to bin
double fact()
return the normalization factor
Definition: NumberCounts.h:301
static const std::string defaultString
default std::string value
Definition: Constants.h:336
static const double defaultDouble
default double value
Definition: Constants.h:348
Var
the catalogue variables
Definition: Catalogue.h:70
HistogramType
the histogram type
Definition: Histogram.h:49
@ _N_V_
the binned counts,
ErrorType
the two-point correlation function error type
Definition: Measure.h:59
@ _Poisson_
Poissonian error.
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38
std::string conv(const T val, const char *fact)
convert a number to a std::string
Definition: Kernel.h:903
BinType
the binning type
Definition: Kernel.h:505