CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
TwoPointCorrelation_projected.h
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2010 by Federico Marulli and Alfonso Veropalumbo *
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 
35 #ifndef __TWOPOINTPROJ__
36 #define __TWOPOINTPROJ__
37 
38 
40 
41 
42 // ===================================================================================================
43 
44 
45 namespace cbl {
46 
47  namespace measure {
48 
49  namespace twopt {
50 
65 
66  protected:
67 
70 
82  std::shared_ptr<data::Data> data_with_extra_info (const std::vector<double> rp, const std::vector<double> ww, const std::vector<double> error) const;
83 
97  std::shared_ptr<data::Data> Projected (const std::vector<double> rp, const std::vector<double> pi, const std::vector<std::vector<double>> xi, const std::vector<std::vector<double>> error_xi) override;
98 
133  void measurePoisson (const std::string dir_output_pairs= par::defaultString, const std::vector<std::string> dir_input_pairs={}, const bool count_dd=true, const bool count_rr=true, const bool count_dr=true, const bool tcount=true, const Estimator estimator=Estimator::_LandySzalay_, const double fact=0.1) override;
134 
174  void measureJackknife (const std::string dir_output_pairs= par::defaultString, const std::vector<std::string> dir_input_pairs={}, const std::string dir_output_resample= par::defaultString, const bool count_dd=true, const bool count_rr=true, const bool count_dr=true, const bool tcount=true, const Estimator estimator=Estimator::_LandySzalay_, const double fact=0.1) override;
175 
220  void measureBootstrap (const int nMocks, const std::string dir_output_pairs, const std::vector<std::string> dir_input_pairs={}, const std::string dir_output_resample = par::defaultString, const bool count_dd=true, const bool count_rr=true, const bool count_dr=true, const bool tcount=true, const Estimator estimator=Estimator::_LandySzalay_, const double fact=0.1, const int seed=3213) override;
221 
232  std::vector<std::shared_ptr<data::Data>> XiJackknife (const std::vector<std::shared_ptr<pairs::Pair>> dd, const std::vector<std::shared_ptr<pairs::Pair>> rr) override;
233 
247  std::vector<std::shared_ptr<data::Data>> XiJackknife (const std::vector<std::shared_ptr<pairs::Pair>> dd, const std::vector<std::shared_ptr<pairs::Pair>> rr, const std::vector<std::shared_ptr<pairs::Pair>> dr) override;
248 
264  std::vector<std::shared_ptr<data::Data>> XiBootstrap (const int nMocks, const std::vector<std::shared_ptr<pairs::Pair>> dd, const std::vector<std::shared_ptr<pairs::Pair>> rr, const int seed=3213) override;
265 
283  std::vector<std::shared_ptr<data::Data>> XiBootstrap (const int nMocks, const std::vector<std::shared_ptr<pairs::Pair>> dd, const std::vector<std::shared_ptr<pairs::Pair>> rr, const std::vector<std::shared_ptr<pairs::Pair>> dr, const int seed=3213) override;
284 
285 
286  public:
287 
292 
298 
333  TwoPointCorrelation_projected (catalogue::Catalogue data, catalogue::Catalogue random, const BinType binType_rp, const double rpMin, const double rpMax, const int nbins_rp, const double shift_rp, const double piMin, const double piMax, const int nbins_pi, const double shift_pi, const double piMax_integral, const CoordinateUnits angularUnits=CoordinateUnits::_radians_, std::function<double(double)> angularWeight=nullptr, const bool compute_extra_info=false, const double random_dilution_fraction=1.)
334  : TwoPointCorrelation2D_cartesian(data, random, binType_rp, rpMin, rpMax, nbins_rp, shift_rp, BinType::_linear_, piMin, piMax, nbins_pi, shift_pi, angularUnits, angularWeight, compute_extra_info, random_dilution_fraction)
335  { m_twoPType = TwoPType::_projected_; m_piMax_integral = piMax_integral; }
336 
369  TwoPointCorrelation_projected (catalogue::Catalogue data, catalogue::Catalogue random, const BinType binType_rp, const double rpMin, const double rpMax, const double binSize_rp, const double shift_rp, const double piMin, const double piMax, const double binSize_pi, const double shift_pi, const double piMax_integral, const CoordinateUnits angularUnits=CoordinateUnits::_radians_, std::function<double(double)> angularWeight=nullptr, const bool compute_extra_info=false, const double random_dilution_fraction=1.)
370  : TwoPointCorrelation2D_cartesian(data, random, binType_rp, rpMin, rpMax, binSize_rp, shift_rp, BinType::_linear_, piMin, piMax, binSize_pi, shift_pi, angularUnits, angularWeight, compute_extra_info, random_dilution_fraction)
371  { m_twoPType = TwoPType::_projected_; m_piMax_integral = piMax_integral; }
372 
378 
380 
385  std::vector<double> yy () const
386  { cbl::ErrorCBL("", "yy", "TwoPointCorrelation_projected.h"); std::vector<double> vv; return vv; }
387 
392  std::vector<double> xi1D () const
393  { std::vector<double> vv; m_dataset->get_data(vv); return vv; }
394 
401  virtual std::vector<double> error1D () const
402  { std::vector<double> vv; m_dataset->get_error(vv); return vv; }
403 
408  std::vector<std::vector<double>> xi2D () const
409  { cbl::ErrorCBL("", "xi2D", "TwoPointCorrelation_projected.h"); std::vector<std::vector<double>> vv; return vv; }
410 
417  std::vector<std::vector<double>> error2D () const
418  { cbl::ErrorCBL("", "error2D", "TwoPointCorrelation_projected.h"); std::vector<std::vector<double>> vv; return vv; }
419 
420 
425 
468  void measure (const ErrorType errorType=ErrorType::_Poisson_, const std::string dir_output_pairs=par::defaultString, const std::vector<std::string> dir_input_pairs={}, const std::string dir_output_resample=par::defaultString, const int nMocks=0, const bool count_dd=true, const bool count_rr=true, const bool count_dr=true, const bool tcount=true, const Estimator estimator=Estimator::_LandySzalay_, const double fact=0.1, const int seed=3213) override;
469 
471 
472 
477 
484  void read (const std::string dir, const std::string file) override;
485 
493  void write (const std::string dir=par::defaultString, const std::string file=par::defaultString, const int rank=0) const override;
494 
496 
497 
502 
509  void read_covariance (const std::string dir, const std::string file) override;
510 
517  void write_covariance (const std::string dir, const std::string file) const override;
518 
527  void compute_covariance (const std::vector<std::shared_ptr<data::Data>> xi, const bool JK) override;
528 
538  void compute_covariance (const std::vector<std::string> file, const bool JK) override;
539 
541 
542  };
543  }
544  }
545 }
546 
547 #endif
The class TwoPointCorrelation2D_cartesian.
The class Catalogue.
Definition: Catalogue.h:654
std::shared_ptr< data::Data > m_dataset
the dataset of the measure
Definition: Measure.h:147
void write_covariance(const std::string dir, const std::string file) const override
write the measured two-point correlation
void measurePoisson(const std::string dir_output_pairs=par::defaultString, const std::vector< std::string > dir_input_pairs={}, const bool count_dd=true, const bool count_rr=true, const bool count_dr=true, const bool tcount=true, const Estimator estimator=Estimator::_LandySzalay_, const double fact=0.1) override
measure the projected two-point correlation function with Poisson errors
std::shared_ptr< data::Data > Projected(const std::vector< double > rp, const std::vector< double > pi, const std::vector< std::vector< double >> xi, const std::vector< std::vector< double >> error_xi) override
measure projected correlation function
void measure(const ErrorType errorType=ErrorType::_Poisson_, const std::string dir_output_pairs=par::defaultString, const std::vector< std::string > dir_input_pairs={}, const std::string dir_output_resample=par::defaultString, const int nMocks=0, const bool count_dd=true, const bool count_rr=true, const bool count_dr=true, const bool tcount=true, const Estimator estimator=Estimator::_LandySzalay_, const double fact=0.1, const int seed=3213) override
measure the projected two-point correlation function
void measureJackknife(const std::string dir_output_pairs=par::defaultString, const std::vector< std::string > dir_input_pairs={}, const std::string dir_output_resample=par::defaultString, const bool count_dd=true, const bool count_rr=true, const bool count_dr=true, const bool tcount=true, const Estimator estimator=Estimator::_LandySzalay_, const double fact=0.1) override
measure the projected two-point correlation function estimating the covariance with Jackknife resampl...
~TwoPointCorrelation_projected()=default
default destructor
virtual std::vector< double > error1D() const
get the error on the binned correlation function function
std::shared_ptr< data::Data > data_with_extra_info(const std::vector< double > rp, const std::vector< double > ww, const std::vector< double > error) const
return a data object with extra info
TwoPointCorrelation_projected(catalogue::Catalogue data, catalogue::Catalogue random, const BinType binType_rp, const double rpMin, const double rpMax, const int nbins_rp, const double shift_rp, const double piMin, const double piMax, const int nbins_pi, const double shift_pi, const double piMax_integral, const CoordinateUnits angularUnits=CoordinateUnits::_radians_, std::function< double(double)> angularWeight=nullptr, const bool compute_extra_info=false, const double random_dilution_fraction=1.)
constructor
std::vector< std::vector< double > > xi2D() const
get the the binned correlation function
std::vector< std::shared_ptr< data::Data > > XiBootstrap(const int nMocks, const std::vector< std::shared_ptr< pairs::Pair >> dd, const std::vector< std::shared_ptr< pairs::Pair >> rr, const int seed=3213) override
measure the bootstrap resampling of the two-point correlation function, ξ(r)
void read(const std::string dir, const std::string file) override
read the projected two-point correlation function
TwoPointCorrelation_projected(catalogue::Catalogue data, catalogue::Catalogue random, const BinType binType_rp, const double rpMin, const double rpMax, const double binSize_rp, const double shift_rp, const double piMin, const double piMax, const double binSize_pi, const double shift_pi, const double piMax_integral, const CoordinateUnits angularUnits=CoordinateUnits::_radians_, std::function< double(double)> angularWeight=nullptr, const bool compute_extra_info=false, const double random_dilution_fraction=1.)
constructor
void write(const std::string dir=par::defaultString, const std::string file=par::defaultString, const int rank=0) const override
write the projected two-point correlation function
std::vector< double > xi1D() const
get the the binned correlation function
void compute_covariance(const std::vector< std::shared_ptr< data::Data >> xi, const bool JK) override
compute the covariance matrix
std::vector< std::vector< double > > error2D() const
get the error on the binned correlation function function
void measureBootstrap(const int nMocks, const std::string dir_output_pairs, const std::vector< std::string > dir_input_pairs={}, const std::string dir_output_resample=par::defaultString, const bool count_dd=true, const bool count_rr=true, const bool count_dr=true, const bool tcount=true, const Estimator estimator=Estimator::_LandySzalay_, const double fact=0.1, const int seed=3213) override
measure the projected two-point correlation function estimating the covariance with Bootstrap resampl...
std::vector< double > yy() const
get the y coordinates
void read_covariance(const std::string dir, const std::string file) override
read the measured covariance matrix
std::vector< std::shared_ptr< data::Data > > XiJackknife(const std::vector< std::shared_ptr< pairs::Pair >> dd, const std::vector< std::shared_ptr< pairs::Pair >> rr) override
measure the jackknife resampling of the two-point correlation function, ξ(r)
std::shared_ptr< pairs::Pair > dr() const
get the protected member m_dr
std::shared_ptr< catalogue::Catalogue > random() const
get the protected member m_random
bool compute_extra_info() const
get the protected member m_compute_extra_info
bool random_dilution_fraction() const
get the protected member m_random_dilution_fraction
std::shared_ptr< pairs::Pair > rr() const
get the protected member m_rr
std::shared_ptr< pairs::Pair > dd() const
get the protected member m_dd
std::shared_ptr< catalogue::Catalogue > data() const
get the protected member m_data
TwoPType m_twoPType
two-point correlation function type
static const std::string defaultString
default std::string value
Definition: Constants.h:336
static const double pi
: the ratio of a circle's circumference to its diameter
Definition: Constants.h:199
Estimator
the two-point correlation estimator
@ _LandySzalay_
Landy&Szalay estimator.
@ _projected_
the projected two-point correlation function, w(rp)
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
int ErrorCBL(const std::string msg, const std::string functionCBL, const std::string fileCBL, const cbl::glob::ExitCode exitCode=cbl::glob::ExitCode::_error_)
throw an exception: it is used for handling exceptions inside the CosmoBolognaLib
Definition: Kernel.h:780
CoordinateUnits
the coordinate units
Definition: Kernel.h:562
@ _radians_
angle in radians
BinType
the binning type
Definition: Kernel.h:505
@ _linear_
linear binning