18#include <lal/LALMalloc.h>
19#include <lal/LALConstants.h>
20#include <lal/LALCosmologyCalculator.h>
26#include <gsl/gsl_const_mksa.h>
27#include <gsl/gsl_integration.h>
81 double ok = omega->
ok;
92 return dH*sinh(sqrt(ok)*dC/dH)/sqrt(ok);
96 return dH*sin(sqrt(fabs(ok))*dC/dH)/sqrt(fabs(ok));
100 fprintf(stderr,
"Something funny happened. Aborting.\n");
114 double x = GSL_CONST_MKSA_SPEED_OF_LIGHT/(100.0*omega->
h);
137 E = sqrt(om*
x*
x*
x+ok*
x*
x+ol*pow(
x,3.*(1.0+w0+w1+w2))*exp(-3.0*((w1+w2)*z/
x + w2*z*z/(2.0*
x*
x))));
149 double epsabs = 5e-5;
150 double epsrel = 1e-5;
158 gsl_integration_workspace * w
159 = gsl_integration_workspace_alloc (1024);
161 gsl_integration_qag (&F, 0.0, z, epsabs, epsrel,
162 limit, key, w, &result, &
error);
164 gsl_integration_workspace_free (w);
179 return unnorm_density/norm;
195 return unnorm_density;
233 double epsabs = 5e-5;
234 double epsrel = 1e-5;
242 gsl_integration_workspace * w
243 = gsl_integration_workspace_alloc (1024);
245 if (z<0.0) gsl_integration_qagiu (&F, 0.0, epsabs, epsrel,
246 limit, w, &result, &
error);
248 else gsl_integration_qag (&F, 0.0, z, epsabs, epsrel,
249 limit, key, w, &result, &
error);
251 gsl_integration_workspace_free (w);
268 double epsabs = 5e-5;
269 double epsrel = 1e-5;
277 gsl_integration_workspace * w
278 = gsl_integration_workspace_alloc (1024);
280 if (z<0.0) gsl_integration_qagiu (&F, 0.0, epsabs, epsrel,
281 limit, w, &result, &
error);
283 else gsl_integration_qag (&F, 0.0, z, epsabs, epsrel,
284 limit, key, w, &result, &
error);
286 gsl_integration_workspace_free (w);
364 omega->
ol = 1.0 - omega->
om - omega->
ok;
404 double x = 1.0/sqrt(1.+z);
406 return hz0/hz*
p->rate->r0*(1.0+
p->rate->W)*exp(
p->rate->Q*z)/(exp(
p->rate->R*z)+
p->rate->W);
431 double epsabs = 5e-5;
432 double epsrel = 1e-5;
440 gsl_integration_workspace * w
441 = gsl_integration_workspace_alloc (1024);
443 if (z<0.0) gsl_integration_qagiu (&F, 0.0, epsabs, epsrel,
444 limit, w, &result, &
error);
446 else gsl_integration_qag (&F, 0.0, z, epsabs, epsrel,
447 limit, key, w, &result, &
error);
449 gsl_integration_workspace_free (w);
461 return unnorm_density/norm;
double XLALGetOmegaLambda(LALCosmologicalParameters *omega)
double XLALComovingVolume(LALCosmologicalParameters *omega, double z)
This function computes the comoving volume between 0 and z.
double XLALGetW2(LALCosmologicalParameters *omega)
LALCosmologicalRateParameters * XLALCreateCosmologicalRateParameters(double r0, double W, double Q, double R)
Function to create a LALCosmologicalRateParameters structure.
double XLALLuminosityDistance(LALCosmologicalParameters *omega, double z)
The set of functions in this module implements the standard cosmological distance measures defined a ...
double XLALGetLocalRate(LALCosmologicalRateParameters *rate)
Returns the local rate.
double XLALGetHubbleConstant(LALCosmologicalParameters *omega)
The next set of functions return specific parameters from the LALCosmologicalParameters structure.
double XLALIntegrateComovingVolume(LALCosmologicalParameters *omega, double z)
Function that integrates the comoving volume element.
double XLALGetOmegaK(LALCosmologicalParameters *omega)
double XLALRateWeightedUniformComovingVolumeDensity(double z, void *params)
Returns the Rate weighted uniform comoving volume density.
double XLALIntegrateComovingVolumeDensity(LALCosmologicalParameters *omega, double z)
Function that integrates the uniform in comoving volume density to compute the normalisation factor.
double XLALComovingTransverseDistance(LALCosmologicalParameters *omega, double z)
Computes the comoving transverse distance from the comoving line-of-sight distance (proper distance) ...
double XLALHubbleParameter(double z, void *omega)
Computes the inverse of the Hubble parameter at redshift z Eq.
double XLALUniformComovingVolumeDistribution(LALCosmologicalParameters *omega, double z, double zmax)
This function computes the value of a uniform probability distribution over the comoving volume.
LALCosmologicalParameters * XLALCreateDefaultCosmologicalParameters(void)
LALCosmologicalParametersAndRate * XLALCreateCosmologicalParametersAndRate(void)
Creates a cosmological parameters and rate structure.
double XLALGetOmegaMatter(LALCosmologicalParameters *omega)
double XLALComovingVolumeElement(double z, void *omega)
This function computes the comoving volume element (a 4&pi shell) between redshift z and z+dz.
double XLALIntegrateHubbleParameter(LALCosmologicalParameters *omega, double z)
Computes the integral of inverse of the Hubble parameter at redshift z.
double XLALRateWeightedComovingVolumeDistribution(LALCosmologicalParametersAndRate *p, double z, double zmax)
Returns the source redshifts distribution function obtained by normalizing the differential rate dR/d...
double XLALGetW0(LALCosmologicalParameters *omega)
void XLALDestroyCosmologicalParametersAndRate(LALCosmologicalParametersAndRate *p)
Destroys a cosmological parameters and rate structure.
double XLALComovingLOSDistance(LALCosmologicalParameters *omega, double z)
Computes the comoving line-of-sight distance (usually called the proper distance) by integrating the ...
double XLALAngularDistance(LALCosmologicalParameters *omega, double z)
Computes the angular size distance by dividing the comoving transverse distance by 1+z Eq.
void XLALDestroyCosmologicalParameters(LALCosmologicalParameters *omega)
Destroys a LALCosmologicalParameters structure.
double XLALUniformComovingVolumeDensity(double z, void *omega)
This function computes the value of a uniform probability density distribution over the comoving volu...
double XLALStarFormationDensity(double z, void *params)
Implements the fit to the SFR in Eq.7 of Coward, Burman 2005 ( http://arxiv.org/abs/astro-ph/0505181 ...
double XLALGetW1(LALCosmologicalParameters *omega)
double XLALHubbleDistance(LALCosmologicalParameters *omega)
Computes the Hubble distance, independent of the redshift.
void XLALSetCosmologicalParametersDefaultValue(LALCosmologicalParameters *omega)
Function to set a LALCosmologicalParameters structure to the default FlatLambdaCDM.
LALCosmologicalParameters * XLALCreateCosmologicalParameters(double h, double om, double ol, double w0, double w1, double w2)
Creates a LALCosmologicalParameters structure from the values of the cosmological parameters.
void XLALSetCosmologicalRateParametersDefaultValue(LALCosmologicalRateParameters *params)
Function to set a LALCosmologicalRateParameters structure to the default independent of z value.
void XLALDestroyCosmologicalRateParameters(LALCosmologicalRateParameters *rate)
Destroys a LALCosmologicalParameters structure.
double XLALIntegrateRateWeightedComovingVolumeDensity(LALCosmologicalParametersAndRate *p, double z)
Function that integrates the uniform in comoving volume density to compute the normalisation factor.
static REAL8TimeSeries * error(const REAL8TimeSeries *s1, const REAL8TimeSeries *s0)
static double Q(double mu, double x)
#define LAL_OMEGA_M
Default dimensionless Hubble constant, dimensionless.
#define LAL_H0_DIMENSIONLESS
Default dimensionless Hubble constant, dimensionless.