gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 5fdd3a4a 31/69: PSF create: including the make


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

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

    PSF create: including the make check step for two PSF scripts
    
    Until this commit, the 'make check' step of the scripts related to the
    construction of the PSF were not set. With this commit, this step has been
    added for two scripts (junction and stamps).  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-create-junction.sh   | 91 +++++++++++++++++++++++++++++++++
 tests/script/psf-create-make-stamp.sh | 96 +++++++++++++++++++++++++++++++++++
 4 files changed, 206 insertions(+), 3 deletions(-)

diff --git a/bin/script/Makefile.am b/bin/script/Makefile.am
index a64c9f65..4827c817 100644
--- a/bin/script/Makefile.am
+++ b/bin/script/Makefile.am
@@ -28,11 +28,15 @@
 ## 'make clean').
 bin_SCRIPTS = astscript-ds9-region \
               astscript-radial-profile \
-              astscript-sort-by-night
+              astscript-sort-by-night \
+              astscript-psf-create-junction \
+              astscript-psf-create-make-stamp
 
 EXTRA_DIST = ds9-region.in \
+             sort-by-night.in \
              radial-profile.in \
-             sort-by-night.in
+             psf-create-junction.in \
+             psf-create-make-stamp.in
 
 CLEANFILES = $(bin_SCRIPTS)
 
@@ -60,3 +64,11 @@ astscript-radial-profile: radial-profile.in Makefile
 astscript-sort-by-night: sort-by-night.in Makefile
        $(do_subst) < $(srcdir)/sort-by-night.in > $@
        chmod +x $@
+
+astscript-psf-create-junction: psf-create-junction.in Makefile
+       $(do_subst) < $(srcdir)/psf-create-junction.in > $@
+       chmod +x $@
+
+astscript-psf-create-make-stamp: psf-create-make-stamp.in Makefile
+       $(do_subst) < $(srcdir)/psf-create-make-stamp.in > $@
+       chmod +x $@
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 83496aad..9d572491 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -207,11 +207,15 @@ endif
 
 # Script tests.
 SCRIPT_TESTS = script/sort-by-night.sh \
-               script/radial-profile.sh
+               script/radial-profile.sh \
+               script/psf-create-junction.sh \
+               script/psf-create-make-stamp.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
 
 
 
diff --git a/tests/script/psf-create-junction.sh 
b/tests/script/psf-create-junction.sh
new file mode 100755
index 00000000..19ce0e4e
--- /dev/null
+++ b/tests/script/psf-create-junction.sh
@@ -0,0 +1,91 @@
+# Generate two stamps from a mock image to test the PSF stamps script
+#
+# 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-create-junction
+dep1=crop
+dep2=fits
+dep3=warp
+dep4=mkprof
+dep5=arithmetic
+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
+execname=../bin/script/astscript-$prog
+fits1name=0_mkprofcat2.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 $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
+
+
+
+
+
+# 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"
+$check_with_program $execname $fits1name --core=$fits1name \
+                                         --fluxfactor=3.3 --radius=5
+
diff --git a/tests/script/psf-create-make-stamp.sh 
b/tests/script/psf-create-make-stamp.sh
new file mode 100755
index 00000000..2a837bfa
--- /dev/null
+++ b/tests/script/psf-create-make-stamp.sh
@@ -0,0 +1,96 @@
+# Generate two stamps from a mock image to test the PSF stamps script
+#
+# 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-create-make-stamp
+dep1=crop
+dep2=fits
+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=0_mkprofcat2.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=$($dep2name $fits1name -h1 | grep 'NAXIS1' | awk '{print $3/2}')
+x=$($dep2name $fits1name -h1 | grep 'NAXIS2' | awk '{print $3/2}')
+$check_with_program $execname $fits1name --center=$x,$y --mode=img 
--stampwidth=100,100
+



reply via email to

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