gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master e47f8db 024/113: Merged recent work in master


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master e47f8db 024/113: Merged recent work in master
Date: Fri, 16 Apr 2021 10:33:35 -0400 (EDT)

branch: master
commit e47f8db3ff72730e33e2e39c2e23c5c3566986ef
Merge: 81f3f65 b367f79
Author: Mohammad Akhlaghi <akhlaghi@gnu.org>
Commit: Mohammad Akhlaghi <akhlaghi@gnu.org>

    Merged recent work in master
    
    The recent work in the master branch is now merged with this one.
---
 Makefile.am                   |  5 ++---
 NEWS                          |  5 +++++
 THANKS                        |  3 ++-
 bin/noisechisel/detection.c   |  6 +++---
 bin/noisechisel/noisechisel.c |  4 ++--
 doc/gnuastro.texi             | 13 ++++++++++---
 lib/fits.c                    |  1 -
 lib/txt.c                     | 25 +++++++++++++++++--------
 8 files changed, 41 insertions(+), 21 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2c60fbd..8555c23 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -136,9 +136,8 @@ dist_sysconf_DATA = bin/gnuastro.conf
 
 ## Files that are only distributed
 ## ===============================
-EXTRA_DIST = bootstrap bootstrap.conf genauthors .dir-locals.el .version   \
-  tmpfs-config-make bootstrapped/m4/gnulib-cache.m4 bootstrapped/README    \
-  .autom4te.cfg
+EXTRA_DIST = genauthors .dir-locals.el .version tmpfs-config-make     \
+  bootstrapped/README .autom4te.cfg
 
 
 
diff --git a/NEWS b/NEWS
index 16c879a..e8cf3e7 100644
--- a/NEWS
+++ b/NEWS
@@ -44,6 +44,11 @@ GNU Astronomy Utilities NEWS                          -*- 
outline -*-
   option, the `--mcol' values of the catalog will be interpretted as total
   brightness (sum of pixel values), not magnitude.
 
+  Library: Functions that read data from an ASCII text file
+  (`gal_txt_table_info', `gal_txt_table_read', `gal_txt_image_read') now
+  also operate on files with CRLF line terminators (for example text files
+  created in MS Windows).
+
 ** Removed features
 
 ** Changed features
diff --git a/THANKS b/THANKS
index 144060a..a672f3d 100644
--- a/THANKS
+++ b/THANKS
@@ -13,8 +13,9 @@ People
 
 The following people provided valuable feedback (suggestions, ideas) to the
 authors of Gnuastro. We hereby gratefully acknowledge their help and
-support in Gnuastro. The list is ordered alphabetically.
+support in Gnuastro. The list is ordered alphabetically (by family name).
 
+    Marjan Akbari                        mrjakbari@gmail.com
     Karl Berry                           karl@gnu.org
     Roland Bacon                         roland.bacon@univ-lyon1.fr
     Nicolas Bouché                       nicolas.bouche@irap.omp.eu
diff --git a/bin/noisechisel/detection.c b/bin/noisechisel/detection.c
index ff25c1e..8ba126b 100644
--- a/bin/noisechisel/detection.c
+++ b/bin/noisechisel/detection.c
@@ -686,7 +686,7 @@ detection_pseudo_remove_low_sn(struct noisechiselparams *p,
   /* If the user wanted to see the steps. */
   if(p->detectionname)
     {
-      workbin->name="TRUE-PSEUDO-DETECTIONS";
+      workbin->name="TRUE-PSEUDOS";
       gal_fits_img_write(workbin, p->detectionname, NULL,
                          PROGRAM_STRING);
       workbin->name=NULL;
@@ -837,7 +837,7 @@ detection_final_remove_small_sn(struct noisechiselparams 
*p, size_t num)
   /* For a check image. */
   if(p->detectionname)
     {
-      p->olabel->name="DETECTION_FINAL";
+      p->olabel->name="DETECTION-FINAL";
       gal_fits_img_write(p->olabel, p->detectionname, NULL,
                          PROGRAM_STRING);
       p->olabel->name=NULL;
@@ -1027,7 +1027,7 @@ detection(struct noisechiselparams *p)
       p->numdetections = num_true_initial;
       if(p->detectionname)
         {
-          p->olabel->name="DETECTION_FINAL";
+          p->olabel->name="DETECTION-FINAL";
           gal_fits_img_write(p->olabel, p->detectionname, NULL,
                              PROGRAM_STRING);
           p->olabel->name=NULL;
diff --git a/bin/noisechisel/noisechisel.c b/bin/noisechisel/noisechisel.c
index e73850b..cf0f94b 100644
--- a/bin/noisechisel/noisechisel.c
+++ b/bin/noisechisel/noisechisel.c
@@ -62,9 +62,9 @@ noisechisel_convolve(struct noisechiselparams *p)
   if(!p->cp.quiet) gettimeofday(&t1, NULL);
   p->conv=gal_convolve_spatial(tl->tiles, p->kernel, p->cp.numthreads,
                                1, tl->workoverch);
-  gal_checkset_allocate_copy("INPUT-CONVOLVED", &p->conv->name);
-
+  gal_checkset_allocate_copy("CONVOLVED", &p->conv->name);
 
+  /* Report timing and write check image if necessary. */
   if(!p->cp.quiet) gal_timing_report(&t1, "Convolved with kernel.", 1);
   if(p->detectionname)
     {
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 210afcc..c5de6fa 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -15309,9 +15309,8 @@ either through a string or through a number (see 
description of
 different total number of parameters: S@'ersic and Moffat functions need 3
 parameters: radial, S@'ersic index or Moffat @mymath{\beta}, and truncation
 radius. The Gaussian function needs two parameters: radial and truncation
-radius. The point function doesn't need any parameters and flat,
-circumference and distance profiles just need one parameter (truncation
-radius).
+radius. The point function doesn't need any parameters. Flat, circumference
+and distance profiles just need one parameter (truncation radius).
 
 The PSF or kernel is a unique (and highly constrained) type of profile: the
 sum of its pixels must be one, its center must be the center of the central
@@ -20027,6 +20026,14 @@ editor or even on the command-line. Therefore the 
functions in this section
 are defined to simplify reading from and writing to plain text
 files.
 
+Lines are one of the most basic buiding blocks (delimiters) of a text
+file. Some operating systems like Microsoft Windows, terminate their ASCII
+text lines with a carriage return character and a new-line character (two
+characters, also known as CRLF line terminators). While Unix-like operating
+systems just use a single new-line character. The functions below that read
+an ASCII text file are able to identify lines with both kinds of line
+terminators.
+
 Gnuastro defines a simple format for metadata of table columns in a plain
 text file that is discussed in @ref{Gnuastro text table format}. The
 functions to get information from, read from and write to plain text files
diff --git a/lib/fits.c b/lib/fits.c
index f970c0b..d172a6c 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -92,7 +92,6 @@ gal_fits_io_error(int status, char *message)
 /*************************************************************
  **************           FITS names           ***************
  *************************************************************/
-
 /* IMPORTANT NOTE: if other compression suffixes are add to this function,
    include them in `gal_checkset_automatic_output', so the compression
    suffix can be skipped when the user doesn't specify an output
diff --git a/lib/txt.c b/lib/txt.c
index 67dcd03..32f9578 100644
--- a/lib/txt.c
+++ b/lib/txt.c
@@ -296,11 +296,19 @@ txt_info_from_first_row(char *line, gal_data_t **datall, 
int format)
   size_t n=0, maxcnum=0, numtokens;
   char *token, *end=line+strlen(line);
 
-  /* Remove the new line character from the end of the line. If the last
-     column is a string, and the given length is larger than the available
-     space on the line, we don't want to have the line's new-line
-     character. Its better for it to actually be shorter than the space. */
-  *(end-1)='\0';
+  /* Remove the line termination character(s) from the end of the line. In
+     Unix, the line terminator is just the new-line character, however, in
+     some operating systems (like MS Windows), it is two characters:
+     carriage return and new-line. To be able to deal with both, we will be
+     checking the second last character first, the ASCII code for carriage
+     return is 13.
+
+     If the last column is a string, and the given length is larger than
+     the available space on the line, we don't want to have the line's
+     new-line character. Its better for it to actually be shorter than the
+     space. */
+  if( *(end-2)==13 ) *(end-2)='\0';
+  else               *(end-1)='\0';
 
   /* Get the maximum number of columns read from the comment
      information. */
@@ -768,8 +776,9 @@ txt_fill(char *line, char **tokens, size_t maxcolnum, 
gal_data_t *info,
   int notenoughcols=0;
   char *end=line+strlen(line);
 
-  /* See explanations in `txt_info_from_row'. */
-  *(end-1)='\0';
+  /* See explanations in `txt_info_from_first_row'. */
+  if( *(end-2)==13 ) *(end-2)='\0';
+  else               *(end-1)='\0';
 
   /* Start parsing the line. Note that `n' and `maxcolnum' start from
      one. */
@@ -781,7 +790,7 @@ txt_fill(char *line, char **tokens, size_t maxcolnum, 
gal_data_t *info,
       if(n>maxcolnum) break;
 
       /* Set the pointer to the start of this token/column. See
-         explanations in `txt_info_from_row'. */
+         explanations in `txt_info_from_first_row'. */
       if( info[n-1].type == GAL_TYPE_STRING )
         {
           /* Remove any delimiters and stop at the first non-delimiter. If



reply via email to

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