CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
NumberCounts1D.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 __NCOUNTS1D__
35 #define __NCOUNTS1D__
36 
37 
38 #include "Data1D_extra.h"
39 #include "NumberCounts.h"
40 
41 
42 // ===================================================================================================
43 
44 
45 namespace cbl {
46 
47  namespace measure {
48 
56  namespace numbercounts {
57 
68  class NumberCounts1D : public NumberCounts {
69 
70  protected:
71 
74 
79 
86  std::shared_ptr<data::Data> m_measurePoisson () override;
87 
97  std::shared_ptr<data::Data> m_measureJackknife (const std::string dir_output_resample=par::defaultString) override;
98 
112  std::shared_ptr<data::Data> m_measureBootstrap (const std::string dir_output_resample=par::defaultString, const int nResamplings=0, const int seed=3213) override;
113 
115 
116  public:
117 
122 
129 
134  virtual ~NumberCounts1D () = default;
135 
159  NumberCounts1D (const catalogue::Var var, const BinType bin_type, const catalogue::Catalogue data, const size_t nbins, const double minVar=par::defaultDouble, const double maxVar=par::defaultDouble, const double shift = 0.5, const glob::HistogramType hist_type=glob::HistogramType::_N_V_, const double fact = 1.);
160 
176  NumberCounts1D (const catalogue::Var var, const std::vector<double> vec_edges, const catalogue::Catalogue data, const glob::HistogramType hist_type=glob::HistogramType::_N_V_, const double fact = 1.);
177 
179 
184 
204  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;
205 
214  void compute_covariance (const std::vector<std::shared_ptr<glob::Histogram>> hist, const bool JK) override;
215 
217 
222 
230  void write (const std::string dir=par::defaultString, const std::string file=par::defaultString, const int rank=0) const override;
231 
239  void write_covariance (const std::string dir, const std::string file) const override;
240 
242 
247  std::shared_ptr<data::Data> Gaussian_smoothing (const double sigma) override;
248 
250 
251  };
252  }
253  }
254 }
255 
256 #endif
The class Data1D_extra.
The class NumberCounts.
The class Catalogue.
Definition: Catalogue.h:654
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 > m_measureJackknife(const std::string dir_output_resample=par::defaultString) override
measure the number counts with Jackknife covariance matrix
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
void write_covariance(const std::string dir, const std::string file) const override
write the measured covariance matrix
void compute_covariance(const std::vector< std::shared_ptr< glob::Histogram >> hist, const bool JK) override
compute the covariance matrix
virtual ~NumberCounts1D()=default
default destructor
catalogue::Var m_Var
the catalogue variable to bin
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_measurePoisson() override
measure the number counts with Poisson errors
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