gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master b3416de 102/113: Imported recent work in maste


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master b3416de 102/113: Imported recent work in master, conflicts fixed
Date: Fri, 16 Apr 2021 10:34:00 -0400 (EDT)

branch: master
commit b3416dedc9e6f801f281166a6809b3cb420ae1f8
Merge: 2dba72f 924b90e
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Imported recent work in master, conflicts fixed
    
    Some conflicts came up in this merge that were fixed. Also, NoiseChisel's
    3D configuration file was updated to have default values for all the new
    options.
---
 NEWS                                   |  31 +++++++---
 bin/arithmetic/arithmetic.c            |  16 +++--
 bin/arithmetic/main.h                  |   2 +
 bin/arithmetic/ui.c                    |  18 +++---
 bin/noisechisel/args.h                 |  41 ++++++++++++-
 bin/noisechisel/astnoisechisel-3d.conf |   7 ++-
 bin/noisechisel/astnoisechisel.conf    |   4 +-
 bin/noisechisel/detection.c            |  70 ++++++++++++---------
 bin/noisechisel/main.h                 |   5 +-
 bin/noisechisel/ui.c                   |   3 +
 bin/noisechisel/ui.h                   |   3 +
 doc/announce-acknowledge.txt           |   1 +
 doc/gnuastro.texi                      | 107 ++++++++++++++++++++++++++-------
 13 files changed, 231 insertions(+), 77 deletions(-)

diff --git a/NEWS b/NEWS
index 6bacbd9..ab729be 100644
--- a/NEWS
+++ b/NEWS
@@ -13,10 +13,10 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
      option's value).
 
   Arithmetic:
-   - The new `tofile-' operator will save the top operand into a file
-     without changing the state of the operand stack (popping the top
-     element). This can greatly help in debugging/understanding an
-     Arithmetic command, especially as it gets longer, or more complicated.
+   - The new `tofile-' and `tofilefree-' operators will save the top
+     operand into a file. They can be very handy in debugging/understanding
+     an Arithmetic command (especially as it gets complicated), or to
+     produce multiple files/extensions with a single call to Arithmetic.
    - Four new operators have beed added to allow coadding multiple datasets
      into one using sigma-clipping: `sigclip-number', `sigclip-mean',
      `sigclip-median', and `sigclip-std'. These are very useful when
@@ -51,11 +51,21 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
      columns into one.
 
   NoiseChisel:
-   --pseudoconcomp: allows setting the connectivity (4 or 8, in a 2D image)
-     to define separate pseudo-detections. If its stronger,
-     pseudo-detections that are touching on the corner will be identified
-     as one. Until this version, this was hard-written into the code and
-     was the weakest connectivity (4-connected in a 2D image).
+
+   --snthresh: Manually set the signal-to-noise ratio of true
+     pseudo-detections. With this option, NoiseChisel will not attempt to
+     find pseudo-detections over the noisy regions of the dataset, but will
+     directly go onto applying the manually input value.
+   - Several new options have been added to remove NoiseChisel's dependence
+     on values that were hard-coded in its source and thus not modifiable
+     at run-time by the user. To allow full configurability, these steps
+     can also be configured by the user.
+     --pseudoconcomp: allows setting the connectivity (4 or 8, in a 2D
+       image) to define separate pseudo-detections. If its stronger,
+       pseudo-detections that are touching on the corner will be identified
+       as one.
+     --dopening: The number of openings to do after applying `--dthresh'.
+     --dopeningngb: The connectivity (4 or 8) to use for `--dopening'.
 
   Library:
     GAL_BLANK_LONG: new macro for the `long' type blank value.
@@ -71,6 +81,9 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   Arithmetic:
    - `num' operator is renamed to `number'.
    - `numvalue' operator is renamed to `numbervalue'.
+   - `--dontdelete' will append the output to any existing file. Note that
+     this change is only in Arithmetic, other programs will still just
+     complain and abort.
 
   ConvertType:
    --forcemin & --forcemax: until now, `--flminbyte' and `--flmaxbyte' were
diff --git a/bin/arithmetic/arithmetic.c b/bin/arithmetic/arithmetic.c
index 986fda2..68e3912 100644
--- a/bin/arithmetic/arithmetic.c
+++ b/bin/arithmetic/arithmetic.c
@@ -846,11 +846,13 @@ arithmetic_collapse(struct arithmeticparams *p, char 
*token, int operator)
 
 
 void
-arithmetic_tofile(struct arithmeticparams *p, char *token)
+arithmetic_tofile(struct arithmeticparams *p, char *token, int freeflag)
 {
   /* Pop the top dataset. */
   gal_data_t *popped = operands_pop(p, token);
-  char *filename=&token[ OPERATOR_PREFIX_LENGTH_TOFILE ];
+  char *filename = &token[ freeflag
+                           ? OPERATOR_PREFIX_LENGTH_TOFILEFREE
+                           : OPERATOR_PREFIX_LENGTH_TOFILE     ];
 
   /* Save it to a file. */
   popped->wcs=p->refdata.wcs;
@@ -864,7 +866,10 @@ arithmetic_tofile(struct arithmeticparams *p, char *token)
 
   /* Reset the WCS to NULL and put it back on the stack. */
   popped->wcs=NULL;
-  operands_add(p, NULL, popped);
+  if(freeflag)
+    gal_data_free(popped);
+  else
+    operands_add(p, NULL, popped);
 }
 
 
@@ -922,7 +927,10 @@ reversepolish(struct arithmeticparams *p)
          specified operation on them. */
       if( !strncmp(OPERATOR_PREFIX_TOFILE, token->v,
                    OPERATOR_PREFIX_LENGTH_TOFILE) )
-        arithmetic_tofile(p, token->v);
+        arithmetic_tofile(p, token->v, 0);
+      else if( !strncmp(OPERATOR_PREFIX_TOFILEFREE, token->v,
+                   OPERATOR_PREFIX_LENGTH_TOFILE) )
+        arithmetic_tofile(p, token->v, 1);
       else if( !strncmp(token->v, OPERATOR_PREFIX_SET,
                         OPERATOR_PREFIX_LENGTH_SET) )
         operands_set_name(p, token->v);
diff --git a/bin/arithmetic/main.h b/bin/arithmetic/main.h
index d6f6661..92c9e9f 100644
--- a/bin/arithmetic/main.h
+++ b/bin/arithmetic/main.h
@@ -42,8 +42,10 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #define NEG_DASH_REPLACE 11 /* Vertical tab (ASCII=11) for negative dash */
 #define OPERATOR_PREFIX_SET               "set-"
 #define OPERATOR_PREFIX_TOFILE            "tofile-"
+#define OPERATOR_PREFIX_TOFILEFREE        "tofilefree-"
 #define OPERATOR_PREFIX_LENGTH_SET        strlen(OPERATOR_PREFIX_SET)
 #define OPERATOR_PREFIX_LENGTH_TOFILE     strlen(OPERATOR_PREFIX_TOFILE)
+#define OPERATOR_PREFIX_LENGTH_TOFILEFREE strlen(OPERATOR_PREFIX_TOFILEFREE)
 
 
 
diff --git a/bin/arithmetic/ui.c b/bin/arithmetic/ui.c
index c4baea8..f08d5c1 100644
--- a/bin/arithmetic/ui.c
+++ b/bin/arithmetic/ui.c
@@ -255,6 +255,7 @@ ui_check_options_and_arguments(struct arithmeticparams *p)
   int output_checked=0;
   gal_list_str_t *token, *hdu;
   size_t nummultiext=0, numhdus=0;
+  struct gal_options_common_params *cp=&p->cp;
 
   /* First, make sure that any tokens are actually given. */
   if(p->tokens==NULL)
@@ -271,6 +272,10 @@ ui_check_options_and_arguments(struct arithmeticparams *p)
      was done in `gal_options_read_config_set'. */
   gal_list_str_reverse(&p->tokens);
 
+  /* To allow adding extensions to existing files, let the `keep' flag be
+     the same as the `dontdelete'. */
+  cp->keep=cp->dontdelete;
+
   /* Set the output file name (if any is needed). Note that since the lists
      are already reversed, the first FITS file encountered, is the first
      FITS file given by the user. Also, note that these file name
@@ -285,7 +290,7 @@ ui_check_options_and_arguments(struct arithmeticparams *p)
 
         {
           /* This token is a file, count how many mult-extension files we
-             haev and use the first to set the output filename (if it has
+             have and use the first to set the output filename (if it has
              not been set). */
           if( gal_array_name_recognized(token->v) )
             {
@@ -299,12 +304,11 @@ ui_check_options_and_arguments(struct arithmeticparams *p)
               /* If the output filename isn't set yet, then set it. */
               if(output_checked==0)
                 {
-                  if(p->cp.output)
-                    gal_checkset_writable_remove(p->cp.output, 0,
-                                                 p->cp.dontdelete);
+                  if(cp->output)
+                    gal_checkset_writable_remove(cp->output, cp->keep,
+                                                 cp->dontdelete);
                   else
-                    p->cp.output=gal_checkset_automatic_output(&p->cp,
-                                                               token->v,
+                    p->cp.output=gal_checkset_automatic_output(cp, token->v,
                                                                "_arith.fits");
                   output_checked=1;
                 }
@@ -321,7 +325,7 @@ ui_check_options_and_arguments(struct arithmeticparams *p)
       else
         {
           filename=&token->v[ OPERATOR_PREFIX_LENGTH_TOFILE ];
-          gal_checkset_writable_remove(filename, 0, p->cp.dontdelete);
+          gal_checkset_writable_remove(filename, cp->keep, cp->dontdelete);
         }
     }
 
diff --git a/bin/noisechisel/args.h b/bin/noisechisel/args.h
index d665af3..63560d2 100644
--- a/bin/noisechisel/args.h
+++ b/bin/noisechisel/args.h
@@ -325,7 +325,7 @@ struct argp_option program_options[] =
       UI_GROUP_DETECTION,
       &p->opening,
       GAL_TYPE_SIZE_T,
-      GAL_OPTIONS_RANGE_GT_0,
+      GAL_OPTIONS_RANGE_GE_0,
       GAL_OPTIONS_MANDATORY,
       GAL_OPTIONS_NOT_SET
     },
@@ -409,6 +409,32 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_SET
     },
     {
+      "dopening",
+      UI_KEY_DOPENING,
+      "INT",
+      0,
+      "Depth of opening after dthresh.",
+      UI_GROUP_DETECTION,
+      &p->dopening,
+      GAL_TYPE_SIZE_T,
+      GAL_OPTIONS_RANGE_GE_0,
+      GAL_OPTIONS_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
+    {
+      "dopeningngb",
+      UI_KEY_DOPENINGNGB,
+      "INT",
+      0,
+      "4 or 8 connectivity for dthresh opening.",
+      UI_GROUP_DETECTION,
+      &p->dopeningngb,
+      GAL_TYPE_SIZE_T,
+      GAL_OPTIONS_RANGE_GT_0,
+      GAL_OPTIONS_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
+    {
       "holengb",
       UI_KEY_HOLENGB,
       "INT",
@@ -487,6 +513,19 @@ struct argp_option program_options[] =
       GAL_OPTIONS_NOT_SET
     },
     {
+      "snthresh",
+      UI_KEY_SNTHRESH,
+      "FLT",
+      0,
+      "Manually input pseudo-det S/N threshold.",
+      UI_GROUP_DETECTION,
+      &p->snthresh,
+      GAL_TYPE_FLOAT32,
+      GAL_OPTIONS_RANGE_GE_0,
+      GAL_OPTIONS_NOT_MANDATORY,
+      GAL_OPTIONS_NOT_SET
+    },
+    {
       "detgrowquant",
       UI_KEY_DETGROWQUANT,
       "FLT",
diff --git a/bin/noisechisel/astnoisechisel-3d.conf 
b/bin/noisechisel/astnoisechisel-3d.conf
index c3f1aa2..eebed94 100644
--- a/bin/noisechisel/astnoisechisel-3d.conf
+++ b/bin/noisechisel/astnoisechisel-3d.conf
@@ -21,8 +21,6 @@
  khdu                    1
  whdu                    1
  chdu                    1
- minskyfrac            0.7
- minnumfalse           100
 
 # Tessellation
  numchannels        1,1,1
@@ -40,10 +38,15 @@
  noerodequant         0.99
  opening                 1
  openingngb             18
+ minskyfrac            0.7
  sigmaclip           3,0.2
  dthresh               0.0
+ dopening                1
+ dopeningngb             6
  holengb                18
+ pseudoconcomp           6
  snminarea              20
+ minnumfalse           100
  snquant              0.99
  detgrowquant         0.95
  detgrowmaxholesize    300
diff --git a/bin/noisechisel/astnoisechisel.conf 
b/bin/noisechisel/astnoisechisel.conf
index 43c1476..cbb4596 100644
--- a/bin/noisechisel/astnoisechisel.conf
+++ b/bin/noisechisel/astnoisechisel.conf
@@ -39,8 +39,10 @@
  minskyfrac            0.7
  sigmaclip           3,0.2
  dthresh               0.0
+ dopening                1
+ dopeningngb             4
  holengb                 8
- pseudoconcomp           8
+ pseudoconcomp           4
  snminarea              10
  minnumfalse           100
  snquant              0.99
diff --git a/bin/noisechisel/detection.c b/bin/noisechisel/detection.c
index f53973e..9104055 100644
--- a/bin/noisechisel/detection.c
+++ b/bin/noisechisel/detection.c
@@ -125,7 +125,7 @@ detection_initial(struct noisechiselparams *p)
   if(!p->cp.quiet)
     {
       if( asprintf(&msg, "Eroded %zu time%s (%zu-connected).", p->erode,
-                   p->erode>1?"s":"", p->erodengb)<0 )
+                   p->erode!=1?"s":"", p->erodengb)<0 )
         error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
       gal_timing_report(&t1, msg, 2);
       free(msg);
@@ -326,7 +326,9 @@ detection_fill_holes_open(void *in_prm)
         }
 
       /* Open all the regions. */
-      gal_binary_open(copy, 1, 1, 1);
+      gal_binary_open(copy, p->dopening,
+                      detection_ngb_to_connectivity(p->input->ndim,
+                                                    p->dopeningngb), 1);
 
       /* Write the copied region back into the large input and AFTERWARDS,
          correct the tile's pointers, the pointers must not be corrected
@@ -797,36 +799,44 @@ detection_pseudo_real(struct noisechiselparams *p)
   workbin->flag=p->input->flag;
 
 
-  /* Over the Sky: find the pseudo-detections and make the S/N table. */
-  if(!p->cp.quiet) gettimeofday(&t1, NULL);
-  numpseudo=detection_pseudo_find(p, workbin, worklab, 0);
-  sn=detection_sn(p, worklab, numpseudo, 0, "PSEUDOS-FOR-SN");
-
-
-  /* A small sanity check */
-  if( sn->size < p->minnumfalse)
-    error(EXIT_FAILURE, 0, "only %zu pseudo-detections could be found over "
-          "the sky region to estimate an S/N. This is less than %zu (value "
-          "to `--minnumfalse' option). Please adjust parameters like "
-          "`--dthresh', `--snminarea', or make sure that there actually "
-          "is sufficient sky area after initial detection. You can use "
-          "`--checkdetection' to see every step until this point", sn->size,
-          p->minnumfalse);
-
-
-  /* Get the S/N quantile and report it if we are in non-quiet mode. */
-  quant=gal_statistics_quantile(sn, p->snquant, 1);
-  p->detsnthresh = *((float *)(quant->array));
-  if(!p->cp.quiet)
+  /* If a manual S/N is given, then don't bother with using
+     pseudo-detections. */
+  if( isnan(p->snthresh) )
     {
-      if( asprintf(&msg, "Pseudo-det S/N: %.3f (%g quant of %zu).",
-                   p->detsnthresh, p->snquant, sn->size)<0 )
-        error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
-      gal_timing_report(&t1, msg, 2);
-      free(msg);
+      /* Over the Sky: find the pseudo-detections and make the S/N
+         table. */
+      if(!p->cp.quiet) gettimeofday(&t1, NULL);
+      numpseudo=detection_pseudo_find(p, workbin, worklab, 0);
+      sn=detection_sn(p, worklab, numpseudo, 0, "PSEUDOS-FOR-SN");
+
+
+      /* A small sanity check */
+      if( sn->size < p->minnumfalse)
+        error(EXIT_FAILURE, 0, "only %zu pseudo-detections could be found "
+              "over the sky region to estimate an S/N. This is less than "
+              "%zu (value to `--minnumfalse' option). Please adjust "
+              "parameters like `--dthresh', `--snminarea', or make sure "
+              "that there actually is sufficient sky area after initial "
+              "detection. You can use `--checkdetection' to see every step "
+              "until this point", sn->size, p->minnumfalse);
+
+
+      /* Get the S/N quantile and report it if we are in non-quiet mode. */
+      quant=gal_statistics_quantile(sn, p->snquant, 1);
+      p->detsnthresh = *((float *)(quant->array));
+      if(!p->cp.quiet)
+        {
+          if( asprintf(&msg, "Pseudo-det S/N: %.3f (%g quant of %zu).",
+                       p->detsnthresh, p->snquant, sn->size)<0 )
+            error(EXIT_FAILURE, 0, "%s: asprintf allocation", __func__);
+          gal_timing_report(&t1, msg, 2);
+          free(msg);
+        }
+      gal_data_free(sn);
+      gal_data_free(quant);
     }
-  gal_data_free(sn);
-  gal_data_free(quant);
+  else
+    p->detsnthresh=p->snthresh;
 
 
   /* Over the detections: find pseudo-detections and make S/N table. */
diff --git a/bin/noisechisel/main.h b/bin/noisechisel/main.h
index b38686e..f0d62c5 100644
--- a/bin/noisechisel/main.h
+++ b/bin/noisechisel/main.h
@@ -73,12 +73,15 @@ struct noisechiselparams
   double         sigmaclip[2];  /* Sigma-clipping parameters.             */
   uint8_t         checkdetsky;  /* Check pseudo-detection sky value.      */
   float               dthresh;  /* Sigma threshold for Pseudo-detections. */
+  size_t             dopening;  /* Depth of opening after dthresh.        */
+  size_t          dopeningngb;  /* Connectivity for opening after dthresh.*/
   size_t              holengb;  /* Connectivity for defining a hole.      */
   size_t        pseudoconcomp;  /* Connectivity for connected components. */
   size_t            snminarea;  /* Minimum pseudo-detection area for S/N. */
   uint8_t             checksn;  /* Save pseudo-detection S/N values.      */
   size_t          minnumfalse;  /* Min No. of det/seg for true quantile.  */
-  float              snquant;  /* True detection quantile.               */
+  float               snquant;  /* True detection quantile.               */
+  float              snthresh;  /* Manually input S/N value.              */
   float          detgrowquant;  /* Quantile to grow true detections.      */
   size_t   detgrowmaxholesize;  /* Max. size of holes to fill in growth.  */
   uint8_t       cleangrowndet;  /* Remove grown objects with small S/N.   */
diff --git a/bin/noisechisel/ui.c b/bin/noisechisel/ui.c
index 84f67b2..7a6a438 100644
--- a/bin/noisechisel/ui.c
+++ b/bin/noisechisel/ui.c
@@ -115,6 +115,8 @@ ui_initialize_options(struct noisechiselparams *p,
   cp->numthreads         = gal_threads_number();
   cp->coptions           = gal_commonopts_options;
 
+  /* Program specific initialization. */
+  p->snthresh=NAN;
 
   /* Modify common options. */
   for(i=0; !gal_options_is_last(&cp->coptions[i]); ++i)
@@ -244,6 +246,7 @@ ui_read_check_only_options(struct noisechiselparams *p)
   ui_ngb_check(p->holengb, "holengb");
   ui_ngb_check(p->erodengb, "erodengb");
   ui_ngb_check(p->openingngb, "openingngb");
+  ui_ngb_check(p->openingngb, "dopeningngb");
   ui_ngb_check(p->pseudoconcomp, "pseudoconcomp");
 
   /* Make sure that the no-erode-quantile is not smaller or equal to
diff --git a/bin/noisechisel/ui.h b/bin/noisechisel/ui.h
index 66f32cc..c42df7d 100644
--- a/bin/noisechisel/ui.h
+++ b/bin/noisechisel/ui.h
@@ -92,9 +92,12 @@ enum option_keys_enum
   UI_KEY_OPENINGNGB,
   UI_KEY_SKYFRACNOBLANK,
   UI_KEY_CHECKDETSKY,
+  UI_KEY_DOPENING,
+  UI_KEY_DOPENINGNGB,
   UI_KEY_HOLENGB,
   UI_KEY_PSEUDOCONCOMP,
   UI_KEY_CHECKSN,
+  UI_KEY_SNTHRESH,
   UI_KEY_DETGROWMAXHOLESIZE,
   UI_KEY_CLEANGROWNDET,
   UI_KEY_CHECKDETECTION,
diff --git a/doc/announce-acknowledge.txt b/doc/announce-acknowledge.txt
index e5c7f79..8e5463a 100644
--- a/doc/announce-acknowledge.txt
+++ b/doc/announce-acknowledge.txt
@@ -1,5 +1,6 @@
 Alphabetically ordered list to acknowledge in the next release.
 
+Leindert Boogaard
 Raúl Infante Sainz
 David Valls-Gabaud
 Ignacio Trujillo
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index ba09486..b7b6537 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -12768,12 +12768,13 @@ $ astarithmetic image.fits set-i   i i 5 gt nan where
 
 @item tofile-AAA
 Write the top oprand on the operands stack into a file called @code{AAA}
-(can be any FITS file name) without changing the operands stack (no operand
-will be operand).
+(can be any FITS file name) without changing the operands stack. If you
+don't need the dataset any more and would like to free it, see the
+@code{tofilefree} operator below.
 
-Any file that is given to this operator is deleted before Arithmetic
-actually starts working on the input datasets. The deletion can be
-deactivated with the @option{--dontdelete} option (as in all Gnuastro
+By default, any file that is given to this operator is deleted before
+Arithmetic actually starts working on the input datasets. The deletion can
+be deactivated with the @option{--dontdelete} option (as in all Gnuastro
 programs, see @ref{Input output options}). If the same FITS file is given
 to this operator multiple times, it will contain multiple extensions (in
 the same order that it was called.
@@ -12785,6 +12786,11 @@ a string of operators and operands given to 
Arithmetic: simply put
 @command{tofile-AAA} anywhere in the process to see what is happening
 behind the scenes without modifying the overall process.
 
+@item tofilefree-AAA
+Similar to the @code{tofile} operator, with the only difference that the
+dataset that is written to a file is popped from the operand stack and
+freed from memory (cannot be used any more).
+
 @end table
 
 @cartouche
@@ -12855,24 +12861,28 @@ $ astarithmetic img1.fits img2.fits img3.fits median  
              \
                 -h0 -h1 -h2 --out=median.fits
 @end example
 
-The output is last remaining operand on the stack, see @ref{Reverse polish
-notation}. When its a single number, it will be printed on the
-command-line. When the output is an array, it will be stored as a file. The
-name of the file can be specified with the @option{--output} option, but if
-its not given, Arithmetic will use ``automatic output'' on the name of the
-first FITS image encountered to generate an output file name, see
-@ref{Automatic output}.
-
-By default, the world coordinate system (WCS) information will be taken
-from the first input image (that contains a WCS) on the command-line. This
-can be modified with the @option{--wcsfile} option described below.
-
 Arithmetic's notation for giving operands to operators is fully described
-in @ref{Reverse polish notation}. To ignore certain pixels, set them as
-blank, see @ref{Blank pixels}, for example with the @command{where}
-operator (see @ref{Arithmetic operators}). See @ref{Common options} for a
-review of the options in all Gnuastro programs. Arithmetic just redefines
-the @option{--hdu} option as explained below.
+in @ref{Reverse polish notation}. The output dataset is last remaining
+operand on the stack. When the output dataset a single number, it will be
+printed on the command-line. When the output is an array, it will be stored
+as a file.
+
+The name of the final file can be specified with the @option{--output}
+option, but if its not given, Arithmetic will use ``automatic output'' on
+the name of the first FITS image encountered to generate an output file
+name, see @ref{Automatic output}. By default, if the output file aready
+exists, it will be deleted before Arithmetic starts operation. However,
+this can be disabled with the @option{--dontdelete} option (see below). At
+any point during Arithmetic's operation, you can also write the top operand
+on the stack to a file, using the @code{tofile} or @code{tofilefree}
+operators, see @ref{Arithmetic operators}.
+
+By default, the world coordinate system (WCS) information of the output
+dataset will be taken from the first input image (that contains a WCS) on
+the command-line. This can be modified with the @option{--wcsfile} and
+@option{--wcshdu} options described below. When the @option{--quiet} option
+isn't given, the name and extension of the dataset used for the output's
+WCS is printed on the commandline.
 
 Through operators like those starting with @code{collapse-}, the
 dimensionality of the inputs may not be the same as the outputs. By
@@ -12882,6 +12892,10 @@ binary) can be set with the @option{--tableformat} 
option, see @ref{Input
 output options}). You can disable this feature (write 1D arrays as FITS
 images/arrays) with the @option{--onedasimage} option.
 
+See @ref{Common options} for a review of the options in all Gnuastro
+programs. Arithmetic just redefines the @option{--hdu} and
+@option{--dontdelete} options as explained below.
+
 @table @option
 
 @item -h INT/STR
@@ -12947,6 +12961,21 @@ HDU/extension to read the WCS within the file given to
 When final dataset to write as output only has one dimension, write it as a
 FITS image/array. By default, if the output is 1D, it will be written as a
 table, see above.
+
+@item -D
+@itemx --dontdelete
+Don't delete the output file, or files given to the @code{tofile} or
+@code{tofilefree} operators, if they already exist. Instead append the
+desired datasets to the extensions that already exist in the respective
+file. Note it doesn't matter if the final output file name is given with
+the the @option{--output} option, or determined automatically.
+
+Arithmetic treats this option differently from its default operation in
+other Gnuastro programs (see @ref{Input output options}). If the output
+file exists, when other Gnuastro programs are called with
+@option{--dontdelete}, they simply complain and abort. But when Arithmetic
+is called with @option{--dontdelete}, it will appended the dataset(s) to
+the existing extension(s) in the file.
 @end table
 
 Arithmetic accepts two kinds of input: images and numbers. Images are
@@ -16485,6 +16514,16 @@ the image. For more, see the description of this 
option in @ref{Detection
 options}.
 
 @item
+@option{dopening}: Number of openings after applying
+@option{--dthresh}. For more, see the description of this option in
+@ref{Detection options}.
+
+@item
+@option{dopeningngb}: Number of openings after applying
+@option{--dthresh}. For more, see the description of this option in
+@ref{Detection options}.
+
+@item
 @option{--holengb}: The connectivity (defined by the number of neighbors)
 to fill holes after applying @option{--dthresh} (above) to find
 pseudo-detections. For more, see the description of this option in
@@ -16496,6 +16535,11 @@ neighbors) to find individual pseudo-detections. For 
more, see the
 description of this option in @ref{Detection options}.
 
 @item
+@option{--snthresh}: Manually set the S/N of true pseudo-detections and
+thus avoid the need to manually identify this value. For more, see the
+description of this option in @ref{Detection options}.
+
+@item
 @option{--detgrowquant}: is used to grow the final true detections until a
 given quantile in the same way that clumps are grown during segmentation
 (compare columns 2 and 3 in Figure 10 of the paper). It replaces the old
@@ -17076,6 +17120,14 @@ ratio of the resulting `pseudo-detections' are used to 
identify true
 vs. false detections. See Section 3.1.5 and Figure 7 in Akhlaghi and
 Ichikawa (2015) for a very complete explanation.
 
+@item --dopening=INT
+The number of openings to do after applying @option{--dthresh}.
+
+@item --dopeningngb=INT
+The connectivity used in the opening of @option{--dopening}. In a 2D image
+this must be either 4 or 8. The stronger the connectivity, the more smaller
+regions will be discarded.
+
 @item --holengb=INT
 The connectivity (defined by the number of neighbors) to fill holes after
 applying @option{--dthresh} (above) to find pseudo-detections. For example
@@ -17136,6 +17188,17 @@ that this is only calculated for the large mesh grids 
that satisfy the
 minimum fraction of undetected pixels (value of @option{--minbfrac}) and
 minimum number of pseudo-detections (value of @option{--minnumfalse}).
 
+@item --snthresh=FLT
+Manually set the signal-to-noise ratio of true pseudo-detections. With this
+option, NoiseChisel will not attempt to find pseudo-detections over the
+noisy regions of the dataset, but will directly go onto applying the
+manually input value.
+
+This option is useful in crowded images where there is no blank sky to find
+the sky pseudo-detections. You can get this value on a similarly reduced
+dataset (from another region of the Sky with more undetected regions
+spaces).
+
 @item -d FLT
 @itemx --detgrowquant=FLT
 Quantile limit to ``grow'' the final detections. As discussed in the



reply via email to

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