18 #include <lal/LALMalloc.h>
19 #include <lal/LALCosmologyCalculator.h>
73 double ok = omega->
ok;
84 return dH*sinh(sqrt(ok)*dC/dH)/sqrt(ok);
88 return dH*sin(sqrt(fabs(ok))*dC/dH)/sqrt(fabs(ok));
92 fprintf(stderr,
"Something funny happened. Aborting.\n");
106 double x = GSL_CONST_MKSA_SPEED_OF_LIGHT/(100.0*omega->
h);
129 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))));
141 double epsabs = 5e-5;
142 double epsrel = 1e-5;
150 gsl_integration_workspace * w
151 = gsl_integration_workspace_alloc (1024);
153 gsl_integration_qag (&F, 0.0, z, epsabs, epsrel,
154 limit, key, w, &result, &
error);
156 gsl_integration_workspace_free (w);
171 return unnorm_density/norm;
187 return unnorm_density;
225 double epsabs = 5e-5;
226 double epsrel = 1e-5;
234 gsl_integration_workspace * w
235 = gsl_integration_workspace_alloc (1024);
237 if (z<0.0) gsl_integration_qagiu (&F, 0.0, epsabs, epsrel,
238 limit, w, &result, &
error);
240 else gsl_integration_qag (&F, 0.0, z, epsabs, epsrel,
241 limit, key, w, &result, &
error);
243 gsl_integration_workspace_free (w);
260 double epsabs = 5e-5;
261 double epsrel = 1e-5;
269 gsl_integration_workspace * w
270 = gsl_integration_workspace_alloc (1024);
272 if (z<0.0) gsl_integration_qagiu (&F, 0.0, epsabs, epsrel,
273 limit, w, &result, &
error);
275 else gsl_integration_qag (&F, 0.0, z, epsabs, epsrel,
276 limit, key, w, &result, &
error);
278 gsl_integration_workspace_free (w);
345 omega->
ok=1.0-0.3175-0.68251;
386 double x = 1.0/sqrt(1.+z);
388 return hz0/hz*
p->rate->r0*(1.0+
p->rate->W)*exp(
p->rate->Q*z)/(exp(
p->rate->R*z)+
p->rate->W);
413 double epsabs = 5e-5;
414 double epsrel = 1e-5;
422 gsl_integration_workspace * w
423 = gsl_integration_workspace_alloc (1024);
425 if (z<0.0) gsl_integration_qagiu (&F, 0.0, epsabs, epsrel,
426 limit, w, &result, &
error);
428 else gsl_integration_qag (&F, 0.0, z, epsabs, epsrel,
429 limit, key, w, &result, &
error);
431 gsl_integration_workspace_free (w);
443 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)
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.
LALCosmologicalRateParameters * XLALCreateCosmologicalRateParameters(double r0, double W, double Q, double R)
Function to create a LALCosmologicalRateParameters structure.
double XLALUniformComovingVolumeDistribution(LALCosmologicalParameters *omega, double z, double zmax)
This function computes the value of a uniform probability distribution over the comoving volume.
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.
LALCosmologicalParametersAndRate * XLALCreateCosmologicalParametersAndRate(void)
Creates a cosmological parameters and rate structure.
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 LambdaCDM value (see http://arxi...
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.
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.
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)