gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 31ada36e: psf-stamp: new --snthresh option to


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 31ada36e: psf-stamp: new --snthresh option to mask low S/N pixels
Date: Fri, 19 Aug 2022 13:23:31 -0400 (EDT)

branch: master
commit 31ada36ef0b805e65934e47f33342be3cafcf5da
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    psf-stamp: new --snthresh option to mask low S/N pixels
    
    Until now, the 'astscript-psf-stamp' script would only optionally mask the
    other clumps/objects in its output. However, another type of pixels that
    users don't want are low signal-to-noise ratio pixels (which can degrade
    the final stack's S/N when stars of different magnitudes are used.
    
    With this commit, a new option has been added to this script for this
    purpose: if the user gives this option a value, all pixels below that S/N
    will be masked (and not harm the regions from brighter stars).
    
    Also, until now, to specify the size of the stamps in these two PSF scripts
    we would use the '--stampwidth' option. However, this new name is hard to
    remember! Based on other gnuastro programs like Crop, users expect to have
    the option name start with '--width*'. With this commit, this option has
    been renamed to '--widthinpix' to be similar to a similarly named option in
    Crop, while also being clear that the expected units are in pixels.
    
    This was implemented after a discussion with Sepideh Eskandarlou and Raul
    Infante-Sainz.
---
 NEWS                           | 16 ++++++++++
 bin/convertt/ui.c              |  2 +-
 bin/script/psf-scale-factor.in | 26 ++++++++--------
 bin/script/psf-stamp.in        | 71 ++++++++++++++++++++++++++++--------------
 doc/gnuastro.texi              | 32 +++++++++++++------
 tests/script/psf-stamp.sh      |  2 +-
 6 files changed, 100 insertions(+), 49 deletions(-)

diff --git a/NEWS b/NEWS
index b7f7b22b..fe9066d0 100644
--- a/NEWS
+++ b/NEWS
@@ -77,6 +77,12 @@ See the end of the file for license conditions.
     of the PSF, but for the outer parts it is statistically negligible. So
     to avoid slowing down you pipeline, you can disable sub-pixel warping
     with this option.
+  --snthresh: if given, the value to this option is assumed to be a
+    signal-to-noise ratio (S/N) threshold and all pixels below that S/N
+    will be masked. This is useful because we are often forced to stack
+    stars of differing magnitudes. While the fainter ones are good for the
+    inner parts of the star, they degrade the stack's outer parts. With
+    this option, the fainter stars won't harm the outer parts.
 
   Library functions:
   - gal_box_border_rotate_around_center: width of box after rotation.
@@ -102,6 +108,16 @@ See the end of the file for license conditions.
     level. The "Sufi simulates a detection" (which was previously first)
     has been moved to the fourth section.
 
+  astscript-psf-scale-factor:
+  --widthinpix: new name for the old '--stampwidth' option. This was done
+    to have the same name to a similar option in Crop and help in
+    remembering.
+
+  astscript-psf-stamp:
+  --widthinpix: new name for the old '--stampwidth' option. This was done
+    to have the same name to a similar option in Crop and help in
+    remembering.
+
   Library
   - gal_eps_write: an extra argument has been added to draw marks.
   - gal_pdf_write: similar to 'gal_eps_write'.
diff --git a/bin/convertt/ui.c b/bin/convertt/ui.c
index 9b02c505..ccd1b856 100644
--- a/bin/convertt/ui.c
+++ b/bin/convertt/ui.c
@@ -334,7 +334,7 @@ ui_list_colors(struct converttparams *p)
   printf("# Column 5: FRAC-B     [frac,   f32] Fraction of Blue.\n");
   printf("# Column 6: HEX        [hex,   str6] Color code in hexadecimal.\n");
   printf("# Column 7: EXAMPLE    [n/a,  str35] Example of color in 24-bit "
-         "terminals\n");
+         "terminals.\n");
 
   /* Print each color's information. */
   for(i=1;i<GAL_COLOR_NUMBER;++i)
diff --git a/bin/script/psf-scale-factor.in b/bin/script/psf-scale-factor.in
index 9056a75c..f78e2a7e 100644
--- a/bin/script/psf-scale-factor.in
+++ b/bin/script/psf-scale-factor.in
@@ -46,7 +46,7 @@ keeptmp=0
 tmpdir=""
 segment=""
 normradii=""
-stampwidth=""
+widthinpix=""
 sigmaclip="3,0.1"
 version=@VERSION@
 scriptname=@SCRIPT_NAME@
@@ -94,7 +94,7 @@ $scriptname options:
   -P, --psfhdu=STR        HDU/extension of the PSF image.
   -O, --mode=STR          Coordinates mode ('wcs' or 'img').
   -c, --center=FLT,FLT    Center coordinates of the object.
-  -W, --stampwidth=INT    Width of the stamp in pixels.
+  -W, --widthinpix=INT    Width of the stamp in pixels.
   -n, --normradii=INT,INT Minimum and maximum radii (in pixels)
                           for computing the scaling factor value.
   -S, --segment=STR       Output of Segment (with OBJECTS and CLUMPS).
@@ -283,9 +283,9 @@ do
         -n|--normradii)      normradii="$2";                            
check_v "$1" "$normradii";  shift;shift;;
         -n=*|--normradii=*)  normradii="${1#*=}";                       
check_v "$1" "$normradii";  shift;;
         -n*)                 normradii=$(echo "$1"  | sed -e's/-n//');  
check_v "$1" "$normradii";  shift;;
-        -W|--stampwidth)     stampwidth="$2";                           
check_v "$1" "$stampwidth";  shift;shift;;
-        -W=*|--stampwidth=*) stampwidth="${1#*=}";                      
check_v "$1" "$stampwidth";  shift;;
-        -W*)                 stampwidth=$(echo "$1"  | sed -e's/-W//'); 
check_v "$1" "$stampwidth";  shift;;
+        -W|--widthinpix)     widthinpix="$2";                           
check_v "$1" "$widthinpix";  shift;shift;;
+        -W=*|--widthinpix=*) widthinpix="${1#*=}";                      
check_v "$1" "$widthinpix";  shift;;
+        -W*)                 widthinpix=$(echo "$1"  | sed -e's/-W//'); 
check_v "$1" "$widthinpix";  shift;;
         -S|--segment)        segment="$2";                              
check_v "$1" "$segment";  shift;shift;;
         -S=*|--segment=*)    segment="${1#*=}";                         
check_v "$1" "$segment";  shift;;
         -S*)                 segment=$(echo "$1"  | sed -e's/-S//');    
check_v "$1" "$segment";  shift;;
@@ -487,8 +487,8 @@ fi
 # Otherwise, make the stamp width of the same size than two times the
 # maximum radius for computing the flux factor. This is the maximum radius
 # that is needed for computing the flux value.
-if [ x"$stampwidth" = x ]; then
-    stampwidth=$(astarithmetic $normradiusmax float32 2.0 x 1.0 + --quiet)
+if [ x"$widthinpix" = x ]; then
+    widthinpix=$(astarithmetic $normradiusmax float32 2.0 x 1.0 + --quiet)
 fi
 
 
@@ -502,7 +502,7 @@ fi
 cropped=$tmpdir/cropped-$objectid.fits
 astcrop $inputs --hdu=$hdu --mode=img \
         --center=$xcenter,$ycenter \
-        --width=$stampwidth --output=$cropped $quiet
+        --width=$widthinpix --output=$cropped $quiet
 
 
 
@@ -558,10 +558,10 @@ EOF
         cropobj=$tmpdir/cropped-objects-$objectid.fits
         astcrop $segment --hdu=OBJECTS --mode=img \
                 --center=$xcenter,$ycenter \
-                --width=$stampwidth --output=$cropobj $quiet
+                --width=$widthinpix --output=$cropobj $quiet
         astcrop $segment --hdu=CLUMPS --mode=img \
                 --center=$xcenter,$ycenter \
-                --width=$stampwidth --output=$cropclp $quiet
+                --width=$widthinpix --output=$cropclp $quiet
 
         # Mask all the undesired regions.
         cropped_masked=$tmpdir/cropped-masked-$objectid.fits
@@ -589,7 +589,7 @@ psfycenter=$(astfits $psf -h$psfhdu --keyvalue=NAXIS2 -q \
                  | awk '{print $1/2+0.5}')
 astcrop $psf --hdu=$psfhdu --mode=img \
         --center=$psfxcenter,$psfycenter \
-        --width=$stampwidth --output=$psfcropped $quiet
+        --width=$widthinpix --output=$psfcropped $quiet
 
 
 
@@ -597,8 +597,8 @@ astcrop $psf --hdu=$psfhdu --mode=img \
 
 # Build a radial profile image. It will be used to only select pixels
 # within the requested radial range.
-radcenter=$(echo $stampwidth | awk '{print $1/2+0.5}')
-radradius=$(echo $stampwidth | awk '{print $1+2}')
+radcenter=$(echo $widthinpix | awk '{print $1/2+0.5}')
+radradius=$(echo $widthinpix | awk '{print $1+2}')
 radcropped=$tmpdir/cropped-radial-$objectid.fits
 echo "1 $radcenter $radcenter 7 $radradius 0 0 1 1 1" \
      | astmkprof --background=$psfcropped --clearcanvas \
diff --git a/bin/script/psf-stamp.in b/bin/script/psf-stamp.in
index 8633a459..ba55b395 100644
--- a/bin/script/psf-stamp.in
+++ b/bin/script/psf-stamp.in
@@ -51,10 +51,11 @@ keeptmp=0
 output=""
 tmpdir=""
 segment=""
+snthresh=""
 axisratio=1
 normradii=""
 sigmaclip=""
-stampwidth=""
+widthinpix=""
 nocentering=0
 normop="median"
 positionangle=0
@@ -99,7 +100,9 @@ $scriptname options:
   -h, --hdu=STR           HDU/extension of all input FITS files.
   -O, --mode=STR          Coordinates mode ('wcs' or 'img').
   -c, --center=FLT,FLT    Center coordinates of the object.
-  -W, --stampwidth=INT,INT Width of the stamp in pixels.
+  -W, --widthinpix=INT,INT Width of the stamp in pixels.
+  -T, --snthresh=FLT      Mask pixels below this S/N (only when
+                          '--segment' is given).
   -n, --normradii=INT,INT Minimum and maximum radii (in pixels)
                           for computing the normalization value.
   -S, --segment=STR       Output of Segment (with OBJECTS and CLUMPS).
@@ -294,9 +297,12 @@ do
         -n|--normradii)      normradii="$2";                            
check_v "$1" "$normradii";  shift;shift;;
         -n=*|--normradii=*)  normradii="${1#*=}";                       
check_v "$1" "$normradii";  shift;;
         -n*)                 normradii=$(echo "$1"  | sed -e's/-n//');  
check_v "$1" "$normradii";  shift;;
-        -W|--stampwidth)     stampwidth="$2";                           
check_v "$1" "$stampwidth";  shift;shift;;
-        -W=*|--stampwidth=*) stampwidth="${1#*=}";                      
check_v "$1" "$stampwidth";  shift;;
-        -W*)                 stampwidth=$(echo "$1"  | sed -e's/-W//'); 
check_v "$1" "$stampwidth";  shift;;
+        -W|--widthinpix)     widthinpix="$2";                           
check_v "$1" "$widthinpix";  shift;shift;;
+        -W=*|--widthinpix=*) widthinpix="${1#*=}";                      
check_v "$1" "$widthinpix";  shift;;
+        -W*)                 widthinpix=$(echo "$1"  | sed -e's/-W//'); 
check_v "$1" "$widthinpix";  shift;;
+        -T|--snthresh)       snthresh="$2";                             
check_v "$1" "$snthresh";  shift;shift;;
+        -T=*|--snthresh=*)   snthresh="${1#*=}";                        
check_v "$1" "$snthresh";  shift;;
+        -T*)                 snthresh=$(echo "$1"  | sed -e's/-W//');   
check_v "$1" "$snthresh";  shift;;
         -S|--segment)        segment="$2";                              
check_v "$1" "$segment";  shift;shift;;
         -S=*|--segment=*)    segment="${1#*=}";                         
check_v "$1" "$segment";  shift;;
         -S*)                 segment=$(echo "$1"  | sed -e's/-S//');    
check_v "$1" "$segment";  shift;;
@@ -405,22 +411,22 @@ EOF
     ycoord=$(echo "$center" | awk 'BEGIN{FS=","} {print $2}')
 fi
 
-# If a stamp width (--stampwidth) is not given, assume the same size than
+# If a stamp width (--widthinpix) is not given, assume the same size than
 # the input.  If the input image has an odd number of pixels, it is fine.
 # Otherwise, if the input image has an even number of pixels, then it has
 # to be cropped around the center position and the size will be set to an
 # odd number of pixels. In this case print a warnings.
-if [ x"$stampwidth" = x ]; then
+if [ x"$widthinpix" = x ]; then
 
     if [ x"$xsizetype" = xeven ]; then
-        xstampwidth=$(echo $xsize | awk '{print $1+1}')
+        xwidthinpix=$(echo $xsize | awk '{print $1+1}')
         if [ x"$quiet" = x ]; then
             cat <<EOF
 $scriptname: WARNING: the image along the first dimension (NAXIS1) has an even 
number of pixels ($xsize). This may cause some problems with the centering of 
the stamp. Please, check and consider providing an image with an odd number of 
pixels
 EOF
         fi
     elif [ x"$xsizetype" = xodd ]; then
-        xstampwidth=$xsize
+        xwidthinpix=$xsize
     else
         cat <<EOF
 $scriptname: ERROR: the size of the image along the first dimension (NAXIS1) 
can not be obtained
@@ -428,14 +434,14 @@ EOF
         exit 1
     fi
     if [ x"$ysizetype" = xeven ]; then
-        ystampwidth=$(echo $ysize | awk '{print $1+1}')
+        ywidthinpix=$(echo $ysize | awk '{print $1+1}')
         if [ x"$quiet" = x ]; then
             cat <<EOF
 $scriptname: WARNING: the image along the second dimension (NAXIS2) has an 
even number of pixels ($ysize). This may cause some problems with the centering 
of the stamp. Please, check and consider providing an image with an odd number 
of pixels
 EOF
         fi
     elif [ x"$ysizetype" = xodd ]; then
-        ystampwidth=$ysize
+        ywidthinpix=$ysize
     else
         cat <<EOF
 $scriptname: ERROR: the size of the image along the second dimension (NAXIS2) 
can not be obtained
@@ -444,20 +450,20 @@ EOF
     fi
     if [ x"$quiet" = x ]; then
         cat <<EOF
-$scriptname: WARNING: no stamp width provided ('--stampwidth' or '-W'). 
Considering that the stamp width is $xstampwidth x $ystampwidth
+$scriptname: WARNING: no stamp width provided ('--widthinpix' or '-W'). 
Considering that the stamp width is $xwidthinpix x $ywidthinpix
 EOF
     fi
 else
-    nstampwidth=$(echo $stampwidth | awk 'BEGIN{FS=","}END{print NF}')
-    if [ x$nstampwidth != x2 ]; then
+    nwidthinpix=$(echo $widthinpix | awk 'BEGIN{FS=","}END{print NF}')
+    if [ x$nwidthinpix != x2 ]; then
         cat <<EOF
-$scriptname: '--stampwidth' (or '-W') only take two values, but $nstampwidth 
were given in '$stampwidth'
+$scriptname: '--widthinpix' (or '-W') only take two values, but $nwidthinpix 
were given in '$widthinpix'
 EOF
         exit 1
     fi
     # Obtain the coordinates of the center.
-    xstampwidth=$(echo "$stampwidth" | awk 'BEGIN{FS=","} {print $1}')
-    ystampwidth=$(echo "$stampwidth" | awk 'BEGIN{FS=","} {print $2}')
+    xwidthinpix=$(echo "$widthinpix" | awk 'BEGIN{FS=","} {print $1}')
+    ywidthinpix=$(echo "$widthinpix" | awk 'BEGIN{FS=","} {print $2}')
 fi
 
 # If a normalization range is not given at all.
@@ -567,7 +573,7 @@ fi
 # of the PSF of a star that is centered outside of the image).
 cropped=$tmpdir/cropped-$objectid.fits
 astcrop $inputs --hdu=$hdu --mode=img --checkcenter=0 \
-        --width=$xstampwidth,$ystampwidth \
+        --width=$xwidthinpix,$ywidthinpix \
         --center=$xcenter,$ycenter \
         --output=$cropped $quiet
 if ! [ -f $cropped ]; then
@@ -575,7 +581,7 @@ if ! [ -f $cropped ]; then
     # 'makenew' will generate a fully 0-valued image. Adding (with '+') any
     # number by NaN will be NaN. Therefore the output of the Arithmetic
     # command below will be a fully NaN-valued image.
-    astarithmetic $xstampwidth $ystampwidth 2 makenew float32 \
+    astarithmetic $xwidthinpix $ywidthinpix 2 makenew float32 \
                   nan + $quiet --output=$output
 
     # Write an empty 'NORMVAL' keyword (as is expected from this program).
@@ -641,10 +647,10 @@ EOF
         cropobj=$tmpdir/cropped-objects-$objectid.fits
         astcrop $segment --hdu=OBJECTS --mode=img \
                 --center=$xcenter,$ycenter \
-                --width=$xstampwidth,$ystampwidth --output=$cropobj $quiet
+                --width=$xwidthinpix,$ywidthinpix --output=$cropobj $quiet
         astcrop $segment --hdu=CLUMPS --mode=img \
                 --center=$xcenter,$ycenter \
-                --width=$xstampwidth,$ystampwidth --output=$cropclp $quiet
+                --width=$xwidthinpix,$ywidthinpix --output=$cropclp $quiet
 
         # Mask all the undesired regions.
         cropped_masked=$tmpdir/cropped-masked-$objectid.fits
@@ -657,6 +663,23 @@ EOF
                       o o $olab eq 0 where set-omask \
                       i omask cmask or nan where
     fi
+
+    # Apply the signal-to-noise threshold if the user provided one.
+    if [ x"$snthresh" != x ]; then
+       cropsnt=$tmpdir/cropped-snt-$objectid.fits
+       cropstd=$tmpdir/cropped-std-$objectid.fits
+       astcrop $segment --hdu=SKY_STD --mode=img \
+                --center=$xcenter,$ycenter \
+                --width=$xwidth,$ywidth \
+               --output=$cropstd $quiet
+       astarithmetic $cropped_masked -h1 set-v \
+                     $cropstd -h1        set-s \
+                     v s /               set-sn \
+                     v sn $snthresh lt \
+                     2 dilate nan where -o$cropsnt
+       mv $cropsnt $cropped_masked
+    fi
+
 else
     cropped_masked=$cropped
 fi
@@ -678,11 +701,11 @@ first_pix_in_img () {
 
     # Find the minimim and maximum from the cropped image.
     if [ $dim = x ]; then
-        width=$xstampwidth
+        width=$xwidthinpix
         min=$(echo "$overlaprange" | awk '{print $1}')
         max=$(echo "$overlaprange" | awk '{print $2}')
     elif [ $dim = y ]; then
-        width=$ystampwidth
+        width=$ywidthinpix
         min=$(echo "$overlaprange" | awk '{print $3}')
         max=$(echo "$overlaprange" | awk '{print $4}')
     else
@@ -768,7 +791,7 @@ if [ $nocentering = 0 ]; then
     CXY=$(echo "$warpcoord" | awk '{print $2}')
     astcrop $warpped -h1 \
             --mode=img --output=$centermsk \
-            --center=$CXY --width=$xstampwidth,$ystampwidth
+            --center=$CXY --width=$xwidthinpix,$ywidthinpix
 else
     # If the user did not want to correct the center of image, we'll use
     # the raw crop as input for the next step.
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index be7244b3..1ce9616a 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -6344,7 +6344,7 @@ $ asttable outer/67510-6-10.fits \
                astscript-psf-stamp label/67510-seg.fits \
                     --mode=wcs \
                     --nocentering \
-                    --stampwidth=1000 \
+                    --widthinpix=1000 \
                     --center=$ra,$dec \
                     --normradii=500,510 \
                     --segment=label/67510-seg.fits \
@@ -6387,7 +6387,7 @@ $ asttable outer/67510-6-10.fits \
                astscript-psf-stamp label/67510-seg.fits \
                     --mode=wcs \
                     --nocentering \
-                    --stampwidth=1000 \
+                    --widthinpix=1000 \
                     --center=$ra,$dec \
                     --normradii=20,30 \
                     --segment=label/67510-seg.fits \
@@ -6460,7 +6460,7 @@ Only the very central core of some of the stars is 
saturated.
 We can therefore use these stars to fill the strong bleeding footprints that 
were present in the outer stack of @file{outer/stack.fits}.
 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 
@option{--keeptmp}).
-In this case, since the stars are fainter, we can set a smaller size for the 
individual stamps, @option{--stampwidth=500}, to speed up the calculations:
+In this case, since the stars are fainter, we can set a smaller size for the 
individual stamps, @option{--widthinpix=500}, to speed up the calculations:
 
 @example
 $ counter=1
@@ -6469,7 +6469,7 @@ $ asttable inner/67510-12-13.fits \
            | while read -r ra dec mag; do
                astscript-psf-stamp label/67510-seg.fits \
                     --mode=wcs \
-                    --stampwidth=500 \
+                    --widthinpix=500 \
                     --center=$ra,$dec \
                     --normradii=5,10 \
                     --segment=label/67510-seg.fits \
@@ -27281,7 +27281,7 @@ Examples:
 ## Make a stamp around (x,y)=(53,69) of width=151 pixels.
 ## Normalize the stamp within the radii 20 and 30 pixels.
 $ astscript-psf-stamp image.fits --mode=img \
-      --center=53,69 --stampwidth=151 --normradii=20,30 \
+      --center=53,69 --widthinpix=151 --normradii=20,30 \
       --output=stamp.fits
 
 ## Iterate over a catalog with positions of stars that are
@@ -27289,7 +27289,7 @@ $ astscript-psf-stamp image.fits --mode=img \
 $ asttable catalog.fits | while read -r ra dec mag; do \
     astscript-psf-stamp image.fits \
         --mode=wcs \
-        --stampwidth=150 \
+        --widthinpix=150 \
         --center=$ra,$dec \
         --normradii=20,30 \
         --output=stamp-"$ra"-"$dec".fits; done
@@ -27300,7 +27300,7 @@ The input is an image from which the stamp of the stars 
are constructed.
 The output image will have the following properties:
 @itemize
 @item
-A certain width (specified by @option{--stampwidth} in pixels).
+A certain width (specified by @option{--widthinpix} in pixels).
 @item
 Centered at the coordinate specified by the option @option{--center} (it can 
be in image/pixel or WCS coordinates, see @option{--mode}).
 If no center is specified, then it is assumed that the object of interest is 
already in the center of the image.
@@ -27312,7 +27312,7 @@ Normalized ``normalized'' by the value computed within 
the ring around the cente
 If no normalization ring is considered, the output will not be normalized.
 @end itemize
 
-In the following cases, this script will produce a fully NaN-valued stamp (of 
the size given to @option{--stampwidth}).
+In the following cases, this script will produce a fully NaN-valued stamp (of 
the size given to @option{--widthinpix}).
 A fully NaN image can safely be used with the stacking operators of Arithmetic 
(see @ref{Stacking operators}) because they will be ignored.
 In case you don't want to waste storage with fully NaN images, you can 
compress them with @code{gzip --best output.fits}, and give the resulting 
@file{.fits.gz} file to Arithmetic.
 @itemize
@@ -27359,7 +27359,7 @@ Don't do the sub-pixel centering to a new pixel grid.
 See the description of the @option{--center} option for more.
 
 @item -W INT
-@itemx --stampwidth=INT
+@itemx --widthinpix=INT
 Size (width) of the output image stamp in pixels.
 The size of the output image will be always an odd number of pixels.
 As a consequence, if the user specify an even number, the final size will be 
the specified size plus 1 pixel.
@@ -27388,6 +27388,18 @@ The non masked object and clump labels are kept into 
the header of the output im
 The keywords are @code{CLABEL} and @code{OLABEL}.
 If no segmentation image is used, then their values are set to @code{none}.
 
+@item -T FLT
+@itemx --snthresh=FLT
+Mask all the pixels below the given signal-to-noise ratio (S/N) threshold.
+This option is only valid with the @option{--segment} option (it will use the 
@code{SKY_STD} extension of the @ref{Segment output}.
+This threshold is applied prior to the possible normalization or centering of 
the stamp.
+After all pixels below the given threshold are masked, the mask is also 
dilated by one level to avoid single pixels above the threshold (which are 
mainly due to noise when the threshold is lower).
+
+This is useful for increasing the S/N of inner parts of each region of the 
finally stacked PSF.
+As the stars (that are to be stacked) become fainter, the S/N of their outer 
parts (at a fixed radius) decreases.
+The stack of a higher-S/N image with a lower-S/N image will have an S/N that 
is lower than the higher one.
+But we can still use the inner parts of those fainter stars (that have 
sufficiently high S/N).
+
 @item -N STR
 @itemx --normop=STR
 The operator for measuring the values within the ring defined by the option 
@option{--normradii}.
@@ -27633,7 +27645,7 @@ The first value is the inner radius, the second is the 
outer radius.
 These two radii define a ring of pixels around the center that is used for 
obtaining the scale factor value.
 
 @item -W INT
-@itemx --stampwidth=INT
+@itemx --widthinpix=INT
 Size (width) of the image stamp in pixels.
 This is an intermediate product computed internally by the script.
 By default, the size of the stamp is automatically set to be as small as 
possible (i.e., two times the external radius of the ring specified by 
@option{--normradii}) to make the computation fast.
diff --git a/tests/script/psf-stamp.sh b/tests/script/psf-stamp.sh
index fb9c7775..b1cd5524 100755
--- a/tests/script/psf-stamp.sh
+++ b/tests/script/psf-stamp.sh
@@ -75,6 +75,6 @@ export PATH="$progbdir:$PATH"
 x=$($dep2name $fits1name -h1 | awk '/^NAXIS1/{print $3/2}')
 y=$($dep2name $fits1name -h1 | awk '/^NAXIS2/{print $3/2}')
 $check_with_program $execname $fits1name --center=$x,$y --mode=img \
-                              --stampwidth=100,100 \
+                              --widthinpix=100,100 \
                               --output=$prog.fits \
                               --tmpdir=tmpdir-$prog



reply via email to

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