CosmoBolognaLib
Free Software C++/Python libraries for cosmological calculations
LogNormalFull.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 
33 #ifndef __LOGNORMALF__
34 #define __LOGNORMALF__
35 
36 #include "Catalogue.h"
37 #include <fftw3.h>
38 
39 namespace cbl {
40 
48  namespace lognormal {
49 
62  class LogNormalFull {
63 
64  protected:
65 
67  std::vector<std::shared_ptr<catalogue::Catalogue>> m_data;
68 
70  std::vector<std::shared_ptr<catalogue::Catalogue>> m_random;
71 
73  std::shared_ptr<cosmology::Cosmology> m_cosmology;
74 
76  std::string m_author;
77 
79  bool m_NL;
80 
82  std::default_random_engine m_generator;
83 
85  std::shared_ptr<data::Field3D> m_clustering_signal;
86 
88  double m_rmin;
89 
91  int m_nx;
92 
94  int m_ny;
95 
97  int m_nz;
98 
100  int m_nzF;
101 
103  double m_xMin;
104 
106  double m_xMax;
107 
109  double m_yMin;
110 
112  double m_yMax;
113 
115  double m_zMin;
116 
118  double m_zMax;
119 
122 
124  int m_nLN;
125 
127  double m_rsmooth;
128 
131 
133  std::shared_ptr<data::Field3D> m_density;
134 
136  std::shared_ptr<data::Field3D> m_densityG;
137 
139  double m_sigma2G;
140 
142  std::shared_ptr<data::Field3D> m_rsd_displacement;
143 
145  std::shared_ptr<data::Field3D> m_displacement;
146 
148  std::shared_ptr<data::Field3D> m_potential;
149 
151  std::shared_ptr<data::Field3D> m_velocity;
152 
154  std::shared_ptr<data::Field3D> m_los_velocity;
155 
157  std::shared_ptr<data::Field3D> m_visibility;
158 
160  std::vector<std::shared_ptr<data::Field3D>> m_visibility_random;
161 
163  std::vector<std::vector<std::shared_ptr<catalogue::Catalogue>>> m_LNCat;
164 
166  std::shared_ptr<glob::FuncGrid> m_func_redshift;
167 
169  std::shared_ptr<glob::FuncGrid> m_func_DC;
170 
172  std::shared_ptr<glob::FuncGrid> m_func_HH;
173 
175  std::vector<std::shared_ptr<glob::FuncGrid> > m_func_bias;
176 
178  std::shared_ptr<glob::FuncGrid> m_func_growth_factor;
179 
181  std::shared_ptr<glob::FuncGrid> m_func_growth_rate;
182 
184  std::shared_ptr<glob::FuncGrid> m_func_pk;
185 
189  void m_set_grid_parameters ();
190 
201  void m_set_fields (const bool use_random, const bool doRSD);
202 
213  void m_reset_fields (const bool use_random, const bool doRSD);
214 
218  void m_set_clustering_signal ();
219 
225  void m_set_density_field (const double smoothing_radius);
226 
231 
235  void m_set_radial_velocity ();
236 
240  void m_set_visibility ();
241 
246 
251 
268  void m_extract_points_lognormal_field (const double nObjects, const bool doRSD, const std::vector<double> redshift, const std::vector<double> bias, const std::shared_ptr<data::Field3D> visibility, const std::string file_out);
269 
270 
271  public:
272 
276  LogNormalFull () = default;
277 
286  LogNormalFull (const cosmology::Cosmology cosmology, const double redshift_min=0., const double redshift_max=10., const int n_redshift_bins=500, const std::string author="CAMB");
287 
303  LogNormalFull (const double rmin, const double xMin, const double xMax, const double yMin, const double yMax, const double zMin, const double zMax, const cosmology::Cosmology cosmology, const double redshift_min=0., const double redshift_max=10., const int n_redshift_bins=500, const std::string author="CAMB");
304 
316  LogNormalFull (const double rmin, const std::vector<std::shared_ptr<catalogue::Catalogue>> random, const double pad, const cosmology::Cosmology cosmology, const double redshift_min=0., const double redshift_max=10., const int n_redshift_bins=500, const std::string author="CAMB");
317 
321  ~LogNormalFull () = default;
322 
331  void set_cosmo_function (const cosmology::Cosmology cosmology, const double redshift_min=0., const double redshift_max=10., const int n_redshift_bins=500, const std::string author="CAMB");
332 
343  void set_grid_parameters (const double rmin, const double xMin, const double xMax, const double yMin, const double yMax, const double zMin, const double zMax);
344 
351  void set_grid_parameters (const double rmin, const std::vector<std::shared_ptr<catalogue::Catalogue>> random, const double pad);
352 
385  void generate_lognormal (const int start, const int stop, const bool doRSD, const double smoothing_radius, const std::vector<double> nObjects, const std::vector<std::vector<double>> redshift, const std::vector<std::vector<double> > bias, const std::string dir, const std::string filename, const int seed, const bool set_fields=true, const bool use_random=true);
386 
387  };
388  }
389 }
390 
391 #endif
The class Catalogue
The class Cosmology.
Definition: Cosmology.h:277
The class LogNormalFull.
Definition: LogNormalFull.h:62
int m_nx
the number of cells along x-axis
Definition: LogNormalFull.h:91
std::shared_ptr< data::Field3D > m_rsd_displacement
vector containing pointers to the LogNormal realizations
int m_nzF
the number of cells along z-axis, Fourier space
double m_yMax
the maximum y-value
int m_nCells_eff
the effective cell numbers
std::vector< std::vector< std::shared_ptr< catalogue::Catalogue > > > m_LNCat
vector containing pointers to the LogNormal realizations
std::string m_author
std::string containing the author of the model power spectrum (i.e. the Boltzmann solver)
Definition: LogNormalFull.h:76
double m_zMax
the maximum z-value
bool m_NL
false compute the linear power spectrum; true compute the non-linear power spectrum
Definition: LogNormalFull.h:79
void m_set_grid_parameters()
set the grid parameters
double m_xMin
the minimum x-value
void m_extract_points_lognormal_field(const double nObjects, const bool doRSD, const std::vector< double > redshift, const std::vector< double > bias, const std::shared_ptr< data::Field3D > visibility, const std::string file_out)
extract points from lognormal density fields
double m_sigma2G
density field variance
std::shared_ptr< glob::FuncGrid > m_func_pk
interpolator for
std::shared_ptr< cosmology::Cosmology > m_cosmology
pointer to the fiducial cosmology
Definition: LogNormalFull.h:73
void m_set_fields(const bool use_random, const bool doRSD)
set the fields
int m_nz
the number of cells along z-axis
Definition: LogNormalFull.h:97
std::shared_ptr< data::Field3D > m_visibility
vector containing pointers to the LogNormal realizations
std::vector< std::shared_ptr< glob::FuncGrid > > m_func_bias
interpolator for
double m_zMin
the minimum z-value
bool m_use_visibility
1 use the visibility mask, 0 don't use the visibility mask
std::shared_ptr< data::Field3D > m_density
vector containing pointers to the LogNormal realizations
void set_cosmo_function(const cosmology::Cosmology cosmology, const double redshift_min=0., const double redshift_max=10., const int n_redshift_bins=500, const std::string author="CAMB")
set cosmological functions
std::shared_ptr< data::Field3D > m_potential
vector containing pointers to the LogNormal realizations
std::shared_ptr< glob::FuncGrid > m_func_growth_factor
interpolator for
std::shared_ptr< data::Field3D > m_densityG
vector containing pointers to the LogNormal realizations
std::shared_ptr< data::Field3D > m_displacement
vector containing pointers to the LogNormal realizations
void m_set_visibility_from_random_RSD()
set the visibility for redshift space mocks
std::vector< std::shared_ptr< catalogue::Catalogue > > m_random
pointer to the random catalogues
Definition: LogNormalFull.h:70
void m_reset_fields(const bool use_random, const bool doRSD)
reset the fields
~LogNormalFull()=default
default destructor
int m_nLN
the number of log-normal realizations to produce/read
void m_set_radial_velocity()
set the radial velocity field
double m_yMin
the minimum y-value
void m_set_visibility_from_random()
set the visibility from random catalogue
std::default_random_engine m_generator
generator for random numbers
Definition: LogNormalFull.h:82
double m_rsmooth
smoothing radius
std::shared_ptr< data::Field3D > m_clustering_signal
the clustering signal
Definition: LogNormalFull.h:85
std::vector< std::shared_ptr< data::Field3D > > m_visibility_random
vector containing pointers to the LogNormal realizations
void generate_lognormal(const int start, const int stop, const bool doRSD, const double smoothing_radius, const std::vector< double > nObjects, const std::vector< std::vector< double >> redshift, const std::vector< std::vector< double > > bias, const std::string dir, const std::string filename, const int seed, const bool set_fields=true, const bool use_random=true)
generate lognormal realizations
std::shared_ptr< data::Field3D > m_velocity
vector containing pointers to the LogNormal realizations
std::shared_ptr< glob::FuncGrid > m_func_redshift
interpolator for
LogNormalFull()=default
default constructor
std::shared_ptr< glob::FuncGrid > m_func_growth_rate
interpolator for
void m_set_density_field(const double smoothing_radius)
set the density field
std::shared_ptr< data::Field3D > m_los_velocity
vector containing pointers to the LogNormal realizations
double m_xMax
the maximum x-value
std::vector< std::shared_ptr< catalogue::Catalogue > > m_data
pointer to the input datasets
Definition: LogNormalFull.h:67
std::shared_ptr< glob::FuncGrid > m_func_DC
interpolator for
void m_set_potential()
set the gravitational potential field
int m_ny
the number of cells along y-axis
Definition: LogNormalFull.h:94
double m_rmin
approximate cell size of the density field
Definition: LogNormalFull.h:88
void m_set_visibility()
set the visibility
std::shared_ptr< glob::FuncGrid > m_func_HH
interpolator for
void set_grid_parameters(const double rmin, const double xMin, const double xMax, const double yMin, const double yMax, const double zMin, const double zMax)
set grid parameters
void m_set_clustering_signal()
set the target dark matter clustering signal
double bias(const double Mmin, const double sigmalgM, const double M0, const double M1, const double alpha, const std::shared_ptr< void > inputs)
the mean galaxy bias
The global namespace of the CosmoBolognaLib
Definition: CAMB.h:38