gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 6300ea11 2/2: Library (txt.c): rest of metadat


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 6300ea11 2/2: Library (txt.c): rest of metadata is read if name is not present
Date: Tue, 27 Jun 2023 07:17:31 -0400 (EDT)

branch: master
commit 6300ea110dd3f12f9266b0de1944e1484819887b
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Library (txt.c): rest of metadata is read if name is not present
    
    Until now, when the NAME component of Gnuastro's plain-text table format
    was not present, the relevant function ('txt_info_from_comment') would
    ignore the whole comment line! But this is not what we have described in
    the book (we have mentioned that NAME is optional)!
    
    With this commit, the cause of the problem (an artificial 'return'
    statement when NAME is empty) has been removed and everything works nicely:
    the imported column will have no name, but that is no problem (all the
    programs and the table reading functions in the library also accept columns
    by their counters).
    
    This fixes bug #64357.
---
 NEWS      | 1 +
 lib/txt.c | 8 +++-----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/NEWS b/NEWS
index 678dd5d9..c88ad2ba 100644
--- a/NEWS
+++ b/NEWS
@@ -95,6 +95,7 @@ See the end of the file for license conditions.
   bug #64274: MakeProfiles crash for points in 3D. Found by Teet Kuumta.
   bug #64303: Statistics fit --fitestimate crash when covariance matrix has
               NaN. Reported Sepideh Eskandarlou.
+  bug #64357: Plain text metadata ignored when no name is present.
 
 
 
diff --git a/lib/txt.c b/lib/txt.c
index 314f013f..d461bb5a 100644
--- a/lib/txt.c
+++ b/lib/txt.c
@@ -280,12 +280,10 @@ txt_info_from_comment(char *in_line, gal_data_t **datall, 
char *comm_start,
       if(*tailptr!='\0' || index<=0) return;
 
 
-      /* If there was no name (the line is just '# Column N:'), then ignore
-         the line. Relying on the column count from the first line is more
-         robust and less prone to human error, for example typing a number
-         larger than the total number of columns.  */
+      /* Read the column name. If no name is given (which is perfectly
+         fine: for example '# Column 4: [abc, f32] description'), then
+         'name' will be NULL. */
       name=gal_txt_trim_space(name);
-      if(name==NULL) return;
 
 
       /* If this is a repeated index, ignore it. */



reply via email to

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