gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master d99fc9df 60/69: PSF select-stars: add new opti


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master d99fc9df 60/69: PSF select-stars: add new option for selecting more bright stars
Date: Wed, 26 Jan 2022 12:39:16 -0500 (EST)

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

    PSF select-stars: add new option for selecting more bright stars
    
    Until now, for select the bright stars in wider range than user has been
    determined, the constant value had been considered. And then based on this
    constant value the wide bright stars had been selected and find the number
    of neighbors around the main star.
    
    With this commit, the new option '--brightmag' has been added, that
    selecting the bright stars in the wider range to be optional.
---
 bin/script/psf-create-select-stars.in | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/bin/script/psf-create-select-stars.in 
b/bin/script/psf-create-select-stars.in
index 0834734e..f2d5fee3 100755
--- a/bin/script/psf-create-select-stars.in
+++ b/bin/script/psf-create-select-stars.in
@@ -46,6 +46,7 @@ output=""
 tmpdir=""
 catalog=""
 keeptmp=""
+brightmag=""
 segmented=""
 racolumn="ra"
 mindistdeg=""
@@ -110,6 +111,7 @@ $scriptname options:
   -F, --faintmagdiff      The difference from the faintest star which the user 
will
                           be determined the faintest star in "--magnituderange"
                           option.
+  -b, --brightmag         The limit for selecting wider range of bright stars.
 
  Output:
   -o, --output            Output table with the object coordinates.
@@ -235,6 +237,9 @@ do
        -F|--faintmagdiff)      faintmagdiff="$2";                            
check_v "$1" "$faintmagdiff";  shift;shift;;
        -F=*|--faintmagdiff=*)  faintmagdiff="${1#*=}";                       
check_v "$1" "$faintmagdiff";  shift;;
        -F*)                    faintmagdiff=$(echo "$1" | sed -e's/-F//');   
check_v "$1" "$faintmagdiff";  shift;;
+       -b|--brightmag)         brightmag="$2";                               
check_v "$1" "$brightmag";  shift;shift;;
+       -b=*|--brightmag=*)     brightmag="${1#*=}";                          
check_v "$1" "$brightmag";  shift;;
+       -b*)                    brightmag=$(echo "$1" | sed -e's/-b//');      
check_v "$1" "$brightmag";  shift;;
        -m|--magnituderange)    magnituderange="$2";                          
check_v "$1" "$magnituderange";  shift;shift;;
        -m=*|--magnituderange=*) magnituderange="${1#*=}";                    
check_v "$1" "$magnituderange";  shift;;
        -m*)                    magnituderange=$(echo "$1" | sed -e's/-m//'); 
check_v "$1" "$magnituderange";  shift;;
@@ -294,6 +299,21 @@ elif [ ! -f $inputs ]; then
     exit 1
 fi
 
+# Check the user provide the magnitude of the faintest stars which she/he
+# want compare.
+if [ x"$faintmagdiff" = x ]; then
+    echo "$scriptname:: The '--faintmagdiff' dose not provided."
+    exit 1
+fi
+
+# Check the user provide the magnitude of the brightest stars which she/he
+# want compare.
+if [ x"$brightmag" = x ]; then
+    echo "$scriptname:: The '--brightmag' dose not provided."
+    exit 1
+fi
+
+
 # Check that 'segmented' is output of 'astsegment'.
 if [ x"$segmented" != x ]; then
     nhdu=$(astfits $segmented --listimagehdus \
@@ -372,7 +392,6 @@ faintmag=$(echo "$magnituderange" | awk 'BEGIN{FS=","} 
{print $2}')
 
 # Range of magnitude which are in the wider range of brighter and fainter
 # magnitude.
-brighter=-10
 fainter=$(astarithmetic $faintmag $faintmagdiff + --quiet)
 
 # Obtain the parallax and parallax_error columns name.
@@ -430,7 +449,7 @@ fi
 #
 # The output name of the catalog of stars in the range of the magnitude
 # between smaller than the brighter and larger than the fainter.
-catalog_main=$tmpdir/catalog-main-$brighter-$fainter.fits
+catalog_main=$tmpdir/catalog-main-$brightmag-$fainter.fits
 
 # The output name of the sky coverage.
 skycoverage=$tmpdir/skycoverage.fits
@@ -476,7 +495,7 @@ if [ x"$catalog" != x ]; then
             echo "External Cataloge already exists "
         else
             # Select stars with magnitude between brighter to fainter.
-            asttable $catalog --range=$field,$brighter,$fainter --sort=$field \
+            asttable $catalog --range=$field,$brightmag,$fainter --sort=$field 
\
                      --range=$racolumn,$minraimg,$maxraimg \
                      --range=$deccolumn,$mindecimg,$maxdecimg \
                      --output=$catalog_main $quiet
@@ -503,7 +522,7 @@ else
         astquery $dataset --output=$catalog_main \
                 --overlapwith=$inputs --hdu=$hdu \
                  --column=$columnquery \
-                --range=$field,$brighter,$fainter \
+                --range=$field,$brightmag,$fainter \
                  --sort=$field $quiet
     fi
 fi



reply via email to

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