gnuastro-commits
[Top][All Lists]
Advanced

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

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


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master a2bf10c4: Code and Book: Corrected typos in comments and book text
Date: Thu, 18 Apr 2024 04:52:21 -0400 (EDT)

branch: master
commit a2bf10c449fda0cc90507e58f6a2dbe80ddf39f6
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 Fits, NoiseChisel and Warp programs, as well
    as the 'data.c' library.
    
    With this commit, all these typos have been corrected.
---
 bin/fits/ui.c        | 17 +++++++++--------
 bin/noisechisel/ui.c | 20 ++++++++++----------
 bin/warp/ui.c        | 18 +++++++++---------
 doc/gnuastro.texi    | 30 +++++++++++++++---------------
 lib/data.c           | 10 +++++-----
 5 files changed, 48 insertions(+), 47 deletions(-)

diff --git a/bin/fits/ui.c b/bin/fits/ui.c
index 1d363364..bd9f2a8e 100644
--- a/bin/fits/ui.c
+++ b/bin/fits/ui.c
@@ -157,7 +157,7 @@ parse_opt(int key, char *arg, struct argp_state *state)
 {
   struct fitsparams *p = state->input;
 
-  /* Pass 'gal_options_common_params' into the child parser.  */
+  /* Pass 'gal_options_common_params' into the child parser. */
   state->child_inputs[0] = &p->cp;
 
   /* In case the user incorrectly uses the equal sign (for example
@@ -278,10 +278,11 @@ ui_check_copykeys(struct fitsparams *p)
              of the 'switch'). Recall that according to the FITS standard,
              a keyword name can only contain digits, alphabetic characters,
              '-', or '_'. See "Section 4.1.2.1. Keyword name" of the FITS
-             4.0 standard.*/
+             4.0 standard. */
           if( isalpha(*pt) || *pt=='-' || *pt=='_' ) break;
 
-          /* Print an error if control reaches here because  */
+          /* Print an error and abort if control reaches here (as described
+             in the error message). */
           error(EXIT_FAILURE, 0, "value to '--copykeys' must either be a "
                 "range of numbers (for example '--copykeys=10:20') or a "
                 "set of names (for example '--copykeys=KEY1,KEY2', for "
@@ -464,7 +465,7 @@ ui_read_check_mode_keyword(struct fitsparams *p)
 
 
 
-/* Same for the extension-related options */
+/* Same for the extension-related options. */
 static void
 ui_read_check_mode_extension(struct fitsparams *p)
 {
@@ -570,8 +571,8 @@ ui_check_options_and_arguments(struct fitsparams *p)
   if(p->keyvalue)
     {
       /* If '--arguments' is given and there is no input files, read the
-         names of the inputs from that. Otherwose, complain about not
-         having any input.*/
+         names of the inputs from that. Otherwise, complain about not
+         having any input. */
       if(p->input==NULL)
         {
           if(p->arguments)
@@ -687,7 +688,7 @@ ui_fill_fits_headerll(gal_list_str_t *input, 
gal_fits_list_key_t **output,
         }
       while(++c<cf);
 
-      /* See if this is an option that needs a value or not.*/
+      /* See if this is an option that needs a value or not. */
       needsvalue=1;
       if(keyname)
         {
@@ -817,7 +818,7 @@ ui_read_check_inputs_setup(int argc, char *argv[], struct 
fitsparams *p)
 #include "args.h"
 
 
-  /* Initialize the options and necessary information.  */
+  /* Initialize the options and necessary information. */
   ui_initialize_options(p, program_options, gal_commonopts_options);
 
 
diff --git a/bin/noisechisel/ui.c b/bin/noisechisel/ui.c
index 133f54de..0f1ab70d 100644
--- a/bin/noisechisel/ui.c
+++ b/bin/noisechisel/ui.c
@@ -160,7 +160,7 @@ parse_opt(int key, char *arg, struct argp_state *state)
 {
   struct noisechiselparams *p = state->input;
 
-  /* Pass 'gal_options_common_params' into the child parser.  */
+  /* Pass 'gal_options_common_params' into the child parser. */
   state->child_inputs[0] = &p->cp;
 
   /* In case the user incorrectly uses the equal sign (for example
@@ -253,7 +253,7 @@ ui_check_only_options(struct noisechiselparams *p)
   /* Kernel checks. */
   if(p->kernelname && strcmp(p->kernelname, UI_NO_CONV_KERNEL_NAME))
     {
-      /* If its FITS, see if a HDU has been provided. */
+      /* If it is FITS, see if a HDU has been provided. */
       if( gal_fits_file_recognized(p->kernelname) && p->khdu==NULL )
         error(EXIT_FAILURE, 0, "no HDU specified for kernel. When the "
               "kernel is a FITS file, a HDU must also be specified. You "
@@ -265,7 +265,7 @@ ui_check_only_options(struct noisechiselparams *p)
   /* Wide kernel checks. */
   if(p->widekernelname)
     {
-      /* If its FITS, see if a HDU has been provided. */
+      /* If it is FITS, see if a HDU has been provided. */
       if( gal_fits_file_recognized(p->widekernelname) && p->whdu==NULL )
         error(EXIT_FAILURE, 0, "no HDU specified for the given wide kernel "
               "('%s'). When the wide kernel is a FITS file, a HDU must also "
@@ -281,7 +281,7 @@ ui_check_only_options(struct noisechiselparams *p)
      wanted a false detection rate of 0.0001 (a super-high value!), and
      instead of inputing 0.9999, we mistakenly gave '--snquant' a value of
      '0.0001'. We were thus fully confused with the output (an extremely
-     low value) and thought its a bug, while it wasn't! */
+     low value) and thought it is a bug, while it wasn't! */
   if(p->snquant<0.1)
     error(EXIT_SUCCESS, 0, "\nWARNING: Value of '--snquant' ('-c') is "
           "%g. Note that this is not a contamination rate (where lower "
@@ -320,7 +320,7 @@ ui_check_options_and_arguments(struct noisechiselparams *p)
   /* Basic input file checks. */
   if(p->inputname)
     {
-      /* If its FITS, see if a HDU has been provided. */
+      /* If it is FITS, see if a HDU has been provided. */
       if( gal_fits_file_recognized(p->inputname) && p->cp.hdu==NULL )
         error(EXIT_FAILURE, 0, "no HDU specified for input. When the input "
               "is a FITS file, a HDU must also be specified, you can use "
@@ -369,7 +369,7 @@ ui_set_output_names(struct noisechiselparams *p)
 
       /* When the output name is given (possibly with directory
          information), the check images will also be put in that same
-         directory.. */
+         directory. */
       p->cp.keepinputdir=1;
     }
   else
@@ -524,7 +524,7 @@ ui_prepare_tiles(struct noisechiselparams *p)
 
 
   /* If the input has blank elements, then set teh appropriate flag for
-     each tile.*/
+     each tile. */
   if( p->input->flag & GAL_DATA_FLAG_HASBLANK )
     {
       gal_tile_block_blank_flag(tl->tiles,  p->cp.numthreads);
@@ -663,7 +663,7 @@ ui_preparations(struct noisechiselparams *p)
   /* Prepare the names of the outputs. */
   ui_set_output_names(p);
 
-  /* Read the input datasets and do the basic checks.*/
+  /* Read the input datasets and do the basic checks. */
   ui_preparations_read_input(p);
 
   /* If a convolved image was given, read it in. Otherwise, read the given
@@ -687,7 +687,7 @@ ui_preparations(struct noisechiselparams *p)
   else
     ui_prepare_kernel(p);
 
-  /* Check for blank values to help later processing.  */
+  /* Check for blank values to help later processing. */
   gal_blank_present(p->input, 1);
 
   /* Prepare the tessellation. */
@@ -744,7 +744,7 @@ ui_read_check_inputs_setup(int argc, char *argv[],
 #include "args.h"
 
 
-  /* Initialize the options and necessary information.  */
+  /* Initialize the options and necessary information. */
   ui_initialize_options(p, program_options, gal_commonopts_options);
 
 
diff --git a/bin/warp/ui.c b/bin/warp/ui.c
index 19251558..4fb45672 100644
--- a/bin/warp/ui.c
+++ b/bin/warp/ui.c
@@ -161,7 +161,7 @@ parse_opt(int key, char *arg, struct argp_state *state)
 {
   struct warpparams *p = state->input;
 
-  /* Pass 'gal_options_common_params' into the child parser.  */
+  /* Pass 'gal_options_common_params' into the child parser. */
   state->child_inputs[0] = &p->cp;
 
   /* In case the user incorrectly uses the equal sign (for example
@@ -408,7 +408,7 @@ ui_check_wcsalign_cdelt(struct warpparams *p)
   /* '--cdelt' is given. */
   if(wa->cdelt)
     {
-      /* CDELT is given, make sure there are no more than two values */
+      /* CDELT is given, make sure there are no more than two values. */
       if(wa->cdelt->size > 2)
         error(EXIT_FAILURE, 0, "%zu values given to '--cdelt', "
               "however this option takes no more than 2 values",
@@ -445,7 +445,7 @@ ui_check_wcsalign_cdelt(struct warpparams *p)
   /* '--cdelt' not given. */
   else
     {
-      /* CDELT is not given, try to deduce from WCS */
+      /* CDELT is not given, try to deduce from WCS. */
       cdelt=gal_wcs_pixel_scale(p->input->wcs);
       if(!cdelt)
         error(EXIT_FAILURE, 0, "%s (hdu %s): the pixel scale couldn't "
@@ -535,7 +535,7 @@ ui_check_wcsalign_width(struct warpparams *p)
       p->width=tmpw;
     }
 
-  /* Image size must be ODD */
+  /* Image size must be ODD. */
   sarray=p->width->array;
   if( sarray[0]%2==0 || sarray[1]%2==0 )
     {
@@ -636,7 +636,7 @@ ui_check_options_and_arguments_wcsalign(struct warpparams 
*p)
   ui_check_wcsalign_cdelt(p);
   if(p->width) ui_check_wcsalign_width(p);
 
-  /* Check CTYPE */
+  /* Check CTYPE. */
   if(!wa->ctype)
     error(EXIT_FAILURE, 0, "no output projection CTYPE specified, "
           "you can use the '--ctype' option and give it a comma "
@@ -655,7 +655,7 @@ ui_check_options_and_arguments_wcsalign(struct warpparams 
*p)
 static void
 ui_check_options_and_arguments(struct warpparams *p)
 {
-  /* Read the input.*/
+  /* Read the input. */
   if(p->inputname==NULL)
     error(EXIT_FAILURE, 0, "no input file is specified");
 
@@ -701,7 +701,7 @@ ui_check_options_and_arguments(struct warpparams *p)
   if(p->input->wcs)
     p->inwcsmatrix=gal_wcs_warp_matrix(p->input->wcs);
 
-  /* Do all the distortion correction sanity-checks.*/
+  /* Do all the distortion correction sanity-checks. */
   if(p->wcsalign)
     ui_check_options_and_arguments_wcsalign(p);
 }
@@ -760,7 +760,7 @@ ui_matrix_prepare_raw(struct warpparams *p)
   size_t *dsize;
   double *in=p->matrix->array, *final;
 
-  /* If the matrix was 2D, then convert it to 3D. Note that we done a size
+  /* If the matrix is 2D, then convert it to 3D. Note that we have done a size
      check when reading the matrix, so at this point, it either has 9
      elements, or 4. */
   if(p->matrix->size==4)
@@ -1008,7 +1008,7 @@ ui_matrix_finalize(struct warpparams *p)
           "is zero");
 
   /* Not yet implemented: Check if the transformation is spatially
-     invariant, in other words, if it differs between differet regions of
+     invariant, in other words, if it differs between different regions of
      the output. If it doesn't we can use this information for a more
      efficient processing. */
 
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index 4b2a3abf..2d5a71bd 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -37901,7 +37901,7 @@ In any case (no matter which columns are checked for 
blanks), the selected rows
 @subsection Data container (@file{data.h})
 
 Astronomical datasets have various dimensions, for example, 1D spectra or 
table columns, 2D images, or 3D Integral field data cubes.
-Datasets can also have various numeric data types, depending on the 
operation/purpose, for example, processed images are commonly stored in 
floating point format, but their mask images are integers (allowing bit-wise 
flags to identify certain classes of pixels to keep or mask, see @ref{Numeric 
data types}).
+Datasets can also have various numeric data types, depending on the 
operation/purpose, for example, processed images are commonly stored in 
floating point format, but their mask images are integers (allowing bitwise 
flags to identify certain classes of pixels to keep or mask, see @ref{Numeric 
data types}).
 Certain other information about a dataset are also commonly necessary, for 
example, the units of the dataset, the name of the dataset and some comments.
 To deal with any generic dataset, Gnuastro defines the @code{gal_data_t} as 
input or output.
 
@@ -38030,9 +38030,9 @@ The main WCSLIB structure keeping all the relevant 
information necessary for WCS
 When it is given a @code{NULL} value, all possible WCS 
calculations/measurements will be ignored.
 
 @item uint8_t flag
-Bit-wise flags to describe general properties of the dataset.
+Bitwise flags to describe general properties of the dataset.
 The number of bytes available in this flag is stored in the 
@code{GAL_DATA_FLAG_SIZE} macro.
-Note that you should use bit-wise operators@footnote{See 
@url{https://en.wikipedia.org/wiki/Bitwise_operations_in_C}.} to check these 
flags.
+Note that you should use bitwise operators@footnote{See 
@url{https://en.wikipedia.org/wiki/Bitwise_operations_in_C}.} to check these 
flags.
 The currently recognized bits are stored in these macros:
 
 @table @code
@@ -38065,7 +38065,7 @@ If this bit is @code{0} and 
@code{GAL_DATA_FLAG_SORT_CH} is @code{1}, then the d
 @end table
 
 The macro @code{GAL_DATA_FLAG_MAXFLAG} contains the largest internally used 
bit-position.
-Higher-level flags can be defined with the bit-wise shift operators using this 
macro to define internal flags for libraries/programs that depend on Gnuastro 
without causing any possible conflict with the internal flags discussed above 
or having to check the values manually on every release.
+Higher-level flags can be defined with the bitwise shift operators using this 
macro to define internal flags for libraries/programs that depend on Gnuastro 
without causing any possible conflict with the internal flags discussed above 
or having to check the values manually on every release.
 
 
 @item int status
@@ -39643,9 +39643,9 @@ The suffix does not have to start with `@key{.}': this 
function will return @cod
 
 @deftypefun int gal_fits_file_recognized (char @code{*name})
 Return @code{1} if the given file name (possibly including its contents) is a 
FITS file.
-This is necessary in when the contents of a FITS file do follow the FITS 
standard, but it the file does not have a Gnuastro-recognized FITS suffix.
+This is necessary when the contents of a FITS file do follow the FITS 
standard, but the file does not have a Gnuastro-recognized FITS suffix.
 Therefore, it will first call @code{gal_fits_name_is_fits}, if the result is 
negative, then this function will attempt to open the file with CFITSIO and if 
it works, it will close it again and return 1.
-In the process of opening the file, CFITSIO will just to open the file, no 
reading will take place, so it should have minimal CPU footprint.
+In the process of opening the file, CFITSIO will just open the file, and no 
reading will take place, so it should have a minimal CPU footprint.
 @end deftypefun
 
 @deftypefun {char *} gal_fits_name_save_as_string (char @code{*filename}, char 
@code{*hdu})
@@ -40146,7 +40146,7 @@ In case you want to add keywords into the HDU that 
contain the data, you can use
 These keywords will be written into the HDU before writing the data: when 
there are more than roughly 5 keywords (assuming your dataset has WCS) and your 
dataset is large, this can result in significant optimization of the running 
time (because adding a keyword beyond the 36 key slots will cause the whole 
data to shift for another block of 36 keywords).
 @end deftypefun
 
-@deftypefun void gal_fits_img_write (gal_data_t @code{*data}, char 
@code{*filename}, gal_fits_list_key_t @code{*keylist}, int @code{freekeys})
+@deftypefun void gal_fits_img_write (gal_data_t @code{*input}, char 
@code{*filename}, gal_fits_list_key_t @code{*keylist}, int @code{freekeys})
 Write the @code{input} dataset into the FITS file named @file{filename}.
 Also add the list of header keywords (@code{keylist}) to the newly created 
HDU/extension
 The list of keywords will be freed after writing into the HDU, if you need 
them later, keep a separate copy of the list before calling this function.
@@ -40154,7 +40154,7 @@ The list of keywords will be freed after writing into 
the HDU, if you need them
 For the importance of why it is better to add your keywords in this function 
(before writing the data) or after it, see the description of 
@code{gal_fits_img_write_to_ptr}.
 @end deftypefun
 
-@deftypefun void gal_fits_img_write_to_type (gal_data_t @code{*data}, char 
@code{*filename}, gal_fits_list_key_t @code{*keylist}, int @code{type}, int 
@code{freekeys})
+@deftypefun void gal_fits_img_write_to_type (gal_data_t @code{*input}, char 
@code{*filename}, gal_fits_list_key_t @code{*keylist}, int @code{type}, int 
@code{freekeys})
 Convert the @code{input} dataset into @code{type}, then write it into the FITS 
file named @file{filename}.
 Also add the @code{keylist} keywords to the newly created HDU/extension along 
with your program's name (@code{program_string}).
 After the FITS file is written, this function will free the copied dataset 
(with type @code{type}) from memory.
@@ -40163,7 +40163,7 @@ For the importance of why it is better to add your 
keywords in this function (be
 This is just a wrapper for the @code{gal_data_copy_to_new_type} and 
@code{gal_fits_img_write} functions.
 @end deftypefun
 
-@deftypefun void gal_fits_img_write_corr_wcs_str (gal_data_t @code{*data}, 
char @code{*filename}, char @code{*wcsstr}, int @code{nkeyrec}, double 
@code{*crpix}, gal_fits_list_key_t @code{*keylist}, int @code{freekeys})
+@deftypefun void gal_fits_img_write_corr_wcs_str (gal_data_t @code{*input}, 
char @code{*filename}, char @code{*wcsstr}, int @code{nkeyrec}, double 
@code{*crpix}, gal_fits_list_key_t @code{*keylist}, int @code{freekeys})
 Write the @code{input} dataset into @file{filename} using the @code{wcsstr} 
while correcting the @code{CRPIX} values.
 For the importance of why it is better to add your keywords in this function 
(before writing the data) or after it, see the description of 
@code{gal_fits_img_write_to_ptr}.
 
@@ -41112,8 +41112,8 @@ So first we will review the constants for the 
recognized flags and operators and
 @deffnx Macro GAL_ARITHMETIC_FLAG_QUIET
 @deffnx Macro GAL_ARITHMETIC_FLAGS_BASIC
 @cindex Bitwise Or
-Bit-wise flags to pass onto @code{gal_arithmetic} (see below).
-To pass multiple flags, use the bitwise-or operator.
+Bitwise flags to pass onto @code{gal_arithmetic} (see below).
+To pass multiple flags, use the bitwise OR operator.
 For example, if you pass @code{GAL_ARITHMETIC_FLAG_INPLACE | 
GAL_ARITHMETIC_FLAG_NUMOK}, then the operation will be done in-place (without 
allocating a new array), and a single number will also be acceptable (that will 
be applied to all the pixels).
 Each flag is described below:
 
@@ -41366,16 +41366,16 @@ When @code{gal_arithmetic} is called with any of 
these operators, it will expect
 Binary integer-only operand operators.
 These operators are only defined on integer data types.
 When @code{gal_arithmetic} is called with any of these operators, it will 
expect two operands: the first is put on the left of the operator and the 
second on the right.
-The ones starting with @code{BIT} are the respective bit-wise operators in C 
and @code{MODULO} is the modulo/remainder operator.
+The ones starting with @code{BIT} are the respective bitwise operators in C 
and @code{MODULO} is the modulo/remainder operator.
 For a discussion on these operators, please see
 @ref{Arithmetic operators}.
 
-The output type is determined from the input types and C's internal 
conversions: it is strongly recommended that both inputs have the same type 
(any integer type), otherwise the bit-wise behavior will be determined by your 
compiler.
+The output type is determined from the input types and C's internal 
conversions: it is strongly recommended that both inputs have the same type 
(any integer type), otherwise the bitwise behavior will be determined by your 
compiler.
 @end deffn
 
 @deffn Macro GAL_ARITHMETIC_OP_BITNOT
-The unary bit-wise NOT operator.
-When @code{gal_arithmetic} is called with any of these operators, it will 
expect one operand of an integer type and preform the bitwise-NOT operation on 
it.
+The unary bitwise NOT operator.
+When @code{gal_arithmetic} is called with any of these operators, it will 
expect one operand of an integer type and preform the bitwise NOT operation on 
it.
 The output will have the same type as the input.
 @end deffn
 
diff --git a/lib/data.c b/lib/data.c
index e91c4c62..3d7f1bae 100644
--- a/lib/data.c
+++ b/lib/data.c
@@ -245,17 +245,17 @@ gal_data_alloc_empty(size_t ndim, size_t minmapsize, int 
quietmmap)
 
 
 /* Free the allocated contents of a data structure, not the structure
-   itsself. The reason that this function is separate from 'gal_data_free'
+   itself. The reason that this function is separate from 'gal_data_free'
    is that the data structure might be allocated as an array (statically
    like 'gal_data_t da[20]', or dynamically like 'gal_data_t *da;
    da=malloc(20*sizeof *da);'). In both cases, a loop will be necessary to
    delete the allocated contents of each element of the data structure
-   array, but not the structure its self. After that loop, if the array of
+   array, but not the structure itself. After that loop, if the array of
    data structures was statically allocated, you don't have to do
    anything. If it was dynamically allocated, we just have to run
    'free(da)'.
 
-   Since we aren't freeing the 'gal_data_t' its-self, after the allocated
+   Since we aren't freeing the 'gal_data_t' itself, after the allocated
    space for each pointer is freed, the pointer is set to NULL for safety
    (to avoid possible re-calls).
 */
@@ -302,7 +302,7 @@ gal_data_free_contents(gal_data_t *data)
 
 
 /* Free the contents of the data structure and the data structure
-   itsself. */
+   itself. */
 void
 gal_data_free(gal_data_t *data)
 {
@@ -388,7 +388,7 @@ gal_data_array_free(gal_data_t *dataarr, size_t size, int 
free_array)
 {
   size_t i;
 
-  /* If its NULL, don't do anything. */
+  /* If it is NULL, don't do anything. */
   if(dataarr==NULL) return;
 
   /* First free all the contents. */



reply via email to

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