gnuastro-commits
[Top][All Lists]
Advanced

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

[gnuastro-commits] master 4e7edd1: Table: wcs-to-img and img-to-wcs new


From: Mohammad Akhlaghi
Subject: [gnuastro-commits] master 4e7edd1: Table: wcs-to-img and img-to-wcs new names for wcstoimg and imgtowcs
Date: Sun, 26 Sep 2021 19:31:21 -0400 (EDT)

branch: master
commit 4e7edd16a76f0f0366011eaebf8e11171d7415a4
Author: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Commit: Mohammad Akhlaghi <mohammad@akhlaghi.org>

    Table: wcs-to-img and img-to-wcs new names for wcstoimg and imgtowcs
    
    Until now, the 'wcstoimg' and 'imgtowcs' were not following the standard
    unit conversion naming convention as others (for example 'counts-to-mag' or
    'jy-to-counts'). This can confuse users and is primarily for historical
    reasons: the two WCS conversion operators were the first such
    unit-converting operators, but after their usage, for later operators a
    '-to-' was added to make the newer operators more easily readable.
    
    With this commit, these two operators have been renamed to 'wcs-to-img' and
    'img-to-wcs' in the code and documentation.
---
 NEWS                         |  7 +++++++
 bin/script/radial-profile.in |  2 +-
 bin/table/arithmetic.c       |  8 ++++----
 doc/gnuastro.texi            | 14 +++++++-------
 4 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/NEWS b/NEWS
index 62d4454..fd50f29 100644
--- a/NEWS
+++ b/NEWS
@@ -101,6 +101,13 @@ See the end of the file for license conditions.
      before all row selection or row re-ording operations (if
      called). Until now, adding columns from other files was done after all
      row selection or re-ordering, but this was not too practically useful.
+   - Column arithmetic operators:
+     - 'wcs-to-img' new name for old 'wcstoimg' operator. The new
+       unit-conversion operators generally have a '-to-' between the units
+       to help in readability. So to avoid confusion, this operator has
+       also been changed.
+    - 'img-to-wcs' new name for old 'imgtowcs' operator (see description of
+      'wcs-to-img' above).
 
   Library
    - gal_fits_key_write_filename: now has 'quiet' argument to avoid
diff --git a/bin/script/radial-profile.in b/bin/script/radial-profile.in
index c380fe9..e0514fc 100755
--- a/bin/script/radial-profile.in
+++ b/bin/script/radial-profile.in
@@ -342,7 +342,7 @@ else
     # input header image is used.
     else
         xy=$(echo "$center" \
-                  | asttable -c'arith $1 $2 wcstoimg' \
+                  | asttable -c'arith $1 $2 wcs-to-img' \
                              --wcsfile=$inputs --wcshdu=$hdu)
         xcenter=$(echo $xy | awk '{print $1}');
         ycenter=$(echo $xy | awk '{print $2}');
diff --git a/bin/table/arithmetic.c b/bin/table/arithmetic.c
index d226a23..73dbdb4 100644
--- a/bin/table/arithmetic.c
+++ b/bin/table/arithmetic.c
@@ -129,8 +129,8 @@ arithmetic_operator_name(int operator)
     switch(operator)
       {
       case ARITHMETIC_TABLE_OP_SET: out="set"; break;
-      case ARITHMETIC_TABLE_OP_WCSTOIMG: out="wcstoimg"; break;
-      case ARITHMETIC_TABLE_OP_IMGTOWCS: out="imgtowcs"; break;
+      case ARITHMETIC_TABLE_OP_WCSTOIMG: out="wcs-to-img"; break;
+      case ARITHMETIC_TABLE_OP_IMGTOWCS: out="img-to-wcs"; break;
       case ARITHMETIC_TABLE_OP_DATETOSEC: out="date-to-sec"; break;
       case ARITHMETIC_TABLE_OP_DISTANCEFLAT: out="distance-flat"; break;
       case ARITHMETIC_TABLE_OP_DISTANCEONSPHERE: out="distance-on-sphere"; 
break;
@@ -182,9 +182,9 @@ arithmetic_set_operator(struct tableparams *p, char *string,
   if( op==GAL_ARITHMETIC_OP_INVALID )
     {
       /* Simple operators. */
-      if(      !strcmp(string, "wcstoimg"))
+      if(      !strcmp(string, "wcs-to-img"))
         { op=ARITHMETIC_TABLE_OP_WCSTOIMG; *num_operands=0; }
-      else if( !strcmp(string, "imgtowcs"))
+      else if( !strcmp(string, "img-to-wcs"))
         { op=ARITHMETIC_TABLE_OP_IMGTOWCS; *num_operands=0; }
       else if( !strcmp(string, "date-to-sec"))
         { op=ARITHMETIC_TABLE_OP_DATETOSEC; *num_operands=0; }
diff --git a/doc/gnuastro.texi b/doc/gnuastro.texi
index dd1f2bc..c920d14 100644
--- a/doc/gnuastro.texi
+++ b/doc/gnuastro.texi
@@ -10051,7 +10051,7 @@ widthpix=$(astfits $g-aligned.fits -h1 --quiet \
 # Crop all the images around the desired center and width.
 for f in $r $g $b; do
   centerpix=$(echo $centerwcs \
-                   | asttable -c'arith $1 $2 wcstoimg' \
+                   | asttable -c'arith $1 $2 wcs-to-img' \
                               --wcsfile=$f-aligned.fits \
                    | awk '@{printf "%g,%g", $1, $2@}')
   astcrop $f-aligned.fits --mode=img --width=$widthpix \
@@ -10858,7 +10858,7 @@ Besides the operators in @ref{Arithmetic operators}, 
several operators are only
 @cindex WCS: World Coordinate System
 @cindex World Coordinate System (WCS)
 @table @code
-@item wcstoimg
+@item wcs-to-img
 Convert the given WCS positions to image/dataset coordinates based on the 
number of dimensions in the WCS structure of @option{--wcshdu} extension/HDU in 
@option{--wcsfile}.
 It will output the same number of columns.
 The first popped operand is the last FITS dimension.
@@ -10868,14 +10868,14 @@ The first three columns are the input table's ID, RA 
and Dec columns.
 The fourth and fifth columns will be the pixel positions in @file{image.fits} 
that correspond to each RA and Dec.
 
 @example
-$ asttable table.fits -cID,RA,DEC,'arith RA DEC wcstoimg' \
+$ asttable table.fits -cID,RA,DEC,'arith RA DEC wcs-to-img' \
            --wcsfile=image.fits
 $ asttable table.fits -cID,RA -cDEC \
-           -c'arith RA DEC wcstoimg' --wcsfile=image.fits
+           -c'arith RA DEC wcs-to-img' --wcsfile=image.fits
 @end example
 
-@item imgtowcs
-Similar to @code{wcstoimg}, except that image/dataset coordinates are 
converted to WCS coordinates.
+@item img-to-wcs
+Similar to @code{wcs-to-img}, except that image/dataset coordinates are 
converted to WCS coordinates.
 
 @item distance-flat
 Return the distance between two points assuming they are on a flat surface.
@@ -11232,7 +11232,7 @@ When this option is called multiple times, it is 
possible to output one column m
 
 @item -w FITS
 @itemx --wcsfile=FITS
-FITS file that contains the WCS to be used in the @code{wcstoimg} and 
@code{imgtowcs} operators of @ref{Column arithmetic}.
+FITS file that contains the WCS to be used in the @code{wcs-to-img} and 
@code{img-to-wcs} operators of @ref{Column arithmetic}.
 The extension name/number within the FITS file can be specified with 
@option{--wcshdu}.
 
 If the value to this option is `@option{none}', no WCS will be written in the 
output.



reply via email to

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