gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 5dc7ae4b: MakeNoise: deleted from Gnuastro


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 5dc7ae4b: MakeNoise: deleted from Gnuastro
Date: Wed, 9 Aug 2023 10:02:54 -0400 (EDT)

branch: master
commit 5dc7ae4bf4e8f5128574d25d63babf6be967315a
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    MakeNoise: deleted from Gnuastro
    
    Until now, we had two ways of adding noise to an image: the MakeNoise
    program or the 'mknoise-*' operators of Arithmetic. This was done
    intentionally to gradually depreciate MakeNoise as a separate program
    because the Arithmetic operators are much more modular and customizable.
    
    With this commit, MakeNoise has finally been removed since the operators do
    all that the program did. The "Noise basics" sub-section of the book has
    also been moved under the Arithmetic program.
    
    In the process, some of the 'Makefiles.am' files have been cleaned to have
    one-line per file name in the variable definitions to help in readability.
---
 Makefile.am                                        |  42 +-
 NEWS                                               |   8 +
 README                                             |   3 -
 bin/mknoise/Makefile.am                            |  45 --
 bin/mknoise/args.h                                 | 142 -----
 bin/mknoise/astmknoise.conf                        |  27 -
 bin/mknoise/authors-cite.h                         |  38 --
 bin/mknoise/main.c                                 |  56 --
 bin/mknoise/main.h                                 |  62 ---
 bin/mknoise/mknoise.c                              | 157 ------
 bin/mknoise/mknoise.h                              |  29 -
 bin/mknoise/ui.c                                   | 466 ----------------
 bin/mknoise/ui.h                                   |  62 ---
 configure.ac                                       |  17 +-
 doc/Makefile.am                                    |  82 ++-
 doc/gnuastro.texi                                  | 608 +++++++++------------
 tests/Makefile.am                                  | 210 ++++---
 .../mknoise-sigma-from-mean-3d.sh}                 |  10 +-
 .../mknoise-sigma-from-mean.sh}                    |  17 +-
 19 files changed, 473 insertions(+), 1608 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index b7c235b6..c62b0af9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -83,9 +83,6 @@ endif
 if COND_MKCATALOG
   MAYBE_MKCATALOG = bin/mkcatalog
 endif
-if COND_MKNOISE
-  MAYBE_MKNOISE = bin/mknoise
-endif
 if COND_MKPROF
   MAYBE_MKPROF = bin/mkprof
 endif
@@ -121,19 +118,44 @@ endif
 
 ## Subdirectories to build
 ## =======================
-##
+## In the list below, ORDER MATTERS:
+##  1. Build Gnulib (and its tests if requested)
+##  2. Build Gnuastro's library.
+##  3. Build the programs (order doesn't matter within the programs, so
+##     they are sorted alphabetically).
+##  4. Build the installed scripts.
+##  5. Build the documentation.
+##  6. Build the tests.
+#
 ## Note that by default 'COND_TEMPLATE' is not set in configure, it is
 ## commented, and exists only as a template for you to copy and paste to
 ## name your new utility. The same rule is applied here (in the 'if'
 ## conditions above). When 'MAYBE_TEMPLATE' is not defined, then Make will
 ## see it as a blank string and igonore it, so there is no problem with
 ## having an uncommented 'MAYBE_TEMPLATE' as a value in 'SUBDIRS'.
-SUBDIRS = bootstrapped/lib $(MAYBE_GNULIBCHECK) lib $(MAYBE_ARITHMETIC) \
-  $(MAYBE_BUILDPROG) $(MAYBE_CONVERTT) $(MAYBE_CONVOLVE) \
-  $(MAYBE_COSMICCAL) $(MAYBE_CROP) $(MAYBE_FITS) $(MAYBE_MATCH) \
-  $(MAYBE_MKCATALOG) $(MAYBE_MKNOISE) $(MAYBE_MKPROF) $(MAYBE_NOISECHISEL) \
-  $(MAYBE_QUERY) $(MAYBE_SEGMENT) $(MAYBE_STATISTICS) $(MAYBE_TABLE) \
-  $(MAYBE_TEMPLATE) $(MAYBE_WARP) bin/script doc tests
+SUBDIRS = bootstrapped/lib \
+          $(MAYBE_GNULIBCHECK) \
+          lib \
+          $(MAYBE_ARITHMETIC) \
+          $(MAYBE_BUILDPROG) \
+          $(MAYBE_CONVERTT) \
+          $(MAYBE_CONVOLVE) \
+          $(MAYBE_COSMICCAL) \
+          $(MAYBE_CROP) \
+          $(MAYBE_FITS) \
+          $(MAYBE_MATCH) \
+          $(MAYBE_MKCATALOG) \
+          $(MAYBE_MKPROF) \
+          $(MAYBE_NOISECHISEL) \
+          $(MAYBE_QUERY) \
+          $(MAYBE_SEGMENT) \
+          $(MAYBE_STATISTICS) \
+          $(MAYBE_TABLE) \
+          $(MAYBE_TEMPLATE) \
+          $(MAYBE_WARP) \
+          bin/script \
+          doc \
+          tests
 
 
 
diff --git a/NEWS b/NEWS
index 1abf61aa..f6ef4b1f 100644
--- a/NEWS
+++ b/NEWS
@@ -86,6 +86,14 @@ See the end of the file for license conditions.
 
 ** Removed features
 
+  MakeNoise:
+    - MakeNoise (with executable name 'astmknoise') has been removed from
+      Gnuastro. This is because the 'mknoise-*' operators of Arithmetic do
+      the same job, but in a much more customizable, modular and managable
+      manner; allowing to mix with other operators. The "Noise basics"
+      sub-section of the book has been moved under the Arithmetic program's
+      documentation also.
+
 ** Changed features
 
   Arithmetic:
diff --git a/README b/README
index c997ad6f..a6bc1f7c 100644
--- a/README
+++ b/README
@@ -70,9 +70,6 @@ categories/chapters.
     NoiseChisel). The catalogs are highly customizable and adding new
     calculations/columns is very streightforward.
 
-  - MakeNoise (astmknoise): Make (add) noise to an image, with a large set
-    of random number generators and any seed.
-
   - MakeProfiles (astmkprof): Make mock 2D profiles in an image. The
     central regions of radial profiles are made with a configurable 2D
     Monte Carlo integration. It can also build the profiles on an
diff --git a/bin/mknoise/Makefile.am b/bin/mknoise/Makefile.am
deleted file mode 100644
index f3cebb2d..00000000
--- a/bin/mknoise/Makefile.am
+++ /dev/null
@@ -1,45 +0,0 @@
-## Process this file with automake to produce Makefile.inx
-##
-## Original author:
-##     Mohammad Akhlaghi <mohammad@akhlaghi.org>
-## Contributing author(s):
-## Copyright (C) 2015-2023 Free Software Foundation, Inc.
-##
-## Gnuastro is free software: you can redistribute it and/or modify it
-## under the terms of the GNU General Public License as published by
-## the Free Software Foundation, either version 3 of the License, or
-## (at your option) any later version.
-##
-## Gnuastro is distributed in the hope that it will be useful, but
-## WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-## General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
-
-
-## Necessary pre-processer and linker flags.
-AM_LDFLAGS  = -L\$(top_builddir)/lib
-AM_CPPFLAGS = -I\$(top_builddir)/bootstrapped/lib \
-              -I\$(top_srcdir)/bootstrapped/lib \
-              -I\$(top_srcdir)/lib
-
-
-
-## Program definition (name, linking, sources and headers)
-bin_PROGRAMS = astmknoise
-
-## Reason for linking with 'libgnu' described in 'bin/TEMPLATE/Makefile.am'.
-astmknoise_LDADD = $(top_builddir)/bootstrapped/lib/libgnu.la \
-                   -lgnuastro $(CONFIG_LDADD)
-
-astmknoise_SOURCES = main.c ui.c mknoise.c
-
-EXTRA_DIST = main.h authors-cite.h args.h ui.h mknoise.h
-
-
-
-## The configuration file (distribute and install).
-## NOTE: the man page is created in doc/Makefile.am
-dist_sysconf_DATA = astmknoise.conf
diff --git a/bin/mknoise/args.h b/bin/mknoise/args.h
deleted file mode 100644
index 4cafa644..00000000
--- a/bin/mknoise/args.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/*********************************************************************
-MakeNoise - Add noise to a dataset.
-MakeNoise is part of GNU Astronomy Utilities (Gnuastro) package.
-
-Original author:
-     Mohammad Akhlaghi <mohammad@akhlaghi.org>
-Contributing author(s):
-Copyright (C) 2016-2023 Free Software Foundation, Inc.
-
-Gnuastro is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation, either version 3 of the License, or (at your
-option) any later version.
-
-Gnuastro is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
-**********************************************************************/
-#ifndef ARGS_H
-#define ARGS_H
-
-
-
-
-
-
-/* Array of acceptable options. */
-struct argp_option program_options[] =
-  {
-    {
-      "sigma",
-      UI_KEY_SIGMA,
-      "FLT",
-      0,
-      "Total noise sigma, ignore other options.",
-      GAL_OPTIONS_GROUP_INPUT,
-      &p->sigma,
-      GAL_TYPE_FLOAT64,
-      GAL_OPTIONS_RANGE_GE_0,
-      GAL_OPTIONS_NOT_MANDATORY,
-      GAL_OPTIONS_NOT_SET
-    },
-    {
-      "instrumental",
-      UI_KEY_INSTRUMENTAL,
-      "FLT",
-      0,
-      "Instrument noise level (in pixel value units).",
-      GAL_OPTIONS_GROUP_INPUT,
-      &p->instrumental,
-      GAL_TYPE_FLOAT64,
-      GAL_OPTIONS_RANGE_GE_0,
-      GAL_OPTIONS_NOT_MANDATORY,
-      GAL_OPTIONS_NOT_SET
-    },
-    {
-      "background",
-      UI_KEY_BACKGROUND,
-      "FLT",
-      0,
-      "Fixed background magnitude for whole input.",
-      GAL_OPTIONS_GROUP_INPUT,
-      &p->background,
-      GAL_TYPE_FLOAT64,
-      GAL_OPTIONS_RANGE_ANY,
-      GAL_OPTIONS_NOT_MANDATORY,
-      GAL_OPTIONS_NOT_SET
-    },
-    {
-      "zeropoint",
-      UI_KEY_ZEROPOINT,
-      "FLT",
-      0,
-      "Zeropoint magnitude of input.",
-      GAL_OPTIONS_GROUP_INPUT,
-      &p->zeropoint,
-      GAL_TYPE_FLOAT64,
-      GAL_OPTIONS_RANGE_GE_0,
-      GAL_OPTIONS_NOT_MANDATORY,
-      GAL_OPTIONS_NOT_SET
-    },
-    {
-      "bgnotmag",
-      UI_KEY_BGNOTMAG,
-      0,
-      0,
-      "Background is brightness, not magnitude.",
-      GAL_OPTIONS_GROUP_OPERATING_MODE,
-      &p->bgnotmag,
-      GAL_OPTIONS_NO_ARG_TYPE,
-      GAL_OPTIONS_RANGE_0_OR_1,
-      GAL_OPTIONS_NOT_MANDATORY,
-      GAL_OPTIONS_NOT_SET
-    },
-
-
-
-
-    {
-      "envseed",
-      UI_KEY_ENVSEED,
-      0,
-      0,
-      "Use GSL_RNG_SEED environment variable for seed",
-      GAL_OPTIONS_GROUP_OPERATING_MODE,
-      &p->envseed,
-      GAL_OPTIONS_NO_ARG_TYPE,
-      GAL_OPTIONS_RANGE_0_OR_1,
-      GAL_OPTIONS_NOT_MANDATORY,
-      GAL_OPTIONS_NOT_SET
-    },
-
-
-    {0}
-  };
-
-
-
-
-
-/* Define the child argp structure. */
-struct argp
-gal_options_common_child = {gal_commonopts_options,
-                            gal_options_common_argp_parse,
-                            NULL, NULL, NULL, NULL, NULL};
-
-/* Use the child argp structure in list of children (only one for now). */
-struct argp_child
-children[]=
-{
-  {&gal_options_common_child, 0, NULL, 0},
-  {0, 0, 0, 0}
-};
-
-/* Set all the necessary argp parameters. */
-struct argp
-thisargp = {program_options, parse_opt, args_doc, doc, children, NULL, NULL};
-#endif
diff --git a/bin/mknoise/astmknoise.conf b/bin/mknoise/astmknoise.conf
deleted file mode 100644
index 5cdec928..00000000
--- a/bin/mknoise/astmknoise.conf
+++ /dev/null
@@ -1,27 +0,0 @@
-# Default parameters (System) for MakeNoise.
-# MakeNoise is part of GNU Astronomy Utitlies.
-#
-# Use the long option name of each parameter followed by a value. The name
-# and value should be separated by atleast one white-space character (for
-# example ' '[space], or tab). Lines starting with '#' are ignored.
-#
-# For more information, please run these commands:
-#
-#  $ astmknoise --help                   # Full list of options, short doc.
-#  $ astmknoise -P                       # Print all options and used values.
-#  $ info astmknoise                     # All options and input/output.
-#  $ info gnuastro "Configuration files" # How to use configuration files.
-#
-# 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.
-
-# Input:
-
-# Output:
- type           float32
-
-# Common options
diff --git a/bin/mknoise/authors-cite.h b/bin/mknoise/authors-cite.h
deleted file mode 100644
index f2e2366a..00000000
--- a/bin/mknoise/authors-cite.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*********************************************************************
-MakeNoise - Add noise to a dataset.
-MakeNoise is part of GNU Astronomy Utilities (Gnuastro) package.
-
-Original author:
-     Mohammad Akhlaghi <mohammad@akhlaghi.org>
-Contributing author(s):
-Copyright (C) 2017-2023 Free Software Foundation, Inc.
-
-Gnuastro is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation, either version 3 of the License, or (at your
-option) any later version.
-
-Gnuastro is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
-**********************************************************************/
-#ifndef AUTHORS_CITE_H
-#define AUTHORS_CITE_H
-
-/* When any specific citation is necessary, please add its BibTeX (from ADS
-   hopefully) to this variable along with a title decribing what this
-   paper/book does for the progarm in a short line. In the following line
-   put a row of '-' with the same length and then put the BibTeX.
-
-   This macro will be used in 'gal_options_print_citation' function of
-   'lib/options.c' (from the top Gnuastro source code directory). */
-
-#define PROGRAM_BIBTEX ""
-
-#define PROGRAM_AUTHORS "Mohammad Akhlaghi"
-
-#endif
diff --git a/bin/mknoise/main.c b/bin/mknoise/main.c
deleted file mode 100644
index 4540dc6e..00000000
--- a/bin/mknoise/main.c
+++ /dev/null
@@ -1,56 +0,0 @@
-/*********************************************************************
-MakeNoise - Add noise to a dataset.
-MakeNoise is part of GNU Astronomy Utilities (Gnuastro) package.
-
-Original author:
-     Mohammad Akhlaghi <mohammad@akhlaghi.org>
-Contributing author(s):
-Copyright (C) 2015-2023 Free Software Foundation, Inc.
-
-Gnuastro is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation, either version 3 of the License, or (at your
-option) any later version.
-
-Gnuastro is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
-**********************************************************************/
-#include <config.h>
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <gnuastro-internal/timing.h>
-
-#include "main.h"
-
-#include "ui.h"                 /* needs main.h.                  */
-#include "mknoise.h"            /* needs main.h.                  */
-
-int
-main (int argc, char *argv[])
-{
-  struct timeval t1;
-  struct mknoiseparams p={{{0},0},0};
-
-  /* Set the starting time.*/
-  time(&p.rawtime);
-  gettimeofday(&t1, NULL);
-
-  /* Read the input parameters. */
-  ui_read_check_inputs_setup(argc, argv, &p);
-
-  /* Run MakeProfiles */
-  mknoise(&p);
-
-  /* Free all non-freed allocations. */
-  ui_free_report(&p, &t1);
-
-  /* Return successfully.*/
-  return EXIT_SUCCESS;
-}
diff --git a/bin/mknoise/main.h b/bin/mknoise/main.h
deleted file mode 100644
index 18bbe434..00000000
--- a/bin/mknoise/main.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*********************************************************************
-MakeNoise - Add noise to a dataset.
-MakeNoise is part of GNU Astronomy Utilities (Gnuastro) package.
-
-Original author:
-     Mohammad Akhlaghi <mohammad@akhlaghi.org>
-Contributing author(s):
-Copyright (C) 2016-2023 Free Software Foundation, Inc.
-
-Gnuastro is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation, either version 3 of the License, or (at your
-option) any later version.
-
-Gnuastro is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
-**********************************************************************/
-#ifndef MAIN_H
-#define MAIN_H
-
-/* Include necessary headers */
-#include <gnuastro/data.h>
-#include <gsl/gsl_rng.h>
-
-#include <gnuastro-internal/options.h>
-
-/* Progarm names.  */
-#define PROGRAM_NAME   "MakeNoise"     /* Program full name.       */
-#define PROGRAM_EXEC   "astmknoise"    /* Program executable name. */
-#define PROGRAM_STRING PROGRAM_NAME" (" PACKAGE_NAME ") " PACKAGE_VERSION
-
-
-
-
-
-/* Main program parameters structure */
-struct mknoiseparams
-{
-  /* From command-line */
-  struct gal_options_common_params cp;   /* Common parameters.           */
-  char        *inputname;    /* Input filename.                          */
-  double           sigma;    /* Total noise sigma (ignoring others).     */
-  double    instrumental;    /* Standard deviation constants.            */
-  double       zeropoint;    /* Zeropoint magnitude of image.            */
-  double      background;    /* Background in magnitudes.                */
-  uint8_t       bgnotmag;    /* Background is not magnitude.             */
-  uint8_t        envseed;    /* ==1, generate a random seed.             */
-
-  /* Internal */
-  gal_data_t      *input;    /* Input image data in double precision.    */
-  gsl_rng           *rng;    /* Main instance of random number generator.*/
-  const char   *rng_name;    /* The type/name of the Random number gen.  */
-  unsigned long rng_seed;    /* Seed of Random number generator.         */
-  time_t         rawtime;    /* Starting time of the program.            */
-};
-
-#endif
diff --git a/bin/mknoise/mknoise.c b/bin/mknoise/mknoise.c
deleted file mode 100644
index 24e37c41..00000000
--- a/bin/mknoise/mknoise.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*********************************************************************
-MakeNoise - Add noise to a dataset.
-MakeNoise is part of GNU Astronomy Utilities (Gnuastro) package.
-
-Original author:
-     Mohammad Akhlaghi <mohammad@akhlaghi.org>
-Contributing author(s):
-Copyright (C) 2015-2023 Free Software Foundation, Inc.
-
-Gnuastro is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation, either version 3 of the License, or (at your
-option) any later version.
-
-Gnuastro is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
-**********************************************************************/
-#include <config.h>
-
-#include <math.h>
-#include <stdio.h>
-#include <errno.h>
-#include <error.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/time.h>            /* Generate random seed. */
-
-#include <gsl/gsl_rng.h>         /* Used in setrandoms.   */
-#include <gnuastro/fits.h>
-#include <gnuastro/units.h>
-#include <gsl/gsl_randist.h>     /* To make noise.        */
-
-#include <gnuastro-internal/timing.h>
-#include <gnuastro-internal/checkset.h>
-
-#include "main.h"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-void
-convertsaveoutput(struct mknoiseparams *p)
-{
-  double tmp;
-  char *keyname;
-  gal_fits_list_key_t *headers=NULL;
-
-  /* Add the proper information to the header of the output: */
-  gal_fits_key_write_filename("INF", p->inputname, &headers, 0,
-                              p->cp.quiet);
-  if( !isnan(p->background) )
-    {
-      gal_checkset_allocate_copy("BCKGRND", &keyname);
-      gal_fits_key_list_add_end(&headers, GAL_TYPE_FLOAT64, keyname, 1,
-                                &p->background, 0,
-                                "Background value for Poisson noise.",
-                                0, NULL, 0);
-      if( !isnan(p->zeropoint) )
-        {
-          tmp=gal_units_counts_to_mag(p->background, p->zeropoint);
-          gal_checkset_allocate_copy("BCKGMAG", &keyname);
-          gal_fits_key_list_add_end(&headers, GAL_TYPE_FLOAT64, keyname, 1,
-                                    &tmp, 0,
-                                    "Background value in magnitudes",
-                                    0, NULL, 0);
-          gal_checkset_allocate_copy("BCKGZP", &keyname);
-          gal_fits_key_list_add_end(&headers, GAL_TYPE_FLOAT64, keyname, 1,
-                                    &p->zeropoint, 0,
-                                    "Zeropoint for interpreting magnitudes.",
-                                    0, NULL, 0);
-        }
-      if( !isnan(p->instrumental) )
-        {
-          gal_checkset_allocate_copy("INSTRU", &keyname);
-          gal_fits_key_list_add_end(&headers, GAL_TYPE_FLOAT64, keyname, 1,
-                                    &p->instrumental, 0,
-                                    "Instrumental noise in units of flux.",
-                                    0, NULL, 0);
-        }
-    }
-  else
-    {
-      gal_checkset_allocate_copy("SIGMA", &keyname);
-      gal_fits_key_list_add_end(&headers, GAL_TYPE_FLOAT64, keyname, 1,
-                                &p->sigma, 0, "Total noise sigma", 0,
-                                NULL, 0);
-    }
-  gal_checkset_allocate_copy("RNGTYPE", &keyname);
-  gal_fits_key_list_add_end(&headers, GAL_TYPE_STRING, keyname, 1,
-                            (void *)(p->rng_name), 0,
-                            "Random number generator (by GSL) type.",
-                            0, NULL, 0);
-  gal_checkset_allocate_copy("RNGSEED", &keyname);
-  gal_fits_key_list_add_end(&headers, GAL_TYPE_ULONG, keyname, 1,
-                            &p->rng_seed, 0,
-                            "Random number generator (by GSL) seed.",
-                            0, NULL, 0);
-
-  /* Save the output: first convert it to the desired type,  */
-  if(p->input->name) { free(p->input->name); p->input->name=NULL; }
-  p->input=gal_data_copy_to_new_type_free(p->input, p->cp.type);
-  p->input->name="NOISED";
-  gal_fits_img_write(p->input, p->cp.output, headers, PROGRAM_NAME);
-  p->input->name=NULL; /* because we didn't allocate it. */
-
-  /* Write the configuration keywords. */
-  gal_fits_key_write_filename("input", p->inputname, &p->cp.okeys, 1,
-                              p->cp.quiet);
-  gal_fits_key_write_config(&p->cp.okeys, "MakeNoise configuration",
-                            "MKNOISE-CONFIG", p->cp.output, "0", "NONE");
-}
-
-
-
-
-
-void
-mknoise(struct mknoiseparams *p)
-{
-  double *d, *df, back=p->background;
-  double inst = ( isnan(p->instrumental)
-                  ? 0.0f
-                  : p->instrumental*p->instrumental );
-
-  /* Add the noise: */
-  df=(d=p->input->array)+p->input->size;
-  if( !isnan(p->sigma) )
-    {
-      do
-        *d += gsl_ran_gaussian(p->rng, p->sigma);
-      while(++d<df);
-    }
-  else
-    {
-      do
-        *d += back + gsl_ran_gaussian(p->rng, sqrt( inst + back + *d ));
-      while(++d<df);
-    }
-
-  /* Convert and save the output in the proper format: */
-  convertsaveoutput(p);
-}
diff --git a/bin/mknoise/mknoise.h b/bin/mknoise/mknoise.h
deleted file mode 100644
index 92a2b741..00000000
--- a/bin/mknoise/mknoise.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*********************************************************************
-MakeNoise - Add noise to a dataset.
-MakeNoise is part of GNU Astronomy Utilities (Gnuastro) package.
-
-Original author:
-     Mohammad Akhlaghi <mohammad@akhlaghi.org>
-Contributing author(s):
-Copyright (C) 2015-2023 Free Software Foundation, Inc.
-
-Gnuastro is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation, either version 3 of the License, or (at your
-option) any later version.
-
-Gnuastro is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
-**********************************************************************/
-#ifndef MKNOISE_H
-#define MKNOISE_H
-
-void
-mknoise(struct mknoiseparams *p);
-
-#endif
diff --git a/bin/mknoise/ui.c b/bin/mknoise/ui.c
deleted file mode 100644
index 163e8094..00000000
--- a/bin/mknoise/ui.c
+++ /dev/null
@@ -1,466 +0,0 @@
-/*********************************************************************
-MakeNoise - Add noise to a dataset.
-MakeNoise is part of GNU Astronomy Utilities (Gnuastro) package.
-
-Original author:
-     Mohammad Akhlaghi <mohammad@akhlaghi.org>
-Contributing author(s):
-Copyright (C) 2015-2023 Free Software Foundation, Inc.
-
-Gnuastro is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation, either version 3 of the License, or (at your
-option) any later version.
-
-Gnuastro is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
-**********************************************************************/
-#include <config.h>
-
-#include <argp.h>
-#include <errno.h>
-#include <error.h>
-#include <stdio.h>
-#include <inttypes.h>
-
-#include <gnuastro/wcs.h>
-#include <gnuastro/fits.h>
-#include <gnuastro/array.h>
-#include <gnuastro/table.h>
-
-#include <gnuastro-internal/timing.h>
-#include <gnuastro-internal/options.h>
-#include <gnuastro-internal/checkset.h>
-#include <gnuastro-internal/tableintern.h>
-#include <gnuastro-internal/fixedstringmacros.h>
-
-#include "main.h"
-
-#include "ui.h"
-#include "authors-cite.h"
-
-
-
-
-
-/**************************************************************/
-/*********      Argp necessary global entities     ************/
-/**************************************************************/
-/* Definition parameters for the Argp: */
-const char *
-argp_program_version = PROGRAM_STRING "\n"
-                       GAL_STRINGS_COPYRIGHT
-                       "\n\nWritten/developed by "PROGRAM_AUTHORS;
-
-const char *
-argp_program_bug_address = PACKAGE_BUGREPORT;
-
-static char
-args_doc[] = "ASTRdata";
-
-const char
-doc[] = GAL_STRINGS_TOP_HELP_INFO PROGRAM_NAME" will add noise to all the "
-  "pixels in an input dataset. The noise parameters can be specified with "
-  "the options below. \n"
-  GAL_STRINGS_MORE_HELP_INFO
-  /* After the list of options: */
-  "\v"
-  PACKAGE_NAME" home page: "PACKAGE_URL;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/**************************************************************/
-/*********    Initialize & Parse command-line    **************/
-/**************************************************************/
-static void
-ui_initialize_options(struct mknoiseparams *p,
-                      struct argp_option *program_options,
-                      struct argp_option *gal_commonopts_options)
-{
-  size_t i;
-  struct gal_options_common_params *cp=&p->cp;
-
-
-  /* Set the necessary common parameters structure. */
-  cp->program_struct     = p;
-  cp->program_name       = PROGRAM_NAME;
-  cp->program_exec       = PROGRAM_EXEC;
-  cp->program_bibtex     = PROGRAM_BIBTEX;
-  cp->program_authors    = PROGRAM_AUTHORS;
-  cp->poptions           = program_options;
-  cp->coptions           = gal_commonopts_options;
-
-
-  /* Initialize options for this program. */
-  p->sigma               = NAN;
-  p->zeropoint           = NAN;
-  p->background          = NAN;
-  p->instrumental        = NAN;
-
-
-  /* Modify common options. */
-  for(i=0; !gal_options_is_last(&cp->coptions[i]); ++i)
-    {
-      /* Selet individually */
-      switch(cp->coptions[i].key)
-        {
-        case GAL_OPTIONS_KEY_TYPE:
-        case GAL_OPTIONS_KEY_MINMAPSIZE:
-          cp->coptions[i].mandatory=GAL_OPTIONS_MANDATORY;
-          break;
-
-        case GAL_OPTIONS_KEY_SEARCHIN:
-        case GAL_OPTIONS_KEY_TABLEFORMAT:
-        case GAL_OPTIONS_KEY_STDINTIMEOUT:
-          cp->coptions[i].flags=OPTION_HIDDEN;
-          break;
-        }
-
-      /* Select by group. */
-      switch(cp->coptions[i].group)
-        {
-        case GAL_OPTIONS_GROUP_TESSELLATION:
-          cp->coptions[i].doc=NULL; /* Necessary to remove title. */
-          cp->coptions[i].flags=OPTION_HIDDEN;
-          break;
-        }
-    }
-}
-
-
-
-
-
-/* Parse a single option: */
-error_t
-parse_opt(int key, char *arg, struct argp_state *state)
-{
-  struct mknoiseparams *p = state->input;
-
-  /* Pass 'gal_options_common_params' into the child parser.  */
-  state->child_inputs[0] = &p->cp;
-
-  /* In case the user incorrectly uses the equal sign (for example
-     with a short format or with space in the long format, then 'arg'
-     start with (if the short version was called) or be (if the long
-     version was called with a space) the equal sign. So, here we
-     check if the first character of arg is the equal sign, then the
-     user is warned and the program is stopped: */
-  if(arg && arg[0]=='=')
-    argp_error(state, "incorrect use of the equal sign ('='). For short "
-               "options, '=' should not be used and for long options, "
-               "there should be no space between the option, equal sign "
-               "and value");
-
-  /* Set the key to this option. */
-  switch(key)
-    {
-    /* Read the non-option tokens (arguments): */
-    case ARGP_KEY_ARG:
-      /* The user may give a shell variable that is empty! In that case
-         'arg' will be an empty string! We don't want to account for such
-         cases (and give a clear error that no input has been given). */
-      if(p->inputname)
-        argp_error(state, "only one argument (input file) should be given");
-      else
-        if(arg[0]!='\0') p->inputname=arg;
-      break;
-
-    /* This is an option, set its value. */
-    default:
-      return gal_options_set_from_key(key, arg, p->cp.poptions, &p->cp);
-    }
-
-  return 0;
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/**************************************************************/
-/***************       Sanity Check         *******************/
-/**************************************************************/
-/* Read and check ONLY the options. When arguments are involved, do the
-   check in 'ui_check_options_and_arguments'. */
-static void
-ui_read_check_only_options(struct mknoiseparams *p)
-{
-  /* At leaset one of '--sigma' or '--background' are necessary. */
-  if( isnan(p->sigma) && isnan(p->background) )
-    error(EXIT_FAILURE, 0, "noise not defined: please define the noise "
-          "level with either '--sigma' (for a fixed noise STD for all "
-          "the pixels, irrespective of their value) or '--background' "
-          "(to use in a Poisson noise model, where the noise will differ "
-          "based on pixel value)");
-
-
-  /* If a background magnitude is given ('--bgbrightness' hasn't been
-     called), the zeropoint is necessary. */
-  if( !isnan(p->background) )
-    {
-      /* Make sure that the background can be interpretted properly. */
-      if( p->bgnotmag==0 && isnan(p->zeropoint) )
-        error(EXIT_FAILURE, 0, "missing background information. When the "
-              "noise is identified by the background, a zeropoint magnitude "
-              "is mandatory. Please use the '--zeropoint' option to specify "
-              "a zeropoint magnitude. Alternatively, if your background value "
-              "is brightness (which is in linear scale and doesn't need a "
-              "zeropoint), please use '--bgnotmag'");
-
-      /* If the background is in units of magnitudes, convert it to
-         brightness. */
-      if( p->bgnotmag==0 )
-        p->background = pow(10, (p->zeropoint-p->background)/2.5f);
-
-      /* Make sure that the background is larger than 1 (where Poisson
-         noise is actually defined). */
-      if( p->background < 1 )
-        error(EXIT_FAILURE, 0, "background value is smaller than 1. "
-              "Poisson noise is only defined on a positive distribution "
-              "with values larger than 1. You can use the '--sigma' "
-              "option to add a fixed noise level (with any positive value) "
-              "to any pixel.");
-    }
-}
-
-
-
-
-
-static void
-ui_check_options_and_arguments(struct mknoiseparams *p)
-{
-  /* Make sure an input file name was given and if it was a FITS file, that
-     a HDU is also given. */
-  if(p->inputname)
-    {
-      if( gal_fits_file_recognized(p->inputname) && p->cp.hdu==NULL )
-        error(EXIT_FAILURE, 0, "no HDU specified. When the input is a FITS "
-              "file, a HDU must also be specified, you can use the '--hdu' "
-              "('-h') option and give it the HDU number (starting from "
-              "zero), extension name, or anything acceptable by CFITSIO");
-
-    }
-  else
-    error(EXIT_FAILURE, 0, "no input file is specified");
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/**************************************************************/
-/***************       Preparations         *******************/
-/**************************************************************/
-void
-ui_preparations(struct mknoiseparams *p)
-{
-  /* Read the input image as a double type */
-  p->input=gal_array_read_one_ch_to_type(p->inputname, p->cp.hdu, NULL,
-                                         GAL_TYPE_FLOAT64,
-                                         p->cp.minmapsize,
-                                         p->cp.quietmmap, "--hdu");
-  p->input->wcs=gal_wcs_read(p->inputname, p->cp.hdu,
-                             p->cp.wcslinearmatrix, 0, 0, &p->input->nwcs,
-                             "--hdu");
-  p->input->ndim=gal_dimension_remove_extra(p->input->ndim, p->input->dsize,
-                                            p->input->wcs);
-
-
-  /* If we are dealing with an input table, make sure the format of the
-     output table is valid, given the type of the output. */
-  if(p->input->ndim==1)
-    gal_tableintern_check_fits_format(p->cp.output, p->cp.tableformat);
-
-
-  /* Set the output name: */
-  if(p->cp.output)
-    gal_checkset_writable_remove(p->cp.output, p->inputname, 0,
-                                 p->cp.dontdelete);
-  else
-    p->cp.output=gal_checkset_automatic_output(&p->cp, p->inputname,
-                                               "_noised.fits");
-
-  /* Allocate the random number generator: */
-  p->rng=gal_checkset_gsl_rng(p->envseed, &p->rng_name, &p->rng_seed);
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/**************************************************************/
-/************         Set the parameters          *************/
-/**************************************************************/
-
-void
-ui_read_check_inputs_setup(int argc, char *argv[], struct mknoiseparams *p)
-{
-  struct gal_options_common_params *cp=&p->cp;
-  char message[GAL_TIMING_VERB_MSG_LENGTH_V];
-
-
-  /* Include the parameters necessary for argp from this program ('args.h')
-     and for the common options to all Gnuastro ('commonopts.h'). We want
-     to directly put the pointers to the fields in 'p' and 'cp', so we are
-     simply including the header here to not have to use long macros in
-     those headers which make them hard to read and modify. This also helps
-     in having a clean environment: everything in those headers is only
-     available within the scope of this function. */
-#include <gnuastro-internal/commonopts.h>
-#include "args.h"
-
-
-  /* Initialize the options and necessary information.  */
-  ui_initialize_options(p, program_options, gal_commonopts_options);
-
-
-  /* Read the command-line options and arguments. */
-  errno=0;
-  if(argp_parse(&thisargp, argc, argv, 0, 0, p))
-    error(EXIT_FAILURE, errno, "parsing arguments");
-
-
-  /* Read the configuration files and set the common values. */
-  gal_options_read_config_set(&p->cp);
-
-
-  /* Read the options into the program's structure, and check them and
-     their relations prior to printing. */
-  ui_read_check_only_options(p);
-
-
-  /* Print the option values if asked. Note that this needs to be done
-     after the option checks so un-sane values are not printed in the
-     output state. */
-  gal_options_print_state(&p->cp);
-
-
-  /* Prepare all the options as FITS keywords to write in output later. */
-  gal_options_as_fits_keywords(&p->cp);
-
-
-  /* Check that the options and arguments fit well with each other. Note
-     that arguments don't go in a configuration file. So this test should
-     be done after (possibly) printing the option values. */
-  ui_check_options_and_arguments(p);
-
-
-  /* Read/allocate all the necessary starting arrays. */
-  ui_preparations(p);
-
-
-  /* Everything is ready, notify the user of the program starting. */
-  if(!p->cp.quiet)
-    {
-      printf(PROGRAM_NAME" "PACKAGE_VERSION" started on %s",
-             ctime(&p->rawtime));
-      sprintf(message, "Random number generator type: %s", p->rng_name);
-      gal_timing_report(NULL, message, 1);
-      sprintf(message, "Random number generator seed: %lu", p->rng_seed);
-      gal_timing_report(NULL, message, 1);
-    }
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/**************************************************************/
-/************      Free allocated, report         *************/
-/**************************************************************/
-void
-ui_free_report(struct mknoiseparams *p, struct timeval *t1)
-{
-  /* Free the allocated arrays: */
-  free(p->cp.hdu);
-  free(p->cp.output);
-  gsl_rng_free(p->rng);
-  gal_data_free(p->input);
-
-  /* Print the final message. */
-  if(!p->cp.quiet)
-    gal_timing_report(t1, PROGRAM_NAME" finished in: ", 0);
-}
diff --git a/bin/mknoise/ui.h b/bin/mknoise/ui.h
deleted file mode 100644
index bd679378..00000000
--- a/bin/mknoise/ui.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*********************************************************************
-MakeNoise - Add noise to a dataset.
-MakeNoise is part of GNU Astronomy Utilities (Gnuastro) package.
-
-Original author:
-     Mohammad Akhlaghi <mohammad@akhlaghi.org>
-Contributing author(s):
-Copyright (C) 2015-2023 Free Software Foundation, Inc.
-
-Gnuastro is free software: you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation, either version 3 of the License, or (at your
-option) any later version.
-
-Gnuastro is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with Gnuastro. If not, see <http://www.gnu.org/licenses/>.
-**********************************************************************/
-#ifndef UI_H
-#define UI_H
-
-/* For common options groups. */
-#include <gnuastro-internal/options.h>
-
-
-
-
-
-/* Available letters for short options:
-
-   a c d f g j k l m n p r t u v w x y
-   A C E G H J L O Q R W X Y
-*/
-enum option_keys_enum
-{
-  /* With short-option version. */
-  UI_KEY_SIGMA          = 's',
-  UI_KEY_INSTRUMENTAL   = 'i',
-  UI_KEY_BACKGROUND     = 'b',
-  UI_KEY_ZEROPOINT      = 'z',
-  UI_KEY_ENVSEED        = 'e',
-  UI_KEY_BGNOTMAG       = 'B',
-
-  /* Only with long version (start with a value 1000, the rest will be set
-     automatically). */
-};
-
-
-
-
-
-void
-ui_read_check_inputs_setup(int argc, char *argv[], struct mknoiseparams *p);
-
-void
-ui_free_report(struct mknoiseparams *p, struct timeval *t1);
-
-#endif
diff --git a/configure.ac b/configure.ac
index 98d0d6ae..dce2b747 100644
--- a/configure.ac
+++ b/configure.ac
@@ -993,12 +993,6 @@ AC_ARG_ENABLE([mkcatalog],
               [AS_IF([test "x$enable_mkcatalog" != xno],
                      [enable_mkcatalog=yes; ayes=true])],
               [enable_mkcatalog=notset])
-AC_ARG_ENABLE([mknoise],
-              [AS_HELP_STRING([--enable-mknoise],
-                    [Install MakeNoise and other enabled programs.])],
-              [AS_IF([test "x$enable_mknoise" != xno],
-                     [enable_mknoise=yes; ayes=true])],
-              [enable_mknoise=notset])
 AC_ARG_ENABLE([mkprof],
               [AS_HELP_STRING([--enable-mkprof],
                     [Install MakeProfile and other enabled programs.])],
@@ -1067,7 +1061,6 @@ AS_IF([test $ayes = true ],
        AS_IF([test $enable_fits = notset],        [enable_fits=no])
        AS_IF([test $enable_match = notset],       [enable_match=no])
        AS_IF([test $enable_mkcatalog = notset],   [enable_mkcatalog=no])
-       AS_IF([test $enable_mknoise = notset],     [enable_mknoise=no])
        AS_IF([test $enable_mkprof = notset],      [enable_mkprof=no])
        AS_IF([test $enable_noisechisel = notset], [enable_noisechisel=no])
        AS_IF([test $enable_query = notset],       [enable_query=no])
@@ -1088,7 +1081,6 @@ AS_IF([test $ayes = true ],
        AS_IF([test $enable_fits = notset],        [enable_fits=yes])
        AS_IF([test $enable_match = notset],       [enable_match=yes])
        AS_IF([test $enable_mkcatalog = notset],   [enable_mkcatalog=yes])
-       AS_IF([test $enable_mknoise = notset],     [enable_mknoise=yes])
        AS_IF([test $enable_mkprof = notset],      [enable_mkprof=yes])
        AS_IF([test $enable_noisechisel = notset], [enable_noisechisel=yes])
        AS_IF([test $enable_query = notset],       [enable_query=yes])
@@ -1122,7 +1114,6 @@ AM_CONDITIONAL([COND_CROP],        [test $enable_crop = 
yes])
 AM_CONDITIONAL([COND_FITS],        [test $enable_fits = yes])
 AM_CONDITIONAL([COND_MATCH],       [test $enable_match = yes])
 AM_CONDITIONAL([COND_MKCATALOG],   [test $enable_mkcatalog = yes])
-AM_CONDITIONAL([COND_MKNOISE],     [test $enable_mknoise = yes])
 AM_CONDITIONAL([COND_MKPROF],      [test $enable_mkprof = yes])
 AM_CONDITIONAL([COND_NOISECHISEL], [test $enable_noisechisel = yes])
 AM_CONDITIONAL([COND_QUERY],       [test $enable_query = yes])
@@ -1150,9 +1141,10 @@ AC_DEFINE_UNQUOTED([CONFIG_GNUASTRO_LDADD], ["$LDADD"],
 
 
 
-# Tell autoconf what to work on: TEMPLATE cannot be put and then
-# commented here like the cases above, so don't forget to add your new
-# utility name here.
+# Tell autoconf what to work on:
+#  1. Order does NOT matter here.
+#  2. TEMPLATE cannot be put and then commented here like the cases above,
+#     so don't forget to add your new utility name here.
 AC_CONFIG_FILES([Makefile
                  doc/Makefile
                  lib/Makefile
@@ -1165,7 +1157,6 @@ AC_CONFIG_FILES([Makefile
                  bin/query/Makefile
                  bin/mkprof/Makefile
                  bin/script/Makefile
-                 bin/mknoise/Makefile
                  bin/segment/Makefile
                  bin/convertt/Makefile
                  bin/convolve/Makefile
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 5e4d146e..37eaa23a 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -120,9 +120,6 @@ endif
 if COND_MKCATALOG
   MAYBE_MKCATALOG_MAN = man/astmkcatalog.1
 endif
-if COND_MKNOISE
-  MAYBE_MKNOISE_MAN = man/astmknoise.1
-endif
 if COND_MKPROF
   MAYBE_MKPROF_MAN = man/astmkprof.1
 endif
@@ -158,7 +155,6 @@ dist_man_MANS = $(MAYBE_ARITHMETIC_MAN) \
   $(MAYBE_FITS_MAN) \
   $(MAYBE_MATCH_MAN) \
   $(MAYBE_MKCATALOG_MAN) \
-  $(MAYBE_MKNOISE_MAN) \
   $(MAYBE_MKPROF_MAN) \
   $(MAYBE_NOISECHISEL_MAN) \
   $(MAYBE_QUERY_MAN) \
@@ -204,67 +200,63 @@ man/astbuildprog.1: $(top_srcdir)/bin/buildprog/args.h  
$(ALLMANSDEP)
                          --libtool $(toputildir)/buildprog/astbuildprog
 
 man/astconvertt.1: $(top_srcdir)/bin/convertt/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "convert known data types to each other"      \
+       $(MAYBE_HELP2MAN) -n "convert known data types to each other" \
                          --libtool $(toputildir)/convertt/astconvertt
 
 man/astconvolve.1: $(top_srcdir)/bin/convolve/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "convolve an image with a given kernel"       \
+       $(MAYBE_HELP2MAN) -n "convolve an image with a given kernel" \
                          --libtool $(toputildir)/convolve/astconvolve
 
 man/astcosmiccal.1: $(top_srcdir)/bin/cosmiccal/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "estimate cosmological values"                \
+       $(MAYBE_HELP2MAN) -n "estimate cosmological values" \
                          --libtool $(toputildir)/cosmiccal/astcosmiccal
 
 man/astcrop.1: $(top_srcdir)/bin/crop/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "crop regions of a dataset"                   \
+       $(MAYBE_HELP2MAN) -n "crop regions of a dataset" \
                          --libtool $(toputildir)/crop/astcrop
 
 man/astfits.1: $(top_srcdir)/bin/fits/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "view and manipulate FITS headers"            \
+       $(MAYBE_HELP2MAN) -n "view and manipulate FITS headers" \
                          --libtool $(toputildir)/fits/astfits
 
 man/astmatch.1: $(top_srcdir)/bin/match/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "match catalogs by 1D or 2D positions"        \
+       $(MAYBE_HELP2MAN) -n "match catalogs by 1D or 2D positions" \
                          --libtool $(toputildir)/match/astmatch
 
 man/astmkcatalog.1: $(top_srcdir)/bin/mkcatalog/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "Make a catalog from labeled input images"    \
+       $(MAYBE_HELP2MAN) -n "Make a catalog from labeled input images" \
                          --libtool $(toputildir)/mkcatalog/astmkcatalog
 
-man/astmknoise.1: $(top_srcdir)/bin/mknoise/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "add noise to an image"                       \
-                         --libtool $(toputildir)/mknoise/astmknoise
-
 man/astmkprof.1: $(top_srcdir)/bin/mkprof/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "make standard 2D profiles on an image"       \
+       $(MAYBE_HELP2MAN) -n "make standard 2D profiles on an image" \
                          --libtool $(toputildir)/mkprof/astmkprof
 
 man/astnoisechisel.1: $(top_srcdir)/bin/noisechisel/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "detect signal in a noisy image"              \
+       $(MAYBE_HELP2MAN) -n "detect signal in a noisy image" \
                          --libtool $(toputildir)/noisechisel/astnoisechisel
 
 man/astquery.1: $(top_srcdir)/bin/query/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "query remote data servers and download"      \
+       $(MAYBE_HELP2MAN) -n "query remote data servers and download" \
                          --libtool $(toputildir)/query/astquery
 
 man/astsegment.1: $(top_srcdir)/bin/segment/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "segmentation based on signal structure"      \
+       $(MAYBE_HELP2MAN) -n "segmentation based on signal structure" \
                          --libtool $(toputildir)/segment/astsegment
 
 man/aststatistics.1: $(top_srcdir)/bin/statistics/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "calculate statistics of a dataset"           \
+       $(MAYBE_HELP2MAN) -n "calculate statistics of a dataset" \
                          --libtool $(toputildir)/statistics/aststatistics
 
 man/asttable.1: $(top_srcdir)/bin/table/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "read and write ASCII and FITS tables"        \
+       $(MAYBE_HELP2MAN) -n "read and write ASCII and FITS tables" \
                          --libtool $(toputildir)/table/asttable
 
 #man/astTEMPLATE.1: $(top_srcdir)/bin/TEMPLATE/args.h  $(ALLMANSDEP)
-#      $(MAYBE_HELP2MAN) -n "put a short description here"                \
+#      $(MAYBE_HELP2MAN) -n "put a short description here"  \
                          $(toputildir)/TEMPLATE/astTEMPLATE
 
 man/astwarp.1: $(top_srcdir)/bin/warp/args.h  $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "warp (transform) input dataset"              \
+       $(MAYBE_HELP2MAN) -n "warp (transform) input dataset" \
                          --libtool $(toputildir)/warp/astwarp
 
 
@@ -272,57 +264,63 @@ man/astwarp.1: $(top_srcdir)/bin/warp/args.h  
$(ALLMANSDEP)
 
 
 # The Scripts:
-man/astscript-dither-simulate.1: $(top_srcdir)/bin/script/dither-simulate.sh   
\
-                            $(ALLMANSDEP)
+man/astscript-dither-simulate.1: $(top_srcdir)/bin/script/dither-simulate.sh \
+                                 $(ALLMANSDEP)
        $(MAYBE_HELP2MAN) -n "Simulate the exposure map of a dither pattern" \
-                         --libtool 
$(toputildir)/script/astscript-dither-simulate
+                         --libtool \
+                         $(toputildir)/script/astscript-dither-simulate
 
-man/astscript-ds9-region.1: $(top_srcdir)/bin/script/ds9-region.sh   \
+man/astscript-ds9-region.1: $(top_srcdir)/bin/script/ds9-region.sh \
                             $(ALLMANSDEP)
        $(MAYBE_HELP2MAN) -n "Create an SAO DS9 region file from a table" \
                          --libtool $(toputildir)/script/astscript-ds9-region
 
-man/astscript-fits-view.1: $(top_srcdir)/bin/script/fits-view.sh   \
+man/astscript-fits-view.1: $(top_srcdir)/bin/script/fits-view.sh \
                             $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "View FITS images in DS9 and tables in TOPCAT 
based on contents" \
+       $(MAYBE_HELP2MAN) -n "View FITS images in DS9 and tables in TOPCAT" \
                          --libtool $(toputildir)/script/astscript-fits-view
 
 man/astscript-psf-scale-factor.1: $(top_srcdir)/bin/script/psf-scale-factor.sh 
\
                                   $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "Find factor to scale PSF to a given star in an 
image" \
-                         --libtool 
$(toputildir)/script/astscript-psf-scale-factor
+       $(MAYBE_HELP2MAN) -n "Find factor to scale PSF to a given star" \
+                         --libtool \
+                         $(toputildir)/script/astscript-psf-scale-factor
 
 man/astscript-psf-select-stars.1: $(top_srcdir)/bin/script/psf-select-stars.sh 
\
                                   $(ALLMANSDEP)
        $(MAYBE_HELP2MAN) -n "Select good stars for constructing the PSF" \
-                         --libtool 
$(toputildir)/script/astscript-psf-select-stars
+                         --libtool \
+                         $(toputildir)/script/astscript-psf-select-stars
 
 man/astscript-psf-stamp.1: $(top_srcdir)/bin/script/psf-stamp.sh \
                            $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "Make normalized stamp of star with background 
objects masked" \
+       $(MAYBE_HELP2MAN) -n "Make normalized stamp with other sources masked" \
                          --libtool $(toputildir)/script/astscript-psf-stamp
 
 man/astscript-psf-subtract.1: $(top_srcdir)/bin/script/psf-subtract.sh \
                               $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "Subtract a given PSF model from the image of 
star" \
-                         --libtool $(toputildir)/script/astscript-psf-subtract
+       $(MAYBE_HELP2MAN) -n "Subtract a given PSF model from the image" \
+                         --libtool \
+                         $(toputildir)/script/astscript-psf-subtract
 
 man/astscript-psf-unite.1: $(top_srcdir)/bin/script/psf-unite.sh \
                            $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "Unite the outer and inner regions of the PSF into 
one" \
+       $(MAYBE_HELP2MAN) -n "Unite the outer and inner regions of the PSF" \
                          --libtool $(toputildir)/script/astscript-psf-unite
 
-man/astscript-radial-profile.1: $(top_srcdir)/bin/script/radial-profile.sh   \
+man/astscript-radial-profile.1: $(top_srcdir)/bin/script/radial-profile.sh \
                                 $(ALLMANSDEP)
        $(MAYBE_HELP2MAN) -n "Create a radial profile of an object in an image" 
\
-                         --libtool 
$(toputildir)/script/astscript-radial-profile
+                         --libtool \
+                         $(toputildir)/script/astscript-radial-profile
 
-man/astscript-sort-by-night.1: $(top_srcdir)/bin/script/sort-by-night.sh   \
+man/astscript-sort-by-night.1: $(top_srcdir)/bin/script/sort-by-night.sh \
                                $(ALLMANSDEP)
-       $(MAYBE_HELP2MAN) -n "Sort input FITS files by night"              \
-                         --libtool $(toputildir)/script/astscript-sort-by-night
+       $(MAYBE_HELP2MAN) -n "Sort input FITS files by night" \
+                         --libtool \
+                         $(toputildir)/script/astscript-sort-by-night
 
-man/astscript-zeropoint.1: $(top_srcdir)/bin/script/zeropoint.sh   \
+man/astscript-zeropoint.1: $(top_srcdir)/bin/script/zeropoint.sh \
                            $(ALLMANSDEP)
        $(MAYBE_HELP2MAN) -n "Estimate zero point of an image" \
                          --libtool $(toputildir)/script/astscript-zeropoint
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index b55535ec..1297b054 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -80,9 +80,6 @@ A copy of the license is included in the section entitled 
``GNU Free Documentati
 * MakeCatalog: (gnuastro)MakeCatalog. Make a catalog from labeled image.
 * astmkcatalog: (gnuastro)Invoking astmkcatalog. Options to MakeCatalog.
 
-* MakeNoise: (gnuastro)MakeNoise. Make (add) noise to an image.
-* astmknoise: (gnuastro)Invoking astmknoise. Options to MakeNoise.
-
 * MakeProfiles: (gnuastro)MakeProfiles. Make mock profiles.
 * astmkprof: (gnuastro)Invoking astmkprof. Options to MakeProfiles.
 
@@ -532,9 +529,17 @@ Arithmetic
 
 * Reverse polish notation::     The current notation style for Arithmetic
 * Integer benefits and pitfalls::  Integers have major benefits, but require 
care
+* Noise basics::
 * Arithmetic operators::        List of operators known to Arithmetic
 * Invoking astarithmetic::      How to run Arithmetic: options and output
 
+Noise basics
+
+* Photon counting noise::       Poisson noise
+* Instrumental noise::          Readout, dark current and other sources.
+* Final noised pixel value::    How the final noised value is calculated.
+* Generating random numbers::   How random numbers are generated.
+
 Arithmetic operators
 
 * Basic mathematical operators::  For example, +, -, /, log, and pow.
@@ -552,7 +557,7 @@ Arithmetic operators
 * Bitwise operators::           Work on bits within one pixel.
 * Numerical type conversion operators::  Convert the numeric datatype of a 
dataset.
 * Random number generators::    Random numbers can be used to add noise for 
example.
-* Box shape operators::         Dealing with box shapes and coordinates of 
vertices.
+* Box shape operators::
 * Loading external columns::    Read a column from a table into the stack.
 * Size and position operators::  Extracting image size and pixel positions.
 * Building new dataset and stack management::  How to construct an empty 
dataset from scratch.
@@ -700,7 +705,6 @@ Match
 Data modeling
 
 * MakeProfiles::                Making mock galaxies and stars.
-* MakeNoise::                   Make (add) noise to an image.
 
 MakeProfiles
 
@@ -725,18 +729,6 @@ Invoking MakeProfiles
 * MakeProfiles output dataset::  The canvas/dataset to build profiles over.
 * MakeProfiles log file::       A description of the optional log file.
 
-MakeNoise
-
-* Noise basics::                Noise concepts and definitions.
-* Invoking astmknoise::         Options and arguments to MakeNoise.
-
-Noise basics
-
-* Photon counting noise::       Poisson noise
-* Instrumental noise::          Readout, dark current and other sources.
-* Final noised pixel value::    How the final noised value is calculated.
-* Generating random numbers::   How random numbers are generated.
-
 High-level calculations
 
 * CosmicCalculator::            Calculate cosmological variables
@@ -1103,9 +1095,6 @@ Input coordinates can be in pixel coordinates or world 
coordinates.
 (@file{astmkcatalog}, see @ref{MakeCatalog}) Make catalog of labeled image 
(output of NoiseChisel).
 The catalogs are highly customizable and adding new calculations/columns is 
very straightforward.
 
-@item MakeNoise
-(@file{astmknoise}, see @ref{MakeNoise}) Make (add) noise to an image, with a 
large set of random number generators and any seed.
-
 @item MakeProfiles
 (@file{astmkprof}, see @ref{MakeProfiles}) Make mock 2D profiles in an image.
 The central regions of radial profiles are made with a configurable 2D Monte 
Carlo integration.
@@ -7692,15 +7681,14 @@ All this trouble was certainly worth it because now 
there is no dimming on the e
 The final step to simulate a real observation would be to add noise to the 
image.
 Sufi set the zero point magnitude to the same value that he set when making 
the mock profiles and looking again at his observation log, he had measured the 
background flux near the nebula had a @emph{per-pixel} magnitude of 7 that 
night.
 For more on how the background value determines the noise, see @ref{Noise 
basics}.
-So using these values he ran MakeNoise, and with the second command, he 
visually inspected the image.
+So using these values he ran Arithmetic's @code{mknoise-sigma-from-mean} 
operator, and with the second command, he visually inspected the image.
+The @code{mknoise-sigma-from-mean} operator takes the noise standard deviation 
in linear units, not magnitudes (which are logarithmic).
+Therefore within the same Arithmetic command, he has converted the sky 
background magnitude to counts using Arithmetic's @code{counts-to-mag} operator.
 
 @example
-$ astmknoise --zeropoint=18 --background=7 --output=out.fits    \
-             cat_convolved_scaled_cropped.fits
-MakeNoise @value{VERSION} started on Sat Oct  6 17:05:06 953
-  - Generator type: ranlxs1
-  - Generator seed: 1428318100
-MakeNoise finished in:  0.033491 (seconds)
+$ astarithmetic cat_convolved_scaled_cropped.fits \
+                7 18 mag-to-counts mknoise-sigma-from-mean \
+                --output=out.fits
 
 $ astscript-fits-view out.fits
 @end example
@@ -7754,8 +7742,9 @@ astcrop "$base"_convolved_scaled.fits --zeroisnotblank \
         --mode=img --section=$st_edge:*-$edge,$st_edge:*-$edge
 
 # Add noise to the image.
-astmknoise --zeropoint=18 --background=7 --output=out.fits \
-           "$base"_convolved_scaled_cropped.fits
+$ astarithmetic "$base"_convolved_scaled_cropped.fits \
+                7 18 mag-to-counts mknoise-sigma-from-mean \
+                --output=out.fits
 
 # Remove all the temporary files.
 rm 0*.fits "$base"*.fits
@@ -19143,6 +19132,7 @@ For more information on how to run Arithmetic, please 
see @ref{Invoking astarith
 @menu
 * Reverse polish notation::     The current notation style for Arithmetic
 * Integer benefits and pitfalls::  Integers have major benefits, but require 
care
+* Noise basics::
 * Arithmetic operators::        List of operators known to Arithmetic
 * Invoking astarithmetic::      How to run Arithmetic: options and output
 @end menu
@@ -19232,7 +19222,7 @@ This is a very powerful notation and is used in 
languages like Postscript @footn
 
 
 
-@node Integer benefits and pitfalls, Arithmetic operators, Reverse polish 
notation, Arithmetic
+@node Integer benefits and pitfalls, Noise basics, Reverse polish notation, 
Arithmetic
 @subsection Integer benefits and pitfalls
 
 Integers are the simplest numerical data types (@ref{Numeric data types}).
@@ -19320,7 +19310,231 @@ It is possible to do internal checks in Gnuastro and 
catch integer overflows and
 However, we have not opted for this solution because all those checks will 
consume significant resources and slow down the program (especially with large 
datasets where RAM, storage and running time become important).
 To be optimal, we therefore trust that you (the wise Gnuastro user!) make the 
appropriate type conversion in your commands where necessary (recall that the 
operators are available in @ref{Numerical type conversion operators}).
 
-@node Arithmetic operators, Invoking astarithmetic, Integer benefits and 
pitfalls, Arithmetic
+@node Noise basics, Arithmetic operators, Integer benefits and pitfalls, 
Arithmetic
+@subsection Noise basics
+
+@cindex Noise
+@cindex Image noise
+Deep astronomical images, like those used in extragalactic studies, seriously 
suffer from noise in the data.
+Generally speaking, the sources of noise in an astronomical image are photon 
counting noise and Instrumental noise which are discussed in @ref{Photon 
counting noise} and @ref{Instrumental noise}.
+This review finishes with @ref{Generating random numbers} which is a short 
introduction on how random numbers are generated.
+We will see that while software random number generators are not perfect, they 
allow us to obtain a reproducible series of random numbers through setting the 
random number generator function and seed value.
+Therefore in this section, we will also discuss how you can set these two 
parameters in Gnuastro's programs (including the arithmetic operators in 
@ref{Random number generators}).
+
+@menu
+* Photon counting noise::       Poisson noise
+* Instrumental noise::          Readout, dark current and other sources.
+* Final noised pixel value::    How the final noised value is calculated.
+* Generating random numbers::   How random numbers are generated.
+@end menu
+
+@node Photon counting noise, Instrumental noise, Noise basics, Noise basics
+@subsubsection Photon counting noise
+
+@cindex Counting error
+@cindex de Moivre, Abraham
+@cindex Poisson distribution
+@cindex Photon counting noise
+@cindex Poisson, Sim@'eon Denis
+With the very accurate electronics used in today's detectors, photon counting 
noise@footnote{In practice, we are actually counting the electrons that are 
produced by each photon, not the actual photons.} is the most significant 
source of uncertainty in most datasets.
+To understand this noise (error in counting) and its effect on the images of 
astronomical targets, let's start by reviewing how a distribution produced by 
counting can be modeled as a parametric function.
+
+Counting is an inherently discrete operation, which can only produce positive 
integer outputs (including zero).
+For example, we cannot count @mymath{3.2} or @mymath{-2} of anything.
+We only count @mymath{0}, @mymath{1}, @mymath{2}, @mymath{3} and so on.
+The distribution of values, as a result of counting efforts is formally known 
as the @url{https://en.wikipedia.org/wiki/Poisson_distribution, Poisson 
distribution}.
+It is associated to Sim@'eon Denis Poisson, because he discussed it while 
working on the number of wrongful convictions in court cases in his 1837 
book@footnote{[From Wikipedia] Poisson's result was also derived in a previous 
study by Abraham de Moivre in 1711.
+Therefore some people suggest it should rightly be called the de Moivre 
distribution.}.
+
+@cindex Probability density function
+Let's take @mymath{\lambda} to represent the expected mean count of something.
+Furthermore, let's take @mymath{k} to represent the output of a counting 
attempt (hence @mymath{k} is a positive integer).
+The probability density function of getting @mymath{k} counts (in each 
attempt, given the expected/mean count of @mymath{\lambda}) can be written as:
+
+@cindex Poisson distribution
+@dispmath{f(k)={\lambda^k \over k!} e^{-\lambda},\quad k\in @{0, 1, 2, 3, 
\dots @}}
+
+@cindex Skewed Poisson distribution
+Because the Poisson distribution is only applicable to positive integer values 
(note the factorial operator, which only applies to non-negative integers), 
naturally it is very skewed when @mymath{\lambda} is near zero.
+One qualitative way to understand this behavior is that for smaller values 
near zero, there simply are not enough integers smaller than the mean, than 
integers that are larger.
+Therefore to accommodate all possibilities/counts, it has to be strongly 
skewed to the positive when the mean is small.
+For more on Skewness, see @ref{Skewness caused by signal and its measurement}.
+
+@cindex Compare Poisson and Gaussian
+As @mymath{\lambda} becomes larger, the distribution becomes more and more 
symmetric, and the variance of that distribution is equal to its mean.
+In other words, the standard deviation is the square root of the mean.
+It can also be proved that when the mean is large, say @mymath{\lambda>1000}, 
the Poisson distribution approaches the 
@url{https://en.wikipedia.org/wiki/Normal_distribution, Normal (Gaussian) 
distribution} with mean @mymath{\mu=\lambda} and standard deviation 
@mymath{\sigma=\sqrt{\lambda}}.
+In other words, a Poisson distribution (with a sufficiently large 
@mymath{\lambda}) is simply a Gaussian that has one free parameter 
(@mymath{\mu=\lambda} and @mymath{\sigma=\sqrt{\lambda}}), instead of the two 
parameters that the Gaussian distribution originally has (independent 
@mymath{\mu} and @mymath{\sigma}).
+
+@cindex Sky value
+@cindex Background flux
+@cindex Undetected objects
+In real situations, the photons/flux from our targets are combined with 
photons from a certain background (observationally, the @emph{Sky} value).
+The Sky value is defined to be the average flux of a region in the dataset 
with no targets.
+Its physical origin can be the brightness of the atmosphere (for ground-based 
instruments), possible stray light within the imaging instrument, the average 
flux of undetected targets, etc.
+The Sky value is thus an ideal definition, because in real datasets, what lies 
deep in the noise (far lower than the detection limit) is never 
known@footnote{In a real image, a relatively large number of very faint objects 
can be fully buried in the noise and never detected.
+These undetected objects will bias the background measurement to slightly 
larger values.
+Our best approximation is thus to simply assume they are uniform, and consider 
their average effect.
+See Figure 1 (a.1 and a.2) and Section 2.2 in 
@url{https://arxiv.org/abs/1505.01664, Akhlaghi and Ichikawa [2015]}.}.
+To account for all of these, the sky value is defined to be the average 
count/value of the undetected regions in the image.
+In a mock image/dataset, we have the luxury of setting the background (Sky) 
value.
+
+@cindex Simulating noise
+@cindex Noise simulation
+In summary, the value in each element of the dataset (pixel in an image) is 
the sum of contributions from various galaxies and stars (after convolution by 
the PSF, see @ref{PSF}).
+Let's name the convolved sum of possibly overlapping objects in each pixel as 
@mymath{I_{nn}}.
+@mymath{nn} represents `no noise'.
+For now, let's assume the background (@mymath{B}) is constant and sufficiently 
high for the Poisson distribution to be approximated by a Gaussian.
+Then the flux of that pixel, after adding noise, is @emph{a random value} 
taken from a Gaussian distribution with the following mean (@mymath{\mu}) and 
standard deviation (@mymath{\sigma}):
+
+@dispmath{\mu=B+I_{nn}, \quad \sigma=\sqrt{B+I_{nn}}}
+
+@cindex Bias level in detectors
+@cindex Dark level in detectors
+In astronomical instruments, @mymath{B} is enhanced by adding a ``bias'' level 
to each pixel before the shutter is even opened (for the exposure to start).
+As the exposure is ongoing and photo-electrons are accumulating from the 
astronomical objects, a ``dark'' current (due to thermal radiation of the 
instrument) also builds up in the pixels.
+The ``dark'' current will accumulate even when the shutter is closed, but the 
CCD electronics are working (hence the name ``dark'').
+This added dark level further enhances the mean value in a real observation 
compared to the raw background value (from the atmosphere for example).
+
+Since this type of noise is inherent in the objects we study, it is usually 
measured on the same scale as the astronomical objects, namely the magnitude 
system, see @ref{Brightness flux magnitude}.
+It is then internally converted to the flux scale for further processing.
+
+The equations above clearly show the importance of the background value and 
its effect on the final signal to noise ratio in each pixel of a science image.
+It is therefore, one of the most important factors in understanding the noise 
(and properly simulating observations where necessary).
+An inappropriately bright background value can hide the signal of the mock 
profile hide behind the noise.
+In other words, a brighter background has larger standard deviation and vice 
versa.
+As a result, the only necessary parameter to define photon-counting noise over 
a mock image of simulated profiles is the background.
+For a complete example, see @ref{Sufi simulates a detection}.
+
+To better understand the correlation between the mean (or background) value 
and the noise standard deviation, let's use an analogy.
+Consider the profile of your galaxy to be analogous to the profile of a ship 
that is sailing in the sea.
+The height of the ship would therefore be analogous to the maximum flux 
difference between your galaxy's minimum and maximum values.
+Furthermore, let's take the depth of the sea to represent the background 
value: a deeper sea, corresponds to a brighter background.
+In this analogy, the ``noise'' would be the height of the waves that surround 
the ship: in deeper waters, the waves would also be taller (the square root of 
the mean depth at the ship's position).
+
+If the ship is in deep waters, the height of waves are greater than when the 
ship is near to the beach (at lower depths).
+Therefore, when the ship is in the middle of the sea, there are high waves 
that are capable of hiding a significant part of the ship from our perspective.
+This corresponds to a brighter background value in astronomical images: the 
resulting noise from that brighter background can completely wash out the 
signal from a fainter galaxy, star or solar system object.
+
+@node Instrumental noise, Final noised pixel value, Photon counting noise, 
Noise basics
+@subsubsection Instrumental noise
+
+@cindex Readout noise
+@cindex Instrumental noise
+@cindex Noise, instrumental
+While taking images with a camera, a bias current is fed to the pixels, the 
variation of the value of this bias current over the pixels, also adds to the 
final image noise.
+Another source of noise is the readout noise that is produced by the 
electronics in the detector.
+Specifically, the parts that attempt to digitize the voltage produced by the 
photo-electrons in the analog to digital converter.
+With the current generation of instruments, this source of noise is not as 
significant as the noise due to the background Sky discussed in @ref{Photon 
counting noise}.
+
+Let @mymath{C} represent the combined standard deviation of all these 
instrumental sources of noise.
+When only this source of noise is present, the noised pixel value would be a 
random value chosen from a Gaussian distribution with
+
+@dispmath{\mu=I_{nn}, \quad \sigma=\sqrt{C^2+I_{nn}}}
+
+@cindex ADU
+@cindex Gain
+@cindex Counts
+This type of noise is independent of the signal in the dataset, it is only 
determined by the instrument.
+So the flux scale (and not magnitude scale) is most commonly used for this 
type of noise.
+In practice, this value is usually reported in analog-to-digital units or 
ADUs, not flux or electron counts.
+The gain value of the device can be used to convert between these two, see 
@ref{Brightness flux magnitude}.
+
+@node Final noised pixel value, Generating random numbers, Instrumental noise, 
Noise basics
+@subsubsection Final noised pixel value
+Based on the discussions in @ref{Photon counting noise} and @ref{Instrumental 
noise}, depending on the values you specify for @mymath{B} and @mymath{C} from 
the above, the final noised value for each pixel is a random value chosen from 
a Gaussian distribution with
+
+@dispmath{\mu=B+I_{nn}, \quad \sigma=\sqrt{C^2+B+I_{nn}}}
+
+
+
+@node Generating random numbers,  , Final noised pixel value, Noise basics
+@subsubsection Generating random numbers
+
+@cindex Random numbers
+@cindex Numbers, random
+As discussed above, to generate noise we need to make random samples of a 
particular distribution.
+So it is important to understand some general concepts regarding the 
generation of random numbers.
+For a very complete and nice introduction we strongly advise reading Donald 
Knuth's ``The art of computer programming'', volume 2, chapter 
3@footnote{Knuth, Donald. 1998.
+The art of computer programming. Addison--Wesley. ISBN 0-201-89684-2 }.
+Quoting from the GNU Scientific Library manual, ``If you do not own it, you 
should stop reading right now, run to the nearest bookstore, and buy 
it''@footnote{For students, running to the library might be more affordable!}!
+
+@cindex Psuedo-random numbers
+@cindex Numbers, psuedo-random
+Using only software, we can only produce what is called a psuedo-random 
sequence of numbers.
+A true random number generator is a hardware (let's assume we have made sure 
it has no systematic biases), for example, throwing dice or flipping coins 
(which have remained from the ancient times).
+More modern hardware methods use atmospheric noise, thermal noise or other 
types of external electromagnetic or quantum phenomena.
+All pseudo-random number generators (software) require a seed to be the basis 
of the generation.
+The advantage of having a seed is that if you specify the same seed for 
multiple runs, you will get an identical sequence of random numbers which 
allows you to reproduce the same final noised image.
+
+@cindex Environment variables
+@cindex GNU Scientific Library
+The programs in GNU Astronomy Utilities (for example, MakeNoise or 
MakeProfiles) use the GNU Scientific Library (GSL) to generate random numbers.
+GSL allows the user to set the random number generator through environment 
variables, see @ref{Installation directory} for an introduction to environment 
variables.
+In the chapter titled ``Random Number Generation'' they have fully explained 
the various random number generators that are available (there are a lot of 
them!).
+Through the two environment variables @code{GSL_RNG_TYPE} and 
@code{GSL_RNG_SEED} you can specify the generator and its seed respectively.
+
+@cindex Seed, Random number generator
+@cindex Random number generator, Seed
+If you do not specify a value for @code{GSL_RNG_TYPE}, GSL will use its 
default random number generator type.
+The default type is sufficient for most general applications.
+If no value is given for the @code{GSL_RNG_SEED} environment variable and you 
have asked Gnuastro to read the seed from the environment (through the 
@option{--envseed} option), then GSL will use the default value of each 
generator to give identical outputs.
+If you do not explicitly tell Gnuastro programs to read the seed value from 
the environment variable, then they will use the system time (accurate to 
within a microsecond) to generate (apparently random) seeds.
+In this manner, every time you run the program, you will get a different 
random number distribution.
+
+There are two ways you can specify values for these environment variables.
+You can call them on the same command-line for example:
+
+@example
+$ GSL_RNG_TYPE="taus" GSL_RNG_SEED=345 astarithmetic input.fits \
+                                                     mknoise-sigma \
+                                                     --envseed
+@end example
+
+@noindent
+In this manner the values will only be used for this particular execution of 
Arithmetic.
+However, it makes your code hard to read!
+Alternatively, you can define them for the full period of your terminal 
session or script, using the shell's @command{export} command with the two 
separate commands below (for a script remove the @code{$} signs):
+
+@example
+$ export GSL_RNG_TYPE="taus"
+$ export GSL_RNG_SEED=345
+@end example
+
+@cindex Startup scripts
+@cindex @file{.bashrc}
+@noindent
+The subsequent programs which use GSL's random number generators will hence 
forth use these values in this session of the terminal you are running or while 
executing this script.
+In case you want to set fixed values for these parameters every time you use 
the GSL random number generator, you can add these two lines to your 
@file{.bashrc} startup script@footnote{Do Not forget that if you are going to 
give your scripts (that use the GSL random number generator) to others you have 
to make sure you also tell them to set these environment variable separately.
+So for scripts, it is best to keep all such variable definitions within the 
script, even if they are within your @file{.bashrc}.}, see @ref{Installation 
directory}.
+
+@strong{IMPORTANT NOTE:} If the two environment variables @code{GSL_RNG_TYPE} 
and @code{GSL_RNG_SEED} are defined, GSL will report them by default, even if 
you do not use the @option{--envseed} option.
+For example, see this call to MakeProfiles:
+
+@example
+$ export GSL_RNG_TYPE=taus
+$ export GSL_RNG_SEED=345
+$ astmkprof -s1 --kernel=gaussian,2,5
+GSL_RNG_TYPE=taus
+GSL_RNG_SEED=345
+MakeProfiles V.VV started on DDD MMM DDD HH:MM:SS YYYY
+  - Building one gaussian kernel
+  - Random number generator (RNG) type: taus
+  - Basic RNG seed: 1618960836
+  ---- ./kernel.fits created.
+  -- Output: ./kernel.fits
+MakeProfiles finished in 0.068945 seconds
+@end example
+
+@noindent
+@cindex Seed, Random number generator
+@cindex Random number generator, Seed
+The first two output lines (showing the names and values of the GSL 
environment variables) are printed by GSL before MakeProfiles actually starts 
generating random numbers.
+Gnuastro's programs will report the actual values they use independently 
(after the name of the program), you should check them for the final values 
used, not GSL's printed values.
+In the example above, did you notice how the random number generator seed 
above is different between GSL and MakeProfiles?
+However, if @option{--envseed} was given, both printed seeds would be the same.
+
+@node Arithmetic operators, Invoking astarithmetic, Noise basics, Arithmetic
 @subsection Arithmetic operators
 
 In this section, list of recognized operators in Arithmetic (and the Table 
program's @ref{Column arithmetic}) and discussed in detail with examples.
@@ -19390,7 +19604,7 @@ Reading NaN as a floating point number in Gnuastro is 
not case-sensitive.
 * Bitwise operators::           Work on bits within one pixel.
 * Numerical type conversion operators::  Convert the numeric datatype of a 
dataset.
 * Random number generators::    Random numbers can be used to add noise for 
example.
-* Box shape operators::         Dealing with box shapes and coordinates of 
vertices.
+* Box shape operators::
 * Loading external columns::    Read a column from a table into the stack.
 * Size and position operators::  Extracting image size and pixel positions.
 * Building new dataset and stack management::  How to construct an empty 
dataset from scratch.
@@ -29412,13 +29626,12 @@ The tools in this chapter create model galaxies and 
will provide 2D fittings to
 
 @menu
 * MakeProfiles::                Making mock galaxies and stars.
-* MakeNoise::                   Make (add) noise to an image.
 @end menu
 
 
 
 
-@node MakeProfiles, MakeNoise, Data modeling, Data modeling
+@node MakeProfiles,  , Data modeling, Data modeling
 @section MakeProfiles
 
 @cindex Checking detection algorithms
@@ -30504,333 +30717,6 @@ If an individual image was created, this column will 
have a value of @code{1}, o
 
 
 
-@node MakeNoise,  , MakeProfiles, Data modeling
-@section MakeNoise
-
-@cindex Noise
-Real data are always buried in noise, therefore to finalize a simulation of 
real data (for example, to test our observational algorithms) it is essential 
to add noise to the mock profiles created with MakeProfiles, see 
@ref{MakeProfiles}.
-Below, the general principles and concepts to help understand how noise is 
quantified is discussed.
-MakeNoise options and argument are then discussed in @ref{Invoking astmknoise}.
-
-@menu
-* Noise basics::                Noise concepts and definitions.
-* Invoking astmknoise::         Options and arguments to MakeNoise.
-@end menu
-
-
-
-@node Noise basics, Invoking astmknoise, MakeNoise, MakeNoise
-@subsection Noise basics
-
-@cindex Noise
-@cindex Image noise
-Deep astronomical images, like those used in extragalactic studies, seriously 
suffer from noise in the data.
-Generally speaking, the sources of noise in an astronomical image are photon 
counting noise and Instrumental noise which are discussed in @ref{Photon 
counting noise} and @ref{Instrumental noise}.
-This review finishes with @ref{Generating random numbers} which is a short 
introduction on how random numbers are generated.
-We will see that while software random number generators are not perfect, they 
allow us to obtain a reproducible series of random numbers through setting the 
random number generator function and seed value.
-Therefore in this section, we will also discuss how you can set these two 
parameters in Gnuastro's programs (including MakeNoise).
-
-@menu
-* Photon counting noise::       Poisson noise
-* Instrumental noise::          Readout, dark current and other sources.
-* Final noised pixel value::    How the final noised value is calculated.
-* Generating random numbers::   How random numbers are generated.
-@end menu
-
-@node Photon counting noise, Instrumental noise, Noise basics, Noise basics
-@subsubsection Photon counting noise
-
-@cindex Counting error
-@cindex de Moivre, Abraham
-@cindex Poisson distribution
-@cindex Photon counting noise
-@cindex Poisson, Sim@'eon Denis
-With the very accurate electronics used in today's detectors, photon counting 
noise@footnote{In practice, we are actually counting the electrons that are 
produced by each photon, not the actual photons.} is the most significant 
source of uncertainty in most datasets.
-To understand this noise (error in counting) and its effect on the images of 
astronomical targets, let's start by reviewing how a distribution produced by 
counting can be modeled as a parametric function.
-
-Counting is an inherently discrete operation, which can only produce positive 
integer outputs (including zero).
-For example, we cannot count @mymath{3.2} or @mymath{-2} of anything.
-We only count @mymath{0}, @mymath{1}, @mymath{2}, @mymath{3} and so on.
-The distribution of values, as a result of counting efforts is formally known 
as the @url{https://en.wikipedia.org/wiki/Poisson_distribution, Poisson 
distribution}.
-It is associated to Sim@'eon Denis Poisson, because he discussed it while 
working on the number of wrongful convictions in court cases in his 1837 
book@footnote{[From Wikipedia] Poisson's result was also derived in a previous 
study by Abraham de Moivre in 1711.
-Therefore some people suggest it should rightly be called the de Moivre 
distribution.}.
-
-@cindex Probability density function
-Let's take @mymath{\lambda} to represent the expected mean count of something.
-Furthermore, let's take @mymath{k} to represent the output of a counting 
attempt (hence @mymath{k} is a positive integer).
-The probability density function of getting @mymath{k} counts (in each 
attempt, given the expected/mean count of @mymath{\lambda}) can be written as:
-
-@cindex Poisson distribution
-@dispmath{f(k)={\lambda^k \over k!} e^{-\lambda},\quad k\in @{0, 1, 2, 3, 
\dots @}}
-
-@cindex Skewed Poisson distribution
-Because the Poisson distribution is only applicable to positive integer values 
(note the factorial operator, which only applies to non-negative integers), 
naturally it is very skewed when @mymath{\lambda} is near zero.
-One qualitative way to understand this behavior is that for smaller values 
near zero, there simply are not enough integers smaller than the mean, than 
integers that are larger.
-Therefore to accommodate all possibilities/counts, it has to be strongly 
skewed to the positive when the mean is small.
-For more on Skewness, see @ref{Skewness caused by signal and its measurement}.
-
-@cindex Compare Poisson and Gaussian
-As @mymath{\lambda} becomes larger, the distribution becomes more and more 
symmetric, and the variance of that distribution is equal to its mean.
-In other words, the standard deviation is the square root of the mean.
-It can also be proved that when the mean is large, say @mymath{\lambda>1000}, 
the Poisson distribution approaches the 
@url{https://en.wikipedia.org/wiki/Normal_distribution, Normal (Gaussian) 
distribution} with mean @mymath{\mu=\lambda} and standard deviation 
@mymath{\sigma=\sqrt{\lambda}}.
-In other words, a Poisson distribution (with a sufficiently large 
@mymath{\lambda}) is simply a Gaussian that has one free parameter 
(@mymath{\mu=\lambda} and @mymath{\sigma=\sqrt{\lambda}}), instead of the two 
parameters that the Gaussian distribution originally has (independent 
@mymath{\mu} and @mymath{\sigma}).
-
-@cindex Sky value
-@cindex Background flux
-@cindex Undetected objects
-In real situations, the photons/flux from our targets are combined with 
photons from a certain background (observationally, the @emph{Sky} value).
-The Sky value is defined to be the average flux of a region in the dataset 
with no targets.
-Its physical origin can be the brightness of the atmosphere (for ground-based 
instruments), possible stray light within the imaging instrument, the average 
flux of undetected targets, etc.
-The Sky value is thus an ideal definition, because in real datasets, what lies 
deep in the noise (far lower than the detection limit) is never 
known@footnote{In a real image, a relatively large number of very faint objects 
can be fully buried in the noise and never detected.
-These undetected objects will bias the background measurement to slightly 
larger values.
-Our best approximation is thus to simply assume they are uniform, and consider 
their average effect.
-See Figure 1 (a.1 and a.2) and Section 2.2 in 
@url{https://arxiv.org/abs/1505.01664, Akhlaghi and Ichikawa [2015]}.}.
-To account for all of these, the sky value is defined to be the average 
count/value of the undetected regions in the image.
-In a mock image/dataset, we have the luxury of setting the background (Sky) 
value.
-
-@cindex Simulating noise
-@cindex Noise simulation
-In summary, the value in each element of the dataset (pixel in an image) is 
the sum of contributions from various galaxies and stars (after convolution by 
the PSF, see @ref{PSF}).
-Let's name the convolved sum of possibly overlapping objects in each pixel as 
@mymath{I_{nn}}.
-@mymath{nn} represents `no noise'.
-For now, let's assume the background (@mymath{B}) is constant and sufficiently 
high for the Poisson distribution to be approximated by a Gaussian.
-Then the flux of that pixel, after adding noise, is @emph{a random value} 
taken from a Gaussian distribution with the following mean (@mymath{\mu}) and 
standard deviation (@mymath{\sigma}):
-
-@dispmath{\mu=B+I_{nn}, \quad \sigma=\sqrt{B+I_{nn}}}
-
-@cindex Bias level in detectors
-@cindex Dark level in detectors
-In astronomical instruments, @mymath{B} is enhanced by adding a ``bias'' level 
to each pixel before the shutter is even opened (for the exposure to start).
-As the exposure is ongoing and photo-electrons are accumulating from the 
astronomical objects, a ``dark'' current (due to thermal radiation of the 
instrument) also builds up in the pixels.
-The ``dark'' current will accumulate even when the shutter is closed, but the 
CCD electronics are working (hence the name ``dark'').
-This added dark level further enhances the mean value in a real observation 
compared to the raw background value (from the atmosphere for example).
-
-Since this type of noise is inherent in the objects we study, it is usually 
measured on the same scale as the astronomical objects, namely the magnitude 
system, see @ref{Brightness flux magnitude}.
-It is then internally converted to the flux scale for further processing.
-
-The equations above clearly show the importance of the background value and 
its effect on the final signal to noise ratio in each pixel of a science image.
-It is therefore, one of the most important factors in understanding the noise 
(and properly simulating observations where necessary).
-An inappropriately bright background value can hide the signal of the mock 
profile hide behind the noise.
-In other words, a brighter background has larger standard deviation and vice 
versa.
-As a result, the only necessary parameter to define photon-counting noise over 
a mock image of simulated profiles is the background.
-For a complete example, see @ref{Sufi simulates a detection}.
-
-To better understand the correlation between the mean (or background) value 
and the noise standard deviation, let's use an analogy.
-Consider the profile of your galaxy to be analogous to the profile of a ship 
that is sailing in the sea.
-The height of the ship would therefore be analogous to the maximum flux 
difference between your galaxy's minimum and maximum values.
-Furthermore, let's take the depth of the sea to represent the background 
value: a deeper sea, corresponds to a brighter background.
-In this analogy, the ``noise'' would be the height of the waves that surround 
the ship: in deeper waters, the waves would also be taller (the square root of 
the mean depth at the ship's position).
-
-If the ship is in deep waters, the height of waves are greater than when the 
ship is near to the beach (at lower depths).
-Therefore, when the ship is in the middle of the sea, there are high waves 
that are capable of hiding a significant part of the ship from our perspective.
-This corresponds to a brighter background value in astronomical images: the 
resulting noise from that brighter background can completely wash out the 
signal from a fainter galaxy, star or solar system object.
-
-@node Instrumental noise, Final noised pixel value, Photon counting noise, 
Noise basics
-@subsubsection Instrumental noise
-
-@cindex Readout noise
-@cindex Instrumental noise
-@cindex Noise, instrumental
-While taking images with a camera, a bias current is fed to the pixels, the 
variation of the value of this bias current over the pixels, also adds to the 
final image noise.
-Another source of noise is the readout noise that is produced by the 
electronics in the detector.
-Specifically, the parts that attempt to digitize the voltage produced by the 
photo-electrons in the analog to digital converter.
-With the current generation of instruments, this source of noise is not as 
significant as the noise due to the background Sky discussed in @ref{Photon 
counting noise}.
-
-Let @mymath{C} represent the combined standard deviation of all these 
instrumental sources of noise.
-When only this source of noise is present, the noised pixel value would be a 
random value chosen from a Gaussian distribution with
-
-@dispmath{\mu=I_{nn}, \quad \sigma=\sqrt{C^2+I_{nn}}}
-
-@cindex ADU
-@cindex Gain
-@cindex Counts
-This type of noise is independent of the signal in the dataset, it is only 
determined by the instrument.
-So the flux scale (and not magnitude scale) is most commonly used for this 
type of noise.
-In practice, this value is usually reported in analog-to-digital units or 
ADUs, not flux or electron counts.
-The gain value of the device can be used to convert between these two, see 
@ref{Brightness flux magnitude}.
-
-@node Final noised pixel value, Generating random numbers, Instrumental noise, 
Noise basics
-@subsubsection Final noised pixel value
-Based on the discussions in @ref{Photon counting noise} and @ref{Instrumental 
noise}, depending on the values you specify for @mymath{B} and @mymath{C} from 
the above, the final noised value for each pixel is a random value chosen from 
a Gaussian distribution with
-
-@dispmath{\mu=B+I_{nn}, \quad \sigma=\sqrt{C^2+B+I_{nn}}}
-
-
-
-@node Generating random numbers,  , Final noised pixel value, Noise basics
-@subsubsection Generating random numbers
-
-@cindex Random numbers
-@cindex Numbers, random
-As discussed above, to generate noise we need to make random samples of a 
particular distribution.
-So it is important to understand some general concepts regarding the 
generation of random numbers.
-For a very complete and nice introduction we strongly advise reading Donald 
Knuth's ``The art of computer programming'', volume 2, chapter 
3@footnote{Knuth, Donald. 1998.
-The art of computer programming. Addison--Wesley. ISBN 0-201-89684-2 }.
-Quoting from the GNU Scientific Library manual, ``If you do not own it, you 
should stop reading right now, run to the nearest bookstore, and buy 
it''@footnote{For students, running to the library might be more affordable!}!
-
-@cindex Psuedo-random numbers
-@cindex Numbers, psuedo-random
-Using only software, we can only produce what is called a psuedo-random 
sequence of numbers.
-A true random number generator is a hardware (let's assume we have made sure 
it has no systematic biases), for example, throwing dice or flipping coins 
(which have remained from the ancient times).
-More modern hardware methods use atmospheric noise, thermal noise or other 
types of external electromagnetic or quantum phenomena.
-All pseudo-random number generators (software) require a seed to be the basis 
of the generation.
-The advantage of having a seed is that if you specify the same seed for 
multiple runs, you will get an identical sequence of random numbers which 
allows you to reproduce the same final noised image.
-
-@cindex Environment variables
-@cindex GNU Scientific Library
-The programs in GNU Astronomy Utilities (for example, MakeNoise or 
MakeProfiles) use the GNU Scientific Library (GSL) to generate random numbers.
-GSL allows the user to set the random number generator through environment 
variables, see @ref{Installation directory} for an introduction to environment 
variables.
-In the chapter titled ``Random Number Generation'' they have fully explained 
the various random number generators that are available (there are a lot of 
them!).
-Through the two environment variables @code{GSL_RNG_TYPE} and 
@code{GSL_RNG_SEED} you can specify the generator and its seed respectively.
-
-@cindex Seed, Random number generator
-@cindex Random number generator, Seed
-If you do not specify a value for @code{GSL_RNG_TYPE}, GSL will use its 
default random number generator type.
-The default type is sufficient for most general applications.
-If no value is given for the @code{GSL_RNG_SEED} environment variable and you 
have asked Gnuastro to read the seed from the environment (through the 
@option{--envseed} option), then GSL will use the default value of each 
generator to give identical outputs.
-If you do not explicitly tell Gnuastro programs to read the seed value from 
the environment variable, then they will use the system time (accurate to 
within a microsecond) to generate (apparently random) seeds.
-In this manner, every time you run the program, you will get a different 
random number distribution.
-
-There are two ways you can specify values for these environment variables.
-You can call them on the same command-line for example:
-
-@example
-$ GSL_RNG_TYPE="taus" GSL_RNG_SEED=345 astmknoise input.fits
-@end example
-
-@noindent
-In this manner the values will only be used for this particular execution of 
MakeNoise.
-Alternatively, you can define them for the full period of your terminal 
session or script length, using the shell's @command{export} command with the 
two separate commands below (for a script remove the @code{$} signs):
-
-@example
-$ export GSL_RNG_TYPE="taus"
-$ export GSL_RNG_SEED=345
-@end example
-
-@cindex Startup scripts
-@cindex @file{.bashrc}
-@noindent
-The subsequent programs which use GSL's random number generators will hence 
forth use these values in this session of the terminal you are running or while 
executing this script.
-In case you want to set fixed values for these parameters every time you use 
the GSL random number generator, you can add these two lines to your 
@file{.bashrc} startup script@footnote{Do Not forget that if you are going to 
give your scripts (that use the GSL random number generator) to others you have 
to make sure you also tell them to set these environment variable separately.
-So for scripts, it is best to keep all such variable definitions within the 
script, even if they are within your @file{.bashrc}.}, see @ref{Installation 
directory}.
-
-@strong{IMPORTANT NOTE:} If the two environment variables @code{GSL_RNG_TYPE} 
and @code{GSL_RNG_SEED} are defined, GSL will report them by default, even if 
you do not use the @option{--envseed} option.
-For example, see this call to MakeProfiles:
-
-@example
-$ export GSL_RNG_TYPE=taus
-$ export GSL_RNG_SEED=345
-$ astmkprof -s1 --kernel=gaussian,2,5
-GSL_RNG_TYPE=taus
-GSL_RNG_SEED=345
-MakeProfiles V.VV started on DDD MMM DDD HH:MM:SS YYYY
-  - Building one gaussian kernel
-  - Random number generator (RNG) type: taus
-  - Basic RNG seed: 1618960836
-  ---- ./kernel.fits created.
-  -- Output: ./kernel.fits
-MakeProfiles finished in 0.068945 seconds
-@end example
-
-@noindent
-@cindex Seed, Random number generator
-@cindex Random number generator, Seed
-The first two output lines (showing the names and values of the GSL 
environment variables) are printed by GSL before MakeProfiles actually starts 
generating random numbers.
-Gnuastro's programs will report the actual values they use independently 
(after the name of the program), you should check them for the final values 
used, not GSL's printed values.
-In the example above, did you notice how the random number generator seed 
above is different between GSL and MakeProfiles?
-However, if @option{--envseed} was given, both printed seeds would be the same.
-
-
-@node Invoking astmknoise,  , Noise basics, MakeNoise
-@subsection Invoking MakeNoise
-
-MakeNoise will add noise to an existing image.
-The executable name is @file{astmknoise} with the following general template
-
-@example
-$ astmknoise [OPTION ...] InputImage.fits
-@end example
-
-@noindent
-One line examples:
-
-@example
-## Add noise with a standard deviation of 100 to image.
-## (this is independent of the pixel value: not Poission noise)
-$ astmknoise --sigma=100 image.fits
-
-## Add noise to the input image assuming a per-pixel background
-## magnitude (with zero point magnitude of 0) and an
-## instrumental noise of 20.
-$ astmknoise --background=-10 -z0 --instrumental=20 mockimage.fits
-@end example
-
-@noindent
-If actual processing is to be done, the input image is a mandatory argument.
-The full list of options common to all the programs in Gnuastro can be seen in 
@ref{Common options}.
-The type (see @ref{Numeric data types}) of the output can be specified with 
the @option{--type} option, see @ref{Input output options}.
-The header of the output FITS file keeps all the parameters that were 
influential in making it.
-This is done for future reproducibility.
-
-@table @option
-
-@item -b FLT
-@itemx --background=FLT
-The background value (per pixel) that will be added to each pixel value 
(internally) to simulate Poisson noise, see @ref{Photon counting noise}.
-By default the units of this value are assumed to be in magnitudes, hence a 
@option{--zeropoint} is also necessary.
-If the background is in units of counts, you need add 
@option{--bgisbrightness}, see @ref{Brightness flux magnitude}.
-
-Internally, the value given to this option will be converted to counts 
(@mymath{b}, when @option{--bgnotmag} is called, the value will be used 
directly).
-Assuming the pixel value is @mymath{p}, the random value for that pixel will 
be taken from a Gaussian distribution with mean of @mymath{p+b} and standard 
deviation of @mymath{\sqrt{p+b}}.
-With this option, the noise will therefore be dependent on the pixel values: 
according to the Poission noise model, as the pixel value becomes larger, its 
noise will also become larger.
-This is thus a realistic way to model noise, see @ref{Photon counting noise}.
-
-@item -B
-@itemx --bgnotmag
-The value given to @option{--background} should not be interpreted as a 
magnitude, but the raw pixel units (usually counts).
-
-@item -z FLT
-@itemx --zeropoint=FLT
-The zero point magnitude used to convert the value of @option{--background} 
(in units of magnitude) to flux, see @ref{Brightness flux magnitude}.
-
-@item -i FLT
-@itemx --instrumental=FLT
-The instrumental noise which is in units of flux, see @ref{Instrumental noise}.
-
-@item -s FLT
-@item --sigma=FLT
-The total noise sigma in the same units as the pixel values.
-With this option, the @option{--background}, @option{--zeropoint} and 
@option{--instrumental} will be ignored.
-With this option, the noise will be independent of the pixel values (which is 
not realistic, see @ref{Photon counting noise}).
-Hence it is only useful if you are working on low surface brightness regions 
where the change in pixel value (and thus real noise) is insignificant.
-
-Generally, @strong{usage of this option is discouraged} unless you understand 
the risks of not simulating real noise.
-This is because with this option, you will not get Poisson noise (the common 
noise model for astronomical imaging), where the noise varies based on pixel 
value.
-Use @option{--background} for adding Poission noise.
-
-@item -e
-@itemx --envseed
-@cindex Seed, Random number generator
-@cindex Random number generator, Seed
-Use the @code{GSL_RNG_SEED} environment variable for the seed used in the 
random number generator, see @ref{Generating random numbers}.
-With this option, the output image noise is always going to be identical (or 
reproducible).
-
-@item -d
-@itemx --doubletype
-Save the output in the double precision floating point format that was used 
internally.
-This option will be most useful if the input images were of integer types.
-
-@end table
-
-
-
-
-
-
-
-
-
-
 
 
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index faa0316d..43a8905a 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -60,39 +60,48 @@ if COND_HASCXX
   versioncxx_SOURCES = lib/versioncxx.cpp
 endif
 if COND_ARITHMETIC
-  MAYBE_ARITHMETIC_TESTS = arithmetic/snimage.sh arithmetic/onlynumbers.sh \
-  arithmetic/where.sh arithmetic/or.sh arithmetic/connected-components.sh
-
+  MAYBE_ARITHMETIC_TESTS = arithmetic/or.sh \
+                           arithmetic/where.sh \
+                           arithmetic/snimage.sh \
+                           arithmetic/onlynumbers.sh \
+                           arithmetic/connected-components.sh \
+                           arithmetic/mknoise-sigma-from-mean.sh \
+                           arithmetic/mknoise-sigma-from-mean-3d.sh
+  arithmetic/or.sh: segment/segment.sh.log
   arithmetic/onlynumbers.sh: prepconf.sh.log
-  arithmetic/connected-components.sh: noisechisel/noisechisel.sh.log
-  arithmetic/snimage.sh: noisechisel/noisechisel.sh.log
   arithmetic/where.sh: noisechisel/noisechisel.sh.log
-  arithmetic/or.sh: segment/segment.sh.log
+  arithmetic/snimage.sh: noisechisel/noisechisel.sh.log
+  arithmetic/mknoise-sigma-from-mean.sh: warp/warp_scale.sh.log
+  arithmetic/mknoise-sigma-from-mean-3d.sh: mkprof/3d-cat.sh.log
+  arithmetic/connected-components.sh: noisechisel/noisechisel.sh.log
 endif
 if COND_BUILDPROG
   MAYBE_BUILDPROG_TESTS = buildprog/simpleio.sh
-
   buildprog/simpleio.sh: mkprof/mosaic1.sh.log
 endif
 if COND_CONVERTT
-  MAYBE_CONVERTT_TESTS = convertt/fitstotxt.sh convertt/fitstojpeg.sh  \
-  convertt/blankch.sh convertt/jpegtotxt.sh convertt/fitstojpegcmyk.sh \
-  convertt/jpegtofits.sh convertt/fitstopdf.sh convertt/fitstotiff.sh
-
+  MAYBE_CONVERTT_TESTS = convertt/blankch.sh \
+                         convertt/fitstotxt.sh \
+                         convertt/jpegtotxt.sh \
+                         convertt/fitstopdf.sh \
+                         convertt/jpegtofits.sh \
+                         convertt/fitstotiff.sh \
+                         convertt/fitstojpeg.sh \
+                         convertt/fitstojpegcmyk.sh
+  convertt/fitstopdf.sh: crop/section.sh.log
+  convertt/blankch.sh: mkprof/mosaic1.sh.log
   convertt/fitstotxt.sh: mkprof/mosaic1.sh.log
   convertt/fitstojpeg.sh: mkprof/mosaic1.sh.log
-  convertt/blankch.sh: mkprof/mosaic1.sh.log
+  convertt/fitstotiff.sh: mkprof/mosaic1.sh.log
+  convertt/jpegtofits.sh: convertt/blankch.sh.log
   convertt/jpegtotxt.sh: convertt/fitstojpeg.sh.log
   convertt/fitstojpegcmyk.sh: mkprof/mosaic1.sh.log
-  convertt/jpegtofits.sh: convertt/blankch.sh.log
-  convertt/fitstopdf.sh: crop/section.sh.log
-  convertt/fitstotiff.sh: mkprof/mosaic1.sh.log
-
 endif
 if COND_CONVOLVE
-  MAYBE_CONVOLVE_TESTS = convolve/spatial.sh convolve/frequency.sh \
-                         convolve/psf-match.sh convolve/spectrum-1d.sh
-
+  MAYBE_CONVOLVE_TESTS = convolve/spatial.sh \
+                         convolve/frequency.sh \
+                         convolve/psf-match.sh \
+                         convolve/spectrum-1d.sh
   convolve/spectrum-1d.sh: prepconf.sh.log
   convolve/spatial.sh: mkprof/mosaic1.sh.log
   convolve/psf-match.sh: mkprof/mosaic1.sh.log
@@ -104,64 +113,78 @@ if COND_COSMICCAL
   cosmiccal/simpletest.sh: prepconf.sh.log
 endif
 if COND_CROP
-  MAYBE_CROP_TESTS = crop/imgcat.sh crop/wcscat.sh crop/imgcenter.sh    \
-  crop/imgcenternoblank.sh crop/section.sh crop/wcscenter.sh            \
-  crop/imgpolygon.sh crop/imgpolygonout.sh crop/wcspolygon.sh
-
+  MAYBE_CROP_TESTS = crop/imgcat.sh \
+                     crop/wcscat.sh \
+                     crop/section.sh \
+                     crop/imgcenter.sh \
+                     crop/wcscenter.sh \
+                     crop/imgpolygon.sh \
+                     crop/wcspolygon.sh \
+                     crop/imgpolygonout.sh \
+                     crop/imgcenternoblank.sh
   crop/imgcat.sh: mkprof/mosaic1.sh.log
-  crop/wcscat.sh: mkprof/mosaic1.sh.log mkprof/mosaic2.sh.log     \
-                  mkprof/mosaic3.sh.log mkprof/mosaic4.sh.log
-  crop/imgcenter.sh: mkprof/mosaic1.sh.log
-  crop/imgcenternoblank.sh: mkprof/mosaic1.sh.log
+  crop/wcscat.sh: mkprof/mosaic1.sh.log \
+                  mkprof/mosaic2.sh.log \
+                  mkprof/mosaic3.sh.log \
+                  mkprof/mosaic4.sh.log
   crop/section.sh: mkprof/mosaic1.sh.log
-  crop/wcscenter.sh: mkprof/mosaic1.sh.log mkprof/mosaic2.sh.log      \
-                     mkprof/mosaic3.sh.log mkprof/mosaic4.sh.log
+  crop/imgcenter.sh: mkprof/mosaic1.sh.log
+  crop/wcscenter.sh: mkprof/mosaic1.sh.log \
+                     mkprof/mosaic2.sh.log \
+                     mkprof/mosaic3.sh.log \
+                     mkprof/mosaic4.sh.log
   crop/imgpolygon.sh: mkprof/mosaic1.sh.log
+  crop/wcspolygon.sh: mkprof/mosaic1.sh.log \
+                      mkprof/mosaic2.sh.log \
+                      mkprof/mosaic3.sh.log \
+                      mkprof/mosaic4.sh.log
   crop/imgpolygonout.sh: mkprof/mosaic1.sh.log
-  crop/wcspolygon.sh: mkprof/mosaic1.sh.log mkprof/mosaic2.sh.log \
-                      mkprof/mosaic3.sh.log mkprof/mosaic4.sh.log
+  crop/imgcenternoblank.sh: mkprof/mosaic1.sh.log
+
 endif
 if COND_FITS
-  MAYBE_FITS_TESTS = fits/write.sh fits/print.sh fits/update.sh        \
-  fits/delete.sh fits/copyhdu.sh
-
-  fits/write.sh: mkprof/mosaic1.sh.log
+  MAYBE_FITS_TESTS = fits/write.sh \
+                     fits/print.sh \
+                     fits/update.sh \
+                     fits/delete.sh \
+                     fits/copyhdu.sh
   fits/print.sh: fits/write.sh.log
   fits/update.sh: fits/write.sh.log
   fits/delete.sh: fits/write.sh.log
+  fits/write.sh: mkprof/mosaic1.sh.log
   fits/copyhdu.sh: fits/write.sh.log mkprof/mosaic2.sh.log
 endif
 if COND_MATCH
-  MAYBE_MATCH_TESTS = match/sort-based.sh match/merged-cols.sh \
-  match/kdtree-internal.sh match/kdtree-separate.sh
-
+  MAYBE_MATCH_TESTS = match/sort-based.sh \
+                      match/merged-cols.sh \
+                      match/kdtree-internal.sh \
+                      match/kdtree-separate.sh
   match/sort-based.sh: prepconf.sh.log
   match/merged-cols.sh: prepconf.sh.log
   match/kdtree-internal.sh: prepconf.sh.log
   match/kdtree-separate.sh: prepconf.sh.log
 endif
 if COND_MKCATALOG
-  MAYBE_MKCATALOG_TESTS = mkcatalog/detections.sh mkcatalog/simple-3d.sh   \
-  mkcatalog/objects-clumps.sh mkcatalog/aperturephot.sh
-
-  mkcatalog/objects-clumps.sh: segment/segment.sh.log
-  mkcatalog/detections.sh: arithmetic/connected-components.sh.log
+  MAYBE_MKCATALOG_TESTS = mkcatalog/detections.sh \
+                          mkcatalog/simple-3d.sh \
+                          mkcatalog/objects-clumps.sh \
+                          mkcatalog/aperturephot.sh
   mkcatalog/simple-3d.sh: segment/segment-3d.sh.log
-  mkcatalog/aperturephot.sh: noisechisel/noisechisel.sh.log          \
+  mkcatalog/objects-clumps.sh: segment/segment.sh.log
+  mkcatalog/aperturephot.sh: noisechisel/noisechisel.sh.log \
                              mkprof/clearcanvas.sh.log
-endif
-if COND_MKNOISE
-  MAYBE_MKNOISE_TESTS = mknoise/addnoise.sh mknoise/addnoise-3d.sh
-
-  mknoise/addnoise.sh: warp/warp_scale.sh.log
-  mknoise/addnoise-3d.sh: mkprof/3d-cat.sh.log
+  mkcatalog/detections.sh: arithmetic/connected-components.sh.log
 endif
 if COND_MKPROF
-  MAYBE_MKPROF_TESTS = mkprof/mosaic1.sh mkprof/mosaic2.sh         \
-  mkprof/mosaic3.sh mkprof/mosaic4.sh mkprof/radeccat.sh           \
-  mkprof/ellipticalmasks.sh mkprof/clearcanvas.sh mkprof/3d-cat.sh \
-  mkprof/3d-kernel.sh
-
+  MAYBE_MKPROF_TESTS = mkprof/3d-cat.sh \
+                       mkprof/mosaic1.sh \
+                       mkprof/mosaic2.sh \
+                       mkprof/mosaic3.sh \
+                       mkprof/mosaic4.sh \
+                       mkprof/radeccat.sh \
+                       mkprof/3d-kernel.sh \
+                       mkprof/clearcanvas.sh \
+                       mkprof/ellipticalmasks.sh
   mkprof/3d-cat.sh: prepconf.sh.log
   mkprof/mosaic1.sh: prepconf.sh.log
   mkprof/mosaic2.sh: prepconf.sh.log
@@ -169,19 +192,18 @@ if COND_MKPROF
   mkprof/mosaic4.sh: prepconf.sh.log
   mkprof/radeccat.sh: prepconf.sh.log
   mkprof/3d-kernel.sh: prepconf.sh.log
-  mkprof/ellipticalmasks.sh: mknoise/addnoise.sh.log
-  mkprof/clearcanvas.sh: mknoise/addnoise.sh.log
+  mkprof/clearcanvas.sh: arithmetic/mknoise-sigma-from-mean.sh.log
+  mkprof/ellipticalmasks.sh: arithmetic/mknoise-sigma-from-mean.sh.log
 endif
 if COND_NOISECHISEL
-  MAYBE_NOISECHISEL_TESTS = noisechisel/noisechisel.sh          \
-  noisechisel/noisechisel-3d.sh
-
-  noisechisel/noisechisel.sh: mknoise/addnoise.sh.log
-  noisechisel/noisechisel-3d.sh: mknoise/addnoise-3d.sh.log
+  MAYBE_NOISECHISEL_TESTS = noisechisel/noisechisel.sh \
+                            noisechisel/noisechisel-3d.sh
+  noisechisel/noisechisel.sh: arithmetic/mknoise-sigma-from-mean.sh.log
+  noisechisel/noisechisel-3d.sh: arithmetic/mknoise-sigma-from-mean-3d.sh.log
 endif
 if COND_SEGMENT
-  MAYBE_SEGMENT_TESTS = segment/segment.sh segment/segment-3d.sh
-
+  MAYBE_SEGMENT_TESTS = segment/segment.sh \
+                        segment/segment-3d.sh
   segment/segment.sh: noisechisel/noisechisel.sh.log
   segment/segment-3d.sh: noisechisel/noisechisel-3d.sh.log
 endif
@@ -190,28 +212,28 @@ if COND_STATISTICS
                            statistics/from-stdin.sh \
                            statistics/estimate_sky.sh \
                            statistics/fitting-polynomial-robust.sh
-
   statistics/from-stdin.sh: prepconf.sh.log
-  statistics/basicstats.sh: mknoise/addnoise.sh.log
-  statistics/estimate_sky.sh: mknoise/addnoise.sh.log
   statistics/fitting-polynomial-robust.sh: prepconf.sh.log
+  statistics/basicstats.sh: arithmetic/mknoise-sigma-from-mean.sh.log
+  statistics/estimate_sky.sh: arithmetic/mknoise-sigma-from-mean.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 \
-  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
+  MAYBE_TABLE_TESTS = table/arith-img-to-wcs.sh \
+                      table/txt-to-fits-ascii.sh \
+                      table/fits-ascii-to-txt.sh \
+                      table/txt-to-fits-binary.sh \
+                      table/fits-binary-to-txt.sh \
+                      table/sexagesimal-to-deg.sh
   table/txt-to-fits-ascii.sh: prepconf.sh.log
-  table/fits-ascii-to-txt.sh: table/txt-to-fits-ascii.sh.log
+  table/txt-to-fits-binary.sh: prepconf.sh.log
   table/sexagesimal-to-deg.sh: prepconf.sh.log
-  table/arith-img-to-wcs.sh: mknoise/addnoise.sh.log
+  table/fits-ascii-to-txt.sh: table/txt-to-fits-ascii.sh.log
+  table/fits-binary-to-txt.sh: table/txt-to-fits-binary.sh.log
+  table/arith-img-to-wcs.sh: arithmetic/mknoise-sigma-from-mean.sh.log
 endif
 if COND_WARP
-  MAYBE_WARP_TESTS = warp/warp_scale.sh warp/homographic.sh
-
+  MAYBE_WARP_TESTS = warp/warp_scale.sh \
+                     warp/homographic.sh
   warp/warp_scale.sh: convolve/spatial.sh.log
   warp/homographic.sh: convolve/spatial.sh.log
 endif
@@ -283,14 +305,26 @@ lib/multithread.sh: mkprof/mosaic1.sh.log
 
 # Final Tests
 # ===========
-TESTS = prepconf.sh lib/multithread.sh $(MAYBE_CXX_TESTS)                  \
-  $(MAYBE_ARITHMETIC_TESTS) $(MAYBE_BUILDPROG_TESTS)                       \
-  $(MAYBE_CONVERTT_TESTS) $(MAYBE_CONVOLVE_TESTS) $(MAYBE_COSMICCAL_TESTS) \
-  $(MAYBE_CROP_TESTS) $(MAYBE_FITS_TESTS) $(MAYBE_MATCH_TESTS)             \
-  $(MAYBE_MKCATALOG_TESTS) $(MAYBE_MKNOISE_TESTS) $(MAYBE_MKPROF_TESTS)    \
-  $(MAYBE_NOISECHISEL_TESTS) $(MAYBE_SEGMENT_TESTS)                        \
-  $(MAYBE_STATISTICS_TESTS) $(MAYBE_SUBTRACTSKY_TESTS)                     \
-  $(MAYBE_TABLE_TESTS) $(MAYBE_WARP_TESTS) $(SCRIPT_TESTS)
+TESTS = prepconf.sh \
+        lib/multithread.sh \
+        $(MAYBE_CXX_TESTS) \
+        $(MAYBE_ARITHMETIC_TESTS) \
+        $(MAYBE_BUILDPROG_TESTS) \
+        $(MAYBE_CONVERTT_TESTS) \
+        $(MAYBE_CONVOLVE_TESTS) \
+        $(MAYBE_COSMICCAL_TESTS) \
+        $(MAYBE_CROP_TESTS) \
+        $(MAYBE_FITS_TESTS) \
+        $(MAYBE_MATCH_TESTS) \
+        $(MAYBE_MKCATALOG_TESTS) \
+        $(MAYBE_MKPROF_TESTS) \
+        $(MAYBE_NOISECHISEL_TESTS) \
+        $(MAYBE_SEGMENT_TESTS) \
+        $(MAYBE_STATISTICS_TESTS) \
+        $(MAYBE_SUBTRACTSKY_TESTS) \
+        $(MAYBE_TABLE_TESTS) \
+        $(MAYBE_WARP_TESTS) \
+        $(SCRIPT_TESTS)
 
 
 
@@ -301,12 +335,12 @@ EXTRA_DIST = $(TESTS) during-dev.sh \
   buildprog/simpleio.c \
   convolve/spectrum.txt \
   crop/cat.txt \
-  mkprof/3d-cat.txt \
   match/positions-1.txt \
   match/positions-2.txt \
-  mkprof/mkprofcat1.txt \
+  mkprof/3d-cat.txt \
   mkprof/clearcanvas.txt \
   mkprof/ellipticalmasks.txt \
+  mkprof/mkprofcat1.txt \
   mkprof/mkprofcat2.txt \
   mkprof/mkprofcat3.txt \
   mkprof/mkprofcat4.txt \
diff --git a/tests/mknoise/addnoise-3d.sh 
b/tests/arithmetic/mknoise-sigma-from-mean-3d.sh
similarity index 87%
rename from tests/mknoise/addnoise-3d.sh
rename to tests/arithmetic/mknoise-sigma-from-mean-3d.sh
index 2a486010..47ec9830 100755
--- a/tests/mknoise/addnoise-3d.sh
+++ b/tests/arithmetic/mknoise-sigma-from-mean-3d.sh
@@ -27,8 +27,9 @@
 # care about the size of the image, but the larger one will be used by
 # those that do: for example SubtractSky and NoiseChisel will be better
 # tested on a larger image.
-prog=mknoise
+prog=arithmetic
 img=3d-cat.fits
+out=3d-cat_noised.fits
 execname=../bin/$prog/ast$prog
 
 
@@ -54,7 +55,10 @@ if [ ! -f $img      ]; then echo "$img does not exist.";     
exit 77; fi
 
 # Actual test script
 # ==================
+zeropoint=0
+background=-10
 export GSL_RNG_SEED=1
 export GSL_RNG_TYPE=ranlxs2
-options="--background=-10 --zeropoint=0 --envseed"
-$check_with_program $execname $img $options
+$check_with_program $execname --envseed --output=$out \
+                    $img $background $zeropoint mag-to-counts \
+                    mknoise-sigma-from-mean
diff --git a/tests/mknoise/addnoise.sh 
b/tests/arithmetic/mknoise-sigma-from-mean.sh
similarity index 81%
rename from tests/mknoise/addnoise.sh
rename to tests/arithmetic/mknoise-sigma-from-mean.sh
index 59af017a..3c667e31 100755
--- a/tests/mknoise/addnoise.sh
+++ b/tests/arithmetic/mknoise-sigma-from-mean.sh
@@ -28,10 +28,12 @@
 # care about the size of the image, but the larger one will be used by
 # those that do: for example SubtractSky and NoiseChisel will be better
 # tested on a larger image.
-prog=mknoise
+prog=arithmetic
 img1=convolve_spatial.fits
 execname=../bin/$prog/ast$prog
+out1=convolve_spatial_noised.fits
 img2=convolve_spatial_scaled.fits
+out2=convolve_spatial_scaled_noised.fits
 
 
 
@@ -61,8 +63,15 @@ if [ ! -f $img2     ]; then echo "$img2 does not exist.";    
exit 77; fi
 # '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.
+zeropoint=0
+background=-10
 export GSL_RNG_SEED=1
 export GSL_RNG_TYPE=ranlxs2
-options="--background=-10 --zeropoint=0 --envseed"
-$check_with_program $execname $img1 $options
-$check_with_program $execname $img2 $options
+
+$check_with_program $execname --envseed --output=$out1 \
+                    $img1 $background $zeropoint mag-to-counts \
+                    mknoise-sigma-from-mean
+
+$check_with_program $execname --envseed --output=$out2 \
+                    $img2 $background $zeropoint mag-to-counts \
+                    mknoise-sigma-from-mean



reply via email to

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