gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master b1e3da80 34/69: PSF junction: fixed bug when c


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master b1e3da80 34/69: PSF junction: fixed bug when centering the different parts of the PSF
Date: Wed, 26 Jan 2022 12:39:12 -0500 (EST)

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

    PSF junction: fixed bug when centering the different parts of the PSF
    
    Until this commit, when merging two different parts of the PSF the center
    of the final merged PSF was not the correct one. In addition to this, also
    the image used for masking the inner part of the outer PSF, and the outer
    part of the inner PSF, was not properly constructed.  With this commit,
    both problems have been solved. By changing the way the center of the PFS
    and the mask profile, now the final PSF has the correct center position and
    the junction is also done in the proper radius.
---
 bin/script/psf-create-junction.in | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/bin/script/psf-create-junction.in 
b/bin/script/psf-create-junction.in
index f4eedef7..fc481a6e 100644
--- a/bin/script/psf-create-junction.in
+++ b/bin/script/psf-create-junction.in
@@ -348,11 +348,9 @@ ypsfcenter=$(astarithmetic $ypsfaxis 2 / --quiet)
 #
 # In order to allocate the PSF into the center coordinates provided by the
 # user, it is necessary to compute the appropiate offsets along the X and Y
-# axis. After that, the PSF image is warped using that offsets. Note that
-# in order to account for a 1 pixel offset, it is necessary to subtract the
-# value 1.
-xdiff=$(astarithmetic $xcenter $xpsfcenter - 1.0 - --quiet)
-ydiff=$(astarithmetic $ycenter $ypsfcenter - 1.0 - --quiet)
+# axis. After that, the PSF image is warped using that offsets.
+xdiff=$(astarithmetic $xcenter $xpsfcenter - --quiet)
+ydiff=$(astarithmetic $ycenter $ypsfcenter - --quiet)
 
 coretranslated=$tmpdir/"$bname_core"_translated.fits
 astwarp $core --translate=$xdiff,$ydiff \
@@ -371,7 +369,9 @@ astwarp $core --translate=$xdiff,$ydiff \
 # PSF or scattered light field model would not be possible. Here, this
 # cropping is done.
 xrange=$(echo "$xdiff $xaxis $xcenter" \
-              | awk '{if($1<0) \
+              | awk '{if($1==0) \
+                       {min=0; max=$2-1;} \
+                      else if($1<0) \
                        {i=int($1); \
                         d=-1*i+1; \
                         min=d; max=$2+d-1;} \
@@ -380,7 +380,9 @@ xrange=$(echo "$xdiff $xaxis $xcenter" \
                       printf "%d:%d", min, max}')
 
 yrange=$(echo "$ydiff $yaxis $ycenter" \
-              | awk '{if($1<0) \
+              | awk '{if($1==0) \
+                       {min=0; max=$2-1;} \
+                      else if($1<0) \
                        {i=int($1); \
                         d=-1*i+1; \
                         min=d; max=$2+d-1;} \
@@ -426,7 +428,9 @@ astarithmetic $corecropped --hdu=1 set-i \
 # As a consequence, the final image will be the sum of these two masked
 # images.
 maskimage=$tmpdir/mask-image.fits
-echo "1 $xcenter $ycenter 5 $radius 1 $positionangle $axisratio 1 1" \
+xcentmask=$(astarithmetic $xcenter 1 + --quiet)
+ycentmask=$(astarithmetic $ycenter 1 + --quiet)
+echo "1 $xcentmask $ycentmask 5 $radius 1 $positionangle $axisratio 1 1" \
       | astmkprof --background=$corefluxscaled \
                  --mode=img \
                   --clearcanvas \
@@ -457,13 +461,13 @@ echo "1 $xcenter $ycenter 5 $radius 1 $positionangle 
$axisratio 1 1" \
 #   0 0 C C 0 0
 #   0 0 0 0 0 0
 
-outer_masked=$tmpdir/"$bname_outer"_masked.fits
+outer_masked=$tmpdir/"$bname_outer"_outermasked.fits
 astarithmetic $inputs --hdu=1 set-psfouter \
               $maskimage --hdu=1 set-mask \
               psfouter mask 1 eq 0 where --output=$outer_masked $quiet
 
 
-core_masked=$tmpdir/"$bname_core"_masked.fits
+core_masked=$tmpdir/"$bname_core"_coremasked.fits
 astarithmetic $corefluxscaled --hdu=1 set-psfinner \
               $maskimage --hdu=1 set-mask \
               psfinner mask 1 ne 0 where --output=$core_masked $quiet



reply via email to

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