gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master ad7fb58 26/32: Central coordinates of the crop


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master ad7fb58 26/32: Central coordinates of the cropped image
Date: Wed, 24 Feb 2021 22:36:19 -0500 (EST)

branch: master
commit ad7fb58e3eb1805f9c0e4009eae45900b987a10f
Author: Zahra Sharbaf <zahra.sharbaf2@gmail.com>
Commit: Zahra Sharbaf <zahra.sharbaf2@gmail.com>

    Central coordinates of the cropped image
    
    Until now, to do an efficient process, at the beginning of the script, we
    cropped the input image based on the specified coordinates and maximum
    radius and then continue the process on the cropped image.
    
    With this commit, the definition of the central coordinates after cropping
    the image changed. Whit this change, the script be usable for the star in
    the image's border, and in a case which we have the half star to calculate
    radial profile.
---
 bin/script/radial-profile.in | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/bin/script/radial-profile.in b/bin/script/radial-profile.in
index 210bc72..fef9d8e 100644
--- a/bin/script/radial-profile.in
+++ b/bin/script/radial-profile.in
@@ -413,15 +413,19 @@ if [ z$output = zdefault ]; then 
output="$defaultname.fits"; fi
 # of that string, and convert to the cropped coordinate system. Note that
 # because FITS pixel couting starts from 1, we need to subtract '1'.
 crop=$tmpdir/crop.fits
-cropwidth=$(echo $rmax | awk '{print $1*2}')
+cropwidth=$(echo $rmax | awk '{print $1*2+1}')
 astcrop $inputs --hdu=$hdu --center=$x,$y --mode=img \
         --width=$cropwidth --output=$crop
 dxy=$(astfits $crop -h1 \
           | grep ICF1PIX \
           | sed -e"s/'/ /g" -e's/\:/ /g' -e's/,/ /' \
           | awk '{print $3-1, $5-1}')
-x=$(echo "$x $dxy" | awk '{print $1-$2}')
-y=$(echo "$y $dxy" | awk '{print $1-$3}')
+echo "x:$x"
+echo "y:$y"
+echo "cropwidth: $cropwidth"
+echo "dxy: $dxy"
+x=$(echo "$x $cropwidth $dxy" | awk '{if($1>int($2/2)) print $1-$3; else print 
int($2/2)+$1-int($1)}')
+y=$(echo "$y $cropwidth $dxy" | awk '{if($1>int($2/2)) print $1-$4; else print 
int($2/2)+$1-int($1)}')
 
 
 
@@ -433,6 +437,8 @@ y=$(echo "$y $dxy" | awk '{print $1-$3}')
 # The apertures image is genrated using MakeProfiles with the parameters
 # previously specified in the ascii file.
 apertures=$tmpdir/apertures.fits
+echo "x:$x"
+echo "y:$y"
 echo "$rmax $x $y 7 $rmax 1 $p $Q $rmax 1" \
     | astmkprof --background=$crop --backhdu=1 --mforflatpix \
                 --mode=$mode --clearcanvas --type=int16 \
@@ -444,6 +450,7 @@ echo "$rmax $x $y 7 $rmax 1 $p $Q $rmax 1" \
 
 
 
+
 # Obtain the radial profile
 # -------------------------
 #
@@ -616,6 +623,7 @@ fi
 # ---------------------
 #
 # If the user has specified this option, temporal files will be removed.
+k=0
 if [ $k = 1 ]; then
     rm $crop \
        $aprofile \



reply via email to

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