gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 90f8260c 04/23: astscript-rgb-image: added the


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 90f8260c 04/23: astscript-rgb-image: added the make check test for this script
Date: Sun, 24 Dec 2023 22:26:16 -0500 (EST)

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

    astscript-rgb-image: added the make check test for this script
    
    Until now, this script did not have a make check test. Also, the
    documentation book was missing some hierarchy references.
    
    With this commit, the make check test that correspond to this script has
    been added. It takes the same image three times to generate a color image.
    In addition to this, the hierarchy of the Book has been updated and now it
    contains the missing references and links to the recent section related to
    this script.
---
 bin/script/Makefile.am    |  6 ++++
 doc/gnuastro.texi         | 35 ++++++++++++++---------
 tests/Makefile.am         |  3 +-
 tests/script/rgb-image.sh | 71 +++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 101 insertions(+), 14 deletions(-)

diff --git a/bin/script/Makefile.am b/bin/script/Makefile.am
index 83d9ec3c..b35edfec 100644
--- a/bin/script/Makefile.am
+++ b/bin/script/Makefile.am
@@ -42,6 +42,7 @@ astscript-fits-view.desktop: 
$(srcdir)/fits-view.desktop.desktop Makefile
 bin_SCRIPTS = astscript-fits-view \
               astscript-psf-unite \
               astscript-psf-stamp \
+              astscript-rgb-image \
               astscript-zeropoint \
               astscript-ds9-region \
               astscript-psf-subtract \
@@ -54,6 +55,7 @@ bin_SCRIPTS = astscript-fits-view \
 EXTRA_DIST = fits-view.sh \
              psf-unite.sh \
              psf-stamp.sh \
+             rgb-image.sh \
              zeropoint.sh \
              zeropoint.mk \
              ds9-region.sh \
@@ -127,3 +129,7 @@ astscript-sort-by-night: sort-by-night.sh Makefile
 astscript-zeropoint: zeropoint.sh Makefile
        $(do_subst) < $(srcdir)/zeropoint.sh > $@
        chmod +x $@
+
+astscript-rgb-image: rgb-image.sh Makefile
+       $(do_subst) < $(srcdir)/rgb-image.sh > $@
+       chmod +x $@
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index d22ad7bd..24545080 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -767,6 +767,7 @@ Installed scripts
 * Viewing FITS file contents with DS9 or TOPCAT::  Open DS9 (images/cubes) or 
TOPCAT (tables).
 * Zero point estimation::       Zero point of an image from reference catalog 
or image(s).
 * Pointing pattern simulation::  Simulate a stack with a given series of 
pointings.
+* RGB image creation::
 * PSF construction and subtraction::  Set of scripts to create extended PSF of 
an image.
 
 Sort FITS files by night
@@ -798,6 +799,10 @@ Pointing pattern simulation
 
 * Invoking astscript-pointing-simulate::  Options and running mode.
 
+RGB image
+
+* Invoking astscript-rgb-image::
+
 PSF construction and subtraction
 
 * Overview of the PSF scripts::  Summary of concepts and methods
@@ -32485,6 +32490,7 @@ If you do confront such strange errors, please submit a 
bug report so we fix it
 * Viewing FITS file contents with DS9 or TOPCAT::  Open DS9 (images/cubes) or 
TOPCAT (tables).
 * Zero point estimation::       Zero point of an image from reference catalog 
or image(s).
 * Pointing pattern simulation::  Simulate a stack with a given series of 
pointings.
+* RGB image creation::
 * PSF construction and subtraction::  Set of scripts to create extended PSF of 
an image.
 @end menu
 
@@ -33614,7 +33620,7 @@ When this option is given, the default installed 
Makefile will not be used: the
 @end table
 
 
-@node Pointing pattern simulation, PSF construction and subtraction, Zero 
point estimation, Installed scripts
+@node Pointing pattern simulation, RGB image creation, Zero point estimation, 
Installed scripts
 @section Pointing pattern simulation
 
 @cindex Depth of data
@@ -33854,7 +33860,7 @@ For more, see @option{Operating mode options}.
 @end table
 
 
-@node RGB image creation, Installed scripts
+@node RGB image creation, PSF construction and subtraction, Pointing pattern 
simulation, Installed scripts
 @section RGB image
 A RGB (Red, Green, Blue) image is a color image generated using images from 
three different filters or channels.
 More info at @url{https://en.wikipedia.org/wiki/RGB_color_model}.
@@ -33871,10 +33877,13 @@ In short: it performs an inverse hyperbolic sinus 
(asinh) transformation of the
 There are several parameters and options in order to change the final output, 
see below.
 A general overview of this script will be published in @url{REF}; please cite 
it if this script proves useful in your research.
 
-@node Invoking astscript-rgb-image
+@menu
+* Invoking astscript-rgb-image::
+@end menu
+
+@node Invoking astscript-rgb-image,  , RGB image creation, RGB image creation
 @subsection Invoking astscript-rgb-image
 This installed script will consider several images for combining them into a 
single color image.
-
 The executable name is @file{astscript-rgb-image}, with the following general 
template:
 
 @example
@@ -33882,7 +33891,7 @@ $ astscript-rgb-image [OPTION...] r.fits g.fits b.fits
 @end example
 
 @noindent
-Examples (for a tutorial, see @ref{Color channels in same pixel grid}):
+Some examples:
 
 @example
 ## Generate a color image from three images with default options.
@@ -33986,7 +33995,7 @@ It should be used with in combination with 
@option{--qbright}.
 It is used for bringing out the faint/intermediate bright structures of the 
image that are shown linearly.
 In general, this parameter is choosen after setting @option{--qbright} to a 
low value.
 
-@itemx --grayback
+@item --grayback
 By default, a black-background image is generated.
 That is, the lowest pixelvalues are shown in black.
 By using this option, a gray-background image will be generated.
@@ -33994,22 +34003,22 @@ An averaged image from the three R, G, B is computed 
for the gray-background ima
 If a fourth image (K) is provided, then it is considered for the 
gray-background.
 See below for more options that control the color and gray regions.
 
-@itemx --colorval=FLT
+@item --colorval=FLT
 When @option{--grayback} is used, this parameter defines the value that 
separates the color and black regions.
 It ranges from 100 (all pixels becoming in color) to 0 (all pixels becoming 
black).
 Check the the histogram 'FOR COLOR-THRESHOLD'  with the option 
@option{--checkparams} for selecting a good value.
 
-@itemx --grayval=FLT
+@item --grayval=FLT
 When @option{--grayback} is used, this parameter defines the value that 
separates the black and white regions.
 It ranges from 100 (all pixels becoming black) to 0 (all pixels becoming 
white).
 Check the the histogram 'FOR GRAY-THRESHOLD'  with the option 
@option{--checkparams} to select the value.
 
-@itemx --colorkernelfwhm=FLT
+@item --colorkernelfwhm=FLT
 Gaussian kernel FWHM (in pixels) for convolving the color regions.
 Sometimes, a convolution of the color regions (bright pixels) is desired.
 With this option, the convolution will be done internally.
 
-@itemx --graykernelfwhm=FLT
+@item --graykernelfwhm=FLT
 Gaussian kernel FWHM (in pixels) for convolving the background image.
 Sometimes, a convolution of the background image is necessary in order to 
smooth the noisier regions.
 With this option, the convolution will be done internally.
@@ -34033,11 +34042,11 @@ This transformation is not linear: 
@mymath{\rm{output}=\rm{image}^{gamma}}.
 This option overrides @option{--brightness} or @option{--contrast}.
 
 
-@itemx --keeptmp
+@item --keeptmp
 Do not remove the temporary directory (see description of This option is
 useful for debugging and checking the outputs of internal steps.
 
-@itemx --checkparams
+@item --checkparams
 Print the statistics of intermediate images that are used for estimating the 
parameters.
 This option is useful to decide the optimum set of parameters.
 
@@ -34061,7 +34070,7 @@ For more, see @option{Operating mode options}.
 @end table
 
 
-@node PSF construction and subtraction,  , Pointing pattern simulation, 
Installed scripts
+@node PSF construction and subtraction,  , RGB image creation, Installed 
scripts
 @section PSF construction and subtraction
 
 The point spread function (PSF) describes how the light of a point-like source 
is affected by several optical scattering effects (atmosphere, telescope, 
instrument, etc.).
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 43a8905a..a0688798 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -239,7 +239,8 @@ if COND_WARP
 endif
 
 # Script tests.
-SCRIPT_TESTS = script/psf-unite.sh \
+SCRIPT_TESTS = script/rgb-image.sh \
+               script/psf-unite.sh \
                script/psf-stamp.sh \
                script/zeropoint.sh \
                script/psf-subtract.sh \
diff --git a/tests/script/rgb-image.sh b/tests/script/rgb-image.sh
new file mode 100755
index 00000000..b9829ee4
--- /dev/null
+++ b/tests/script/rgb-image.sh
@@ -0,0 +1,71 @@
+# Generate a color image from three fits files
+#
+# 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-2023, 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=rgb-image
+execname=../bin/script/astscript-$prog
+
+fits1name=0_mkprofcat2.fits
+dep1name=$progbdir/astmkprof
+dep2name=$progbdir/astconvertt
+dep3name=$progbdir/astconvolve
+dep4name=$progbdir/astarithmetic
+dep5name=$progbdir/aststatistics
+
+
+
+# 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
+
+
+
+
+
+# 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"
+$check_with_program $execname $fits1name $fits1name $fits1name \
+                              --hdus=1,1,1 --output=$prog.jpg



reply via email to

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