gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 3cc85d96 34/39: astscript-zeropoint: new optio


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 3cc85d96 34/39: astscript-zeropoint: new option --matchradius added
Date: Wed, 19 Apr 2023 12:18:27 -0400 (EDT)

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

    astscript-zeropoint: new option --matchradius added
    
    Until this commit, when matching with the reference catalog, a fixed
    matching distance (0.2 arcsec) was considered. However, it is not good to
    have such important parameter fixed. In some situations it would be
    necessary to change this parameter.
    
    With this commit, the possibility of changing this matching distance has
    been added. Now the zero point script has an option, -s/--matchradius, to
    modify that parameter.
---
 bin/script/zeropoint.in | 20 +++++++++++++-------
 bin/script/zeropoint.mk |  3 ++-
 doc/gnuastro.texi       |  6 ++++++
 3 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/bin/script/zeropoint.in b/bin/script/zeropoint.in
index 966684b0..6730ffcc 100644
--- a/bin/script/zeropoint.in
+++ b/bin/script/zeropoint.in
@@ -60,6 +60,7 @@ racolumn="RA"
 referencezp=""
 referencehdu=""
 deccolumn="DEC"
+matchradius=0.2
 magnituderange=""
 magcolumn="MAGNITUDE"
 version=@VERSION@magmg
@@ -97,12 +98,13 @@ $scriptname options:
   -d, --deccolumn=STR          Declination (Dec) column name of the ref. 
catalog.
   -m, --magcolumn=STR          Magnitude column name of the ref. catalog.
   -M, --magnituderange=FLT,FLT Range of the magnitude to be considered.
+  -s, --matchradius=FLT        Matching distance with the ref. catalog.
 
   -R, --reference=STR[,STR]    Image(s) considered as the reference(s).
   -z, --referencezp=FLT[,FLT]  Zero point(s) of the reference image(s).
   -H, --referencehdu=STR/INT   HDU/Extension name(s) or number(s) the ref. 
images.
-  -a, --aperarcsec=FLT[,FLT]   Aperture radius (in arco seconds).
-  -K, --keepzpap               Keep a zero point for each aperture in a 
different HDU.
+  -a, --aperarcsec=FLT[,FLT]   Aperture radius (in arco seconds) for 
photometry.
+  -K, --keepzpap               Keep the zero point from each aperture in a 
different HDU.
   -j, --jobs=INT               Number of threads; maximum jobs with no arg.
 
  Output:
@@ -275,6 +277,9 @@ do
        -m|--magcolumn)          magcolumn="$2";                               
check_v "$1" "$magcolumn";  shift;shift;;
        -m=*|--magcolumn=*)      magcolumn="${1#*=}";                          
check_v "$1" "$magcolumn";  shift;;
        -m*)                     magcolumn=$(echo "$1" | sed -e's/-m//');      
check_v "$1" "$magcolumn";  shift;;
+       -s|--matchradius)        matchradius="$2";                             
check_v "$1" "$matchradius";  shift;shift;;
+       -s=*|--matchradius=*)    matchradius="${1#*=}";                        
check_v "$1" "$matchradius";  shift;;
+       -s*)                     matchradius=$(echo "$1" | sed -e's/-s//');    
check_v "$1" "$matchradius";  shift;;
 
        -M|--magnituderange)     magnituderange="$2";                          
check_v "$1" "$magnituderange";  shift;shift;;
        -M=*|--magnituderange=*) magnituderange="${1#*=}";                     
check_v "$1" "$magnituderange";  shift;;
@@ -492,11 +497,12 @@ fi
 #
 # Basic parameters.
 config=$tmpdir/zeropoint.conf
-echo "input    = $inputs"  > $config
-echo "output   = $output" >> $config
-echo "hduinput = $hdu"    >> $config
-echo "zpinput  = 0"       >> $config
-echo "tmpdir   = $tmpdir" >> $config
+echo "zpinput = 0" > $config
+echo "input = $inputs" >> $config
+echo "hduinput = $hdu" >> $config
+echo "output = $output" >> $config
+echo "tmpdir = $tmpdir" >> $config
+echo "matchradius = $matchradius" >> $config
 
 # Magnitude range. Empty string if not provided.
 if [ x$magnituderange = x ]; then
diff --git a/bin/script/zeropoint.mk b/bin/script/zeropoint.mk
index b8ff6942..06d22674 100644
--- a/bin/script/zeropoint.mk
+++ b/bin/script/zeropoint.mk
@@ -183,8 +183,9 @@ $(magdiff): $(tmpdir)/%-magdiff.fits: $(tmpdir)/%-cat.fits \
        match=$(subst .fits,-match.fits,$@)
        input=$(tmpdir)/input-$(word 2,$(subst -, ,$*))-cat.fits
        astmatch $$ref --hdu=1 $$input --hdu2=1 \
-                --ccol1=RA,DEC --ccol2=RA,DEC --aperture=0.2 \
+                --ccol1=RA,DEC --ccol2=RA,DEC \
                 --outcols=aMAGNITUDE,bMAGNITUDE \
+                --aperture=$(matchradius) \
                 --output=$$match
 
 #      Subtract the reference catalog mag from input catalog's mag.
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 0ccd7aae..a2c63365 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -30026,6 +30026,12 @@ Magnitude column name of the reference catalog.
 @itemx --reference=STR,[STR]
 Reference image or images which based on the zeropoint of the input image will 
be estimated.
 
+@item -s FLT
+@itemx --matchradius=FLT
+Matching radius in arc seconds.
+The searching distance to match sources with the reference catalog.
+By default it is 0.2 arcsec.
+
 @item -z FLT,[FLT]
 @itemx --referencezp=FLT,[FLT]
 Zeropoint of the reference image or images.



reply via email to

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