gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master d7f080af: PSF scripts: keeping temporary direc


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master d7f080af: PSF scripts: keeping temporary directory in radial profile calls
Date: Thu, 10 Feb 2022 06:54:20 -0500 (EST)

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

    PSF scripts: keeping temporary directory in radial profile calls
    
    Until this commit, when constructing the PSF, the temporary directory was
    removed as soon as the radial-profile script finished. This is simply
    because the temporary directory for the PSF scripts and the temporary
    directory for the radial profile script was the same. This is not good
    since the directory is removed in the middle of the execution.  Step by
    step, what happened was:
    
     - PSF scripts generated a temporary directory (tmpdir).
     - At some point, the PSF scripts called the radial profile script.
     - The radial profile script removed the temporary directory (tmpdir).
     - PSF scripts crashed as a consequence of the directory removal.
    
    With this commit, this bug has been corrected by keeping the temporary
    files when calling the radial profile script (within the PSF scripts). By
    doing this, the temporary directory is kept until the end of the execution
    of the PSf script and the scripts don't crash.
---
 bin/script/psf-create-make-stamp.in |  1 +
 bin/script/psf-model-flux-factor.in | 12 ++++++++----
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/bin/script/psf-create-make-stamp.in 
b/bin/script/psf-create-make-stamp.in
index b1e6892a..3cf8fe8a 100644
--- a/bin/script/psf-create-make-stamp.in
+++ b/bin/script/psf-create-make-stamp.in
@@ -530,6 +530,7 @@ if [ x"$normradiusmin" != x ] && [ x"$normradiusmax" != x 
]; then
     astscript-radial-profile $cropped_masked --hdu=1 --rmax=$maxr \
                              --measure=$normop $finalsigmaclip \
                              --positionangle=$positionangle \
+                             --tmpdir=$tmpdir --keeptmp \
                              --axisratio=$axisratio \
                              --output=$radialprofile $quiet
 
diff --git a/bin/script/psf-model-flux-factor.in 
b/bin/script/psf-model-flux-factor.in
index 9b7a1d79..38d4a8dc 100644
--- a/bin/script/psf-model-flux-factor.in
+++ b/bin/script/psf-model-flux-factor.in
@@ -549,14 +549,18 @@ psfradialprofile=$tmpdir/rprofile-psf-$objectid.fits
 if [ x"$rmax" != x ]; then maximumradius="--rmax=$rmax"
 else                       maximumradius="--rmax=$normradiusmax";
 fi
-astscript-radial-profile $cropped_masked --hdu=1 $maximumradius \
-                         --measure=$normop --output=$radialprofile $quiet
+astscript-radial-profile $cropped_masked --hdu=1 \
+                         $maximumradius --measure=$normop \
+                         --tmpdir $tmpdir --keeptmp \
+                         --output=$radialprofile $quiet
 
 # If the user provide a PSF image, compute the radial profile of that PSF.
 # Else, consider the PSF radial profile provided.
 if [ x"$psfprofile" = x ]; then
-    astscript-radial-profile $psf --hdu=$psfhdu $maximumradius $quiet \
-                             --measure=$normop --output=$psfradialprofile
+    astscript-radial-profile $psf --hdu=$psfhdu $maximumradius \
+                             --measure=$normop \
+                             --tmpdir $tmpdir --keeptmp \
+                             --output=$psfradialprofile $quiet
 else
     asttable $psfprofile \
              --output=$psfradialprofile $quiet \



reply via email to

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