gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 827a4ee3 2/2: Scripts: setting LC_NUMERIC="en_


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 827a4ee3 2/2: Scripts: setting LC_NUMERIC="en_US.UTF-8" to avoid having commas
Date: Tue, 6 Feb 2024 15:06:29 -0500 (EST)

branch: master
commit 827a4ee3017ecdcbeda0b3ece4cf64779469d451
Author: Raul Infante-Sainz <infantesainz@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Scripts: setting LC_NUMERIC="en_US.UTF-8" to avoid having commas
    
    Until now, we used 'LANG=C' to avoid having commas within the scripts.
    However, even using this option, in some situations the system put commas
    when printing decimal point numbers.
    
    With this commit, for these scripts, we have set 'LC_NUMERIC' in these
    scripts to avoid this problem. Some minor typos were also corrected in the
    Book.
    
    This bug was reported by Jesús Vega.
    
    This fixes bug #65269.
---
 NEWS                           |  8 ++++++--
 THANKS                         |  1 +
 bin/script/color-faint-gray.sh |  7 +++++--
 bin/script/psf-stamp.sh        | 15 ++++++++++++++-
 doc/announce-acknowledge.txt   |  1 +
 doc/gnuastro.texi              | 20 ++++++++++----------
 6 files changed, 37 insertions(+), 15 deletions(-)

diff --git a/NEWS b/NEWS
index ef14d612..e22cde1c 100644
--- a/NEWS
+++ b/NEWS
@@ -40,8 +40,12 @@ See the end of the file for license conditions.
     specify if it is in physical or comoving coordinates. Found and fixed
     by Boud Roukema.
 
-  - bug #65267: astscript-fits-view created incorrect call to ds9 when the
-    number of input files was more than the specified HDUs.
+  - bug #65267: 'astscript-fits-view' created incorrect call to ds9 when
+    the number of input files was more than the specified HDUs.
+
+  - bug #65269: 'astscript-color-faint-gray' and 'astscript-psf-stamp' use
+    a coma as the decimal point on some operating systems. Reported by
+    Jesús Vega and fixed by Raul Infante-Sainz.
 
 
 
diff --git a/THANKS b/THANKS
index d36ff494..a75aef10 100644
--- a/THANKS
+++ b/THANKS
@@ -73,6 +73,7 @@ support in Gnuastro. The list is ordered alphabetically (by 
family name).
     Jenny Sorce                          jenny.sorce@univ-lyon1.fr
     Jeremy Lim                           jjlim@hku.hk
     Jesús Varela                         jvarela@cefca.es
+    Jesús Vega                           astrovega@gmail.com
     Joanna Sakowska                      js01093@surrey.ac.uk
     Johan Knapen                         jhk@iac.es
     Johannes Zabl                        johannes.zabl@irap.omp.eu
diff --git a/bin/script/color-faint-gray.sh b/bin/script/color-faint-gray.sh
index 209653e2..3fe7b1a8 100644
--- a/bin/script/color-faint-gray.sh
+++ b/bin/script/color-faint-gray.sh
@@ -35,8 +35,10 @@ set -e
 # Save the current system language, and then change it to English to avoid
 # problems in some parts of the code (AWK with `,' instead of `.' for
 # decimal separator).
-system_lang=$LANG
+sys_lang=$LANG
 export LANG=C
+sys_lcnumeric=$LC_NUMERIC
+export LC_NUMERIC="en_US.UTF-8"
 
 
 
@@ -1135,4 +1137,5 @@ fi
 
 # The script has finished, reset the original language to the system's
 # default language.
-export LANG=$system_lang
+export LANG=$sys_lang
+export LC_NUMERIC=$sys_lcnumeric
diff --git a/bin/script/psf-stamp.sh b/bin/script/psf-stamp.sh
index 402ac34b..4738bf35 100644
--- a/bin/script/psf-stamp.sh
+++ b/bin/script/psf-stamp.sh
@@ -37,7 +37,10 @@ set -e
 
 # 'LC_NUMERIC' is responsible for formatting numbers printed by the OS.  It
 # prevents floating points like '23,45' instead of '23.45'.
-export LC_NUMERIC=C
+sys_lang=$LANG
+export LANG=C
+sys_lcnumeric=$LC_NUMERIC
+export LC_NUMERIC="en_US.UTF-8"
 
 
 
@@ -917,6 +920,7 @@ if [ x"$quiet" = x ] && [ $normvalue = nan ]; then 
all_nan_warning; fi
 
 
 
+
 # Remove temporary files
 # ----------------------
 #
@@ -925,3 +929,12 @@ if [ x"$quiet" = x ] && [ $normvalue = nan ]; then 
all_nan_warning; fi
 if [ $keeptmp = 0 ]; then
     rm -r $tmpdir
 fi
+
+
+
+
+
+# The script has finished, reset the original language to the system's
+# default language.
+export LANG=$sys_lang
+export LC_NUMERIC=$sys_lcnumeric
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index 68a5aed8..f53790cf 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,5 +1,6 @@
 Alphabetically ordered list to acknowledge in the next release.
 
+Jesús Vega
 Phil Wyett
 
 
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index b907555c..599bb13e 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -5903,7 +5903,7 @@ With the first command below you can use Gnuastro's 
@command{asttable} and @comm
 @example
 ## Create a DS9 region file from the check table (activated
 ## with '--checkuplim')
-asttable lab_upcheck.fits --noblank=RANDOM_SUM \
+asttable sbl_upcheck.fits --noblank=RANDOM_SUM \
          | astscript-ds9-region -c1,2 --mode=img \
                                 --radius=$r_pixel
 
@@ -29370,14 +29370,10 @@ Therefore, before continuing with the various 
measurement limits below, let's re
 Instead of going into the theoretical definitions of the two (which you can 
see in their respective Wikipedia pages), we'll discuss the concepts in a 
hands-on and practical way here.
 
 Let's simulate an observation of the sky, but without any astronomical sources!
-In other words, where we only a background flux level (from the sky emission).
+In other words, we only have a background flux level (from the sky emission).
 With the first command below, let's make an image called @file{1.fits} that 
contains @mymath{200\times200} pixels that are filled with random noise from a 
Poisson distribution with a mean of 100 counts (the flux from the background 
sky).
-Recall that the Poisson distribution is equal to a normal distribution for 
larger mean values (as in this case).
-
-The standard deviation (@mymath{\sigma}) of the Poisson distribution is the 
square root of the mean, see @ref{Photon counting noise}.
 With the second command, we'll have a look at the image.
-Note that due to the random nature of the noise, the values reported in the 
next steps on your computer will be very slightly different.
-To reproducible exactly the same values in different runs, see @ref{Generating 
random numbers}, and for more on the first command, see @ref{Arithmetic}.
+Recall that the Poisson distribution is equal to a normal distribution for 
large mean values (as in this case).
 
 @example
 $ astarithmetic 200 200 2 makenew 100 mknoise-poisson \
@@ -29386,6 +29382,10 @@ $ astarithmetic 200 200 2 makenew 100 mknoise-poisson \
 $ astscript-fits-view 1.fits
 @end example
 
+The standard deviation (@mymath{\sigma}) of the Poisson distribution is the 
square root of the mean, see @ref{Photon counting noise}.
+Note that due to the random nature of the noise, the values reported in the 
next steps on your computer will be very slightly different.
+To reproducible exactly the same values in different runs, see @ref{Generating 
random numbers}, and for more on the first command, see @ref{Arithmetic}.
+
 Each pixel shows the result of one sampling from the Poisson distribution.
 In other words, assuming the sky emission in our simulation is constant over 
our field of view, each pixel's value shows one measurement of the sky emission.
 Statistically speaking, a ``measurement'' is a sampling from an underlying 
distribution of values.
@@ -29576,7 +29576,7 @@ As the surface brightness of the objects decreases, the 
ability to detect them w
 An important statistic is thus the fraction of objects of similar morphology 
and magnitude that will be detected with our detection algorithm/parameters in 
a given image.
 This fraction is known as @emph{completeness}.
 For brighter objects, completeness is 1: all bright objects that might exist 
over the image will be detected.
-However, as we go to objects of lower overall surface brightness, we will fail 
to detect a fraction of them, and fainter than a certain surface brightness 
level (for each morphology),nothing will be detectable in the image: you will 
need more data to construct a ``deeper'' image.
+However, as we go to objects of lower overall surface brightness, we will fail 
to detect a fraction of them, and fainter than a certain surface brightness 
level (for each morphology), nothing will be detectable in the image: you will 
need more data to construct a ``deeper'' image.
 For a given profile and dataset, the magnitude where the completeness drops 
below a certain level (usually above @mymath{90\%}) is known as the 
completeness limit.
 
 @cindex Purity
@@ -29731,7 +29731,7 @@ A more accurate measure which will provide a realistic 
value for every labeled r
 @cindex Correlated noise
 @cindex Noise, correlated
 As mentioned in @ref{Surface brightness limit of image}, the surface 
brightness limit assumes independent pixels when deriving the standard 
deviation (the main input in the equation).
-It just extrapolates the standard devaiation derived from one pixel to the 
requested area.
+It just extrapolates the standard deviation derived from one pixel to the 
requested area.
 But as mentioned at the end of that section, we have correlated noise in our 
science-ready (deep) images and the noise of the pixels are not independent.
 
 Because of this, the surface brightness limit will always under-estimate the 
surface brightness (give fainter values than what is statistically possible in 
the data for the requested area).
@@ -29749,7 +29749,7 @@ In MakeCatalog, the number of these random positions 
can be configured with @opt
 Calculate the sum of pixel values in each randomly placed footprint.
 @item
 Calculate the sigma-clipped standard deviation of the resulting distribution 
(of sum of pixel values in the randomly placed apertures).
-Therefore, each footprint's measurement is be independent of the other.
+Therefore, each footprint's measurement is independent of the other.
 @item
 Calculate the surface brightness of that standrad deviation (after multiplying 
it with your desired multiple of sigma).
 For the definition of surface brightness, see @ref{Brightness flux magnitude}.



reply via email to

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