gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 2894b35a 32/69: PSF model: including the make


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 2894b35a 32/69: PSF model: including the make check step for two PSF scripts
Date: Wed, 26 Jan 2022 12:39:12 -0500 (EST)

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

    PSF model: including the make check step for two PSF scripts
    
    Until this commit, the 'make check' step of the scripts related to the
    modeling of objects using the PSF were not set. With this commit, this step
    has been added for two scripts (flux-factor and scattered-light).  Now,
    during the installation of Gnuastro they are check in order to ensure
    eveything is fine.
---
 bin/script/Makefile.am                    | 16 ++++-
 tests/Makefile.am                         |  6 +-
 tests/script/psf-model-flux-factor.sh     | 98 +++++++++++++++++++++++++++++++
 tests/script/psf-model-scattered-light.sh | 97 ++++++++++++++++++++++++++++++
 4 files changed, 214 insertions(+), 3 deletions(-)

diff --git a/bin/script/Makefile.am b/bin/script/Makefile.am
index 4827c817..0f8c3c1c 100644
--- a/bin/script/Makefile.am
+++ b/bin/script/Makefile.am
@@ -30,13 +30,17 @@ bin_SCRIPTS = astscript-ds9-region \
               astscript-radial-profile \
               astscript-sort-by-night \
               astscript-psf-create-junction \
-              astscript-psf-create-make-stamp
+              astscript-psf-create-make-stamp \
+              astscript-psf-model-flux-factor \
+              astscript-psf-model-scattered-light
 
 EXTRA_DIST = ds9-region.in \
              sort-by-night.in \
              radial-profile.in \
              psf-create-junction.in \
-             psf-create-make-stamp.in
+             psf-create-make-stamp.in \
+             psf-model-flux-factor.in \
+             psf-model-scattered-light.in
 
 CLEANFILES = $(bin_SCRIPTS)
 
@@ -72,3 +76,11 @@ astscript-psf-create-junction: psf-create-junction.in 
Makefile
 astscript-psf-create-make-stamp: psf-create-make-stamp.in Makefile
        $(do_subst) < $(srcdir)/psf-create-make-stamp.in > $@
        chmod +x $@
+
+astscript-psf-model-flux-factor: psf-model-flux-factor.in Makefile
+       $(do_subst) < $(srcdir)/psf-model-flux-factor.in > $@
+       chmod +x $@
+
+astscript-psf-model-scattered-light: psf-model-scattered-light.in Makefile
+       $(do_subst) < $(srcdir)/psf-model-scattered-light.in > $@
+       chmod +x $@
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 9d572491..926ec6f5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -209,13 +209,17 @@ endif
 SCRIPT_TESTS = script/sort-by-night.sh \
                script/radial-profile.sh \
                script/psf-create-junction.sh \
-               script/psf-create-make-stamp.sh
+               script/psf-create-make-stamp.sh \
+               script/psf-model-flux-factor.sh \
+               script/psf-model-scattered-light.sh
 
 # We want to have several FITS files as input for this script.
 script/sort-by-night.sh: mkcatalog/aperturephot.sh.log
 script/radial-profile.sh: mkprof/mosaic2.sh.log
 script/psf-create-junction.sh: mkprof/mosaic2.sh.log
 script/psf-create-make-stamp.sh: mkprof/mosaic2.sh.log
+script/psf-model-flux-factor.sh: mkprof/mosaic2.sh.log
+script/psf-model-scattered-light.sh: mkprof/mosaic2.sh.log
 
 
 
diff --git a/tests/script/psf-model-flux-factor.sh 
b/tests/script/psf-model-flux-factor.sh
new file mode 100755
index 00000000..3c98d02d
--- /dev/null
+++ b/tests/script/psf-model-flux-factor.sh
@@ -0,0 +1,98 @@
+# Compute the flux factor of one object by itself
+#
+# See the Tests subsection of the manual for a complete explanation
+# (in the Installing gnuastro section).
+#
+# Original author:
+#     Raul Infante-Sainz <infantesainz@gmail.com>
+# Contributing author(s):
+#     Mohammad Akhlaghi <mohammad@akhlaghi.org>
+# Copyright (C) 2015-2021, Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without any warranty.
+
+
+
+
+
+# Preliminaries
+# =============
+#
+# Set the variables (the executable is in the build tree). Do the
+# basic checks to see if the executable is made or if the defaults
+# file exists (basicchecks.sh is in the source tree).
+prog=psf-model-flux-factor
+dep1=fits
+dep2=crop
+dep3=table
+dep4=arithmetic
+dep5=statistics
+dep6=radial-profile
+dep1name=../bin/$dep1/ast$dep1
+dep2name=../bin/$dep2/ast$dep2
+dep3name=../bin/$dep3/ast$dep3
+dep4name=../bin/$dep4/ast$dep4
+dep5name=../bin/$dep5/ast$dep5
+dep6name=../bin/script/astscript-$dep6
+execname=../bin/script/astscript-$prog
+fits1name=mkprofcat1.fits
+
+
+
+
+
+# Skip?
+# =====
+#
+# If the dependencies of the test don't exist, then skip it. There are two
+# types of dependencies:
+#
+#   - The executable script was not made.
+#   - The programs it use weren't made.
+#   - The input data weren't made.
+if [ ! -f $execname ]; then echo "$execname doesn't exist."; exit 77; fi
+if [ ! -f $dep1name ]; then echo "$dep1name doesn't exist."; exit 77; fi
+if [ ! -f $dep2name ]; then echo "$dep2name doesn't exist."; exit 77; fi
+if [ ! -f $dep3name ]; then echo "$dep3name doesn't exist."; exit 77; fi
+if [ ! -f $dep4name ]; then echo "$dep4name doesn't exist."; exit 77; fi
+if [ ! -f $dep5name ]; then echo "$dep5name doesn't exist."; exit 77; fi
+if [ ! -f $dep6name ]; then echo "$dep6name doesn't exist."; exit 77; fi
+if [ ! -f $fits1name ]; then echo "$fits1name doesn't exist."; exit 77; fi
+
+
+
+
+
+
+# Put a link of Gnuastro program(s) used into current directory. Note that
+# other script tests may have already brought it.
+ln -sf $dep1name ast$dep1
+ln -sf $dep2name ast$dep2
+ln -sf $dep3name ast$dep3
+ln -sf $dep4name ast$dep4
+ln -sf $dep5name ast$dep5
+ln -sf $dep6name astscript-$dep6
+
+
+
+
+
+# Actual test script
+# ==================
+#
+# 'check_with_program' can be something like Valgrind or an empty
+# string. Such programs will execute the command if present and help in
+# debugging when the developer doesn't have access to the user's system.
+#
+# Since we want the script to recognize the programs that it will use from
+# this same build of Gnuastro, we'll add the current directory to PATH.
+export PATH="./:$PATH"
+y=$($dep1name $fits1name -h1 | grep 'NAXIS1' | awk '{print $3/2}')
+x=$($dep1name $fits1name -h1 | grep 'NAXIS2' | awk '{print $3/2}')
+$check_with_program $execname $fits1name --center=$x,$y --mode=img \
+                                         --psf=$fits1name \
+                                         --normradii=5,10
+
diff --git a/tests/script/psf-model-scattered-light.sh 
b/tests/script/psf-model-scattered-light.sh
new file mode 100755
index 00000000..28aa9273
--- /dev/null
+++ b/tests/script/psf-model-scattered-light.sh
@@ -0,0 +1,97 @@
+# Generate a simple scattered light field with one single object
+#
+# See the Tests subsection of the manual for a complete explanation
+# (in the Installing gnuastro section).
+#
+# Original author:
+#     Raul Infante-Sainz <infantesainz@gmail.com>
+# Contributing author(s):
+#     Mohammad Akhlaghi <mohammad@akhlaghi.org>
+# Copyright (C) 2015-2021, Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.  This file is offered as-is,
+# without any warranty.
+
+
+
+
+
+# Preliminaries
+# =============
+#
+# Set the variables (the executable is in the build tree). Do the
+# basic checks to see if the executable is made or if the defaults
+# file exists (basicchecks.sh is in the source tree).
+prog=psf-model-scattered-light
+dep1=fits
+dep2=crop
+dep3=table
+dep4=arithmetic
+dep5=statistics
+dep6=radial-profile
+dep1name=../bin/$dep1/ast$dep1
+dep2name=../bin/$dep2/ast$dep2
+dep3name=../bin/$dep3/ast$dep3
+dep4name=../bin/$dep4/ast$dep4
+dep5name=../bin/$dep5/ast$dep5
+dep6name=../bin/script/astscript-$dep6
+execname=../bin/script/astscript-$prog
+fits1name=mkprofcat1.fits
+
+
+
+
+
+# Skip?
+# =====
+#
+# If the dependencies of the test don't exist, then skip it. There are two
+# types of dependencies:
+#
+#   - The executable script was not made.
+#   - The programs it use weren't made.
+#   - The input data weren't made.
+if [ ! -f $execname ]; then echo "$execname doesn't exist."; exit 77; fi
+if [ ! -f $dep1name ]; then echo "$dep1name doesn't exist."; exit 77; fi
+if [ ! -f $dep2name ]; then echo "$dep2name doesn't exist."; exit 77; fi
+if [ ! -f $dep3name ]; then echo "$dep3name doesn't exist."; exit 77; fi
+if [ ! -f $dep4name ]; then echo "$dep4name doesn't exist."; exit 77; fi
+if [ ! -f $dep5name ]; then echo "$dep5name doesn't exist."; exit 77; fi
+if [ ! -f $dep6name ]; then echo "$dep6name doesn't exist."; exit 77; fi
+if [ ! -f $fits1name ]; then echo "$fits1name doesn't exist."; exit 77; fi
+
+
+
+
+
+
+# Put a link of Gnuastro program(s) used into current directory. Note that
+# other script tests may have already brought it.
+ln -sf $dep1name ast$dep1
+ln -sf $dep2name ast$dep2
+ln -sf $dep3name ast$dep3
+ln -sf $dep4name ast$dep4
+ln -sf $dep5name ast$dep5
+ln -sf $dep6name astscript-$dep6
+
+
+
+
+
+# Actual test script
+# ==================
+#
+# 'check_with_program' can be something like Valgrind or an empty
+# string. Such programs will execute the command if present and help in
+# debugging when the developer doesn't have access to the user's system.
+#
+# Since we want the script to recognize the programs that it will use from
+# this same build of Gnuastro, we'll add the current directory to PATH.
+export PATH="./:$PATH"
+y=$($dep1name $fits1name -h1 | grep 'NAXIS1' | awk '{print $3/2}')
+x=$($dep1name $fits1name -h1 | grep 'NAXIS2' | awk '{print $3/2}')
+$check_with_program $execname $fits1name --center=$x,$y --mode=img \
+                                         --psf=$fits1name --fluxfactor=3.3
+



reply via email to

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