gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 9ca784e4 27/69: PSF select stars: if the image


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 9ca784e4 27/69: PSF select stars: if the image has not stars in `--min` and `--max` range
Date: Wed, 26 Jan 2022 12:39:12 -0500 (EST)

branch: master
commit 9ca784e4616d43f325907609d9036e194d2eefe6
Author: Sepideh Eskandarlou <sepideh.eskandarlou@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    PSF select stars: if the image has not stars in `--min` and `--max` range
    of magnitude
    
    Until now, if the user had been specified to select the stars in the range
    of magnitude between the `--min` to `--max`, while in the image, stars in
    the range of magnitude between `--min` and `--max` was not exist, the error
    of the "--stdintimeout" had been ocured. Without any warning about the
    stars in this range of magnitude was not exist.
    
    Now with this commit, when the user has specified to select the stars in
    the range of magnitude between `--min`-`--max`, while in the image any
    stars in this range of magnitude does not exist, the script will be
    stopped, and print the "There were no stars in magnitude range `--min` to
    `--max`". In this case the user will be know where is the problem.
---
 bin/script/psf-create-select-stars.in | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/bin/script/psf-create-select-stars.in 
b/bin/script/psf-create-select-stars.in
index 1856b388..06e16e9b 100755
--- a/bin/script/psf-create-select-stars.in
+++ b/bin/script/psf-create-select-stars.in
@@ -51,7 +51,6 @@ max=20
 hdu=""
 bdir=""
 show=""
-input=""
 quiet=""
 catalog=""
 segmented=""
@@ -382,7 +381,16 @@ if [ -f $catalog ]; then
         else
             # Select stars with magnitude between 0 to maximum.
             asttable $catalog --range=$field,0:$max --sort=$field \
+                     --range=ra,$minraimg:$maxraimg \
+                     --range=dec,$mindecimg:$maxdecimg \
                      --output=$query
+
+            numstars=$(asttable $query -i | grep 'Number of rows' | awk 
'{print $4}')
+            if [ "$numstars" = 0 ]; then
+                rm -rf $bdir
+                echo "There were no stars in magnitude range $min to $max"
+                exit 2
+            fi
         fi
     else
         # If catalog doesn't overlap the image stop.



reply via email to

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