gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 2f478270: astscript-zeropoint: check test of z


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 2f478270: astscript-zeropoint: check test of zero point script is added
Date: Thu, 18 May 2023 13:55:18 -0400 (EDT)

branch: master
commit 2f478270ba10ae6893beb3099a531573f499ff26
Author: Sepideh Eskandarlou <sepideh.eskandarlou@gmail.com>
Commit: Sepideh Eskandarlou <sepideh.eskandarlou@gmail.com>

    astscript-zeropoint: check test of zero point script is added
    
    Until now, 'astscript-zeropoint' did not have a test, when running 'make
    check'.
    
    With this commit, all the things for checking the 'astscript-zeropoint'
    script is prepared and the check test is done. To do the test it was
    necessary to create another test for 'asttable' to make a reference catalog
    and star catalog (which are same).
    
    Thanks to Mohammad Akhlaghi for helping me to add this test.
---
 tests/Makefile.am                                  | 11 ++-
 tests/mkprof/mkprofcat1.txt                        | 24 ++++++
 tests/mkprof/mosaic1.sh                            |  2 +-
 tests/script/zeropoint.sh                          | 89 ++++++++++++++++++++++
 .../mosaic1.sh => table/arith-img-to-wcs.sh}       | 42 +++++-----
 5 files changed, 146 insertions(+), 22 deletions(-)

diff --git a/tests/Makefile.am b/tests/Makefile.am
index 5a06bb45..e824bb8c 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -192,15 +192,17 @@ if COND_STATISTICS
   statistics/fitting-polynomial-robust.sh: prepconf.sh.log
 endif
 if COND_TABLE
-  MAYBE_TABLE_TESTS = table/txt-to-fits-binary.sh              \
-  table/fits-binary-to-txt.sh table/txt-to-fits-ascii.sh       \
-  table/fits-ascii-to-txt.sh table/sexagesimal-to-deg.sh
+  MAYBE_TABLE_TESTS = table/txt-to-fits-binary.sh \
+  table/fits-binary-to-txt.sh table/txt-to-fits-ascii.sh \
+  table/fits-ascii-to-txt.sh table/sexagesimal-to-deg.sh \
+  table/arith-img-to-wcs.sh
 
   table/txt-to-fits-binary.sh: prepconf.sh.log
   table/fits-binary-to-txt.sh: table/txt-to-fits-binary.sh.log
   table/txt-to-fits-ascii.sh: prepconf.sh.log
   table/fits-ascii-to-txt.sh: table/txt-to-fits-ascii.sh.log
   table/sexagesimal-to-deg.sh: prepconf.sh.log
+  table/arith-img-to-wcs.sh: mknoise/addnoise.sh.log
 endif
 if COND_WARP
   MAYBE_WARP_TESTS = warp/warp_scale.sh warp/homographic.sh
@@ -212,6 +214,7 @@ endif
 # Script tests.
 SCRIPT_TESTS = script/psf-unite.sh \
                script/psf-stamp.sh \
+               script/zeropoint.sh \
                script/psf-subtract.sh \
                script/sort-by-night.sh \
                script/radial-profile.sh \
@@ -225,9 +228,9 @@ script/psf-subtract.sh: mkprof/mosaic1.sh.log
 script/radial-profile.sh: mkprof/mosaic2.sh.log
 script/psf-scale-factor.sh: mkprof/mosaic1.sh.log
 script/psf-select-stars.sh: segment/segment.sh.log
+script/zeropoint.sh: table/arith-img-to-wcs.sh.log
 script/sort-by-night.sh: mkcatalog/aperturephot.sh.log
 
-
 # Environment variables for the test scripts.
 AM_TESTS_ENVIRONMENT = \
 export LANG=C; \
diff --git a/tests/mkprof/mkprofcat1.txt b/tests/mkprof/mkprofcat1.txt
index 6364ca10..f58ee40c 100644
--- a/tests/mkprof/mkprofcat1.txt
+++ b/tests/mkprof/mkprofcat1.txt
@@ -19,3 +19,27 @@
 1     0.0000     0.0000     gaussian   2.000     0.000      0.0000     1.000   
   0.000     5.000
 2     100.40     100.40     sersic     20.00     2.500      45.000     1.000   
   -18.0     5.000
 3     50.321     50.827     sersic     5.978     1.320      77.650     0.801   
   -15.0     5.000
+4     12.874     87.816     point      0         0          0          0       
   -12       1
+5     15.574     65.532     point      0         0          0          0       
   -12       1
+6     41.682     33.876     point      0         0          0          0       
   -12       1
+7     20.397     31.320     point      0         0          0          0       
   -12       1
+8     20.397     47.640     point      0         0          0          0       
   -12       1
+9     81.000     22.956     point      0         0          0          0       
   -12       1
+10    45.797     14.148     point      0         0          0          0       
   -12       1
+11    12.586     15.000     point      0         0          0          0       
   -12       1
+12    3.935      5.4960     point      0         0          0          0       
   -12       1
+13    5.495      40.404     point      0         0          0          0       
   -12       1
+14    66.950     74.892     point      0         0          0          0       
   -12       1
+15    58.287     84.972     point      0         0          0          0       
   -12       1
+16    35.299     76.032     point      0         0          0          0       
   -12       1
+17    49.769     50.340     point      0         0          0          0       
   -12       1
+18    74.041     54.456     point      0         0          0          0       
   -12       1
+19    70.357     2.3760     point      0         0          0          0       
   -12       1
+20    90.502     9.6120     point      0         0          0          0       
   -12       1
+21    90.934     71.916     point      0         0          0          0       
   -12       1
+22    48.077     95.328     point      0         0          0          0       
   -12       1
+23    66.518     39.276     point      0         0          0          0       
   -12       1
+24    92.350     44.100     point      0         0          0          0       
   -12       1
+25    86.819     57.156     point      0         0          0          0       
   -12       1
+26    3.360      97.608     point      0         0          0          0       
   -12       1
+27    45.941     64.536     point      0         0          0          0       
   -12       1
diff --git a/tests/mkprof/mosaic1.sh b/tests/mkprof/mosaic1.sh
index 22298bf9..c0f70e4e 100755
--- a/tests/mkprof/mosaic1.sh
+++ b/tests/mkprof/mosaic1.sh
@@ -56,6 +56,6 @@ if [ ! -f $cat      ]; then echo "$cat does not exist.";   
exit 77; fi
 # 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.
 $check_with_program $execname $cat --mergedsize=100,100 \
-                    --output=mkprofcat1.fits \
+                    --output=mkprofcat1.fits --zeropoint=0 \
     && mv 0_mkprofcat1.fits psf.fits \
     && mv 1_mkprofcat1.fits psf-sharp.fits
diff --git a/tests/script/zeropoint.sh b/tests/script/zeropoint.sh
new file mode 100755
index 00000000..f12eb753
--- /dev/null
+++ b/tests/script/zeropoint.sh
@@ -0,0 +1,89 @@
+# Check the zeropoint script.
+#
+# See the Tests subsection of the manual for a complete explanation
+# (in the Installing gnuastro section).
+#
+# Original author:
+#     Sepideh Eskandarlou <sepideh.eskandarlou@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=zeropoint
+execname=../bin/script/astscript-$prog
+
+dep1name=$progbdir/astfits
+dep2name=$progbdir/asttable
+dep3name=$progbdir/astmatch
+dep4name=$progbdir/astmkprof
+dep5name=$progbdir/astmkcatalog
+
+intable=table-img-to-wcs.fits
+inimg=convolve_spatial_scaled_noised.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 $intable  ]; then echo "$intable doesn't exist."; exit 77; fi
+if [ ! -f $inimg    ]; then echo "$inimg doesn't exist."; exit 77; fi
+
+
+
+
+
+
+# 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="$progbdir:$PATH"
+
+# Test the script: finding the zeropoint.
+$check_with_program $execname \
+                    $inimg \
+                    --hdu=1 \
+                    --keepzpap \
+                    --refcatra=RA \
+                    --refcatdec=DEC \
+                    --refcat=$intable \
+                    --starcat=$intable \
+                    --aperarcsec=0.09,0.13 \
+                    --refcatmag=Magnitude \
+                    --output=zeropoint-cat.fits
diff --git a/tests/mkprof/mosaic1.sh b/tests/table/arith-img-to-wcs.sh
similarity index 54%
copy from tests/mkprof/mosaic1.sh
copy to tests/table/arith-img-to-wcs.sh
index 22298bf9..1ff1d635 100755
--- a/tests/mkprof/mosaic1.sh
+++ b/tests/table/arith-img-to-wcs.sh
@@ -1,9 +1,4 @@
-# Create a mock image from cat1.txt:
-#
-#  - It includes one large and bright profile that is on the last
-#    pixel of this image. The other tests will also build the same
-#    profile with the absolute place fixed.
-#
+# Check conversion of coordinates.
 #
 # See the Tests subsection of the manual for a complete explanation
 # (in the Installing gnuastro section).
@@ -11,6 +6,7 @@
 # Original author:
 #     Mohammad Akhlaghi <mohammad@akhlaghi.org>
 # Contributing author(s):
+#     Sepideh Eskandarlou <sepideh.eskandarlou@gmail.com>
 # Copyright (C) 2015-2023 Free Software Foundation, Inc.
 #
 # Copying and distribution of this file, with or without modification,
@@ -19,16 +15,19 @@
 # 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=mkprof
+prog=table
 execname=../bin/$prog/ast$prog
-cat=$topsrc/tests/$prog/mkprofcat1.txt
-
+inimg=convolve_spatial_scaled_noised.fits
+intable=$topsrc/tests/mkprof/mkprofcat1.txt
 
 
 
@@ -39,11 +38,13 @@ cat=$topsrc/tests/$prog/mkprofcat1.txt
 # If the dependencies of the test don't exist, then skip it. There are two
 # types of dependencies:
 #
-#   - The executable was not made (for example due to a configure option).
+#   - The executable was not made (for example due to a configure option),
 #
-#   - Catalog doesn't exist (problem in tarball release).
+#   - The input data was not made (for example the test that created the
+#     data file failed).
 if [ ! -f $execname ]; then echo "$execname not created."; exit 77; fi
-if [ ! -f $cat      ]; then echo "$cat does not exist.";   exit 77; fi
+if [ ! -f $intable  ]; then echo "$intable doesn't exist.";  exit 77; fi
+if [ ! -f $inimg    ]; then echo "$inimg doesn't exist.";  exit 77; fi
 
 
 
@@ -52,10 +53,17 @@ if [ ! -f $cat      ]; then echo "$cat does not exist.";   
exit 77; fi
 # Actual test script
 # ==================
 #
-# 'check_with_program' can be something like Valgrind or an empty
+# '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.
-$check_with_program $execname $cat --mergedsize=100,100 \
-                    --output=mkprofcat1.fits \
-    && mv 0_mkprofcat1.fits psf.fits \
-    && mv 1_mkprofcat1.fits psf-sharp.fits
+#
+# This table will be used for checking the zeropoint script. Be carful
+# about column metadata.
+$check_with_program $execname $intable \
+                    --wcsfile=$inimg \
+                    --equal=Function,point \
+                    --output=table-img-to-wcs.fits \
+                    -c'arith X Y img-to-wcs',Magnitude \
+                    --colmetadata=2,DEC,deg,"Declination" \
+                    --colmetadata=1,RA,deg,"Right Ascension" \
+                    --colmetadata=3,Magnitude,log,"Magnitude of profile"



reply via email to

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