[Top][All Lists]

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

[gnuastro-commits] master 5d3c9378: Book: extended PSF tutorial not usin

From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 5d3c9378: Book: extended PSF tutorial not using ls to count/use files
Date: Sun, 12 Feb 2023 07:33:22 -0500 (EST)

branch: master
commit 5d3c937813ba667c634e54d7fe7e997aa905d54d
Author: Mohammad Akhlaghi <>
Commit: Mohammad Akhlaghi <>

    Book: extended PSF tutorial not using ls to count/use files
    Until now, in the extended PSF tutorial, we were using 'ls' to get the list
    of files for the inner and outer parts of the PSF. However, in [1], Alex
    Borlaff reported that in some systems the behavior of 'ls' can cause
    problems (by default it behaves like 'ls -1' in GNU Coreutils; printing
    each file on a separate line).
    With this commit, to avoid this situation for future users, we have removed
    this style of 'ls' usage (fortunately the 'imgs' variable was not necessary
    in other places of the tutorial, otherwise, we should have used a more
    complicated fix).
    This problem was reported by Alejandro Serrano Borlaff.
 doc/gnuastro.texi | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 1b5cdedd..240b7c63 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -6623,11 +6623,14 @@ After the stamps are created, we need to stack them 
together with a simple Arith
 The stack is done using the sigma-clipped mean operator that will preserve 
more of the signal, while rejecting outliers (more than @mymath{3\sigma} with a 
tolerance of @mymath{0.2}, for more on sigma-clipping see @ref{Sigma clipping}).
 Just recall that we need to specify the number of inputs into the stacking 
operators, so we are reading the list of images and counting them as separate 
variables before calling Arithmetic.
+@c We are not using something like 'ls' because on some systems, 'ls'
+@c always prints outputs on a one-file-per-line format and this will cause
+@c a problem in Arithmetic, see:
-$ imgs=outer/stamps/*.fits
-$ numimgs=$(echo $imgs | wc -w)
-$ astarithmetic $imgs $numimgs 3 0.2 sigclip-mean -g1 \
-                --output=outer/stack.fits  --wcsfile=none
+$ numimgs=$(echo outer/stamps/*.fits | wc -w)
+$ astarithmetic outer/stamps/*.fits $numimgs 3 0.2 sigclip-mean \
+                -g1 --output=outer/stack.fits --wcsfile=none
 @end example
@@ -6685,6 +6688,8 @@ Similar to before, let's build ready-to-stack crops of 
these stars.
 To get a better feeling of the normalization radii, follow the same steps of 
@ref{Building outer part of PSF} (setting @option{--tmpdir} and 
 In this case, since the stars are fainter, we can set a smaller size for the 
individual stamps, @option{--widthinpix=500,500}, to speed up the calculations:
+@c For 'numimgs' and the 'astarithmetic' commands, see the comments above
+@c the same step for the outer part.
 $ counter=1
 $ mkdir inner/stamps
@@ -6700,10 +6705,9 @@ $ asttable inner/67510-12-13.fits \
                counter=$((counter+1)); \
-$ imgs=inner/stamps/*.fits
-$ numimgs=$(echo $imgs | wc -w)
-$ astarithmetic $imgs $numimgs 3 0.2 sigclip-mean -g1 \
-                --output=inner/stack.fits --wcsfile=none
+$ numimgs=$(echo inner/stamps/*.fits | wc -w)
+$ astarithmetic inner/stamps/*.fits $numimgs 3 0.2 sigclip-mean \
+                -g1 --output=inner/stack.fits --wcsfile=none
 $ astscript-fits-view inner/stack.fits inner/stamps/*.fits
 @end example

reply via email to

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