19 for(
int i = 0; i < nz; i++){
20 double x = std::log(1.0/(1+
z[i]));
27 for(
int i = 0; i < nz; i++){
28 double x = std::log(1.0/(1+
z[i]));
41 if(nk != npofk_lin or nk != npofk)
42 throw std::runtime_error(
"Arrays k and pofk must be compatible\n");
43 for(
int i = 0; i < nk; i++){
44 const double factor = (2.0*M_PI*M_PI)/std::pow(
k[i],3);
53 if(nk != npofk_1h or nk != npofk_2h)
54 throw std::runtime_error(
"Arrays k and pofk must be compatible\n");
55 for(
int i = 0; i < nk; i++){
56 const double factor = (2.0*M_PI*M_PI)/std::pow(
k[i],3);
63void get_nofM(
HaloModel **hmp,
int nm,
double *
M,
int ndnofm,
double *dnofm,
int nnofm,
double * nofm){
65 if(nm != nnofm or nm != ndnofm)
66 throw std::runtime_error(
"Arrays M and nofM must be compatible\n");
67 for(
int i = 0; i < nm; i++){
77 if(std::fabs(
z-zcollapse) < 1e-8)
99 std::string filename_pofk,
108 double deltac_multiplier,
109 double DeltaVir_multiplier,
110 double cofM_multiplier){
113 const double OmegaLambda = 1.0-
OmegaM;
114 const double xini_spherical_collapse = std::log(1e-5);
115 const double xpofk = 0.0;
116 const int npts_spherical_collapse = 1000;
126 const Func1 logEprimeofx = [
OmegaM,OmegaLambda,
w0,
wa,Eofx](
double x) ->
double {
127 const double E = Eofx(
x);
129 return 1.0 / (2.0 * E * E) * (-3.0 *
OmegaM / (a * a * a) +
131 (3.0 *
wa * a - 3.0 * (1 +
w0 +
wa)));
133 const Func1 muofx = [
mu0,
mua,Eofx](
double x) ->
double {
134 const double E = Eofx(
x);
136 return 1.0 + (
mu0 +
mua*(1.0-a)) / (E*E);
138 const Func1 muofx_lcdm = []([[maybe_unused]]
double x) ->
double {
141 const Func1 wofx = [
w0,
wa]([[maybe_unused]]
double x) ->
double {
143 return w0 +
wa*(1-a);
145 const Func1 OmegaMofx = [
OmegaM,Eofx](
double x) ->
double {
146 const double E = Eofx(
x);
167 Spline Dofx_spline, fofx_spline;
168 Spline Dlcdmofx_spline, flcdmofx_spline;
171 const double xlinearpofk = 0.0;
172 const double xscaleback = std::log(1.0/50.0);
173 const double pofk_normalization = (
sigma8norm ? 1.0 :
174 std::pow(Dlcdmofx_spline(xscaleback) / Dlcdmofx_spline(xlinearpofk), 2) /
175 std::pow(Dofx_spline(xscaleback) / Dofx_spline(xlinearpofk), 2));
176 Spline logDelta_of_logk_spline;
179 logDelta_of_logk_spline,
204 const std::string filename_mu,
210 bool negativemu =
false;
211 for (
auto & line : mudata) {
212 xmu.push_back(std::log(line[0]));
213 mu.push_back(line[1]);
214 if(line[1] < 0.0) negativemu =
true;
218 std::cout <<
"Error: mu is negative, could be a problem\n";
222 mu_of_x_spline =
Spline(xmu,mu);
FML::COSMOLOGY::SPHERICALCOLLAPSE::Func1 Func1
FML::INTERPOLATION::SPLINE::DVector DVector
FML::COSMOLOGY::SPHERICALCOLLAPSE::SphericalCollapseModel SphericalCollapseModel
void get_pofk_1h_2h(HaloModel **hmp, int nk, double *k, int npofk_1h, double *pofk_1h, int npofk_2h, double *pofk_2h)
FML::INTERPOLATION::SPLINE::Spline Spline
void output(HaloModel **hmp, std::string label)
void get_nofM(HaloModel **hmp, int nm, double *M, int ndnofm, double *dnofm, int nnofm, double *nofm)
void init(HaloModel **hmp, std::string filename_pofk, double OmegaM, double w0, double wa, double mu0, double mua, bool verbose, bool hmcode, bool sigma8norm, double deltac_multiplier, double DeltaVir_multiplier, double cofM_multiplier)
FML::COSMOLOGY::HALOMODEL::HaloModel HaloModel
void get_deltac(HaloModel **hmp, int nz, double *z, int ndeltac, double *deltac)
void get_DeltaVir(HaloModel **hmp, int nz, double *z, int nDeltaVir, double *DeltaVir)
void info(HaloModel **hmp)
void free(HaloModel **hm)
void get_pofk(HaloModel **hmp, int nk, double *k, int npofk_lin, double *pofk_lin, int npofk, double *pofk)
void calc(HaloModel **hmp, double z)
void read_and_spline_mu_file(const std::string filename_mu, Spline &mu_of_x_spline)
Class for computing the standard halomodel predictions for plus or just doing spherical collapse.
void output_nofM(std::string filename, double Mmin=1e8, double Mmax=1e16, int npts_M=100) const
Spline deltac_of_x_spline
Spline logDeltaHM_full_of_logk_spline
Spline logDelta_of_logk_spline
double DeltaVir_multiplier
void compute_at_redshift(double zcollapse)
double get_DeltaVir_hmcode(double x) const
double xini_spherical_collapse
Spline DeltaVir_of_x_spline
int npts_spherical_collapse
Spline growthfactor_of_x_spline
void output_deltac(std::string filename, double zmin=0.0, double zmax=10.0, int npts_z=100) const
double get_deltac_hmcode(double x) const
void output_pofk(std::string filename, double kmin=1e-5, double kmax=100, int npts_k=1000) const
SphericalCollapseModel spcmodel
Spline logDeltaHM_twohalo_of_logk_spline
Spline logDeltaHM_onehalo_of_logk_spline
Spline dndlogM_of_logM_spline
The class contains all the info about the model needed to run the spherical collapse and halomodel Co...
This is a wrapper class for easy use of GSL splines It is (OpenMP) thread safe as long as splines are...
void read_pofk_file(const std::string filename_pofk, Spline &logDelta_of_logk_spline, double normalization, int col_k, int col_pofk)
std::function< double(double)> Func1
void compute_growthfactor(const SphericalCollapseModel &model, Spline &growthfactor_of_x_spline, Spline &growthrate_of_x_spline, const double xini, const double xend, const int npts)
Computes the growth factor (not normalized) and growth rate for a given model and returns splines wit...
DVector2D read_regular_ascii(std::string filename, int ncols, std::vector< int > cols_to_keep, int nskip, size_t nestimated_lines)
Read a regular ascii files with nskip header lines and containing ncol collums nestimated_lines is th...
std::vector< double > DVector