CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
PowerSpectrum_Angular.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 
30 #ifndef __POWSPECTRUMANG__
31 #define __POWSPECTRUMANG__
32 
34 
35 
36 // ===================================================================================================
37 
38 
39 namespace cbl {
40 
41  namespace measure {
42 
49  namespace angularpk {
50 
63  void read_mixing_matrix (const std::string dir, const std::string file, std::vector<double> &ll, std::vector<std::vector<double>> &matrix);
64 
70  enum class AngularEstimator {
71 
73  _Fast_,
74 
77 
78  };
79 
89  class PowerSpectrum_angular : public Measure {
90 
91  private:
92 
94  std::vector<double> m_theta;
95 
97  std::vector<double> m_w;
98 
100  std::vector<double> m_w_err;
101 
103  std::vector<double> m_x;
104 
106  std::vector<double> m_y;
107 
109  std::vector<double> m_y_err;
110 
112  std::vector<double> m_l;
113 
115  std::vector<double> m_AngularPowerSpectrum;
116 
118  std::vector<double> m_l_av;
119 
121  std::vector<double> m_AngularPowerSpectrum_av;
122 
124  double m_l_min;
125 
127  double m_l_max;
128 
130  double m_Nl;
131 
133  double m_nbins;
134 
136  std::vector<double> m_Wl;
137 
139  std::vector<std::vector<double>> m_RR;
140 
143 
146 
149 
152 
155 
158 
161 
164 
166  std::shared_ptr<twopt::TwoPointCorrelation1D_angular> m_TwoPointCorrelation1D_angular;
167 
169  std::shared_ptr<catalogue::Catalogue> m_catalogue;
170 
172  std::vector<double> m_theta_mask;
173 
175  std::vector<double> m_theta_mask_min;
176 
178  std::vector<double> m_theta_mask_max;
179 
181  std::vector<double> m_RA_mask;
182 
184  std::vector<double> m_RA_mask_min;
185 
187  std::vector<double> m_RA_mask_max;
188 
190  double m_pixel_area;
191 
194 
201 
212  double m_dtheta_theta (const BinType binType, int i);
213 
223  std::vector<double> m_error (const BinType binType, std::vector<double> w_err);
224 
232  void set_catalogue (cbl::catalogue::Catalogue catalogue);
233 
234 
239  void m_averagePowerSpectrum ();
240 
241 
254  void m_read_angular_mask (const std::string mask_file, std::string mask_type, double pixel_area, int n_lines_header=1);
255 
256  public:
257 
262 
266  PowerSpectrum_angular () = default;
267 
303  PowerSpectrum_angular (const catalogue::Catalogue data, const catalogue::Catalogue random, const double l_min, const double l_max, const int Nl, const BinType binType, const double thetaMin, const double thetaMax, const int nbins, const double shift, const CoordinateUnits angularUnits, const BinType correlation_binType);
304 
336  PowerSpectrum_angular (const catalogue::Catalogue data, const double l_min, const double l_max, const int bandwidth=1, const std::string mask_file="", const std::string mask_type="", const double pixel_area=0, const int n_lines_header=1);
337 
338 
343 
345 
352  void set_l_output (const BinType binType);
353 
384  void measure (const AngularEstimator estimator=AngularEstimator::_Fast_, const std::string dir_correlation_input="", const std::string file_correlation_input="", const int n_lines_header=1, CoordinateUnits inputUnits=CoordinateUnits::_arcminutes_, BinType input_binType=BinType::_logarithmic_, cbl::measure::ErrorType errorType=ErrorType::_Poisson_, const std::string dir_correlation_output= par::defaultString, const std::string file_correlation_output="xi_angular.dat", const int nMocks=0);
385 
414  void measureFast (const std::string dir_correlation_input="", const std::string file_correlation_input="", const int n_lines_header=1, CoordinateUnits inputUnits=CoordinateUnits::_arcminutes_, BinType input_binType=BinType::_logarithmic_, cbl::measure::ErrorType errorType=ErrorType::_Poisson_, const std::string dir_correlation_output= par::defaultString, const std::string file_correlation_output="xi_angular.dat", const int nMocks=0);
415 
421  void measureSphericalArmonic ();
422 
427  std::vector<double> theta () { return m_theta; }
428 
433  std::vector<double> Wl () { return m_Wl; }
434 
439  std::vector<double> AngularPowerSpectrum () { return m_AngularPowerSpectrum; }
440 
445  std::vector<double> l () { return m_l; }
446 
455  void compute_mixing_matrix(std::string dir_window_input="", std::string file_window_input="");
456 
467  double angular_mask(double theta, double RA);
468 
473 
482  void write (const std::string dir, const std::string file);
483 
492  void write_average (const std::string dir, const std::string file);
493 
504  void write_mixing_matrix (const std::string dir, const std::string file, bool store_window=false);
505 
522  void read (const std::string dir, const std::string file, const std::vector<int> column_x={1}, const std::vector<int> column_y={2}, const std::vector<int> column_error={3}, const int n_lines_header=1);
523 
525 
526  };
527  }
528  }
529 }
530 
531 #endif
The class TwoPointCorrelation1D_angular.
The class Catalogue.
Definition: Catalogue.h:654
The class Measure.
Definition: Measure.h:142
std::vector< double > theta()
get the private member m_theta
cbl::CoordinateUnits m_angularUnits
the coordinate units of the correlation function (if computed with cbl)
std::shared_ptr< catalogue::Catalogue > m_catalogue
variable that store the constructor for the catalogue
std::vector< std::vector< double > > m_RR
the mixing matrix
void compute_mixing_matrix(std::string dir_window_input="", std::string file_window_input="")
compute the mixing matrix
void write_average(const std::string dir, const std::string file)
write the angular power spectrum on file
std::string m_file_correlation_output
the file to write w (if computed with cbl)
std::vector< double > m_RA_mask_min
vector containing the min RA vector of the mask
void read(const std::string dir, const std::string file, const std::vector< int > column_x={1}, const std::vector< int > column_y={2}, const std::vector< int > column_error={3}, const int n_lines_header=1)
read data from file
std::vector< double > m_w
vector containing the angular correlation function
std::vector< double > m_y_err
vector containing the y errors read from file
double m_nbins
the number of multipoles at which the angular power spectrum is computed
cbl::BinType m_binType
the bin type of the correlation function (if computed with cbl)
void m_averagePowerSpectrum()
compute the average of the power spectrum
std::shared_ptr< twopt::TwoPointCorrelation1D_angular > m_TwoPointCorrelation1D_angular
variable that store the constructor for the measure of angular correlation function
std::vector< double > m_RA_mask_max
vector containing the max RA vector of the mask
std::vector< double > m_l
vector containing the multipoles at which power spectrum is computed
std::vector< double > AngularPowerSpectrum()
get the private member AngularPowerSpectrum
double m_Nl
the number of multipoles at which the angular power spectrum is computed
void set_l_output(const BinType binType)
generate vector which contains the multipoles at which the angular power spectrum is computed
std::vector< double > m_RA_mask
vector containing the RA vector of the mask
std::string m_dir_correlation_output
the directory to write w (if computed with cbl)
~PowerSpectrum_angular()=default
default destructor
std::vector< double > m_w_err
vector containing the angular correlation function error
PowerSpectrum_angular()=default
default constructor Power_spectrum_angular
std::vector< double > m_l_av
vector containing the average of the multipoles
void measureFast(const std::string dir_correlation_input="", const std::string file_correlation_input="", const int n_lines_header=1, CoordinateUnits inputUnits=CoordinateUnits::_arcminutes_, BinType input_binType=BinType::_logarithmic_, cbl::measure::ErrorType errorType=ErrorType::_Poisson_, const std::string dir_correlation_output=par::defaultString, const std::string file_correlation_output="xi_angular.dat", const int nMocks=0)
measure the angular power spectrum with fast estimator
std::vector< double > m_theta_mask_min
vector containing the min colatitude vector of the mask
std::string m_dir_correlation_input
the directory to read w
std::vector< double > m_AngularPowerSpectrum
vector containing the angular power spectrum
std::vector< double > m_theta
vector containing the angular separation
void measureSphericalArmonic()
measure the angular power spectrum with spherical armonic estimator
std::vector< double > m_error(const BinType binType, std::vector< double > w_err)
measure the angular power spectrum errors
void write(const std::string dir, const std::string file)
write the angular power spectrum on file
std::vector< double > m_y
vector containing the y coordinate read from file
std::vector< double > m_AngularPowerSpectrum_av
vector containing the angular power spectrum average
cbl::CoordinateUnits m_inputUnits
the coordinate units of the input file
double m_dtheta_theta(const BinType binType, int i)
compute the dtheta*theta for the integral
std::vector< double > m_theta_mask_max
vector containing the max colatitude vector of the mask
std::vector< double > m_Wl
vector containing the angular power spectrum of the window function
std::vector< double > m_x
vector containing the x coordinate read from file
std::vector< double > Wl()
get the private member Wl
void measure(const AngularEstimator estimator=AngularEstimator::_Fast_, const std::string dir_correlation_input="", const std::string file_correlation_input="", const int n_lines_header=1, CoordinateUnits inputUnits=CoordinateUnits::_arcminutes_, BinType input_binType=BinType::_logarithmic_, cbl::measure::ErrorType errorType=ErrorType::_Poisson_, const std::string dir_correlation_output=par::defaultString, const std::string file_correlation_output="xi_angular.dat", const int nMocks=0)
measure the angular power spectrum
void write_mixing_matrix(const std::string dir, const std::string file, bool store_window=false)
write the angular power spectrum on file
std::string m_file_correlation_input
the file to read w
void m_convert_angular_units(cbl::CoordinateUnits inputUnits)
converts the input angle in radians
double angular_mask(double theta, double RA)
include the binary angular mask
std::vector< double > l()
get the private member m_l
void m_read_angular_mask(const std::string mask_file, std::string mask_type, double pixel_area, int n_lines_header=1)
read the angular mask from file
std::vector< double > m_theta_mask
vector containing the colatitude vector of the mask
void set_catalogue(cbl::catalogue::Catalogue catalogue)
set the catalogue for Spherical armonic estimator
static const std::string defaultString
default std::string value
Definition: Constants.h:336
void read_mixing_matrix(const std::string dir, const std::string file, std::vector< double > &ll, std::vector< std::vector< double >> &matrix)
read mixing matrix from file
AngularEstimator
the angular two-point correlation estimator type
@ _SphericalArmonic_
the spherical armonic estimator
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
CoordinateUnits
the coordinate units
Definition: Kernel.h:562
@ _arcminutes_
angle in arcminutes
BinType
the binning type
Definition: Kernel.h:505
@ _logarithmic_
logarithmic binning