gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 06b1a9f4 2/2: Library (arithmetic.c): error fo


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 06b1a9f4 2/2: Library (arithmetic.c): error for binary integers of same width
Date: Thu, 26 Oct 2023 19:40:35 -0400 (EDT)

branch: master
commit 06b1a9f4b340a40e31ec76201867dd9d7b18798e
Author: Faezeh Bidjarchian <fbidjarchian@gmail.com>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Library (arithmetic.c): error for binary integers of same width
    
    Until now, when both operands of binary operators in the arithmetic library
    had the same width, but different signs, a warning was printed that the
    output might be wrong. But, when the output may be wrong we need the Error,
    not warning. Because the main purpose of each function is to produce output
    correctly, not just to create output. Also, there were some typos within
    the comments of various parts of the source.
    
    With this commit, this warning has been changed to an error. Besides, the
    typos have been fixed.
    
    This issue was originally raised by Sepideh Eskandarlou.
---
 NEWS                      | 19 ++++++++++
 bin/table/table.c         | 26 ++++++-------
 doc/gnuastro.texi         |  3 +-
 lib/arithmetic.c          | 12 +++---
 lib/jpeg.c                | 18 ++++-----
 lib/kdtree.c              |  8 ++--
 lib/label.c               | 30 +++++++--------
 lib/list.c                | 14 +++----
 lib/makeplugin.c          | 16 ++++----
 lib/match.c               |  8 ++--
 lib/options.c             |  2 +-
 lib/pdf.c                 |  2 +-
 lib/permutation.c         |  4 +-
 lib/pointer.c             |  4 +-
 lib/polygon.c             | 26 ++++++-------
 lib/qsort.c               |  2 +-
 lib/speclines.c           |  6 +--
 lib/statistics.c          | 40 ++++++++++----------
 lib/table.c               | 22 +++++------
 lib/tableintern.c         | 10 ++---
 lib/tiff.c                | 32 ++++++++--------
 lib/tile-internal.c       |  2 +-
 lib/tile.c                | 20 +++++-----
 lib/txt.c                 | 52 ++++++++++++-------------
 lib/type.c                | 10 ++---
 lib/units.c               | 26 ++++++-------
 lib/warp.c                | 96 +++++++++++++++++++++++------------------------
 lib/wcs.c                 |  2 +-
 lib/wcsdistortion.c       | 20 +++++-----
 tests/arithmetic/where.sh |  3 +-
 30 files changed, 277 insertions(+), 258 deletions(-)

diff --git a/NEWS b/NEWS
index 4c64e900..bc3f22fe 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,25 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
 Copyright (C) 2015-2023 Free Software Foundation, Inc.
 See the end of the file for license conditions.
 
+* Noteworthy changes in release X.XX (library XX.0.0) (YYYY-MM-DD)
+** New features
+** Removed features
+** Changed features
+*** Arithmetic
+  - Binary operators (like '+' or 'x') that are given two integers will
+    crash with an error if the input operands have the same width but
+    different signs. Until now, they would just report a warning and print
+    the output. However, in large scripts, users could miss the warning and
+    not be aware of a possibly wrong result. Therefore it is more robust to
+    crash with an error rather than print a warning. This was suggested by
+    Sepideh Eskandarlou and implemented by Faezeh Bidjarchian after a poll
+    on Gnuastro's Matrix chat channel (#gnuastro:openastronomy.org).
+
+** Bugs fixed
+
+
+
+
 
 * Noteworthy changes in release 0.21 (library 19.0.0) (2023-10-20)
 ** New features
diff --git a/bin/table/table.c b/bin/table/table.c
index 8133420f..2ce80e49 100644
--- a/bin/table/table.c
+++ b/bin/table/table.c
@@ -199,7 +199,7 @@ table_selection_range(struct tableparams *p, gal_data_t 
*col)
   gal_data_free(tmp);
 
   /* Find all the elements outside this range (smaller than the minimum,
-     larger than the maximum or blank) as separate binary flags.. */
+     larger than the maximum or blank) as separate binary flags. */
   ltmin=gal_arithmetic(GAL_ARITHMETIC_OP_LT, 1, numok, col, min);
   gemax=gal_arithmetic(GAL_ARITHMETIC_OP_GE, 1, numok, col, max);
 
@@ -276,7 +276,7 @@ table_selection_polygon(struct tableparams *p, gal_data_t 
*col1,
                      NULL, NULL, NULL);
   oarr=out->array;
 
-  /* Loop through all the rows in the given columns and check the points.*/
+  /* Loop through all the rows in the given columns and check the points. */
   for(i=0; i<col1->size; i++)
     {
       /* Read the column values as a double. */
@@ -369,7 +369,7 @@ table_selection_equal_or_notequal(struct tableparams *p, 
gal_data_t *col,
      elements. */
   for(i=0;i<arg->size;++i)
     {
-      /* Write the value  */
+      /* Write the value. */
       if(col->type==GAL_TYPE_STRING)
         eq=table_selection_string_eq_ne(col, strarr[i], e0n1);
       else
@@ -412,7 +412,7 @@ table_selection_equal_or_notequal(struct tableparams *p, 
gal_data_t *col,
 
   /* Move the main pointer to the next possible call of the given
      option. Note that 'arg' already points to 'p->equal' or 'p->notequal',
-     so it will automatically be freed with the next step.*/
+     so it will automatically be freed with the next step. */
   if(e0n1) p->notequal=p->notequal->next;
   else     p->equal=p->equal->next;
 
@@ -692,7 +692,7 @@ table_random_rows(gal_data_t *table, gsl_rng *rng, size_t 
numrandom,
   ids=rowids->array;
   for(i=0;i<numrandom;++i)
     {
-      /* Select a random index and make sure its new. */
+      /* Select a random index and make sure it is new. */
       bad=1;
       while(bad)
         {
@@ -784,7 +784,7 @@ table_select_by_position(struct tableparams *p)
          not be used (outside the allocated array directly
          'gal_data_t'). We don't have to worry about the space for the
          actual pointers (they will be free'd by 'free' in any case, since
-         they are in the initially allocated array).*/
+         they are in the initially allocated array). */
       if(col->type==GAL_TYPE_STRING)
         {
           /* Parse the rows and free extra pointers. */
@@ -914,7 +914,7 @@ table_catcolumn(struct tableparams *p)
                   }
             }
 
-      /* Find the final column of the main table and add this table.*/
+      /* Find the final column of the main table and add this table. */
       final=gal_list_data_last(p->table);
       final->next=tocat;
       ++counter;
@@ -1068,7 +1068,7 @@ table_tovector(struct tableparams *p)
         }
 
       /* Reverse the list to be in the same order as the input, and convert
-         it to a vector.*/
+         it to a vector. */
       gal_list_data_reverse(&list);
       vector=gal_table_cols_to_vector(list);
       gal_list_data_free(list);
@@ -1158,7 +1158,7 @@ table_catrows_prepare(struct tableparams *p)
                           tmp->name, tmp->unit, tmp->comment);
 
       /* Put the full contents of the existing column into the new
-         column: this will be the first set of rows,  */
+         column: this will be the first set of rows. */
       memcpy(ocol->array, tmp->array, tmp->size*gal_type_sizeof(tmp->type));
 
       /* If the column type is a string, we should set the input pointers
@@ -1262,7 +1262,7 @@ table_catrows(struct tableparams *p)
                   ttmp->ndim==1?"single-valued":"vector");
 
           /* If the column is vector, make sure it has the same number of
-             elements.*/
+             elements. */
           if(tmp->ndim==2 && tmp->dsize[1]!=ttmp->dsize[1])
             error(EXIT_FAILURE, 0, "%s: vector column %zu has %zu elements "
                   "However, in the final table (before adding rows) this "
@@ -1286,7 +1286,7 @@ table_catrows(struct tableparams *p)
               for(i=0;i<tmp->size;++i) strarr[i]=NULL;
             }
 
-          /* Take 'ttmp' to the next column and increment the counter */
+          /* Take 'ttmp' to the next column and increment the counter. */
           ttmp=ttmp->next;
           ++colcount;
         }
@@ -1426,7 +1426,7 @@ table_noblankend(struct tableparams *p)
         /* First go through the column names and if they match, add
            them. Note that we don't want to stop once a name is found, in
            this scenario, if multiple columns have the same name, we should
-           use all.*/
+           use all. */
         j=0;
         found=0;
         for(tcol=p->table; tcol!=NULL; tcol=tcol->next)
@@ -1458,7 +1458,7 @@ table_noblankend(struct tableparams *p)
                     "have given 0");
 
             /* Make sure that the index falls within the number (note that
-               it still counts from 1).  */
+               it still counts from 1). */
             if(*index > gal_list_data_number(p->table))
               error(EXIT_FAILURE, 0, "the final output table only has "
                     "%zu columns, but you have given column %zu to "
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 3bd764b0..05afd1fc 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -17601,7 +17601,8 @@ $ asttable [OPTION...] InputFile
 One line examples:
 
 @example
-## Get the table column information (name, data type, or units):
+## Get the table column information (name, units, or data type), and
+## the number of rows:
 $ asttable table.fits --information
 
 ## Print columns named RA and DEC, followed by all the columns where
diff --git a/lib/arithmetic.c b/lib/arithmetic.c
index 193a6b9a..40922aaf 100644
--- a/lib/arithmetic.c
+++ b/lib/arithmetic.c
@@ -2381,16 +2381,16 @@ arithmetic_binary_int_sanity_check(gal_data_t *l, 
gal_data_t *r,
   /* Variables to simplify the checks. */
   int l_is_signed=0, r_is_signed=0;
 
-  /* Warning only necessary for same-width types. */
+  /* Error only necessary for same-width types. */
   if( gal_type_sizeof(l->type)==gal_type_sizeof(r->type) )
     {
-      /* Warning not needed when one of the inputs is a float. */
+      /* Error not needed when one of the inputs is a float. */
       if(    l->type==GAL_TYPE_FLOAT32 || l->type==GAL_TYPE_FLOAT64
           || r->type==GAL_TYPE_FLOAT32 || r->type==GAL_TYPE_FLOAT64 )
         return;
       else
         {
-          /* Warning not needed if both have (or don't have) a sign. */
+          /* Error not needed if both have (or don't have) a sign. */
           if(    l->type==GAL_TYPE_INT8  || l->type==GAL_TYPE_INT16
               || l->type==GAL_TYPE_INT32 || l->type==GAL_TYPE_INT64 )
             l_is_signed=1;
@@ -2398,7 +2398,7 @@ arithmetic_binary_int_sanity_check(gal_data_t *l, 
gal_data_t *r,
               || r->type==GAL_TYPE_INT32 || r->type==GAL_TYPE_INT64 )
             r_is_signed=1;
           if( l_is_signed!=r_is_signed )
-            error(EXIT_SUCCESS, 0, "warning: the two integer operands "
+            error(EXIT_FAILURE, 0, "the two integer operands "
                   "given to '%s' have the same width (number of bits), "
                   "but a different sign: the first popped operand (that "
                   "is closer to the operator, or the \"right\" operand) "
@@ -2416,10 +2416,10 @@ arithmetic_binary_int_sanity_check(gal_data_t *l, 
gal_data_t *r,
                   "'int32' or 'int64'). For more, see the \"Integer "
                   "benefits and pitfalls\" section of Gnuastro's "
                   "manual with this command: 'info gnuastro integer'. "
-                  "This warning can be removed with '--quiet' (or "
+                  "This Error can be removed with '--quiet' (or "
                   "'-q')", gal_arithmetic_operator_string(operator),
                   gal_type_name(r->type, 1), gal_type_name(l->type, 1));
-        }
+            }
     }
 }
 
diff --git a/lib/jpeg.c b/lib/jpeg.c
index 72156544..5fa49fa3 100644
--- a/lib/jpeg.c
+++ b/lib/jpeg.c
@@ -47,7 +47,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #ifdef HAVE_LIBJPEG
 
 /* Read the example.c in libjpeg's source code to understand the
-   details of what is going on here.  */
+   details of what is going on here. */
 struct my_error_mgr
 {
   struct jpeg_error_mgr pub;        /* "public" fields */
@@ -60,14 +60,14 @@ typedef struct my_error_mgr *my_error_ptr;
 METHODDEF(void)
 jpeg_error_exit(j_common_ptr cinfo)
 {
-  /* cinfo->err really points to a my_error_mgr struct, so coerce pointer */
+  /* cinfo->err really points to a my_error_mgr struct, so coerce pointer. */
   my_error_ptr myerr = (my_error_ptr) cinfo->err;
 
   /* Always display the message. */
   /* We could postpone this until after returning, if we chose. */
   (*cinfo->err->output_message) (cinfo);
 
-  /* Return control to the setjmp point */
+  /* Return control to the setjmp point. */
   longjmp(myerr->setjmp_buffer, 1);
 }
 
@@ -213,7 +213,7 @@ jpeg_read_to_array(char *inname, size_t *outs0, size_t 
*outs1, size_t *numcolors
   size_t i, j, size, nc, s0, s1;
   struct jpeg_decompress_struct cinfo;
 
-  /* Open the input file */
+  /* Open the input file. */
   errno=0;
   if ((infile = fopen(inname, "rb")) == NULL)
     error(EXIT_FAILURE, errno, "%s", inname);
@@ -266,7 +266,7 @@ jpeg_read_to_array(char *inname, size_t *outs0, size_t 
*outs1, size_t *numcolors
       jpeg_read_scanlines(&cinfo, jsarr, 1);
     }
 
-  /* Put the different colors into the different arrays */
+  /* Put the different colors into the different arrays. */
   for(i=0;i<size;++i)
     for(j=0;j<nc;++j)
       all[j][i]=jsamp[i*nc+j];
@@ -367,7 +367,7 @@ jpeg_write_array(JSAMPLE *jsr, gal_data_t *in, char 
*filename,
     error(EXIT_FAILURE, 0, "%s: quality value %u not acceptable. It must be "
           "a value between zero and 100 (inclusive)", __func__, quality);
 
-  /* Begin the JPEG writing, following libjpeg's example.c  */
+  /* Begin the JPEG writing, following libjpeg's example.c */
   cinfo.err = jpeg_std_error(&jerr);
   jpeg_create_compress(&cinfo);
 
@@ -407,8 +407,8 @@ jpeg_write_array(JSAMPLE *jsr, gal_data_t *in, char 
*filename,
   cinfo.Y_density=cinfo.X_density=dsize[1]/(widthincm/2.54);
   jpeg_start_compress(&cinfo, TRUE);
 
-  /* cinfo.next_scanline is 'unsigned int' */
-  c=dsize[0]-1; /* In JPEG the first row is on the bottom!  */
+  /* cinfo.next_scanline is 'unsigned int'. */
+  c=dsize[0]-1; /* In JPEG the first row is on the bottom! */
   while (cinfo.next_scanline < cinfo.image_height)
     {
       r[0] = & jsr[c-- * row_stride];
@@ -446,7 +446,7 @@ gal_jpeg_write(gal_data_t *in, char *filename, uint8_t 
quality,
 
   /* Make sure the file doesn't exist and that we have write
      permission. Note that the JPEG standard doesn't have multple
-     extensions.*/
+     extensions. */
   if( gal_checkset_writable_notexist(filename)==0 )
     error(EXIT_FAILURE, 0, "%s: already exists or its directory doesn't "
           "write permssion. Note that the JPEG standard only allows one "
diff --git a/lib/kdtree.c b/lib/kdtree.c
index 364c137a..f4cad57b 100644
--- a/lib/kdtree.c
+++ b/lib/kdtree.c
@@ -426,7 +426,7 @@ kdtree_fill_subtrees(struct kdtree_params *p, size_t 
node_left,
      to node median when there are only 2 points and at this point,
      there can never be a single point (node left == node right).
      But node right can never be equal to node median.
-     So we don't check for it.*/
+     So we don't check for it. */
   p->right[node_median] = kdtree_fill_subtrees(p, node_median+1,
                                                node_right,
                                                depth+1);
@@ -453,7 +453,7 @@ gal_kdtree_create(gal_data_t *coords_raw, size_t *root)
   /* Initialise the params structure. */
   kdtree_prepare(&p, coords_raw);
 
-  /* Fill the kd-tree*/
+  /* Fill the kd-tree. */
   *root=kdtree_fill_subtrees(&p, 0, coords_raw->size-1, 0);
 
   /* For a check
@@ -467,7 +467,7 @@ gal_kdtree_create(gal_data_t *coords_raw, size_t *root)
   gal_permutation_apply_inverse(p.left_col, p.input_row);
   gal_permutation_apply_inverse(p.right_col, p.input_row);
 
-  /* Free and clean up */
+  /* Free and clean up. */
   kdtree_cleanup(&p, coords_raw);
 
   /* Return results. */
@@ -515,7 +515,7 @@ kdtree_nearest_neighbour(struct kdtree_params *p, uint32_t 
node_current,
   /* If no subtree present, don't search further. */
   if(node_current==GAL_BLANK_UINT32) return;
 
-  /* The distance between search point to the current node.*/
+  /* The distance between search point to the current node. */
   d = kdtree_distance_find(p, node_current, point);
 
   /* Distance between the splitting coordinate of the search
diff --git a/lib/label.c b/lib/label.c
index 68761095..db622e2c 100644
--- a/lib/label.c
+++ b/lib/label.c
@@ -125,7 +125,7 @@ gal_label_indexs(gal_data_t *labels, size_t numlabs, size_t 
minmapsize,
 
   /* Allocate/Initialize the dataset containing the indexs of each
      object. We don't want the labels of the non-detected regions
-     (areas[0]). So we'll set that to zero.*/
+     (areas[0]). So we'll set that to zero. */
   for(i=1;i<numlabs+1;++i)
     gal_data_initialize(&labindexs[i], NULL, GAL_TYPE_SIZE_T, 1,
                         &areas[i], NULL, 0, minmapsize, quietmmap,
@@ -136,7 +136,7 @@ gal_label_indexs(gal_data_t *labels, size_t numlabs, size_t 
minmapsize,
   memset(areas, 0, (numlabs+1)*sizeof *areas);
   lf=(a=l=labels->array)+labels->size;
   do
-    if(*l>0)  /* No undetected regions (*l==0), or blank (<0) */
+    if(*l>0)  /* No undetected regions (*l==0), or blank (<0). */
       ((size_t *)(labindexs[*l].array))[ areas[*l]++ ] = l-a;
   while(++l<lf);
 
@@ -192,7 +192,7 @@ gal_label_watershed(gal_data_t *values, gal_data_t *indexs,
   size_t *dinc=gal_dimension_increment(ndim, dsize);
   int32_t n1, nlab, rlab, curlab=1, *labs=labels->array;
 
-  /* Sanity checks */
+  /* Sanity checks. */
   label_check_type(values, GAL_TYPE_FLOAT32, "values", __func__);
   label_check_type(indexs, GAL_TYPE_SIZE_T,  "indexs", __func__);
   label_check_type(labels, GAL_TYPE_INT32,   "labels", __func__);
@@ -240,7 +240,7 @@ gal_label_watershed(gal_data_t *values, gal_data_t *indexs,
 
   /* If the indexs aren't already sorted (by the value they correspond to),
      sort them given indexs based on their flux ('gal_qsort_index_arr' is
-     defined as static in 'gnuastro/qsort.h') */
+     defined as static in 'gnuastro/qsort.h'). */
   if( !( (indexs->flag & GAL_DATA_FLAG_SORT_CH)
         && ( indexs->flag
              & (GAL_DATA_FLAG_SORTED_I
@@ -320,7 +320,7 @@ gal_label_watershed(gal_data_t *values, gal_data_t *indexs,
                            {
                              /* If this neighbor has not been labeled yet
                                 and has an equal flux, add it to the queue
-                                to expand the studied region.*/
+                                to expand the studied region. */
                              if( nlab==GAL_LABEL_INIT && arr[nind]==arr[*a] )
                                {
                                  labs[nind]=GAL_LABEL_TMPCHECK;
@@ -338,7 +338,7 @@ gal_label_watershed(gal_data_t *values, gal_data_t *indexs,
                                        is different from 'nlab' then this
                                        whole equal flux region should be a
                                        wide river because it is connecting
-                                       two connected regions.*/
+                                       two connected regions. */
                                     ? ( n1
                                         ? (n1==nlab ? n1 : GAL_LABEL_RIVER)
                                         : nlab )
@@ -377,7 +377,7 @@ gal_label_watershed(gal_data_t *values, gal_data_t *indexs,
             else
               {
                 rlab = curlab++;
-                if( topinds )              /* This is a local maximum of   */
+                if( topinds )              /* This is a local maximum of "?". 
*/
                   topinds[rlab]=*a;        /* this region, save its index. */
               }
 
@@ -407,7 +407,7 @@ gal_label_watershed(gal_data_t *values, gal_data_t *indexs,
                one label or not. If the pixel is neighboured by more than
                one label, set it as a river pixel. Also if it is touching a
                zero valued pixel (which does not belong to this object),
-               set it as a river pixel.*/
+               set it as a river pixel. */
             GAL_DIMENSION_NEIGHBOR_OP(*a, ndim, dsize, ndim, dinc,
                {
                  /* When 'n1' has already been set as a river, there is no
@@ -460,7 +460,7 @@ gal_label_watershed(gal_data_t *values, gal_data_t *indexs,
                is either a river pixel (has more than one labeled neighbor
                and has been set to 'GAL_LABEL_RIVER' before) or all its
                neighbors have the same label. In both such cases, rlab
-               should be set to n1.*/
+               should be set to n1. */
             if(n1) rlab = n1;
             else
               {
@@ -625,7 +625,7 @@ label_clump_significance_sanity(gal_data_t *values, 
gal_data_t *std,
      covered by all the indexs, then both (or one) of 'first' or 'second'
      will be NAN. In either case, the significance measure is not going to
      be meaningful if we assume the clumps start from the maxima or
-     minima. So we won't check if they are NaN or not.*/
+     minima. So we won't check if they are NaN or not. */
   return first>second ? 1 : 0;
 }
 
@@ -640,7 +640,7 @@ label_clump_significance_sanity(gal_data_t *values, 
gal_data_t *std,
    object (already found in deblendclumps()) and add them appropriately.
 
    The output is an array of size cltprm->numinitial*INFO_NCOLS. as listed
-   below.*/
+   below. */
 enum infocols
   {
     INFO_STD,            /* Standard deviation.                           */
@@ -800,7 +800,7 @@ gal_label_clump_significance(gal_data_t *values, gal_data_t 
*std,
       sigind->type  = GAL_TYPE_INT32;
       sigind->dsize = gal_pointer_allocate(GAL_TYPE_SIZE_T, 1, 0, __func__,
                                            "sigind->dsize");
-      sigind->size  = sigind->dsize[0] = tablen;/* After dsize */
+      sigind->size  = sigind->dsize[0] = tablen;/* After dsize. */
       sigind->array = gal_pointer_allocate(sigind->type, tablen, 0, __func__,
                                            "sigind->array");
     }
@@ -810,7 +810,7 @@ gal_label_clump_significance(gal_data_t *values, gal_data_t 
*std,
   label_clump_significance_raw(values, std, label, indexs, tl, info);
 
 
-  /* Calculate the signficance value for successful clumps */
+  /* Calculate the signficance value for successful clumps. */
   sigarr=sig->array;
   if(keepsmall) sigarr[0]=NAN;
   if(sigind) indarr=sigind->array;
@@ -848,7 +848,7 @@ gal_label_clump_significance(gal_data_t *values, gal_data_t 
*std,
       else
         {
           /* Only over detections, we should put a NaN when the S/N isn't
-             calculated.  */
+             calculated. */
           if(keepsmall)
             {
               sigarr[i]=NAN;
@@ -961,7 +961,7 @@ gal_label_grow_indexs(gal_data_t *labels, gal_data_t 
*indexs, int withrivers,
                     {
                       if(n1)       /* A prev. ngb label has been found. */
                         {
-                          if( n1 != nlab )    /* Different label from   */
+                          if( n1 != nlab )    /* Different label from "?". */
                             {    /* prevously found ngb for this pixel. */
                               n1=GAL_LABEL_RIVER;
                               searchngb=0;
diff --git a/lib/list.c b/lib/list.c
index 0ee1b533..b3d18660 100644
--- a/lib/list.c
+++ b/lib/list.c
@@ -174,7 +174,7 @@ gal_list_str_free(gal_list_str_t *list, int freevalue)
 
 /* Replacement characters for commented space (ASCII code 14 for "Shift
    out"). These are chosen as non-printable ASCII characters, that user's
-   will not be typing. Inspired from 'gal_options_parse_list_of_strings'.*/
+   will not be typing. Inspired from 'gal_options_parse_list_of_strings'. */
 #define LIST_COMMENTED_SPACE 14
 gal_list_str_t *
 gal_list_str_extract(char *string)
@@ -241,14 +241,14 @@ gal_list_str_cat(gal_list_str_t *list, char delimiter)
   for(tmp=list; tmp!=NULL; tmp=tmp->next)
     {
       /* Count the characters. If we have a SPACE, we need to add an extra
-         count for the back slash.*/
+         count for the back slash. */
       c=tmp->v;
       do {++bsize; if(*c==delimiter) ++bsize;} while(*(++c)!='\0');
-      ++bsize; /* For the extra space between characters */
+      ++bsize; /* For the extra space between characters. */
     }
 
   /* Allocate the necessary space and write all the strings inside of it,
-     (while also commenting the space characters).*/
+     (while also commenting the space characters). */
   out=gal_pointer_allocate(GAL_TYPE_STRING, bsize, 0, __func__, "out");
   o=out;
   for(tmp=list; tmp!=NULL; tmp=tmp->next)
@@ -1133,7 +1133,7 @@ gal_list_osizet_add(gal_list_osizet_t **list,
   newnode->v=value;
   newnode->s=tosort;
 
-  /* *list points to the smallest value in the queue!*/
+  /* *list points to the smallest value in the queue! */
   while(tmp!=NULL)
     {
       if(tosort<tmp->s) break;
@@ -1422,7 +1422,7 @@ gal_list_data_add(gal_data_t **list, gal_data_t *newnode)
     /* Its not a list, so just set it to 'toadd'. */
     toadd=newnode;
 
-  /* Set the next element of toadd and update what list points to.*/
+  /* Set the next element of toadd and update what list points to. */
   toadd->next=*list;
   *list=newnode;
 }
@@ -1553,7 +1553,7 @@ gal_list_data_select_by_id(gal_data_t *table, char 
*idstr, size_t *index)
       for(tmp=table;tmp!=NULL;tmp=tmp->next)
         { ++i; if(i==colind) { oind=i-1; out=tmp; break;} }
     }
-  else /* ID is string; parse the names in the table.*/
+  else /* ID is string; parse the names in the table. */
     {
       /* Parse the table and if the name exists, return it. */
       colind=i=0;
diff --git a/lib/makeplugin.c b/lib/makeplugin.c
index 2ee4e181..8b1222b9 100644
--- a/lib/makeplugin.c
+++ b/lib/makeplugin.c
@@ -46,7 +46,7 @@ int plugin_is_GPL_compatible=1;
 
 
 
-/* Names of the separate functions */
+/* Names of the separate functions. */
 #define MAKEPLUGIN_FUNC_PREFIX "ast"
 static char *version_is_name=MAKEPLUGIN_FUNC_PREFIX"-version-is";
 static char *text_contains_name=MAKEPLUGIN_FUNC_PREFIX"-text-contains";
@@ -76,7 +76,7 @@ makeplugin_version_is(const char *caller, unsigned int argc, 
char **argv)
   /* If the version matches, set the value of 'check'. */
   if( version && !strcmp(PACKAGE_VERSION, version) ) check=1;
 
-  /* Write the value into the 'out' pointer.*/
+  /* Write the value into the 'out' pointer. */
   if( asprintf(&out, "%d", check)<0 )
     error(EXIT_FAILURE, 0, "%s: couldn't allocate output string",
           __func__);
@@ -141,7 +141,7 @@ makeplugin_text_contains_base(char **argv, int has1_not0)
 /* Return any of the input strings that contain the given string. It takes
    two arguments:
       0. String to check.
-      1. List of text.*/
+      1. List of text. */
 static char *
 makeplugin_text_contains(const char *caller, unsigned int argc,
                          char **argv)
@@ -156,7 +156,7 @@ makeplugin_text_contains(const char *caller, unsigned int 
argc,
 /* Return any of the input strings that contain the given string. It takes
    two arguments:
       0. String to check.
-      1. List of text.*/
+      1. List of text. */
 static char *
 makeplugin_text_not_contains(const char *caller, unsigned int argc,
                              char **argv)
@@ -237,12 +237,12 @@ makeplugin_fits_with_keyvalue(const char *caller, 
unsigned int argc,
     return NULL;
 
   /* Extract the components in the arguments with possibly multiple
-     values and find the output files.*/
+     values and find the output files. */
   files=gal_list_str_extract(argv[3]);
   values=gal_list_str_extract(argv[1]);
   outlist=gal_fits_with_keyvalue(files, hdu, name, values, NULL);
 
-  /* Write the output string */
+  /* Write the output string. */
   out=gal_list_str_cat(outlist, ' ');
 
   /* Clean up and return. */
@@ -274,7 +274,7 @@ makeplugin_fits_unique_keyvalues(const char *caller, 
unsigned int argc,
     return NULL;
 
   /* Extract the components in the arguments with possibly multiple
-     values and find the output files.*/
+     values and find the output files. */
   files=gal_list_str_extract(argv[2]);
   outlist=gal_fits_unique_keyvalues(files, hdu, name, NULL);
 
@@ -313,7 +313,7 @@ libgnuastro_make_gmk_setup()
                    4, 4, GMK_FUNC_DEFAULT);
 
   /* Return the unique values given to a certain keyword in many FITS
-     files.*/
+     files. */
   gmk_add_function(fits_unique_keyvalues_name,
                    makeplugin_fits_unique_keyvalues,
                    3, 3, GMK_FUNC_DEFAULT);
diff --git a/lib/match.c b/lib/match.c
index 42590e86..1d31cab0 100644
--- a/lib/match.c
+++ b/lib/match.c
@@ -330,12 +330,12 @@ match_rearrange(gal_data_t *A, gal_data_t *B, struct 
match_sfll **bina)
 
   /* Re-fill the bina array, but this time only with the 'bi' that is
      closest to it. Note that bina was fully set to NULL after popping all
-     the elements in the loop above.*/
+     the elements in the loop above. */
   for( bi=0; bi<br; ++bi )
     if( !isnan(ainb[bi*2]) )
       {
        /* Just to keep the same terminology as before and easier
-          reading.*/
+          reading. */
        r=ainb[bi*2+1];
        ai=(size_t)(ainb[bi*2]);
 
@@ -377,7 +377,7 @@ match_rearrange(gal_data_t *A, gal_data_t *B, struct 
match_sfll **bina)
   exit(0);
   */
 
-  /* Clean up */
+  /* Clean up. */
   free(ainb);
 }
 
@@ -456,7 +456,7 @@ match_output(gal_data_t *A, gal_data_t *B, size_t *A_perm, 
size_t *B_perm,
         }
 
       /* No match found. At this stage, we can only fill the indexs of the
-         first input. The second input needs to be matched afterwards.*/
+         first input. The second input needs to be matched afterwards. */
       else aind[ nomatch_i++ ] = A_perm ? A_perm[ai] : ai;
     }
 
diff --git a/lib/options.c b/lib/options.c
index b0ca4f4c..b3f6e714 100644
--- a/lib/options.c
+++ b/lib/options.c
@@ -488,7 +488,7 @@ gal_options_read_color(struct argp_option *option, char 
*arg,
                       arg, option->name);
 
       /* For no un-used variable warning. This function doesn't need the
-         pointer.*/
+         pointer. */
       return junk=NULL;
     }
 }
diff --git a/lib/pdf.c b/lib/pdf.c
index 3ed870e3..af406e4e 100644
--- a/lib/pdf.c
+++ b/lib/pdf.c
@@ -114,7 +114,7 @@ gal_pdf_write(gal_data_t *in, char *filename, float 
widthincm,
   /* Get the size of the image in 'pt' units. */
   gal_eps_to_pt(widthincm, in->dsize, w_h_in_pt);
 
-  /* Set the device from the file name */
+  /* Set the device from the file name. */
   if(gal_jpeg_name_is_jpeg(filename)) device="jpeg";
   else                                device="pdfwrite";
 
diff --git a/lib/permutation.c b/lib/permutation.c
index 0115692d..7f5a0d51 100644
--- a/lib/permutation.c
+++ b/lib/permutation.c
@@ -159,7 +159,7 @@ gal_permutation_apply_inverse(gal_data_t *input, size_t 
*permutation)
 
   if(permutation)
     {
-      /* Initializations */
+      /* Initializations. */
       width=gal_type_sizeof(input->type);
       tmp=gal_pointer_allocate(input->type, 1, 0, __func__, "tmp");
       ttmp=gal_pointer_allocate(input->type, 1, 0, __func__, "ttmp");
@@ -290,7 +290,7 @@ permutation_transpose_2d_rectangle(gal_data_t *input)
       gal_data_free(out);
     }
 
-  /* Update the dimesions */
+  /* Update the dimesions. */
   input->dsize[0]=od[0];
   input->dsize[1]=od[1];
 }
diff --git a/lib/pointer.c b/lib/pointer.c
index c2b307e2..8fc318ec 100644
--- a/lib/pointer.c
+++ b/lib/pointer.c
@@ -47,7 +47,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
    is mainly useful when dealing with the 'block' pointer of a tile over a
    larger image. This function reads the address as a 'char *' type (note
    that 'char' is guaranteed to have a size of 1 (byte)). It then
-   increments the 'char *' by 'increment*sizeof(type)' */
+   increments the 'char *' by 'increment*sizeof(type)'. */
 void *
 gal_pointer_increment(void *pointer, size_t increment, uint8_t type)
 {
@@ -137,7 +137,7 @@ gal_pointer_mmap_allocate(uint8_t type, size_t size, int 
clear,
   if(dirname) free(dirname);
 
 
-  /* Create a zero-sized file and keep its descriptor.  */
+  /* Create a zero-sized file and keep its descriptor. */
   errno=0;
   /*filedes=open(filename, O_RDWR | O_CREAT | O_EXCL | O_TRUNC );*/
   filedes=mkstemp(*filename);
diff --git a/lib/polygon.c b/lib/polygon.c
index 479d9b41..3d9392aa 100644
--- a/lib/polygon.c
+++ b/lib/polygon.c
@@ -125,7 +125,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 /**************       Basic operations        ******************/
 /***************************************************************/
 
-/* Sort the pixels in anti clock-wise order.*/
+/* Sort the pixels in anti clock-wise order. */
 void
 gal_polygon_vertices_sort_convex(double *in, size_t n, size_t *ordinds)
 {
@@ -215,7 +215,7 @@ gal_polygon_is_convex(double *v, size_t n)
         return 0;
     }
 
-  /* Check the edge between nth and 1st point */
+  /* Check the edge between nth and 1st point. */
   if(flag)
     {
       if( GAL_POLYGON_LEFT_OF_LINE(&v[(n-2)*2], &v[(n-1)*2], &v[0]) )
@@ -321,10 +321,10 @@ gal_polygon_is_inside(double *v, double *p, size_t n)
      crosses the polygon. */
   size_t wn=0, i=0, j=n-1;
 
-  /* Loop through all the edges of the polygon*/
+  /* Loop through all the edges of the polygon. */
   while(i<n)
     {
-      /* Edge from v[i] to v[i+1] in upward direction */
+      /* Edge from v[i] to v[i+1] in upward direction. */
       if(v[j*2+1] <= p[1])
         {
           if(v[i*2+1] > p[1])
@@ -333,14 +333,14 @@ gal_polygon_is_inside(double *v, double *p, size_t n)
               wn++;
         }
       else{
-        /* edge from v[i] to v[i+1] in downward direction */
+        /* Edge from v[i] to v[i+1] in downward direction. */
         if(v[i*2+1] <= p[1])
-          /* p right of edge is a downward intersection, decrease wn */
+          /* p right of edge is a downward intersection, decrease wn. */
           if( GAL_POLYGON_TRI_CROSS_PRODUCT(&v[j*2], &v[i*2], p) < 0 )
             wn--;
       }
 
-      /* Increment 'j' */
+      /* Increment 'j'. */
       j=i++;
 
       /* For a check:
@@ -364,7 +364,7 @@ gal_polygon_is_inside(double *v, double *p, size_t n)
    If the point is inside the polygon, it will always be to the left
    of the edge connecting the two vertices when the vertices are
    traversed in order. See the comments above 'gal_polygon_area' for an
-   explanation about i and j and the loop.*/
+   explanation about i and j and the loop. */
 int
 gal_polygon_is_inside_convex(double *v, double *p, size_t n)
 {
@@ -475,7 +475,7 @@ gal_polygon_to_counterclockwise(double *v, size_t n)
           j++;
         }
 
-      /* Put the vertices in the 'gal_data_t' object */
+      /* Put the vertices in the 'gal_data_t' object. */
       temp=gal_data_alloc(v, GAL_TYPE_FLOAT64, 1, &n, NULL, 0,
                           -1, 0, NULL, NULL, NULL);
 
@@ -517,7 +517,7 @@ seginfintersection(double *Aa, double *Ab, double *Ba, 
double *Bb,
   /* If all four points lie on the same line, there is infinite
      intersections, so return -1. If three of the points are
      collinear, then the point on the line segment that is collinear
-     with the infinite line is the intersection point.*/
+     with the infinite line is the intersection point. */
   if( Aacollinear && Abcollinear)
     return -1;
   else if( Aacollinear || Abcollinear)
@@ -750,7 +750,7 @@ polygon_leftof_vector(double *in, size_t n, double x, 
double y)
   polygon_rightmost_point(in, n, &r);
   test = (r.y-y)*(r.x-l.x) - (r.y-l.y)*(r.x-x);
 
-  /* Due to the choice of return value, we multiply 'test' by -1 */
+  /* Due to the choice of return value, we multiply 'test' by -1. */
   test = -1*test;
   return test?(test>0?1:-1):0;
 }
@@ -892,7 +892,7 @@ gal_polygon_vertices_sort(double *vertices, size_t n, 
size_t *ordinds)
   qsort(A, A_size, sizeof(struct point), polygon_compareA);
   qsort(B, B_size, sizeof(struct point), polygon_compareB);
 
-  /*Finally, we put the contents of A and B in a final sorted array.*/
+  /*Finally, we put the contents of A and B in a final sorted array. */
   for(i=0; i<A_size; i++) sorted[i]=A[i];
   for(j=0; j<B_size; j++) sorted[i++]=B[j];
 
@@ -902,7 +902,7 @@ gal_polygon_vertices_sort(double *vertices, size_t n, 
size_t *ordinds)
   */
 
   /* The temporary array is now used to find the location of points stored
-     in sorted array and assign index in ordinds accordingly.*/
+     in sorted array and assign index in ordinds accordingly. */
   for(i=0; i<n; i++)
     for(j=0; j<n; j++)
       if( tordinds[i].x == sorted[j].x && tordinds[i].y == sorted[j].y )
diff --git a/lib/qsort.c b/lib/qsort.c
index e8f94d62..ea063fd0 100644
--- a/lib/qsort.c
+++ b/lib/qsort.c
@@ -44,7 +44,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
    equal zero, we don't have any NaNs and this 'COMPARE_FLOAT_POSTPROCESS'
    macro is called only when the comparison gives zero. Being larger or
    smaller isn't defined for NaNs, so we'll just put them in the end of the
-   sorted list whether it is sorted by decreasing or increasing mode.*/
+   sorted list whether it is sorted by decreasing or increasing mode. */
 #define COMPARE_FLOAT_POSTPROCESS (                                     \
    isnan(ta) && isnan(tb)                                               \
    ? 0                                /* Both NaN, define as equal. */  \
diff --git a/lib/speclines.c b/lib/speclines.c
index 151f2d7d..b61f2450 100644
--- a/lib/speclines.c
+++ b/lib/speclines.c
@@ -277,7 +277,7 @@ gal_speclines_line_name(int linecode)
     case GAL_SPECLINES_He_I_10830:     return GAL_SPECLINES_NAME_He_I_10830;
     case GAL_SPECLINES_Pa_gamma:       return GAL_SPECLINES_NAME_Pa_gamma;
 
-    /* Limits */
+    /* Limits. */
     case GAL_SPECLINES_LIMIT_LYMAN:    return GAL_SPECLINES_NAME_LIMIT_LYMAN;
     case GAL_SPECLINES_LIMIT_BALMER:   return GAL_SPECLINES_NAME_LIMIT_BALMER;
     case GAL_SPECLINES_LIMIT_PASCHEN:  return GAL_SPECLINES_NAME_LIMIT_PASCHEN;
@@ -765,7 +765,7 @@ gal_speclines_line_code(char *name)
   else if( !strcmp(name, GAL_SPECLINES_NAME_Pa_gamma) )
     return GAL_SPECLINES_Pa_gamma;
 
-  /* Limits */
+  /* Limits. */
   else if( !strcmp(name, GAL_SPECLINES_NAME_LIMIT_LYMAN) )
     return GAL_SPECLINES_LIMIT_LYMAN;
   else if( !strcmp(name, GAL_SPECLINES_NAME_LIMIT_BALMER) )
@@ -1024,7 +1024,7 @@ gal_speclines_line_angstrom(int linecode)
     case GAL_SPECLINES_He_I_10830:     return 
GAL_SPECLINES_ANGSTROM_He_I_10830;
     case GAL_SPECLINES_Pa_gamma:       return GAL_SPECLINES_ANGSTROM_Pa_gamma;
 
-    /* Limits */
+    /* Limits. */
     case GAL_SPECLINES_LIMIT_LYMAN:    return 
GAL_SPECLINES_ANGSTROM_LIMIT_LYMAN;
     case GAL_SPECLINES_LIMIT_BALMER:   return 
GAL_SPECLINES_ANGSTROM_LIMIT_BALMER;
     case GAL_SPECLINES_LIMIT_PASCHEN:  return 
GAL_SPECLINES_ANGSTROM_LIMIT_PASCHEN;
diff --git a/lib/statistics.c b/lib/statistics.c
index 9bc2771c..c7913e57 100644
--- a/lib/statistics.c
+++ b/lib/statistics.c
@@ -95,7 +95,7 @@ gal_statistics_minimum(gal_data_t *input)
       gal_type_max(out->type, out->array);
 
       /* Parse the full input. A NaN value will always fail a conditional
-         (as if it was larger); so NaNs will not cause problems here.*/
+         (as if it was larger); so NaNs will not cause problems here. */
       GAL_TILE_PARSE_OPERATE( input, out, 0, 1,
                               {*o = *i < *o ? *i : *o; ++n;} );
     }
@@ -125,7 +125,7 @@ gal_statistics_maximum(gal_data_t *input)
       gal_type_min(out->type, out->array);
 
       /* Parse the full input. A NaN value will always fail a conditional
-         (as if it was smaller); so NaNs will not cause problems here.*/
+         (as if it was smaller); so NaNs will not cause problems here. */
       GAL_TILE_PARSE_OPERATE(input, out, 0, 1,
                              {*o = *i > *o ? *i : *o; ++n;});
     }
@@ -304,7 +304,7 @@ gal_statistics_mean_std(gal_data_t *input)
       GAL_TILE_PARSE_OPERATE(input, out, 0, 1,
                              {++n; v=*i; s+=v; s2+=v*v;});
 
-      /* Write the mean */
+      /* Write the mean. */
       o[0]=s/n;
 
       /* Write the standard deviation. If the square of the average value
@@ -380,7 +380,7 @@ gal_statistics_median(gal_data_t *input, int inplace)
   else
     gal_blank_write(out->array, out->type);
 
-  /* Clean up (if necessary), then return the output */
+  /* Clean up (if necessary), then return the output. */
   if(nbs!=input) gal_data_free(nbs);
   return out;
 }
@@ -389,7 +389,7 @@ gal_statistics_median(gal_data_t *input, int inplace)
 
 
 /* For a given size, return the index (starting from zero) that is at the
-   given quantile.  */
+   given quantile. */
 size_t
 gal_statistics_quantile_index(size_t size, double quantile)
 {
@@ -635,7 +635,7 @@ gal_statistics_quantile_function(gal_data_t *input, 
gal_data_t *value,
 
 
 
-/* Pull out unique elements */
+/* Pull out unique elements. */
 #define UNIQUE_BYTYPE(TYPE) {                                           \
     size_t i, j;                                                        \
     TYPE *a=out->array, b;                                              \
@@ -708,7 +708,7 @@ gal_statistics_unique(gal_data_t *input, int inplace)
         if(input!=block)                                                \
           af = ( a = start + increment ) + input->dsize[input->ndim-1]; \
                                                                         \
-        /* Check for blank values (only for integers: b==b) */          \
+        /* Check for blank values (only for integers: b==b). */         \
         if(b==b) do if(*a!=b  && *a<0) { hasneg=1; break; } while(++a<af); \
         else     do if(*a==*a && *a<0) { hasneg=1; break; } while(++a<af); \
                                                                         \
@@ -734,7 +734,7 @@ gal_statistics_has_negative(gal_data_t *input)
   /* The operation depends on the type of the input. */
   switch(input->type)
     {
-    /* Unsigned integer types are always positive */
+    /* Unsigned integer types are always positive. */
     case GAL_TYPE_UINT8:
     case GAL_TYPE_UINT16:
     case GAL_TYPE_UINT32:
@@ -920,7 +920,7 @@ mode_mirror_max_index_diff(struct statistics_mode_params 
*p, size_t m)
       prevj=j;
     }
 
-  /* Return the maximum difference  */
+  /* Return the maximum difference. */
   return maxdiff;
 }
 
@@ -1064,7 +1064,7 @@ mode_golden_section(struct statistics_mode_params *p)
 
    Now, the "symmetricity" of the mode can be defined as: (b-m)/(m-a). For
    a completly symmetric mode, this should be 1. Note that the search for
-   'b' only goes to the 95% of the distribution.  */
+   'b' only goes to the 95% of the distribution. */
 #define MODE_SYM(IT) {                                                  \
     IT *a=p->data->array, af=0, bf=0, mf=0, fi;                         \
                                                                         \
@@ -1192,7 +1192,7 @@ gal_statistics_mode(gal_data_t *input, float mirrordist, 
int inplace)
           __func__, mirrordist);
 
 
-  /* Make sure the input doesn't have blank values and is sorted.  */
+  /* Make sure the input doesn't have blank values and is sorted. */
   p.data=gal_statistics_no_blank_sorted(input, inplace);
 
 
@@ -1263,7 +1263,7 @@ gal_statistics_mode(gal_data_t *input, float mirrordist, 
int inplace)
          oa[0], oa[1], oa[2], oa[3]);
   */
 
-  /* Clean up (if necessary), then return the output */
+  /* Clean up (if necessary), then return the output. */
   if(p.data!=input) gal_data_free(p.data);
   gal_data_free(tmptype);
   gal_data_free(b_val);
@@ -2045,7 +2045,7 @@ gal_statistics_histogram2d(gal_data_t *input, gal_data_t 
*bins)
   size_t i, j, bsizea, bsizeb, outsize;
   double *da, *db, binwidtha, binwidthb, mina, minb, maxa, maxb;
 
-  /* Basic sanity checks */
+  /* Basic sanity checks. */
   if(input->next==NULL)
     error(EXIT_FAILURE, 0, "%s: 'input' has to be a list of two datasets",
           __func__);
@@ -2126,7 +2126,7 @@ gal_statistics_histogram2d(gal_data_t *input, gal_data_t 
*bins)
             __func__, input->type);
     }
 
-  /* Return the final output */
+  /* Return the final output. */
   return out;
 }
 
@@ -2177,7 +2177,7 @@ gal_statistics_cfp(gal_data_t *input, gal_data_t *bins, 
int normalize)
   /* If the histogram has float32 type it was given by the user and is
      either normalized or its maximum was set to 1. We can only use it if
      it was normalized. If it isn't normalized, then we must ignore it and
-     build the histogram here.*/
+     build the histogram here. */
   if(hist->type==GAL_TYPE_FLOAT32)
     {
       sum=0.0f;
@@ -2225,7 +2225,7 @@ gal_statistics_cfp(gal_data_t *input, gal_data_t *bins, 
int normalize)
   if(normalize && cfp->type==GAL_TYPE_SIZE_T)
     {
       /* Find the sum, then divide the plot by it. Note that the sum must
-         come from the histogram, not the CFP!*/
+         come from the histogram, not the CFP! */
       sums=0;
       cfp=gal_data_copy_to_new_type_free(cfp, GAL_TYPE_FLOAT32);
       sf=(s=hist->array)+hist->size; do sums += *s++;   while(s<sf);
@@ -2448,7 +2448,7 @@ gal_statistics_sigma_clip(gal_data_t *input, float 
multip, float param,
              Note that when all the elements are identical after the clip,
              'std' will be zero. In this case we shouldn't calculate the
              tolerance (because it will be infinity and thus lager than the
-             requested tolerance level value).*/
+             requested tolerance level value). */
           if( bytolerance && num>0 )
             if( *std==0 || ((oldstd - *std) / *std) < param )
               {
@@ -2484,7 +2484,7 @@ gal_statistics_sigma_clip(gal_data_t *input, float 
multip, float param,
           oldmean = *mean;
           ++num;
 
-          /* Clean up: */
+          /* Clean up. */
           gal_data_free(meanstd);
           gal_data_free(median_d);
         }
@@ -2532,7 +2532,7 @@ gal_statistics_sigma_clip(gal_data_t *input, float 
multip, float param,
                                         sigclip_param, 0, 1);           \
         sarr=sclip->array;                                              \
                                                                         \
-        /* For a check */                                               \
+        /* For a check. */                                               \
         if(quiet==0)                                                    \
           printf("%f [%zu]: %f (%f, %f) %f\n", (float)(arr[i]), i,      \
                  (float)(arr[i]-arr[i-1]), sarr[1], sarr[3],            \
@@ -2656,7 +2656,7 @@ gal_statistics_outlier_bydistance(int pos1_neg0, 
gal_data_t *input,
                               (float)(*p), (float)diff, check, sarr[1], \
                               sarr[3]);                                 \
                                                                         \
-            /* When values are equal, std will be roughly zero */       \
+            /* When values are equal, std will be roughly zero. */      \
             if(sarr[3]>1e-6 && check>thresh)                            \
               {                                                         \
                 if(flatind==GAL_BLANK_SIZE_T)                           \
diff --git a/lib/table.c b/lib/table.c
index 2f89e3b7..60db006e 100644
--- a/lib/table.c
+++ b/lib/table.c
@@ -232,7 +232,7 @@ gal_table_print_info(gal_data_t *allcols, size_t numcols, 
size_t numrows)
 /************************************************************************/
 
 /* Function to print regular expression error. This is taken from the GNU C
-   library manual, with small modifications to fit out style, */
+   library manual, with small modifications to fit out style. */
 static void
 table_regexerrorexit(int errcode, regex_t *compiled, char *input)
 {
@@ -254,7 +254,7 @@ table_regexerrorexit(int errcode, regex_t *compiled, char 
*input)
 
 
 
-/* Macro to set the string to search in */
+/* Macro to set the string to search in. */
 static char *
 table_set_strcheck(gal_data_t *col, int searchin)
 {
@@ -297,7 +297,7 @@ gal_table_list_of_indexs(gal_list_str_t *cols, gal_data_t 
*allcols,
   size_t i, nummatch, colcount=0, len;
   char *str, *strcheck, *tailptr, *errorstring;
 
-  /* Go over the given columns.  */
+  /* Go over the given columns. */
   if(cols)
     for(tmp=cols; tmp!=NULL; tmp=tmp->next)
       {
@@ -333,7 +333,7 @@ gal_table_list_of_indexs(gal_list_str_t *cols, gal_data_t 
*allcols,
 
                Here, we don't care about the details of a match, the only
                important thing is a match, so we are using the REG_NOSUB
-               flag.*/
+               flag. */
             regreturn=0;
             regreturn=regcomp(regex, str, ( ignorecase
                                             ? RE_SYNTAX_AWK | REG_ICASE
@@ -388,7 +388,7 @@ gal_table_list_of_indexs(gal_list_str_t *cols, gal_data_t 
*allcols,
 
                 /* Check if the given value is not larger than the number
                    of columns in the input catalog (note that the user is
-                   counting from 1, not 0!) */
+                   counting from 1, not 0!). */
                 if(tlong>numcols)
                   error(EXIT_FAILURE, 0, "%s: has %zu columns, but you "
                         "have asked for column number %ld",
@@ -397,7 +397,7 @@ gal_table_list_of_indexs(gal_list_str_t *cols, gal_data_t 
*allcols,
 
                 /* Everything seems to be fine, put this column number in
                    the output column numbers linked list. Note that
-                   internally, the column numbers start from 0, not 1.*/
+                   internally, the column numbers start from 0, not 1. */
                 gal_list_sizet_add(&indexll, tlong-1);
                 ++nummatch;
               }
@@ -505,7 +505,7 @@ gal_table_read(char *filename, char *hdu, gal_list_str_t 
*lines,
 
   /* Depending on the table format, read the columns into the output
      structure. Also note that after these functions, the 'indexll' will be
-     all freed (each popped element is actually freed).*/
+     all freed (each popped element is actually freed). */
   switch(tableformat)
     {
     case GAL_TABLE_FORMAT_TXT:
@@ -582,7 +582,7 @@ gal_table_comments_add_intro(gal_list_str_t **comments,
 
   /* Program name: this will be the top of the list (first line). We will
      need to set the allocation flag for this one, because program_string
-     is usually statically allocated.*/
+     is usually statically allocated. */
   if(program_string)
     gal_list_str_add(comments, program_string, 1);
 }
@@ -627,10 +627,10 @@ gal_table_write_log(gal_data_t *logll, char 
*program_string,
 {
   char *msg;
 
-  /* Write all the comments into */
+  /* Write all the comments into "?". */
   gal_table_comments_add_intro(&comments, program_string, rawtime);
 
-  /* Write the log file to disk */
+  /* Write the log file to disk. */
   gal_table_write(logll, NULL, comments, GAL_TABLE_FORMAT_TXT,
                   filename, "LOG", 0);
 
@@ -731,7 +731,7 @@ gal_table_cols_to_vector(gal_data_t *list)
   char *name, *unit=NULL, *inname=NULL;
   size_t i, j, dsize[2], num=gal_list_data_number(list);
 
-  /* If the list is empty or just has a single column, return itself.*/
+  /* If the list is empty or just has a single column, return itself. */
   if(num<2) return list;
 
   /* Go over the inputs na make sure they are all single dimensional and
diff --git a/lib/tableintern.c b/lib/tableintern.c
index 1abde72a..a674dcd3 100644
--- a/lib/tableintern.c
+++ b/lib/tableintern.c
@@ -139,7 +139,7 @@ gal_tableintern_format_as_string(uint8_t tableformat)
 /* In programs, the 'searchin' variable is much more easier to format in as
    a description than an integer (which is what 'gal_table_read_cols'
    needs). This function will check the string value and give the
-   corresponding integer value.*/
+   corresponding integer value. */
 uint8_t
 gal_tableintern_string_to_searchin(char *string)
 {
@@ -259,7 +259,7 @@ gal_tableintern_col_print_info(gal_data_t *col, int 
tableformat,
 
   /* Set the formats and widths based on the type of the column. Initialize
      the characters and blank pointer. The long prefix is not necessary for
-     most types, so just initialize it once up here.*/
+     most types, so just initialize it once up here. */
   fmt[0]=fmt[1]=lng[0]=lng[1]=lng[2]='\0';
   switch(col->type)
     {
@@ -297,7 +297,7 @@ gal_tableintern_col_print_info(gal_data_t *col, int 
tableformat,
     case GAL_TYPE_UINT64:
 
       /* For the FITS ASCII table, there is only one format for all
-         integers.  */
+         integers. */
       if(tableformat==GAL_TABLE_FORMAT_AFITS)
         fmt[0]='I';
       else
@@ -377,7 +377,7 @@ gal_tableintern_col_print_info(gal_data_t *col, int 
tableformat,
             fmt[0] = 'e'; break;  /* it is independent of the power. */
           }
 
-      /* Set the width and precision */
+      /* Set the width and precision. */
       switch(col->type)
         {
         case GAL_TYPE_FLOAT32:
@@ -445,7 +445,7 @@ gal_tableintern_read_blank(gal_data_t *col, char *blank)
   /* Read the blank value as the given type. If successful, then
      'gal_data_string_to_type' will return 0. In that case, we need to
      initialize the necessary parameters to read this data structure
-     correctly. If it isn't successful, then  */
+     correctly. If it isn't successful, then "?" */
   if( gal_type_from_string((void **)(&col->array), blank, col->type) )
     {
       col->flag |= GAL_TABLEINTERN_FLAG_ARRAY_IS_BLANK_STRING;
diff --git a/lib/tiff.c b/lib/tiff.c
index 848efa25..590d6f06 100644
--- a/lib/tiff.c
+++ b/lib/tiff.c
@@ -111,7 +111,7 @@ gal_tiff_suffix_is_tiff(char *name)
 
 /* Users may define the TIFF directory to read as a string, in that case,
    this function can be used to convert it to a 'size_t' for use in
-   'gal_tiff_read'.  */
+   'gal_tiff_read'. */
 size_t
 gal_tiff_dir_string_read(char *string)
 {
@@ -160,7 +160,7 @@ gal_tiff_dir_string_read(char *string)
 static void
 tiff_read_tag(TIFF *tif, ttag_t tag, void *out, char *filename, size_t dir)
 {
-  /* Read the tag */
+  /* Read the tag. */
   if( !TIFFGetField(tif, tag, out) )
     error(EXIT_FAILURE, 0, "%s: %s (dir %zu): tag %d couldn't be fetched",
           __func__, filename, dir, tag);
@@ -170,7 +170,7 @@ tiff_read_tag(TIFF *tif, ttag_t tag, void *out, char 
*filename, size_t dir)
 
 
 
-/* Convert the TIFF type code into Gnuastro's type code.*/
+/* Convert the TIFF type code into Gnuastro's type code. */
 static uint8_t
 tiff_type_read(TIFF *tif, char *filename, size_t dir)
 {
@@ -319,7 +319,7 @@ tiff_read_contig_strip_data(TIFF *tif, char *filename, 
size_t dir,
       /* Copy the contents of the buffer to the output array. Note that
          'ostart' is the byte count already, so the type is
          irrelevant. Thus, we can read 'out->array' as a 'char *'
-         pointer.*/
+         pointer. */
       memcpy( (char *)(out->array)+ostart, buf, nrow*scanline);
       ostart+=nrow*scanline;
     }
@@ -394,7 +394,7 @@ tiff_read_separate_strip_data(TIFF* tif, char *filename, 
size_t dir,
 /* The data have been read contiguously (the pixels for each color are
    beside each other). We need to separate the color channels into
    different datasets. We will also use this chance to reverse the order of
-   the rows */
+   the rows. */
 static gal_data_t *
 tiff_separate_channels_reverse(gal_data_t *out, size_t numch,
                                size_t minmapsize, int quietmmap)
@@ -566,7 +566,7 @@ tiff_img_read(TIFF *tif, char *filename, size_t dir, size_t 
minmapsize,
   /* When there are more than one channels and the colors are stored
      contiguously, we need to break up the array into multiple arrays. When
      any of these conditions don't hold, the channels are already
-     separated, we just need to reverse them.*/
+     separated, we just need to reverse them. */
   if( numch>1 && config==PLANARCONFIG_CONTIG )
     {
       sep=tiff_separate_channels_reverse(out, numch, minmapsize, quietmmap);
@@ -673,13 +673,13 @@ tiff_img_write(TIFF *tif, gal_data_t *in, char *filename)
           "images can currently only have a 'uint8' type", __func__,
           gal_type_name(in->type, 1));
 
-  /* Allocate memory for image */
+  /* Allocate memory for image. */
   image = (unsigned char*)malloc(in->size * numch);
   if(image == NULL)
     error(EXIT_FAILURE, errno, "%s: %s: failed to allocate memory"
           "for image", __func__, filename);
 
-  /* Extract color channels from input data */
+  /* Extract color channels from input data. */
   for(ch = 0; ch < numch; ch++)
     {
       if(channel != NULL && channel->array != NULL)
@@ -695,7 +695,7 @@ tiff_img_write(TIFF *tif, gal_data_t *in, char *filename)
         }
     }
 
-  /* Copy input data to image buffer */
+  /* Copy input data to image buffer. */
   for(row = 0; row < height; row++)
     {
       for(col = 0; col < width; col++)
@@ -708,7 +708,7 @@ tiff_img_write(TIFF *tif, gal_data_t *in, char *filename)
         }
     }
 
-  /* Set TIFF tags */
+  /* Set TIFF tags. */
   TIFFSetField(tif, TIFFTAG_IMAGEWIDTH, width);
   TIFFSetField(tif, TIFFTAG_IMAGELENGTH, height);
   if(numch==1)
@@ -720,14 +720,14 @@ tiff_img_write(TIFF *tif, gal_data_t *in, char *filename)
   TIFFSetField(tif, TIFFTAG_COMPRESSION, COMPRESSION_NONE);
   TIFFSetField(tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
 
-  /* Allocate memory for scanline buffer */
+  /* Allocate memory for scanline buffer. */
   errno=0;
   buf = (unsigned char*)_TIFFmalloc(TIFFScanlineSize(tif));
   if(buf == NULL)
     error(EXIT_FAILURE, errno, "%s: %s: failed to allocate necessary"
           "memory for the scanline buffer" , __func__, filename);
 
-  /* Write each scanline of the image to the TIFF file */
+  /* Write each scanline of the image to the TIFF file. */
   for(row = height; row > 0; row--)
     {
       _TIFFmemcpy(buf, &image[(row - 1) * width * numch], width * numch);
@@ -741,7 +741,7 @@ tiff_img_write(TIFF *tif, gal_data_t *in, char *filename)
         }
     }
 
-  /* Clean up */
+  /* Clean up. */
   _TIFFfree(buf);
   free(image);
 }
@@ -763,16 +763,16 @@ gal_tiff_write(gal_data_t* in, char* filename)
     error(EXIT_FAILURE, 0, "%s: '%s', input data is NULL",
           __func__, filename);
 
-  /* Open the TIFF file */
+  /* Open the TIFF file. */
   tif = TIFFOpen(filename, "w");
   if(tif == NULL)
     error(EXIT_FAILURE, errno,
           "%s: '%s' couldn't be opened for writing", __func__, filename);
 
-  /* Write to TIFF file */
+  /* Write to TIFF file. */
   tiff_img_write(tif, in, filename);
 
-  /* Close file */
+  /* Close file. */
   TIFFClose(tif);
 
   /* The TIFF library didn't exist. */
diff --git a/lib/tile-internal.c b/lib/tile-internal.c
index b39f2343..b9f8f259 100644
--- a/lib/tile-internal.c
+++ b/lib/tile-internal.c
@@ -250,7 +250,7 @@ gal_tileinternal_no_outlier(gal_data_t *first, gal_data_t 
*second,
 {
   size_t i;
 
-  /* A small sanity check: */
+  /* A small sanity check. */
   if(first->size!=tl->tottiles)
     error(EXIT_FAILURE, 0, "%s: 'first->size' and 'tl->tottiles' must have "
           "the same value, but they don't: %zu, %zu", __func__, first->size,
diff --git a/lib/tile.c b/lib/tile.c
index 6c5eda2b..973dec84 100644
--- a/lib/tile.c
+++ b/lib/tile.c
@@ -120,7 +120,7 @@ gal_tile_start_end_coord(gal_data_t *tile, size_t 
*start_end, int rel_block)
     }
 
   /* Add the dimensions of the tile to the starting coordinate. Note that
-     the ending coordinates are stored immediately after the start.*/
+     the ending coordinates are stored immediately after the start. */
   gal_dimension_add_coords(start_end, tile->dsize, end, ndim);
 }
 
@@ -146,13 +146,13 @@ gal_tile_start_end_ind_inclusive(gal_data_t *tile, 
gal_data_t *work,
 
   /* The starting index can be found from the distance of the 'tile->array'
      pointer and 'block->array' pointer. IMPORTANT: with the type of the
-     block array.  */
+     block array. */
   start_end_inc[0]=gal_pointer_num_between(block->array, tile->array,
                                            block->type);
 
 
   /* To find the end index, we need to know the coordinates of the starting
-     point in the allocated block.  */
+     point in the allocated block. */
   gal_dimension_index_to_coord(start_end_inc[0], ndim, block->dsize,
                               start_coord);
 
@@ -161,7 +161,7 @@ gal_tile_start_end_ind_inclusive(gal_data_t *tile, 
gal_data_t *work,
      dimension. To have less potential for bugs, we will remove that extra
      value, so we get the coordinates of the last pixel in the tile
      (inclusive). We will finally, increment that value by one to get to
-     the pixel immediately outside of the tile.*/
+     the pixel immediately outside of the tile. */
   e=end_coord;
   l=tile->dsize;
   sf=(s=start_coord)+ndim; do *e++ = *s + *l++ - 1; while(++s<sf);
@@ -234,7 +234,7 @@ gal_tile_series_from_minmax(gal_data_t *block, size_t 
*minmax, size_t number)
   size_t i, d, ind, size, width=2*ndim;
   gal_data_t *tiles=gal_data_array_calloc(number);
 
-  /* Fill the tile information.  */
+  /* Fill the tile information. */
   for(i=0;i<number;++i)
     {
       /* To make things more readable. */
@@ -851,7 +851,7 @@ gal_tile_full(gal_data_t *input, size_t *regular,
 
       /* Set the block structure for this tile to the 'input', and set the
          next pointer as the next tile. Note that only when we are dealing
-         with the last tile should the 'next' pointer be set to NULL.*/
+         with the last tile should the 'next' pointer be set to NULL. */
       tiles[i].flag  = 0;
       tiles[i].block = input;
       tiles[i].next  = i==numtiles-1 ? NULL : &tiles[i+1];
@@ -934,7 +934,7 @@ gal_tile_full_sanity_check(char *filename, char *hdu, 
gal_data_t *input,
   for(i=0;i<ndim;++i)
     {
       /* Check if the number of channels is not more than the size of the
-         image. Note that the reported dimension must be in FITS format.*/
+         image. Note that the reported dimension must be in FITS format. */
       if( input->dsize[i] < tl->numchannels[i] )
         error(EXIT_FAILURE, 0, "the number of channels in dimension %zu "
               "(%zu) is more than the size of the '%s' (hdu: %s) in that "
@@ -983,7 +983,7 @@ gal_tile_full_two_layers(gal_data_t *input,
   gal_data_t *t;
   size_t i, *junk, *junk2, ndim=tl->ndim=input->ndim;
 
-  /* Initialize.  */
+  /* Initialize. */
   tl->channels=tl->tiles=NULL;
 
   /* Initialize necessary values and do the channels tessellation. */
@@ -1014,7 +1014,7 @@ gal_tile_full_two_layers(gal_data_t *input,
       tl->tiles[ i * tl->tottilesinch - 1 ].next = t;
 
       /* Fill in the information for all the tiles in this channel. Note
-         that we already have the returned value, so it isn't important.*/
+         that we already have the returned value, so it isn't important. */
       junk=gal_tile_full(&tl->channels[i], tl->tilesize, tl->remainderfrac,
                          &t, 1, &junk2);
       free(junk);
@@ -1205,7 +1205,7 @@ gal_tile_full_values_smooth(gal_data_t *tilevalues,
   /* Reverse the permutation. */
   if(permute) gal_permutation_apply_inverse(smoothed, tl->permutation);
 
-  /* Clean up and return; */
+  /* Clean up and return. */
   free(kdsize);
   gal_data_free(kernel);
   return smoothed;
diff --git a/lib/txt.c b/lib/txt.c
index d461bb5a..8cb7ecd2 100644
--- a/lib/txt.c
+++ b/lib/txt.c
@@ -349,7 +349,7 @@ txt_info_from_comment(char *in_line, gal_data_t **datall, 
char *comm_start,
          array) by default. If there is a blank value its value will be put
          into the array by 'gal_table_read_blank'. To keep the name, unit,
          and comment strings, trim the white space before and after each
-         before using them here.  */
+         before using them here. */
       gal_list_data_add_alloc(datall, NULL, type, 0, NULL, NULL, 0,
                               repeat, 1, name, gal_txt_trim_space(unit),
                               gal_txt_trim_space(comment) );
@@ -470,7 +470,7 @@ txt_info_from_first_row(char *in_line, gal_data_t **datall, 
int format,
                  loop). VERY IMPORTANT: to do this, 'line' should not be
                  '<=end'. If the given width is larger than line, there is
                  no problem, the '\0' of the line will also be used to end
-                 this last column.*/
+                 this last column. */
               if(line<end)
                 {
                   *line++='\0';
@@ -480,7 +480,7 @@ txt_info_from_first_row(char *in_line, gal_data_t **datall, 
int format,
           else
             {
               /* Repeat is put in minmapsize (when we were reading the
-                 column info from comments) */
+                 column info from comments). */
               for(i=0;i<col->minmapsize;++i)
                 {
                   token=strtok_r(ncol==1?line:NULL, GAL_TXT_DELIMITERS,
@@ -535,7 +535,7 @@ txt_info_from_first_row(char *in_line, gal_data_t **datall, 
int format,
      two column information comments on an image plain text file.
 
      Note that 'ncol' counts from 1, so the total number of tokens is one
-     less than 'ncol'.*/
+     less than 'ncol'. */
   numchecked=ncol-1;
   if(format==TXT_FORMAT_IMAGE) ncol=1;
 
@@ -549,7 +549,7 @@ txt_info_from_first_row(char *in_line, gal_data_t **datall, 
int format,
       col=*datall;
       while(col!=NULL)
         {
-          /* This column has no data (was only in comments) */
+          /* This column has no data (was only in comments). */
           if(col->status > numchecked)
             {
               /* This column has to be removed/freed. But we have to make
@@ -564,7 +564,7 @@ txt_info_from_first_row(char *in_line, gal_data_t **datall, 
int format,
 
                   - When there actually was a previous element
                     ('prev!=NULL'), then we must correct it's next
-                    pointer. Otherwise we will break up the chain.*/
+                    pointer. Otherwise we will break up the chain. */
               if(prev) prev->next=col->next; else *datall=col->next;
               tmp=col->next;
               gal_data_free(col);
@@ -617,7 +617,7 @@ txt_infoll_to_array(gal_data_t *datall, size_t *numdata)
       /* Allocate the array. */
       dataarr=gal_data_array_calloc(numc);
 
-      /* Put each dataset/column into its proper place in the array.  */
+      /* Put each dataset/column into its proper place in the array. */
       while(datall!=NULL)
         {
           /* Pop the top element. */
@@ -679,7 +679,7 @@ txt_get_info_line(char *line, gal_data_t **datall, char 
*comm_start,
       txt_info_from_comment(line, datall, comm_start, inplace);
       break;
 
-    /* Line is actual data, use it to fill in the gaps.  */
+    /* Line is actual data, use it to fill in the gaps. */
     case GAL_TXT_LINESTAT_DATAROW:
       ++dsize[0];
       if(*firstlinedone==0)
@@ -700,7 +700,7 @@ txt_get_info_line(char *line, gal_data_t **datall, char 
*comm_start,
 
 
 /* Return the information about a text file table. If there were no
-   readable rows, it will return NULL.*/
+   readable rows, it will return NULL. */
 static gal_data_t *
 txt_get_info(char *filename, gal_list_str_t *lines, int format,
              size_t *numdata, size_t *dsize)
@@ -719,7 +719,7 @@ txt_get_info(char *filename, gal_list_str_t *lines, int 
format,
           "arguments must be NULL, but they are both %s", __func__,
           test==2 ? "non-NULL" : "NULL");
 
-  /* Set the constant strings */
+  /* Set the constant strings. */
   switch(format)
     {
     case TXT_FORMAT_TABLE: format_err="table";comm_start="# Column ";break;
@@ -788,7 +788,7 @@ txt_get_info(char *filename, gal_list_str_t *lines, int 
format,
 
 
 
-/* Get the information of each column in a text file */
+/* Get the information of each column in a text file. */
 gal_data_t *
 gal_txt_table_info(char *filename, gal_list_str_t *lines, size_t *numcols,
                    size_t *numrows)
@@ -1244,7 +1244,7 @@ txt_read_prepare_table(gal_data_t *info, size_t *indsize,
       /* Allocate the necessary space. If there are no rows, we are setting
          a 1-element array to avoid any allocation errors (minmapsize,
          which holds the "repeat", will be 1 for non-vector column). Then
-         we are freeing the allocated spaces and correcting the sizes.*/
+         we are freeing the allocated spaces and correcting the sizes. */
       ndim = (repeat=dsize[1]=idata->minmapsize)==1 ? 1 : 2;
       gal_list_data_add_alloc(&out, NULL, idata->type, ndim, dsize,
                               NULL, 0, minmapsize, quietmmap,
@@ -1279,7 +1279,7 @@ txt_read_prepare_table(gal_data_t *info, size_t *indsize,
          then add them to the 'block' pointer (which is not relevant here,
          while 'next' is used to link the various columns). Note that all
          elements of 'tokeninout' have been initialized to NULL with the
-         'calloc' function above, so we can safely use it as a list.*/
+         'calloc' function above, so we can safely use it as a list. */
       for(i=0;i<repeat;++i)
         tokeninout[tokc+i]=txt_blocklist_add(tokeninout[tokc+i], out);
     }
@@ -1430,7 +1430,7 @@ txt_read(char *filename, gal_list_str_t *lines, size_t 
*indsize,
           "arguments must be NULL, but they are both %s", __func__,
           test==2 ? "non-NULL" : "NULL");
 
-  /* Necessary preparations/allocations */
+  /* Necessary preparations/allocations. */
   out=txt_read_prepare(info, indsize, indexll, minmapsize, quietmmap,
                        format, &line, linelen, &tokeninout, &ntokforout,
                        &tokenininfo, &tokenvecind);
@@ -1461,7 +1461,7 @@ txt_read(char *filename, gal_list_str_t *lines, size_t 
*indsize,
               "ASCII table information in %s", filename, __func__);
     }
 
-  else /* Input from standard input */
+  else /* Input from standard input. */
     for(tmp=lines; tmp!=NULL; tmp=tmp->next)
       {
         /* To read for standard output, we are setting 'inplace' to zero
@@ -1476,7 +1476,7 @@ txt_read(char *filename, gal_list_str_t *lines, size_t 
*indsize,
      an input column was used more than once in the output. It is no longer
      necessary and being non-NULL can cause problems for the users of the
      columns (because it has a special meaning in Gnuastro, outside of
-     tables, see 'lib/data.h'), so we should set them all to NULL.*/
+     tables, see 'lib/data.h'), so we should set them all to NULL. */
   for(ocol=out;ocol!=NULL;ocol=ocol->next) ocol->block=NULL;
 
   /* Clean up the allocations of 'txt_read_prepare' and return. */
@@ -1562,7 +1562,7 @@ txt_stdin_has_contents(long timeout_microsec)
      'select' will return 1. When the timeout has been reached, it will
      return 0 and when there was an error it will return -1. If there is an
      error, we'll abort the program and ask the user to contact us (its a
-     bug).*/
+     bug). */
   errno=0;
   sout=select(STDIN_FILENO+1, &fds, NULL, NULL, &tv);
   if(sout==-1)
@@ -1648,7 +1648,7 @@ static void
 txt_fmts_for_printf_norm(gal_data_t *data, char *fmta, char *lng,
                          char *fmt, int leftadjust)
 {
-  /* Strings should be treated like  */
+  /* Strings should be treated as if they don't have negative. */
   int hasneg = ( data->type==GAL_TYPE_STRING
                  ? 0
                  : gal_statistics_has_negative(data) );
@@ -1674,12 +1674,12 @@ static void
 txt_fmts_for_printf_last(gal_data_t *data, char *fmta, char *lng,
                          char *fmt)
 {
-  /* Strings should be treated like  */
+  /* Strings should be treated as if they don't have negative. */
   int hasneg = ( data->type==GAL_TYPE_STRING
                  ? 0
                  : gal_statistics_has_negative(data) );
 
-  /* See 'txt_fmts_for_printf_norm' */
+  /* See 'txt_fmts_for_printf_norm'. */
   if(data->disp_precision == GAL_BLANK_INT)
     sprintf(fmta, hasneg ? "%% %s%s" : "%%%s%s", lng, fmt);
   else
@@ -1733,7 +1733,7 @@ txt_fmts_for_printf(gal_data_t *datall, int leftadjust, 
int tab0_img1)
               i*FMTS_COLS+1);
 
       /* If we have a blank value, get the blank value as a string and
-         adjust the width */
+         adjust the width. */
       fmts[ i*FMTS_COLS+2 ] = ( gal_blank_present(data, 0)
                                 ? gal_blank_as_string(data->type, 0)
                                 : NULL );
@@ -1748,7 +1748,7 @@ txt_fmts_for_printf(gal_data_t *datall, int leftadjust, 
int tab0_img1)
                              : data->disp_width );
 
       /* Set the string for the Gnuastro type. For strings, we also need to
-         write the maximum number of characters.*/
+         write the maximum number of characters. */
       if(data->type==GAL_TYPE_STRING)
         sprintf(fmts[i*FMTS_COLS+1], "%s%d", gal_type_name(data->type, 0),
                 data->disp_width);
@@ -1976,7 +1976,7 @@ txt_write_keys(FILE *fp, struct gal_fits_list_key_t 
**keylist)
         }
 
       /* Keep the pointer to the next keyword and free the allocated
-         space for this keyword.*/
+         space for this keyword. */
       ttmp=tmp->next;
       free(tmp);
       tmp=ttmp;
@@ -2033,7 +2033,7 @@ gal_txt_write(gal_data_t *input, struct 
gal_fits_list_key_t **keylist,
          elements. The 'input->dsize && data->dsize' conditions are because
          we may have fully empty tables (where 'dsize==NULL'). In this
          case, we want to continue with printing, and there is no
-         problem.*/
+         problem. */
       if( input!=data && input->dsize && data->dsize
           && input->dsize[0]!=data->dsize[0] )
         error(EXIT_FAILURE, 0, "%s: the input list of datasets must "
@@ -2069,7 +2069,7 @@ gal_txt_write(gal_data_t *input, struct 
gal_fits_list_key_t **keylist,
       for(strt=comment; strt!=NULL; strt=strt->next)
         fprintf(fp, "# %s\n", strt->v);
 
-      /* Write the keywords */
+      /* Write the keywords. */
       if(keylist) txt_write_keys(fp, keylist);
     }
   else
@@ -2081,7 +2081,7 @@ gal_txt_write(gal_data_t *input, struct 
gal_fits_list_key_t **keylist,
     txt_write_metadata(fp, input, fmts, tab0_img1);
 
 
-  /* Print row-by-row (if we actually have data to print! */
+  /* Print row-by-row (if we actually have data to print!). */
   if(input->array)
     {
       if(tab0_img1) /* Image. */
diff --git a/lib/type.c b/lib/type.c
index e6ebcd34..ab081896 100644
--- a/lib/type.c
+++ b/lib/type.c
@@ -58,7 +58,7 @@ gal_type_sizeof(uint8_t type)
       /* The parenthesis after sizeof is not a function, it is actually a
          type cast, so we have put a space between size of and the
          parenthesis to highlight this. In C, 'sizeof' is an operator, not
-         a function.*/
+         a function. */
     case GAL_TYPE_UINT8:     return sizeof (uint8_t);
     case GAL_TYPE_INT8:      return sizeof (int8_t);
     case GAL_TYPE_UINT16:    return sizeof (uint16_t);
@@ -239,7 +239,7 @@ gal_type_from_name(char *str)
 
 /* Put the minimum (or maximum for the 'gal_type_max') value for the
    type in the space (that must already be allocated before the call to
-   this function) pointed to by in.  */
+   this function) pointed to by in. */
 void
 gal_type_min(uint8_t type, void *in)
 {
@@ -465,7 +465,7 @@ gal_type_to_string(void *ptr, uint8_t type, int 
quote_if_str_has_space)
    want the value to be stored, for example &(array[i]).
 
    If parsing was successful, it will return a 0. If there was a problem,
-   it will return 1.  */
+   it will return 1. */
 int
 gal_type_from_string(void **out, char *string, uint8_t type)
 {
@@ -665,7 +665,7 @@ gal_type_string_to_number(char *string, uint8_t *type)
   else
     {
       /* Start counting the number of digits from the start of the string
-         (while ignoring any '0's at the start) */
+         (while ignoring any '0's at the start). */
       digits=0;
       for(cp=string;*cp!='\0';++cp)
         {
@@ -677,7 +677,7 @@ gal_type_string_to_number(char *string, uint8_t *type)
       /* In the previous loop, we went to the end of the string (or the 'e'
          character in an exponential), so 'cp' now points to its end. We
          just have to iterate backwards and stop when we hit a non-zero
-         character */
+         character. */
       for(;cp!=string;--cp)
         if(isdigit(*cp))
           {
diff --git a/lib/units.c b/lib/units.c
index a79129c9..ff3ad8d6 100644
--- a/lib/units.c
+++ b/lib/units.c
@@ -55,7 +55,7 @@ gal_units_extract_decimal(char *convert, const char 
*delimiter,
   copy=strdup(convert);
   do
     {
-      /* Check if the required number of arguments are passed */
+      /* Check if the required number of arguments are passed. */
       if(i==n+1)
         {
           free(copy);
@@ -64,7 +64,7 @@ gal_units_extract_decimal(char *convert, const char 
*delimiter,
           return 0;
         }
 
-      /* Extract the substring till the next delimiter */
+      /* Extract the substring till the next delimiter. */
       token=strtok(i==0?copy:NULL, delimiter);
       if(token)
         {
@@ -127,7 +127,7 @@ gal_units_ra_to_degree(char *convert)
   double val[3];
   double decimal=0.0;
 
-  /* Check whether the string is successfully parsed */
+  /* Check whether the string is successfully parsed. */
   if(gal_units_extract_decimal(convert, ":hms", val, 3))
     {
       /* Check whether the first value is in within limits, and add it. We
@@ -190,7 +190,7 @@ gal_units_dec_to_degree(char *convert)
         unsigned zero (in other words, '-0.0' will be interpretted to be
         positive). In the case of declination, this can happen just below
         the equator (where the declination is less than one degree), for
-        example '-00d:12:34'*/
+        example '-00d:12:34'. */
       sign = signbit(val[0]) ? -1 : 1;
       decimal += val[0] * sign;
 
@@ -198,7 +198,7 @@ gal_units_dec_to_degree(char *convert)
       if(signbit(val[1]) || val[1]>60.0) return NAN;
       decimal += val[1] / 60;
 
-      /* Check whether value of arc-seconds is in within limits */
+      /* Check whether value of arc-seconds is in within limits. */
       if (signbit(val[2]) || val[2] > 60.0) return NAN;
       decimal += val[2] / 3600;
 
@@ -248,14 +248,14 @@ gal_units_degree_to_ra(double decimal, int usecolon)
 {
   size_t nchars;
   int hours=0, minutes=0;
-  float seconds=0.0; /* For sub-second accuracy */
+  float seconds=0.0; /* For sub-second accuracy. */
 
   /* Allocate a long string which is large enough for string of format
-     hh:mm:ss.ss and sign */
+     hh:mm:ss.ss and sign. */
   char *ra=gal_pointer_allocate(GAL_TYPE_UINT8, UNITS_RADECSTR_MAXLENGTH,
                                 0, __func__, "ra");
 
-  /* Check if decimal value is within bounds otherwise return error */
+  /* Check if decimal value is within bounds otherwise return error. */
   if (decimal<0 || decimal>360)
     {
       error (0, 0, "%s: value of decimal should be between be 0 and 360, "
@@ -264,7 +264,7 @@ gal_units_degree_to_ra(double decimal, int usecolon)
     }
 
   /* Divide decimal value by 15 and extract integer part of decimal value
-     to obtain hours */
+     to obtain hours. */
   decimal /= 15.0;
   hours = (int)decimal;
 
@@ -277,7 +277,7 @@ gal_units_degree_to_ra(double decimal, int usecolon)
   seconds = (decimal - hours - minutes / 60.0) * 3600;
 
   /* Format the extracted hours, minutes and seconds as a string with
-     leading zeros if required, in hh:mm:ss format */
+     leading zeros if required, in hh:mm:ss format. */
   nchars = snprintf(ra, UNITS_RADECSTR_MAXLENGTH-1,
                     usecolon ? "%02d:%02d:%g" : "%02dh%02dm%g",
                     hours, minutes, seconds);
@@ -294,7 +294,7 @@ gal_units_degree_to_ra(double decimal, int usecolon)
 
 
 
-/* Parse the declination input as a decimal to a string in form of dd:mm:ss*/
+/* Parse the declination input as a decimal to a string in form of dd:mm:ss . 
*/
 char *
 gal_units_degree_to_dec(double decimal, int usecolon)
 {
@@ -303,11 +303,11 @@ gal_units_degree_to_dec(double decimal, int usecolon)
   int sign, degrees=0, arc_minutes=0;
 
   /* Allocate string of fixed length which is large enough for string of
-   * format hh:mm:ss.ss and sign */
+   * format hh:mm:ss.ss and sign. */
   char *dec=gal_pointer_allocate(GAL_TYPE_UINT8, UNITS_RADECSTR_MAXLENGTH,
                                  0, __func__, "ra");
 
-  /* Check if decimal value is within bounds otherwise return error */
+  /* Check if decimal value is within bounds otherwise return error. */
   if(decimal<-90 || decimal>90)
     {
       error (0, 0, "%s: value of decimal should be between be -90 and 90, "
diff --git a/lib/warp.c b/lib/warp.c
index 621d2b2a..f69f5c6e 100644
--- a/lib/warp.c
+++ b/lib/warp.c
@@ -40,7 +40,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 
 
-/* Macros */
+/* Macros. */
 #define WARP_NEXT_ODD(D) \
   ( (size_t)( ceil((D)) ) + ( (size_t)( ceil((D)) )%2==0 ? 1 : 0 ) )
 
@@ -62,11 +62,11 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 
 /* Generate the points on the outer boundary of a dsize[0] x dsize[1]
-   matrix and return the array */
+   matrix and return the array. */
 static gal_data_t *
 warp_alloc_perimeter(gal_data_t *input)
 {
-  /* Low level variables */
+  /* Low level variables. */
   size_t ind, i;
   gal_data_t *pcrn;
   double *x=NULL, *y=NULL;
@@ -75,7 +75,7 @@ warp_alloc_perimeter(gal_data_t *input)
   int quietmmap=input->quietmmap;
   size_t minmapsize=input->minmapsize;
 
-  /* High level variables */
+  /* High level variables. */
   size_t npcrn=2*(is0+is1);
   pcrn=gal_data_alloc(NULL, GAL_TYPE_FLOAT64, 1, &npcrn, NULL, 0,
                       minmapsize, quietmmap, NULL, NULL, NULL);
@@ -83,10 +83,10 @@ warp_alloc_perimeter(gal_data_t *input)
                             minmapsize, quietmmap, NULL, NULL, NULL);
 
   /* Find outermost pixel coordinates of the input image. Cover two
-     corners at once to shorten the loop */
+     corners at once to shorten the loop. */
   x=pcrn->array; y=pcrn->next->array;
 
-  /* Top and bottom */
+  /* Top and bottom. */
   ind=0;
   for(i=is1+1; i--;)
     {
@@ -94,7 +94,7 @@ warp_alloc_perimeter(gal_data_t *input)
       x[ind]=i+0.5f; y[ind]=is0+0.5f; ind++;
     }
 
-  /* Left and right */
+  /* Left and right. */
   for(i=is0-1; i--;)
     {
       x[ind]=0.5f;     y[ind]=1.5f+i; ind++;
@@ -102,7 +102,7 @@ warp_alloc_perimeter(gal_data_t *input)
     }
 
   /* Sanity check: let's make sure we have correctly covered the input
-     perimeter */
+     perimeter. */
   if(ind!=npcrn)
     error(EXIT_FAILURE, 0, "%s: the input img perimeter of size <%zu> "
           "is not covered correctly. Currently on ind <%zu>.", __func__,
@@ -120,7 +120,7 @@ warp_alloc_perimeter(gal_data_t *input)
 static void
 warp_wcsalign_init_output_from_params(gal_warp_wcsalign_t *wa)
 {
-  /* Low level variables */
+  /* Low level variables. */
   size_t i, nkcoords, *osize;
   gal_data_t *input=wa->input;
   int quietmmap=input->quietmmap;
@@ -130,7 +130,7 @@ warp_wcsalign_init_output_from_params(gal_warp_wcsalign_t 
*wa)
   double ocrpix[2], *xkcoords, *ykcoords, *x=NULL, *y=NULL;
   double pmin[2]={DBL_MAX, DBL_MAX}, pmax[2]={-DBL_MAX, -DBL_MAX}, tmp;
 
-  /* Base WCS default parameters */
+  /* Base WCS default parameters. */
   double pc[4]={-1, 0, 0, 1};
   double rcrpix[2]={1.0, 1.0};
   char **ctype=wa->ctype->array;
@@ -138,15 +138,15 @@ warp_wcsalign_init_output_from_params(gal_warp_wcsalign_t 
*wa)
   double *cdelt=wa->cdelt->array;
   double *center=wa->center->array;
 
-  /* High level variables */
+  /* High level variables. */
   char  *cunit[2]={iwcs->cunit[0], iwcs->cunit[1]};
 
-  /* Determine the output image size */
+  /* Determine the output image size. */
   size_t iminr=GAL_BLANK_SIZE_T, imaxr=GAL_BLANK_SIZE_T; /* indexs of  */
   size_t imind=GAL_BLANK_SIZE_T, imaxd=GAL_BLANK_SIZE_T; /* extreme-um */
   double pminr=DBL_MAX, pmind=DBL_MAX, pmaxr=-DBL_MAX, pmaxd=-DBL_MAX;
 
-  /* Create the reference WCS */
+  /* Create the reference WCS. */
   rwcs=gal_wcs_create(rcrpix, center, cdelt, pc, cunit, ctype, 2,
                       GAL_WCS_LINEAR_MATRIX_PC);
 
@@ -166,7 +166,7 @@ warp_wcsalign_init_output_from_params(gal_warp_wcsalign_t 
*wa)
 
   /* Prepare the key world coorinates and change to image coordinates
      later. We are doing this to determine the CRPIX and NAXISi size for
-     the final image */
+     the final image. */
   nkcoords=5;
   kcoords=gal_data_alloc(NULL, GAL_TYPE_FLOAT64, 1, &nkcoords, NULL, 0,
                          minmapsize, quietmmap, NULL, NULL, NULL);
@@ -179,15 +179,15 @@ warp_wcsalign_init_output_from_params(gal_warp_wcsalign_t 
*wa)
   xkcoords[3]=x[imaxd];   ykcoords[3]=y[imaxd];   /* max Dec      */
   xkcoords[4]=center[0];  ykcoords[4]=center[1];  /* Image center */
 
-  /* Convert to pixel coords */
+  /* Convert to pixel coords. */
   gal_wcs_world_to_img(kcoords, rwcs, 1);
 
-  /* Determine output image size */
+  /* Determine output image size. */
   if( wa->widthinpix )
     osize=wa->widthinpix->array;
   else
     {
-      /* Automatic: the first four coordinates are the extreme-um RA/Dec */
+      /* Automatic: the first four coordinates are the extreme-um RA/Dec. */
       for(i=4; i--;)
         {
           pmin[0] = xkcoords[i] < pmin[0] ? xkcoords[i] : pmin[0];
@@ -216,11 +216,11 @@ warp_wcsalign_init_output_from_params(gal_warp_wcsalign_t 
*wa)
   /* Set the CRPIX value
 
      Note: os1 is number of columns, so we use it to define CRPIX in the
-     horizontal axis, and vice versa */
+     horizontal axis, and vice versa. */
   ocrpix[0]= 1.5f + osize[1]/2.0f - xkcoords[4];
   ocrpix[1]= 1.5f + osize[0]/2.0f - ykcoords[4];
 
-  /* Create the base WCS */
+  /* Create the base WCS. */
   bwcs=gal_wcs_create(ocrpix, center, cdelt, pc, cunit,
                       ctype, 2, GAL_WCS_LINEAR_MATRIX_PC);
 
@@ -234,12 +234,12 @@ warp_wcsalign_init_output_from_params(gal_warp_wcsalign_t 
*wa)
           "given center is too far from the image)", __func__, osize[1],
           osize[0]);
 
-  /* Create the output image dataset with the base WCS */
+  /* Create the output image dataset with the base WCS. */
   wa->output=gal_data_alloc(NULL, GAL_TYPE_FLOAT64, 2, osize, bwcs, 0,
                             minmapsize, quietmmap,
                             GAL_WARP_OUTPUT_NAME_WARPED, NULL, NULL);
 
-  /* Free */
+  /* Clean up. */
   wcsfree(bwcs);
   wcsfree(rwcs);
   gal_list_data_free(pcrn);
@@ -374,7 +374,7 @@ warp_check_output_clockwise(gal_warp_wcsalign_t *wa)
 
   wa->isccw=gal_polygon_is_counterclockwise(temp, 4);
 
-  /* Clean up */
+  /* Clean up. */
   free(temp);
 }
 
@@ -385,24 +385,24 @@ warp_check_output_clockwise(gal_warp_wcsalign_t *wa)
 static double *
 warp_pixel_perimeter_ccw(gal_warp_wcsalign_t *wa, size_t ind)
 {
-  /* Low-level variables */
+  /* Low-level variables. */
   size_t i, j, hor, ver, ic;
   double *xcrn=NULL, *ycrn=NULL, *ocrn=NULL;
 
-  /* High-level variables */
+  /* High-level variables. */
   size_t v0=wa->v0;
   size_t gcrn=wa->gcrn;
   size_t ncrn=wa->ncrn;
   size_t es=wa->edgesampling;
   size_t os1=wa->output->dsize[1];
 
-  /* Set ocrn, the corners of each output pixel */
+  /* Set ocrn, the corners of each output pixel. */
   xcrn=wa->vertices->array;
   ycrn=wa->vertices->next->array;
   ocrn=gal_pointer_allocate(GAL_TYPE_FLOAT64, (2*ncrn), 0, __func__,
                             "ocrn");
 
-  /* Index of surrounding vertices for this pixel */
+  /* Index of surrounding vertices for this pixel. */
   hor=WARP_WCSALIGN_H(ind, es, os1);
   ver=WARP_WCSALIGN_V(ind, es, v0, os1);
 
@@ -446,25 +446,25 @@ warp_pixel_perimeter_ccw(gal_warp_wcsalign_t *wa, size_t 
ind)
   j=hor+gcrn;
   ocrn[2*i]=xcrn[j]; ocrn[2*i+1]=ycrn[j];
 
-  /* Sampling corners of the output pixel on the input image */
+  /* Sampling corners of the output pixel on the input image. */
   for(i=es; i--;)
     {
-      /* bottom vertice: 0*(es+1)+(i+1) */
+      /* Bottom vertice: 0*(es+1)+(i+1) */
       ic=i+1;
       j=hor+i+1;
       ocrn[2*ic]=xcrn[j]; ocrn[2*ic+1]=ycrn[j];
 
-      /* right vertice:  1*(es+1)+(i+1) */
+      /* Right vertice:  1*(es+1)+(i+1) */
       ic=i+2+es;
       j=ver+es+i;
       ocrn[2*ic]=xcrn[j]; ocrn[2*ic+1]=ycrn[j];
 
-      /* top vertice:    2*(es+1)+(i+1) */
+      /* Top vertice:    2*(es+1)+(i+1) */
       ic=i+3+2*es;
       j=hor+es+gcrn-i;
       ocrn[2*ic]=xcrn[j]; ocrn[2*ic+1]=ycrn[j];
 
-      /* left vertice:   3*(es+1)+(i+1) */
+      /* Left vertice:   3*(es+1)+(i+1) */
       ic=i+4+3*es;
       j=ver+es-i-1;
       ocrn[2*ic]=xcrn[j]; ocrn[2*ic+1]=ycrn[j];
@@ -488,19 +488,19 @@ warp_pixel_perimeter_cw(gal_warp_wcsalign_t *wa, size_t 
ind)
   size_t es=wa->edgesampling;
   size_t os1=wa->output->dsize[1];
 
-  /* High level variables */
+  /* High level variables. */
   size_t v0=wa->v0;
 
-  /* Set ocrn, the corners of each output pixel */
+  /* Set ocrn, the corners of each output pixel. */
   xcrn=wa->vertices->array;
   ycrn=wa->vertices->next->array;
   ocrn=gal_pointer_allocate(GAL_TYPE_FLOAT64, 2*ncrn, 0, __func__, "ocrn");
 
-  /* Index of surrounding vertices for this pixel */
+  /* Index of surrounding vertices for this pixel. */
   hor=WARP_WCSALIGN_H(ind, es, os1);
   ver=WARP_WCSALIGN_V(ind, es, v0, os1);
 
-  /* All four corners: same as the counter clockwise method */
+  /* All four corners: same as the counter clockwise method. */
 
   /* top left                <- previously bottom left      */
   i=0;
@@ -522,7 +522,7 @@ warp_pixel_perimeter_cw(gal_warp_wcsalign_t *wa, size_t ind)
   ocrn[ 2*i   ]=xcrn[ hor ];                  /* xcrn=[ hor+gcrn ] */
   ocrn[ 2*i+1 ]=ycrn[ hor ];                  /* ycrn=[ hor+gcrn ] */
 
-  /* Sampling corners of the output pixel on the input image       */
+  /* Sampling corners of the output pixel on the input image.      */
   for(i=es; i--;)
     {
       /* top vertice     0*(es+1)+(i+1) <- previously bottom left  */
@@ -613,7 +613,7 @@ warp_check_basic_params(gal_warp_wcsalign_t *wa, const char 
*func)
           gal_type_name(wa->input->type, 1));
 
   /* Check 'edgesampling', can't compare to '0' since it has meaning, can't
-     check if negative since it is an unsigned type */
+     check if negative since it is an unsigned type. */
   if(wa->edgesampling==GAL_BLANK_SIZE_T)
     error(EXIT_FAILURE, 0, "%s: no 'edgesampling' specified. This is the "
           "Order of samplings along each pixel edge", func);
@@ -627,7 +627,7 @@ warp_check_basic_params(gal_warp_wcsalign_t *wa, const char 
*func)
   if(wa->numthreads==GAL_BLANK_SIZE_T || wa->numthreads==0)
     wa->numthreads=gal_threads_number();
 
-  /* Initialize the internal parameters */
+  /* Initialize the internal parameters. */
   wa->vertices=NULL;
   wa->isccw=GAL_BLANK_INT;
   wa->v0=GAL_BLANK_SIZE_T;
@@ -707,7 +707,7 @@ warp_wcsalign_init_params(gal_warp_wcsalign_t *wa, const 
char *func)
   warp_wcsalign_check_2d(wa->center, GAL_TYPE_FLOAT64, func, "center",
                          "This is the output image center in degrees");
 
-  /* Check 'widthinpix', it can be null for automatic detection */
+  /* Check 'widthinpix', it can be null for automatic detection. */
   if(wa->widthinpix)
     {
       warp_wcsalign_check_2d(wa->widthinpix, GAL_TYPE_SIZE_T, func,
@@ -880,7 +880,7 @@ gal_warp_wcsalign_init(gal_warp_wcsalign_t *wa)
                                 0, minmapsize, quietmmap,
                                 GAL_WARP_OUTPUT_NAME_MAXFRAC, NULL, NULL);
 
-  /* Set up the output image corners in pixel coords */
+  /* Set up the output image corners in pixel coords. */
   warp_wcsalign_init_vertices(wa);
 
   /* Project the output image corners to the input image pixel coords. We
@@ -935,7 +935,7 @@ gal_warp_wcsalign_onpix(gal_warp_wcsalign_t *wa, size_t ind)
           "something in the programming has gone wrong. Please contact "
           "us at %s so we can correct it", wa->isccw, PACKAGE_BUGREPORT);
 
-  /* Find overlapping pixels */
+  /* Find overlapping pixels. */
   xmin =  DBL_MAX; ymin =  DBL_MAX;
   xmax = -DBL_MAX; ymax = -DBL_MAX;
   for(ic=ncrn; ic--;)
@@ -953,7 +953,7 @@ gal_warp_wcsalign_onpix(gal_warp_wcsalign_t *wa, size_t ind)
   xend   = GAL_DIMENSION_NEARESTINT_HALFLOWER(  xmax ) + 1;
   yend   = GAL_DIMENSION_NEARESTINT_HALFLOWER(  ymax ) + 1;
 
-  /* Check which input pixels we are covering */
+  /* Check which input pixels we are covering. */
   for(y=ystart;y<yend;++y)
     {
       /* If the pixel isn't in the image (note that the pixel
@@ -1040,7 +1040,7 @@ gal_warp_wcsalign_onthread(void *inparam)
   struct gal_threads_params *tprm=(struct gal_threads_params *)inparam;
   gal_warp_wcsalign_t *wa=(gal_warp_wcsalign_t *)tprm->params;
 
-  /* Loop over pixels given from the 'warp' function */
+  /* Loop over pixels given from the 'warp' function. */
   for(i=0; tprm->indexs[i] != GAL_BLANK_SIZE_T; ++i)
     {
       ind=tprm->indexs[i];
@@ -1105,19 +1105,19 @@ gal_warp_wcsalign_free(gal_warp_wcsalign_t *wa)
 
 
 
-/* Finalize the output 'gal_data_t' image in 'wa->output' */
+/* Finalize the output 'gal_data_t' image in 'wa->output'. */
 void
 gal_warp_wcsalign(gal_warp_wcsalign_t *wa)
 {
-  /* Calculate and allocate the output image size and WCS */
+  /* Calculate and allocate the output image size and WCS. */
   gal_warp_wcsalign_init(wa);
 
-  /* Fill the output image */
+  /* Fill the output image. */
   gal_threads_spin_off(gal_warp_wcsalign_onthread, wa, wa->output->size,
                        wa->numthreads, wa->input->minmapsize,
                        wa->input->quietmmap);
 
-  /* Clean up the internally allocated variables */
+  /* Clean up the internally allocated variables. */
   gal_warp_wcsalign_free(wa);
 }
 
@@ -1149,7 +1149,7 @@ warp_pixelarea_onthread(void *inparam)
           "something in the programming has gone wrong. Please contact "
           "us at %s so we can correct it", wa->isccw, PACKAGE_BUGREPORT);
 
-  /* Loop over pixels given from the 'warp' function */
+  /* Loop over pixels given from the 'warp' function. */
   for(i=0; tprm->indexs[i] != GAL_BLANK_SIZE_T; ++i)
     {
       /* Pixel to use. */
diff --git a/lib/wcs.c b/lib/wcs.c
index 4e8b30a2..630704a7 100644
--- a/lib/wcs.c
+++ b/lib/wcs.c
@@ -1978,7 +1978,7 @@ gal_wcs_remove_dimension(struct wcsprm *wcs, size_t 
fitsdim)
    creating the tiles they don't have any WCS structure. When needed, this
    function can be used to add a WCS structure to the tile by copying the
    WCS structure of its block and correcting its starting points. If the
-   tile already has a WCS structure, this function won't do anything.*/
+   tile already has a WCS structure, this function won't do anything. */
 void
 gal_wcs_on_tile(gal_data_t *tile)
 {
diff --git a/lib/wcsdistortion.c b/lib/wcsdistortion.c
index 0fe4c155..86326094 100644
--- a/lib/wcsdistortion.c
+++ b/lib/wcsdistortion.c
@@ -33,8 +33,6 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 #include <wcslib/wcslib.h>
 
 #include <gsl/gsl_linalg.h>
-#include <gsl/gsl_vector.h>
-#include <gsl/gsl_matrix.h>
 #include <gsl/gsl_multifit.h>
 
 #include <gnuastro/wcs.h>
@@ -46,7 +44,7 @@ along with Gnuastro. If not, see 
<http://www.gnu.org/licenses/>.
 
 
 
-/* Internally used macro(s) to help in the processing */
+/* Internally used macro(s) to help in the processing. */
 #define wcsdistortion_max(a,b) \
    ({ __typeof__ (a) _a = (a);  \
        __typeof__ (b) _b = (b); \
@@ -95,7 +93,7 @@ wcsdistortion_get_tpvparams(struct wcsprm *wcs, double 
cd[2][2],
   for(i=0; i<2; ++i)
     for(j=0; j<2; ++j)
       {
-        /* If a value is present store it, else store 0.*/
+        /* If a value is present store it, else store 0. */
         if(temp_cd[k] != 0)   cd[i][j]=temp_cd[k++];
         else                  cd[i][j]=0;
 
@@ -187,7 +185,7 @@ wcsdistortion_get_sipparams(struct wcsprm *wcs, double 
cd[2][2],
   for(i=0,k=0; i<2; ++i)
     for(j=0; j<2; ++j)
       {
-        /* If a value is present store it, else store 0.*/
+        /* If a value is present store it, else store 0. */
         if(temp_cd[k] != 0)   cd[i][j]=temp_cd[k++];
         else                  cd[i][j]=0;
 
@@ -975,7 +973,7 @@ wcsdistortion_calc_tpveq(struct wcsprm *wcs, double 
cd[2][2],
     */
   determinant = cd[0][0]*cd[1][1] - cd[0][1]*cd[1][0];
 
-  /* Inverse matrix */
+  /* Inverse matrix. */
   cd_inv[0][0]=cd[1][1]/determinant;      /* a */
   cd_inv[0][1]=(-1*cd[0][1])/determinant; /* b */
   cd_inv[1][0]=(-1*cd[1][0])/determinant; /* c */
@@ -1154,7 +1152,7 @@ wcsdistortion_fitreverse(double *u, double *v, size_t 
a_order, size_t b_order,
       vprime[i]=v[i];
     }
 
-  /* Allocate and initialize udict and vdict.*/
+  /* Allocate and initialize udict and vdict. */
   udict=malloc((a_order+1)*sizeof(*udict));
   vdict=malloc((b_order+1)*sizeof(*vdict));
   for(i=0; i<=wcsdistortion_max(a_order, b_order); ++i)
@@ -1324,7 +1322,7 @@ wcsdistortion_fitreverse(double *u, double *v, size_t 
a_order, size_t b_order,
       printf("X[%ld][%ld] = %.8lf\n", i, j, gsl_matrix_get(X_ap, j, i));
   */
 
-  /* Free the memory allocations.*/
+  /* Free the memory allocations. */
   gsl_multifit_linear_free(work_bp);
   gsl_multifit_linear_free(work_ap);
   gsl_matrix_free(cov_bp);
@@ -1382,7 +1380,7 @@ wcsdistortion_get_revkeyvalues(struct wcsprm *wcs, size_t 
*fitsize,
           __func__, tsize*sizeof(*v));
 
 
-  /* Make the grid and bring it's origin to the world's origin*/
+  /* Make the grid and bring it's origin to the world's origin. */
   k=0; for(i=0; i<naxis2; i+=4) for(j=0; j<naxis1; j+=4) u[k++]=j-crpix1;
   k=0; for(i=0; i<naxis2; i+=4) for(j=0; j<naxis1; j+=4) v[k++]=i-crpix2;
   /*For a check.
@@ -1425,7 +1423,7 @@ wcsdistortion_get_revkeyvalues(struct wcsprm *wcs, size_t 
*fitsize,
 /* Make the sip key-cards and add them to fullheader.
 
    Return:
-   char *fullheader - string of keycards.*/
+   char *fullheader - string of keycards. */
 static char *
 wcsdistortion_add_sipkeywords(struct wcsprm *wcs, size_t *fitsize,
                               double tpvu[8][8], double tpvv[8][8],
@@ -1888,7 +1886,7 @@ wcsdistortion_set_internalstruct(struct wcsprm *wcs, char 
*fullheader,
 
    Return:
      struct wcsprm *outwcs - The transformed wcs parameters in the
-                             sip distortion type.*/
+                             sip distortion type. */
 struct wcsprm *
 gal_wcsdistortion_tpv_to_sip(struct wcsprm *inwcs,
                              size_t *fitsize)
diff --git a/tests/arithmetic/where.sh b/tests/arithmetic/where.sh
index 934ca326..e9ec0103 100755
--- a/tests/arithmetic/where.sh
+++ b/tests/arithmetic/where.sh
@@ -54,4 +54,5 @@ if [ ! -f $img      ]; then echo "$img 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.
-$check_with_program $execname $img $img 0 eq nan where -h1 -h2 
--output=where.fits
+$check_with_program $execname $img -h1 $img -h2 0 uint8 eq nan where \
+                    --output=where.fits



reply via email to

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