gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 595186ae 2/3: psf-scale-factor: correcting a b


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 595186ae 2/3: psf-scale-factor: correcting a bug in the center position of the PSF
Date: Tue, 21 Mar 2023 12:16:45 -0400 (EDT)

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

    psf-scale-factor: correcting a bug in the center position of the PSF
    
    Until this commit, the center of the PSF was not properly computed. It was
    0.5-pixel added while it should be 1-pixel added. I found this problem
    while constructing the PSF of the T80 (OAJ).
    
    With this commit I changed the 0.5 to 1.0 pixel so the PSF is properly
    centered. I tested this change with a mock profile. The factor by which it
    was necessary to scale a mock PSF to match with itself at a given radius
    was < 1.0 (0.95 or so). Now, with the correction, it is almost 1.0
    (0.99999999).
---
 bin/script/psf-scale-factor.in | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/script/psf-scale-factor.in b/bin/script/psf-scale-factor.in
index 7ec0ae7c..36b13126 100644
--- a/bin/script/psf-scale-factor.in
+++ b/bin/script/psf-scale-factor.in
@@ -706,9 +706,9 @@ fi
 # Crop the PSF image with the same size.
 psfcropped=$tmpdir/cropped-psf-$objectid.fits
 psfxcenter=$(astfits $psf -h$psfhdu --keyvalue=NAXIS1 --quiet \
-                     | awk '{print $1/2+0.5}')
+                     | awk '{print $1/2+1}')
 psfycenter=$(astfits $psf -h$psfhdu --keyvalue=NAXIS2 --quiet \
-                     | awk '{print $1/2+0.5}')
+                     | awk '{print $1/2+1}')
 astcrop $psf --hdu=$psfhdu --mode=img \
         --center=$psfxcenter,$psfycenter \
         --width=$xwidthinpix,$ywidthinpix \
@@ -720,8 +720,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.
-xradcenter=$(echo $xwidthinpix | awk '{print $1/2+0.5}')
-yradcenter=$(echo $ywidthinpix | awk '{print $1/2+0.5}')
+xradcenter=$(echo $xwidthinpix | awk '{print $1/2+1}')
+yradcenter=$(echo $ywidthinpix | awk '{print $1/2+1}')
 maxradius=$(printf "$xwidthinpix\n$ywidthinpix" \
                    | aststatistics --maximum --quiet)
 radcropped=$tmpdir/cropped-radial-$objectid.fits



reply via email to

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