[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnuastro-commits] master 781f0f33 39/69: PSF scripts: checking that the
From: |
Mohammad Akhlaghi |
Subject: |
[gnuastro-commits] master 781f0f33 39/69: PSF scripts: checking that the input file actually exists |
Date: |
Wed, 26 Jan 2022 12:39:13 -0500 (EST) |
branch: master
commit 781f0f3303c6fcd7185d57a1004f12138259d0bf
Author: Raul Infante-Sainz <infantesainz@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>
PSF scripts: checking that the input file actually exists
Until this commit, all PSF related scripts checked if the 'inputs' variable
was empty or not. If it was empty, an error and message was printed to
warn the user that no input was provided. However, if the input file was
not properly specified (i.e., a typo while writing it), the scripts tried
to continue without checking if the inputs actually exists. This is bad,
and the script should stop as soon as it detects that the input file does
not exists. With this commit, this bug has been fixed for several scripts.
This problem was reported by Sepideh Eskandarlou.
---
bin/script/psf-create-junction.in | 6 ++++++
bin/script/psf-create-make-stamp.in | 3 +++
bin/script/psf-create-select-stars.in | 8 +++++++-
bin/script/psf-model-flux-factor.in | 3 +++
bin/script/psf-model-scattered-light.in | 6 ++++++
bin/script/radial-profile.in | 3 +++
6 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/bin/script/psf-create-junction.in
b/bin/script/psf-create-junction.in
index fc481a6e..32f189da 100644
--- a/bin/script/psf-create-junction.in
+++ b/bin/script/psf-create-junction.in
@@ -244,6 +244,9 @@ if [ x"$inputs" = x ]; then
echo "$scriptname: no input FITS image files."
echo "Run with '--help' for more information on how to run."
exit 1
+elif [ ! -f $inputs ]; then
+ echo "$scriptname: $inputs: No such file or directory."
+ exit 1
fi
# If a core image (--core) is not given at all.
@@ -251,6 +254,9 @@ if [ x"$core" = x ]; then
echo "$scriptname: no core image provided."
echo "A core image of the PSF to be specified with --stampwidth or -w."
exit 1
+elif [ ! -f $core ]; then
+ echo "$scriptname: $core: No such file or directory."
+ exit 1
fi
# If a radius (--radius) is not given at all.
diff --git a/bin/script/psf-create-make-stamp.in
b/bin/script/psf-create-make-stamp.in
index 125d8070..01cd075a 100644
--- a/bin/script/psf-create-make-stamp.in
+++ b/bin/script/psf-create-make-stamp.in
@@ -285,6 +285,9 @@ if [ x"$inputs" = x ]; then
echo "$scriptname: no input FITS image files."
echo "Run with '--help' for more information on how to run."
exit 1
+elif [ ! -f $inputs ]; then
+ echo "$scriptname: $inputs: No such file or directory."
+ exit 1
fi
# If a stamp width (--stampwidth) is not given at all.
diff --git a/bin/script/psf-create-select-stars.in
b/bin/script/psf-create-select-stars.in
index da7497be..37727001 100644
--- a/bin/script/psf-create-select-stars.in
+++ b/bin/script/psf-create-select-stars.in
@@ -271,7 +271,10 @@ done
if [ x"$inputs" = x ]; then
echo " $scriptname: no input image file specified."
echo "Run with '--help' for more information on how to run."
- exit 1
+ exit 1
+elif [ ! -f $inputs ]; then
+ echo "$scriptname: $inputs: No such file or directory."
+ exit 1
fi
# Check that 'segmented' is output of 'astsegment'.
@@ -286,6 +289,9 @@ $scriptname: the file given to '--segmented' does not have
'CLUMPS' and
EOF
exit 1
fi
+elif [ ! -f $segmented ]; then
+ echo "$scriptname: $segmented: No such file or directory."
+ exit 1
fi
diff --git a/bin/script/psf-model-flux-factor.in
b/bin/script/psf-model-flux-factor.in
index 8e78b614..752e0877 100644
--- a/bin/script/psf-model-flux-factor.in
+++ b/bin/script/psf-model-flux-factor.in
@@ -293,6 +293,9 @@ if [ x"$inputs" = x ]; then
echo "$scriptname: no input FITS image files."
echo "Run with '--help' for more information on how to run."
exit 1
+elif [ ! -f $inputs ]; then
+ echo "$scriptname: $inputs: No such file or directory."
+ exit 1
fi
# If a PSF image (--psf) and profile (--psfprofile) are not given at all.
diff --git a/bin/script/psf-model-scattered-light.in
b/bin/script/psf-model-scattered-light.in
index b07e1f52..d2ef5db1 100644
--- a/bin/script/psf-model-scattered-light.in
+++ b/bin/script/psf-model-scattered-light.in
@@ -241,6 +241,9 @@ if [ x"$inputs" = x ]; then
echo "$scriptname: no input FITS image files."
echo "Run with '--help' for more information on how to run."
exit 1
+elif [ ! -f $inputs ]; then
+ echo "$scriptname: $inputs: No such file or directory."
+ exit 1
fi
# If a PSF image (--psf) is not given at all.
@@ -248,6 +251,9 @@ if [ x"$psf" = x ]; then
echo "$scriptname: no PSF image provided."
echo "$scriptname: a PSF image '--psf' ('-p') should be provided."
exit 1
+elif [ ! -f $psf ]; then
+ echo "$scriptname: $psf: No such file or directory."
+ exit 1
fi
# If a flux factor (--fluxfactor) is not given at all.
diff --git a/bin/script/radial-profile.in b/bin/script/radial-profile.in
index df1af166..6908b4fc 100644
--- a/bin/script/radial-profile.in
+++ b/bin/script/radial-profile.in
@@ -286,6 +286,9 @@ if [ x"$inputs" = x ]; then
echo "$scriptname: no input FITS image files."
echo "Run with '--help' for more information on how to run."
exit 1
+elif [ ! -f $inputs ]; then
+ echo "$scriptname: $inputs: No such file or directory."
+ exit 1
fi
# If a '--center' has been given, make sure it only has two numbers.
- [gnuastro-commits] master f7af955d 03/69: PSF stamp: Renaming this script to 'psf-create-make-stamp', (continued)
- [gnuastro-commits] master f7af955d 03/69: PSF stamp: Renaming this script to 'psf-create-make-stamp', Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master 9a66fff9 07/69: Scripts: removing the executability of some source code scripts, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master f58c3211 08/69: PSF model: checking that a PSF image is given for computing flux factor, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master a6788c50 13/69: Book: adding documentation of 'psf-create-make-stamp' script, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master 57b27b9e 12/69: PSF scripts: correcting several bugs and homogenizing the notation, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master b14fdf1d 04/69: PSF stamp: fixing wrong directory of this script, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master 4c5fe969 17/69: Book: fully working example on how to construct and correct the PSF, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master ccae240f 29/69: PSF stamp: bug in --rmax option introduced in previous commit fixed, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master de1b645b 20/69: PSF stamp: computing radial profile up to the minimum possible value, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master 194b49d1 59/69: PSF select-stars: change the name of the two varibales., Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master 781f0f33 39/69: PSF scripts: checking that the input file actually exists,
Mohammad Akhlaghi <=
- [gnuastro-commits] master 0a6625ab 61/69: Book: explain about two new option in the psf-create-select-stars, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master 6901ec82 49/69: PSF select-stars: check the image and catalog have a overlap area or not, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master f9b7edfa 10/69: PSF stamp: removing the option --oversample as it is not enabled, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master 81720014 15/69: Book: adding documentation of 'psf-model-flux-factor' script, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master 9ca784e4 27/69: PSF select stars: if the image has not stars in `--min` and `--max` range, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master f1cfd384 25/69: PSF select stars: remove --input add --output and --catalog, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master bf8792c2 52/69: Book: For selecting stars some mandatory options did not mention, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master f3619dd5 57/69: Book: edits in the PSF scripts, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master ce020710 41/69: Book: new section for the tutorial on how to construct and extended PSF, Mohammad Akhlaghi, 2022/01/26
- [gnuastro-commits] master 9ab3dd28 51/69: PSF stamp: new option to set a mask sky pixel value: maskskyval, Mohammad Akhlaghi, 2022/01/26