- Main Page
- Related Pages
- Data Structures
- Files

# log.h

Go to the documentation of this file.

    00001 /*============================================================================
    00002
    00003   WCSLIB 4.10 - an implementation of the FITS WCS standard.
    00004   Copyright (C) 1995-2012, Mark Calabretta
    00005
    00006   This file is part of WCSLIB.
    00007
    00008   WCSLIB is free software: you can redistribute it and/or modify it under the
    00009   terms of the GNU Lesser General Public License as published by the Free
    00010   Software Foundation, either version 3 of the License, or (at your option)
    00011   any later version.
    00012
    00013   WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
    00014   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00015   FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for
    00016   more details.
    00017
    00018   You should have received a copy of the GNU Lesser General Public License
    00019   along with WCSLIB.  If not, see <http://www.gnu.org/licenses/>.
    00020
    00021   Correspondence concerning WCSLIB may be directed to:
    00022     Internet email: mcalabre@atnf.csiro.au
    00023     Postal address: Dr. Mark Calabretta
    00024                     Australia Telescope National Facility, CSIRO
    00025                     PO Box 76
    00026                     Epping NSW 1710
    00027                     AUSTRALIA
    00028
    00029   Author: Mark Calabretta, Australia Telescope National Facility
    00030   http://www.atnf.csiro.au/~mcalabre/index.html
    00031   $Id: log.h,v 4.10 2012/02/05 23:41:44 cal103 Exp $
    00032 *=============================================================================
    00033 *
    00034 * WCSLIB 4.10 - C routines that implement logarithmic coordinate systems as
    00035 * defined by the FITS World Coordinate System (WCS) standard.  Refer to
    00036 *
    00037 *   "Representations of world coordinates in FITS",
    00038 *   Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I)
    00039 *
    00040 *   "Representations of spectral coordinates in FITS",
    00041 *   Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.
    00042 *   2006, A&A, 446, 747 (Paper III)
    00043 *
    00044 * Refer to the README file provided with WCSLIB for an overview of the
    00045 * library.
    00046 *
    00047 *
    00048 * Summary of the log routines
    00049 * ---------------------------
    00050 * These routines implement the part of the FITS WCS standard that deals with
    00051 * logarithmic coordinates.  They define methods to be used for computing
    00052 * logarithmic world coordinates from intermediate world coordinates (a linear
    00053 * transformation of image pixel coordinates), and vice versa.
    00054 *
    00055 * logx2s() and logs2x() implement the WCS logarithmic coordinate
    00056 * transformations.
    00057 *
    00058 * Argument checking:
    00059 * ------------------
    00060 * The input log-coordinate values are only checked for values that would
    00061 * result in floating point exceptions and the same is true for the
    00062 * log-coordinate reference value.
    00063 *
    00064 * Accuracy:
    00065 * ---------
    00066 * No warranty is given for the accuracy of these routines (refer to the
    00067 * copyright notice); intending users must satisfy for themselves their
    00068 * adequacy for the intended purpose.  However, closure effectively to within
    00069 * double precision rounding error was demonstrated by test routine tlog.c
    00070 * which accompanies this software.
    00071 *
    00072 *
    00073 * logx2s() - Transform to logarithmic coordinates
    00074 * -----------------------------------------------
    00075 * logx2s() transforms intermediate world coordinates to logarithmic
    00076 * coordinates.
    00077 *
    00078 * Given and returned:
    00079 *   crval     double    Log-coordinate reference value (CRVALia).
    00080 *
    00081 * Given:
    00082 *   nx        int       Vector length.
    00083 *
    00084 *   sx        int       Vector stride.
    00085 *
    00086 *   slogc     int       Vector stride.
    00087 *
    00088 *   x         const double[]
    00089 *                       Intermediate world coordinates, in SI units.
    00090 *
    00091 * Returned:
    00092 *   logc      double[]  Logarithmic coordinates, in SI units.
    00093 *
    00094 *   stat      int[]     Status return value status for each vector element:
    00095 *                         0: Success.
    00096 *
    00097 * Function return value:
    00098 *             int       Status return value:
    00099 *                         0: Success.
    00100 *                         2: Invalid log-coordinate reference value.
    00101 *
    00102 *
    00103 * logs2x() - Transform logarithmic coordinates
    00104 * --------------------------------------------
    00105 * logs2x() transforms logarithmic world coordinates to intermediate world
    00106 * coordinates.
    00107 *
    00108 * Given and returned:
    00109 *   crval     double    Log-coordinate reference value (CRVALia).
    00110 *
    00111 * Given:
    00112 *   nlogc     int       Vector length.
    00113 *
    00114 *   slogc     int       Vector stride.
    00115 *
    00116 *   sx        int       Vector stride.
    00117 *
    00118 *   logc      const double[]
    00119 *                       Logarithmic coordinates, in SI units.
    00120 *
    00121 * Returned:
    00122 *   x         double[]  Intermediate world coordinates, in SI units.
    00123 *
    00124 *   stat      int[]     Status return value status for each vector element:
    00125 *                         0: Success.
    00126 *                         1: Invalid value of logc.
    00127 *
    00128 * Function return value:
    00129 *             int       Status return value:
    00130 *                         0: Success.
    00131 *                         2: Invalid log-coordinate reference value.
    00132 *                         4: One or more of the world-coordinate values
    00133 *                            are incorrect, as indicated by the stat vector.
    00134 *
    00135 *
    00136 * Global variable: const char *log_errmsg[] - Status return messages
    00137 * ------------------------------------------------------------------
    00138 * Error messages to match the status value returned from each function.
    00139 *
    00140 *===========================================================================*/
    00141
    00142 #ifndef WCSLIB_LOG
    00143 #define WCSLIB_LOG
    00144
    00145 #ifdef __cplusplus
    00146 extern "C" {
    00147 #endif
    00148
    00149 extern const char *log_errmsg[];
    00150
    00151 enum log_errmsg_enum {
    00152   LOGERR_SUCCESS         = 0,   /* Success. */
    00153   LOGERR_NULL_POINTER    = 1,   /* Null pointer passed. */
    00154   LOGERR_BAD_LOG_REF_VAL = 2,   /* Invalid log-coordinate reference value. */
    00155   LOGERR_BAD_X           = 3,   /* One or more of the x coordinates were
    00156                                    invalid. */
    00157   LOGERR_BAD_WORLD       = 4    /* One or more of the world coordinates were
    00158                                    invalid. */
    00159 };
    00160
    00161 int logx2s(double crval, int nx, int sx, int slogc, const double x[],
    00162            double logc[], int stat[]);
    00163
    00164 int logs2x(double crval, int nlogc, int slogc, int sx, const double logc[],
    00165            double x[], int stat[]);
    00166
    00167
    00168 #ifdef __cplusplus
    00169 }
    00170 #endif
    00171
    00172 #endif /* WCSLIB_LOG */