CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
SuperSampleCovariance.h
Go to the documentation of this file.
1 /********************************************************************
2  * Copyright (C) 2021 by Federico Marulli and Giorgio Lesci *
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 
56 #ifndef __SSC__
57 #define __SSC__
58 
59 
60 #include "Cosmology.h"
61 
62 
63 namespace cbl {
64 
65  namespace cosmology {
66 
67 
78  {
79 
80  protected:
81 
83  std::vector<std::shared_ptr<statistics::Model>> m_response_func;
84 
86  std::shared_ptr<cosmology::Cosmology> m_cosmo;
87 
89  std::vector<cbl::cosmology::CosmologicalParameter> m_cosmo_param;
90 
92  std::string m_method_Pk;
93 
95  bool m_NL;
96 
99 
101  int m_nbins;
102 
104  int m_nsteps;
105 
107  std::vector<double> m_redshifts;
108 
110  double m_area;
111 
113  double m_precision;
114 
116  std::vector<std::vector<double>> m_windows;
117 
128  void m_compute_topHat_window (const double delta_z, const std::vector<double> redshift_edges);
129 
144  void m_compute_gaussian_window (const double delta_z, const std::vector<double> W_mean, const std::vector<double> W_std);
145 
154  std::vector<std::vector<double>> m_compute_Sij (cbl::cosmology::Cosmology cosmo) const;
155 
156 
157  public:
158 
163 
216  SuperSampleCovariance (cbl::cosmology::Cosmology cosm, const std::vector<cbl::cosmology::CosmologicalParameter> cosmo_param, const std::vector<double> redshift_edges, const double area, const std::string method_Pk="EisensteinHu", const double delta_z=0.001, const double precision=10, const bool NL=false, const bool store_output=false);
217 
275  SuperSampleCovariance (cbl::cosmology::Cosmology cosm, const std::vector<cbl::cosmology::CosmologicalParameter> cosmo_param, const double area, const std::vector<double> W_mean, const std::vector<double> W_std, const std::string method_Pk="EisensteinHu", const double delta_z=0.001, const double precision=10, const bool NL=false, const bool store_output=false);
276 
280  virtual ~SuperSampleCovariance () = default;
281 
283 
288 
296  std::vector<std::vector<double>> operator () (std::vector<double> &parameter) const;
297 
299 
300 
305 
306 
312  std::vector<std::vector<double>> get_window_function ();
313 
319  int Sij_dimension ();
320 
322 
323 
328 
329 
338  void write_window_function (const std::string dir, const std::string file);
339 
353  void write_Sij (const std::string dir, const std::string file);
354 
356 
357 
358  };
359 
360 
361  }
362 }
363 
364 #endif
The class Cosmology.
The class Cosmology.
Definition: Cosmology.h:277
The class SuperSampleCovariance.
std::vector< std::vector< double > > m_windows
window functions in the redshift bins
std::vector< std::shared_ptr< statistics::Model > > m_response_func
pointer to the response function of the probe
void m_compute_topHat_window(const double delta_z, const std::vector< double > redshift_edges)
compute the top-hat window functions in the redshift bins
std::vector< std::vector< double > > operator()(std::vector< double > &parameter) const
get
void m_compute_gaussian_window(const double delta_z, const std::vector< double > W_mean, const std::vector< double > W_std)
compute the Gaussian window functions in the redshift bins
int Sij_dimension()
return the dimension of the Sij matrix
std::vector< std::vector< double > > m_compute_Sij(cbl::cosmology::Cosmology cosmo) const
compute the S_ij matrix
void write_window_function(const std::string dir, const std::string file)
write the window functions on file
double m_area
survey area in steradians
int m_nsteps
number of redshift steps where the S matrix is computed
virtual ~SuperSampleCovariance()=default
default destructor
std::shared_ptr< cosmology::Cosmology > m_cosmo
pointer to the Cosmology object
std::vector< cbl::cosmology::CosmologicalParameter > m_cosmo_param
names of the cosmological parameters
void write_Sij(const std::string dir, const std::string file)
Write the matrix on file.
std::vector< std::vector< double > > get_window_function()
return the window functions
std::string m_method_Pk
method used to compute the power spectrum
double m_precision
precision of the array
bool m_NL
linear o non-linear power-spectrum
std::vector< double > m_redshifts
vector containing the redshift values where the S matrix is computed
SuperSampleCovariance(cbl::cosmology::Cosmology cosm, const std::vector< cbl::cosmology::CosmologicalParameter > cosmo_param, const std::vector< double > redshift_edges, const double area, const std::string method_Pk="EisensteinHu", const double delta_z=0.001, const double precision=10, const bool NL=false, const bool store_output=false)
Default constructor, used to compute the matrix, assuming top-hat window functions....
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38