gnuastro-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gnuastro-commits] master 9c2ab0f8: NEWS: added bug fix entry of previou


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 9c2ab0f8: NEWS: added bug fix entry of previous commit
Date: Thu, 1 Feb 2024 19:31:52 -0500 (EST)

branch: master
commit 9c2ab0f816afd0d692525baa82bb9154507feff3
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    NEWS: added bug fix entry of previous commit
    
    Until now, we had forgot to mention the bug fix of the previous commit in
    the NEWS file.
    
    With this commit, a note has been added for this. Also the sanity check at
    the start of the more complex cosmology library functions was moved after
    the definitions of variables (as is necessary according to Gnuastro's
    coding conventions).
---
 NEWS            |  2 ++
 lib/cosmology.c | 20 ++++++++++++++++----
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/NEWS b/NEWS
index 9035163e..bfaabbcd 100644
--- a/NEWS
+++ b/NEWS
@@ -247,6 +247,8 @@ See the end of the file for license conditions.
   - gal_wcs_write: as in 'gal_fits_img_write'.
 
 ** Bugs fixed
+  - bug #52295: Cosmology library integrals crash for high z; fixed by
+    Thorsten Alteholz.
   - bug #52674: Correcting Clang warnings on macOS during compilation;
     fixed with help of Thorsten Alteholz and Raul Infante-Sainz.
   - bug #61476: astscript-ds9-region: output created when input file does
diff --git a/lib/cosmology.c b/lib/cosmology.c
index 62bf775f..b5ad954d 100644
--- a/lib/cosmology.c
+++ b/lib/cosmology.c
@@ -222,7 +222,6 @@ double
 gal_cosmology_age(double z, double H0, double o_lambda_0, double o_matter_0,
                   double o_radiation_0)
 {
-  cosmology_density_check(o_lambda_0, o_matter_0, o_radiation_0);
   gsl_function F;
   double result, error;
   double o_curv_0 = 1.0 - ( o_lambda_0 + o_matter_0 + o_radiation_0 );
@@ -231,6 +230,10 @@ gal_cosmology_age(double z, double H0, double o_lambda_0, 
double o_matter_0,
   struct cosmology_integrand_t p={o_lambda_0, o_curv_0, o_matter_0,
                                   o_radiation_0};
 
+  /* Basic sanity check (no problem with the usage of these variables in
+     the definitions above; they are just  */
+  cosmology_density_check(o_lambda_0, o_matter_0, o_radiation_0);
+
   /* Set the GSL function parameters. */
   F.params=&p;
   F.function=&cosmology_integrand_age;
@@ -249,7 +252,6 @@ double
 gal_cosmology_proper_distance(double z, double H0, double o_lambda_0,
                               double o_matter_0, double o_radiation_0)
 {
-  cosmology_density_check(o_lambda_0, o_matter_0, o_radiation_0);
   int status;
   size_t neval;
   gsl_function F;
@@ -261,6 +263,10 @@ gal_cosmology_proper_distance(double z, double H0, double 
o_lambda_0,
   struct cosmology_integrand_t p={o_lambda_0, o_curv_0, o_matter_0,
                                   o_radiation_0};
 
+  /* Basic sanity check (no problem with the usage of these variables in
+     the definitions above; they are just  */
+  cosmology_density_check(o_lambda_0, o_matter_0, o_radiation_0);
+
   /* Set the GSL function parameters */
   F.params=&p;
   F.function=&cosmology_integrand_proper_dist;
@@ -302,7 +308,6 @@ double
 gal_cosmology_comoving_volume(double z, double H0, double o_lambda_0,
                               double o_matter_0, double o_radiation_0)
 {
-  cosmology_density_check(o_lambda_0, o_matter_0, o_radiation_0);
   int status;
   size_t neval;
   gsl_function F;
@@ -316,6 +321,10 @@ gal_cosmology_comoving_volume(double z, double H0, double 
o_lambda_0,
   struct cosmology_integrand_t p={o_lambda_0, o_curv_0, o_matter_0,
                                   o_radiation_0};
 
+  /* Basic sanity check (no problem with the usage of these variables in
+     the definitions above; they are just  */
+  cosmology_density_check(o_lambda_0, o_matter_0, o_radiation_0);
+
   /* Set the GSL function parameters */
   F.params=&p;
   F.function=&cosmology_integrand_comoving_volume;
@@ -357,13 +366,16 @@ double
 gal_cosmology_critical_density(double z, double H0, double o_lambda_0,
                                double o_matter_0, double o_radiation_0)
 {
-  cosmology_density_check(o_lambda_0, o_matter_0, o_radiation_0);
   double H;
   double H0s=H0/1000/GSL_CONST_MKSA_PARSEC;     /* H0 in units of seconds. */
   double o_curv_0 = 1.0 - ( o_lambda_0 + o_matter_0 + o_radiation_0 );
   struct cosmology_integrand_t p={o_lambda_0, o_curv_0, o_matter_0,
                                   o_radiation_0};
 
+  /* Basic sanity check (no problem with the usage of these variables in
+     the definitions above; they are just  */
+  cosmology_density_check(o_lambda_0, o_matter_0, o_radiation_0);
+
   /* Set the place holder, then return the result. */
   H = H0s * cosmology_integrand_Ez(z, &p);
   return 3*H*H/(8*M_PI*GSL_CONST_MKSA_GRAVITATIONAL_CONSTANT)/1000;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]