gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master cd14a366 44/69: PSF select-stars: including th


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master cd14a366 44/69: PSF select-stars: including the make check step for this script
Date: Wed, 26 Jan 2022 12:39:14 -0500 (EST)

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

    PSF select-stars: including the make check step for this script
    
    Until this commit, the 'make check' step of the script related with the
    selection of good stars was not set.
    
    With this commit, this step has been added.  Now, during the installation
    of Gnuastro this script is checked in order to ensure eveything is fine.
---
 bin/script/Makefile.am                  |  6 +++
 tests/Makefile.am                       |  2 +
 tests/script/psf-create-select-stars.sh | 87 +++++++++++++++++++++++++++++++++
 3 files changed, 95 insertions(+)

diff --git a/bin/script/Makefile.am b/bin/script/Makefile.am
index 0f8c3c1c..0a82c877 100644
--- a/bin/script/Makefile.am
+++ b/bin/script/Makefile.am
@@ -32,6 +32,7 @@ bin_SCRIPTS = astscript-ds9-region \
               astscript-psf-create-junction \
               astscript-psf-create-make-stamp \
               astscript-psf-model-flux-factor \
+              astscript-psf-create-select-stars \
               astscript-psf-model-scattered-light
 
 EXTRA_DIST = ds9-region.in \
@@ -40,6 +41,7 @@ EXTRA_DIST = ds9-region.in \
              psf-create-junction.in \
              psf-create-make-stamp.in \
              psf-model-flux-factor.in \
+             psf-create-select-stars.in \
              psf-model-scattered-light.in
 
 CLEANFILES = $(bin_SCRIPTS)
@@ -81,6 +83,10 @@ astscript-psf-model-flux-factor: psf-model-flux-factor.in 
Makefile
        $(do_subst) < $(srcdir)/psf-model-flux-factor.in > $@
        chmod +x $@
 
+astscript-psf-create-select-stars: psf-create-select-stars.in Makefile
+       $(do_subst) < $(srcdir)/psf-create-select-stars.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 926ec6f5..cd339ae5 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -211,6 +211,7 @@ SCRIPT_TESTS = script/sort-by-night.sh \
                script/psf-create-junction.sh \
                script/psf-create-make-stamp.sh \
                script/psf-model-flux-factor.sh \
+               script/psf-create-select-stars.sh \
                script/psf-model-scattered-light.sh
 
 # We want to have several FITS files as input for this script.
@@ -219,6 +220,7 @@ 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-select-stars.sh: mkprof/mosaic2.sh.log
 script/psf-model-scattered-light.sh: mkprof/mosaic2.sh.log
 
 
diff --git a/tests/script/psf-create-select-stars.sh 
b/tests/script/psf-create-select-stars.sh
new file mode 100755
index 00000000..a5886dbb
--- /dev/null
+++ b/tests/script/psf-create-select-stars.sh
@@ -0,0 +1,87 @@
+# Generate a catalog of stars to test the select-stars PSF 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) 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-select-stars
+dep1=mkcatalog
+dep1name=../bin/$dep1/ast$dep1
+execname=../bin/script/astscript-$prog
+fits1name=convolve_spatial_noised.fits
+fits2name=convolve_spatial_noised_detected_segmented.fits
+fits3name=convolve_spatial_noised_detected_segmented_catalog.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 $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
+
+
+
+
+
+# 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"
+
+# Create a catalog with appropiate parameters
+$check_with_program astmkcatalog $fits2name \
+                    --ra --dec --magnitude \
+                    --axisratio --output=$fits3name
+
+# Test the script: selecting good stars
+$check_with_program $execname $fits1name --hdu=1 \
+                    --segmented=$fits2name \
+                    --catalog=$fits3name \
+                    --field=magnitude
+



reply via email to

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