gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master c3bd7164: Code and Book: Corrected typos in co


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master c3bd7164: Code and Book: Corrected typos in comments and book text
Date: Tue, 11 Jun 2024 12:22:34 -0400 (EDT)

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

    Code and Book: Corrected typos in comments and book text
    
    Until now, there were some typos in the book and also in the comments
    within the source code of the Table, NoiseChisel, Query programs, and
    the 'Arithmetic.c' library. Also, the name of the 'ui_free_report'
    function in Fits and Arithmetic programs differed from others.
    
    With this commit, all these typos have been corrected. Also, for more
    readability, the name of the 'ui_free_report' function has been unified in
    all programs.
---
 bin/arithmetic/main.c         |  2 +-
 bin/arithmetic/ui.c           |  2 +-
 bin/arithmetic/ui.h           |  2 +-
 bin/fits/main.c               |  2 +-
 bin/fits/ui.c                 |  2 +-
 bin/fits/ui.h                 |  2 +-
 bin/noisechisel/noisechisel.c |  6 +++---
 bin/query/tap.c               |  8 ++++----
 bin/table/table.c             |  2 +-
 doc/gnuastro.texi             | 16 +++++++--------
 lib/arithmetic.c              | 12 +++++------
 lib/fits.c                    | 48 +------------------------------------------
 12 files changed, 29 insertions(+), 75 deletions(-)

diff --git a/bin/arithmetic/main.c b/bin/arithmetic/main.c
index 1bbeb303..c579311d 100644
--- a/bin/arithmetic/main.c
+++ b/bin/arithmetic/main.c
@@ -49,7 +49,7 @@ main (int argc, char *argv[])
   arithmetic(&p);
 
   /* Free any allocated space. */
-  freeandreport(&p, &t1);
+  ui_free_report(&p, &t1);
 
   /* Return successfully. */
   return 0;
diff --git a/bin/arithmetic/ui.c b/bin/arithmetic/ui.c
index 765214ba..a961b32a 100644
--- a/bin/arithmetic/ui.c
+++ b/bin/arithmetic/ui.c
@@ -537,7 +537,7 @@ ui_read_check_inputs_setup(int argc, char *argv[], struct 
arithmeticparams *p)
 /************      Free allocated, report         *************/
 /**************************************************************/
 void
-freeandreport(struct arithmeticparams *p, struct timeval *t1)
+ui_free_report(struct arithmeticparams *p, struct timeval *t1)
 {
   /* Free the simple strings. */
   free(p->cp.output);
diff --git a/bin/arithmetic/ui.h b/bin/arithmetic/ui.h
index a3044f93..bcefac13 100644
--- a/bin/arithmetic/ui.h
+++ b/bin/arithmetic/ui.h
@@ -63,6 +63,6 @@ size_t *
 ui_read_ndim_dsize(char *filename, char *hdu, size_t *ndim);
 
 void
-freeandreport(struct arithmeticparams *p, struct timeval *t1);
+ui_free_report(struct arithmeticparams *p, struct timeval *t1);
 
 #endif
diff --git a/bin/fits/main.c b/bin/fits/main.c
index 95dd31ab..be00d00c 100644
--- a/bin/fits/main.c
+++ b/bin/fits/main.c
@@ -49,7 +49,7 @@ main (int argc, char *argv[])
   r=fits(&p);
 
   /* Free all non-freed allocations. */
-  ui_free_and_report(&p);
+  ui_free_report(&p);
 
   /* Return successfully. */
   return r;
diff --git a/bin/fits/ui.c b/bin/fits/ui.c
index bd9f2a8e..5504f949 100644
--- a/bin/fits/ui.c
+++ b/bin/fits/ui.c
@@ -884,7 +884,7 @@ ui_read_check_inputs_setup(int argc, char *argv[], struct 
fitsparams *p)
 /************      Free allocated, report         *************/
 /**************************************************************/
 void
-ui_free_and_report(struct fitsparams *p)
+ui_free_report(struct fitsparams *p)
 {
   /* Free the allocated arrays: */
   free(p->cp.output);
diff --git a/bin/fits/ui.h b/bin/fits/ui.h
index 3952cdf9..a33047df 100644
--- a/bin/fits/ui.h
+++ b/bin/fits/ui.h
@@ -104,6 +104,6 @@ ui_read_check_inputs_setup(int argc, char *argv[],
                            struct fitsparams *p);
 
 void
-ui_free_and_report(struct fitsparams *p);
+ui_free_report(struct fitsparams *p);
 
 #endif
diff --git a/bin/noisechisel/noisechisel.c b/bin/noisechisel/noisechisel.c
index 1e0af5f6..69ec0a5b 100644
--- a/bin/noisechisel/noisechisel.c
+++ b/bin/noisechisel/noisechisel.c
@@ -165,7 +165,7 @@ noisechisel_output(struct noisechiselparams *p)
     }
 
 
-  /* Write the detected pixels and useful information into it's header. */
+  /* Write the detected pixels and useful information into its header. */
   gal_fits_key_list_add(&keys, GAL_TYPE_FLOAT32, "DETSN", 0,
                         &p->detsnthresh, 0,
                         "Minimum S/N of true pseudo-detections", 0,
@@ -190,7 +190,7 @@ noisechisel_output(struct noisechiselparams *p)
   keys=NULL;
 
 
-  /* Write the Sky image into the output */
+  /* Write the Sky image into the output. */
   if(p->sky->name) free(p->sky->name);
   p->sky->name="SKY";
   gal_tile_full_values_write(p->sky, &p->cp.tl, !p->ignoreblankintiles,
@@ -254,7 +254,7 @@ noisechisel(struct noisechiselparams *p)
   /* Find the final Sky and Sky STD values. */
   sky_and_std(p, p->skyname);
 
-  /* Abort if the user only wanted to see until this point.*/
+  /* Abort if the user only wanted to see until this point. */
   if(p->skyname && !p->continueaftercheck)
     ui_abort_after_check(p, p->skyname, NULL,
                          "derivation of final Sky (and its STD) value");
diff --git a/bin/query/tap.c b/bin/query/tap.c
index abf30bf8..963c22dd 100644
--- a/bin/query/tap.c
+++ b/bin/query/tap.c
@@ -226,7 +226,7 @@ tap_query_construct_noblank(struct queryparams *p, char 
**outstr)
 
   for(tmp=p->noblank; tmp!=NULL; tmp=tmp->next)
     {
-      /* Write 'rangestr'. */
+      /* Write 'noblankstr'. */
       if(prevstr)
         {
           if( asprintf(&noblankstr, "%s AND %s IS NOT NULL",
@@ -240,7 +240,7 @@ tap_query_construct_noblank(struct queryparams *p, char 
**outstr)
           error(EXIT_FAILURE, 0,
                 "%s: asprintf allocation ('noblankstr', 2)", __func__);
 
-      /* Put the 'rangestr' in previous-range string for the next
+      /* Put the 'noblankstr' in previous-range string for the next
          round.*/
       prevstr=noblankstr;
     }
@@ -299,7 +299,7 @@ tap_query_construct_sort(struct queryparams *p)
 
   for(tmp=p->sort; tmp!=NULL; tmp=tmp->next)
     {
-      /* Write 'rangestr'. */
+      /* Write 'sortstr'. */
       if(prevstr)
         {
           if( asprintf(&sortstr, "%s,%s", prevstr, tmp->v) < 0 )
@@ -312,7 +312,7 @@ tap_query_construct_sort(struct queryparams *p)
           error(EXIT_FAILURE, 0,
                 "%s: asprintf allocation ('sortstr', 2)", __func__);
 
-      /* Put the 'rangestr' in previous-range string for the next
+      /* Put the 'sortstr' in previous-range string for the next
          round.*/
       prevstr=sortstr;
     }
diff --git a/bin/table/table.c b/bin/table/table.c
index 88b35ce7..1d68efca 100644
--- a/bin/table/table.c
+++ b/bin/table/table.c
@@ -1342,7 +1342,7 @@ table_colmetadata(struct tableparams *p)
               "starting from 1), or their name (the first column "
               "found with the given name will be used)", meta->name);
 
-      /* The matching column is found and we know that atleast one value is
+      /* The matching column is found and we know that at least one value is
          already given (otherwise 'gal_options_parse_name_and_values' would
          abort the program). The first given string is the new name. */
       strarr=meta->array;
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index c5754b8c..0e07ee13 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -1474,7 +1474,7 @@ Therefore, the unofficial version number 
`@code{3.92.8-29c8}', corresponds to th
 The unofficial version number is sort-able (unlike the raw hash) and as shown 
above is descriptive of the state of the unofficial release.
 Of course an official release is preferred for publication (since its tarballs 
are easily available and it has gone through more tests, making it more 
stable), so if an official release is announced prior to your publication's 
final review, please consider updating to the official release.
 
-The major version number is set by a major goal which is defined by the 
developers and user community before hand, for example, see @ref{GNU Astronomy 
Utilities 1.0}.
+The major version number is set by a major goal which is defined by the 
developers and user community beforehand, for example, see @ref{GNU Astronomy 
Utilities 1.0}.
 The incremental work done in minor releases are commonly small steps in 
achieving the major goal.
 Therefore, there is no limit on the number of minor releases and the 
difference between the (hypothetical) versions 2.927 and 3.0 can be a small 
(negligible to the user) improvement that finalizes the defined goals.
 
@@ -15351,7 +15351,7 @@ But as mentioned above, non-volatile memory has much 
slower I/O speed than the R
 Hence in such situations, the programs will become noticeably slower 
(sometimes by factors of 10 times slower, depending on your non-volatile memory 
speed).
 
 Because of the drop in I/O speed (and thus the speed of your running program), 
the moment that any to-be-allocated dataset is memory-mapped, Gnuastro's 
programs and libraries will notify you with a descriptive statement like below 
(can happen in any phase of their analysis).
-It shows the location of the memory-mapped file, its size, complemented with a 
small description of the cause, a pointer to this section of the book for more 
information on how to deal with it (if necessary), and what to do to suppress 
it.
+It shows the location of the memory-mapped file, and its size, complemented 
with a small description of the cause, a pointer to this section of the book 
for more information on how to deal with it (if necessary), and how to suppress 
it.
 
 @example
 astarithmetic: ./gnuastro_mmap/Fu7Dhs: temporary memory-mapped file
@@ -40068,7 +40068,7 @@ filename and HDU as input instead of an already opened 
CFITSIO
 
 @deftypefun void gal_fits_key_list_add (gal_fits_list_key_t @code{**list}, 
uint8_t @code{type}, char @code{*keyname}, int @code{kfree}, void 
@code{*value}, int @code{vfree}, char @code{*comment}, int @code{cfree}, char 
@code{*unit}, int @code{ufree})
 Add a keyword to the top of list of header keywords that need to be written 
into a FITS file.
-In the end, the keywords will have to be freed, so it is important to know 
before hand if they were allocated or not (hence the presence of the arguments 
ending in @code{free}).
+In the end, the keywords will have to be freed, so it is important to know 
beforehand if they were allocated or not (hence the presence of the arguments 
ending in @code{free}).
 If the space for the respective element is not allocated, set these arguments 
to @code{0} (zero).
 
 You can call this function multiple times on a single list add several keys 
that will be written in one call to @code{gal_fits_key_write} or 
@code{gal_fits_key_write_in_ptr}.
@@ -40077,7 +40077,7 @@ Hence, the written keys will have the inverse order of 
your calls to this functi
 To avoid this problem, you can either use @code{gal_fits_key_list_add_end} 
instead (which will add each key to the end of the list, not to the top like 
this function).
 Alternatively, you can use @code{gal_fits_key_list_reverse} after adding all 
the keys with this function.
 
-@strong{Important note for strings}: the value should be the pointer to the 
string its-self (@code{char *}), not a pointer to a pointer (@code{char **}).
+@strong{Important note for strings}: the value should be the pointer to the 
string itself (@code{char *}), not a pointer to a pointer (@code{char **}).
 @end deftypefun
 
 @deftypefun void gal_fits_key_list_add_end (gal_fits_list_key_t @code{**list}, 
uint8_t @code{type}, char @code{*keyname}, int @code{kfree}, void 
@code{*value}, int @code{vfree}, char @code{*comment}, int @code{cfree}, char 
@code{*unit}, int @code{ufree})
@@ -40157,7 +40157,7 @@ Write the WCS header string (produced with WCSLIB's 
@code{wcshdo} function) into
 This function will put a few blank keyword lines along with a comment 
@code{WCS information} before writing each keyword record.
 @end deftypefun
 
-@deftypefun void gal_fits_key_write (gal_fits_list_key_t @code{**keylist}, 
char @code{*filename}, char @code{*hdu}, char @code{*hdu_option_name}, int 
@code{freekeys}, int @code{create_fits_not_exists})
+@deftypefun void gal_fits_key_write (gal_fits_list_key_t @code{*keylist}, char 
@code{*filename}, char @code{*hdu}, char @code{*hdu_option_name}, int 
@code{freekeys}, int @code{create_fits_not_exists})
 Write the list of keywords in @code{keylist} into the @code{hdu} extension of 
the file called @code{filename}.
 If the file may not exist before this function is activated, set 
@code{create_fits_not_exists} to non-zero and set the HDU to @code{"0"}.
 If the keywords should be freed after they are written, set the 
@code{freekeys} value to non-zero.
@@ -40184,13 +40184,13 @@ int main()
   gal_fits_key_list_add_end(&keylist, GAL_TYPE_FLOAT32, keyname, 0,
                             &value, 0, comment, 0, unit, 0);
   gal_fits_key_list_title_add(&keylist, "Matching metadata", 0);
-  gal_fits_key_write(&keylist, filename, "1", "NONE", 1, 0);
+  gal_fits_key_write(keylist, filename, "1", "NONE", 1, 0);
   return EXIT_SUCCESS;
 @}
 @end example
 @end deftypefun
 
-@deftypefun void gal_fits_key_write_in_ptr (gal_fits_list_key_t 
@code{**keylist}, fitsfile @code{*fptr}, int @code{freekeys})
+@deftypefun void gal_fits_key_write_in_ptr (gal_fits_list_key_t 
@code{*keylist}, fitsfile @code{*fptr}, int @code{freekeys})
 Write the list of keywords in @code{keylist} into the given CFITSIO 
@code{fitsfile} pointer and free keylist.
 For more on the input @code{keylist}, see the description and example for 
@code{gal_fits_key_write}, above.
 @end deftypefun
@@ -47176,7 +47176,7 @@ This is more suited for people who commonly contribute 
to the code (see @ref{For
 @end enumerate
 
 In both cases, your commits (with your name and information) will be preserved 
and your contributions will thus be fully recorded in the history of Gnuastro 
and in the @file{AUTHORS} file and this book (second page in the PDF format) 
once they have been incorporated into the official repository.
-Needless to say that in such cases, be sure to follow the bug or task trackers 
(or subscribe to the @command{gnuastro-devel} mailing list) and contact us 
before hand so you do not do something that someone else is already working on.
+Needless to say that in such cases, be sure to follow the bug or task trackers 
(or subscribe to the @command{gnuastro-devel} mailing list) and contact us 
beforehand so you do not do something that someone else is already working on.
 In that case, you can get in touch with them and help the job go on faster, 
see @ref{Gnuastro project webpage}.
 This workflow is currently mostly borrowed from the general recommendations of 
Git@footnote{@url{https://github.com/git/git/blob/master/Documentation/SubmittingPatches}}
 and GitHub.
 But since Gnuastro is currently under heavy development, these might change 
and evolve to better suit our needs.
diff --git a/lib/arithmetic.c b/lib/arithmetic.c
index a7907a93..a073d54c 100644
--- a/lib/arithmetic.c
+++ b/lib/arithmetic.c
@@ -1700,7 +1700,7 @@ struct multioperandparams
     n=0;                                                                \
     for(i=0;i<p->dnum;++i)                                              \
       {                                                                 \
-        /* Only integers and non-NaN floats: v==v is 1. */              \
+        /* Only integers and non-NaN floats: b==b is 1. */              \
         if(p->hasblank[i])                                              \
           use = ( b==b                                                  \
                   ? ( a[i][j]!=b       ? 1 : 0 )     /* Integer */      \
@@ -1795,7 +1795,7 @@ struct multioperandparams
                                                                         \
         for(i=0;i<p->dnum;++i)  /* Loop over each array. */             \
           {                                                             \
-            /* Only integers and non-NaN floats: v==v is 1. */          \
+            /* Only integers and non-NaN floats: b==b is 1. */          \
             if(p->hasblank[i])                                          \
               use = ( b==b                                              \
                       ? ( a[i][j]!=b       ? 1 : 0 )      /* Integer */ \
@@ -1829,7 +1829,7 @@ struct multioperandparams
                                                                         \
         for(i=0;i<p->dnum;++i)  /* Loop over each array. */             \
           {                                                             \
-            /* Only integers and non-NaN floats: v==v is 1. */          \
+            /* Only integers and non-NaN floats: b==b is 1. */          \
             if(p->hasblank[i])                                          \
               use = ( b==b                                              \
                       ? ( a[i][j]!=b       ? 1 : 0 )     /* Integer */  \
@@ -1863,7 +1863,7 @@ struct multioperandparams
                                                                         \
         for(i=0;i<p->dnum;++i)  /* Loop over each array. */             \
           {                                                             \
-            /* Only integers and non-NaN floats: v==v is 1. */          \
+            /* Only integers and non-NaN floats: b==b is 1. */          \
             if(p->hasblank[i])                                          \
               use = ( b==b                                              \
                       ? ( a[i][j]!=b       ? 1 : 0 )     /* Integer */  \
@@ -1897,7 +1897,7 @@ struct multioperandparams
                                                                         \
         for(i=0;i<p->dnum;++i)  /* Loop over each array. */             \
           {                                                             \
-            /* Only integers and non-NaN floats: v==v is 1. */          \
+            /* Only integers and non-NaN floats: b==b is 1. */          \
             if(p->hasblank[i])                                          \
               use = ( b==b                                              \
                       ? ( a[i][j]!=b       ? 1 : 0 )     /* Integer */  \
@@ -1937,7 +1937,7 @@ struct multioperandparams
         /* Loop over each array: 'i' is input dataset's index. */       \
         for(i=0;i<p->dnum;++i)                                          \
           {                                                             \
-            /* Only integers and non-NaN floats: v==v is 1. */          \
+            /* Only integers and non-NaN floats: b==b is 1. */          \
             if(p->hasblank[i])                                          \
               use = ( b==b                                              \
                       ? ( a[i][j]!=b       ? 1 : 0 )     /* Integer */  \
diff --git a/lib/fits.c b/lib/fits.c
index 97ecbb9e..87d59c77 100644
--- a/lib/fits.c
+++ b/lib/fits.c
@@ -1306,53 +1306,7 @@ gal_fits_key_date_to_seconds(char *fitsdate, char 
**subsecstr,
    linked list of 'gal_data_t'. Before calling this function, you just have
    to set the 'name' and desired 'type' values of each element in the list
    to the keyword you want it to keep the value of. The given 'name' value
-   will be directly passed to CFITSIO to read the desired keyword. This
-   function will allocate space to keep the value. Here is one example of
-   using this function:
-
-      gal_data_t *keysll=gal_data_array_calloc(N);
-
-      for(i=0;i<N-2;++i) keysll[i]->next=keysll[i+1];
-
-      \\ Put a name and type for each element.
-
-      gal_fits_key_read_from_ptr(fptr, keysll, 0, 0);
-
-      \\ use the values as you like.
-
-      gal_data_array_free(keysll, N, 1);
-
-   If the 'array' pointer of each keyword's dataset is not NULL, then it is
-   assumed that the space has already been allocated. If it is NULL, then
-   space will be allocated internally here.
-
-   Strings need special consideration: the reason is that generally,
-   'gal_data_t' needs to also allow for array of strings (as it supports
-   arrays of integers for example). Hence two allocations will be done here
-   (one if 'array!=NULL') and 'keysll[i].array' must be interpretted as
-   'char **': one allocation for the pointer, one for the actual
-   characters. You don't have to worry about the freeing,
-   'gal_data_array_free' will free both allocations. So to read a string,
-   one easy way would be the following:
-
-      char *str, **strarray;
-      strarr = keysll[i].array;
-      str    = strarray[0];
-
-   If CFITSIO is unable to read a keyword for any reason the 'status'
-   element of the respective 'gal_data_t' will be non-zero. You can check
-   the successful reading of the keyword from the 'status' value in each
-   keyword's 'gal_data_t'. If it is zero, then the keyword was found and
-   succesfully read. Otherwise, it a CFITSIO status value. You can use
-   CFITSIO's error reporting tools or 'gal_fits_io_error' for reporting the
-   reason. A tip: when the keyword doesn't exist, then CFITSIO's status
-   value will be 'KEY_NO_EXIST'.
-
-   CFITSIO will start searching for the keywords from the last place in the
-   header that it searched for a keyword. So it is much more efficient if
-   the order that you ask for keywords is based on the order they are
-   stored in the header.
- */
+   will be directly passed to CFITSIO to read the desired keyword. */
 void
 gal_fits_key_read_from_ptr(fitsfile *fptr, gal_data_t *keysll,
                            int readcomment, int readunit)



reply via email to

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