00001 /*============================================================================ 00002 00003 WCSLIB 4.17 - an implementation of the FITS WCS standard. 00004 Copyright (C) 1995-2013, 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 Direct correspondence concerning WCSLIB to mark@calabretta.id.au 00022 00023 Author: Mark Calabretta, Australia Telescope National Facility, CSIRO. 00024 http://www.atnf.csiro.au/people/Mark.Calabretta 00025 $Id: log.h,v 4.17 2013/01/29 05:29:20 cal103 Exp $ 00026 *============================================================================= 00027 * 00028 * WCSLIB 4.17 - C routines that implement logarithmic coordinate systems as 00029 * defined by the FITS World Coordinate System (WCS) standard. Refer to 00030 * 00031 * "Representations of world coordinates in FITS", 00032 * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (Paper I) 00033 * 00034 * "Representations of spectral coordinates in FITS", 00035 * Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L. 00036 * 2006, A&A, 446, 747 (Paper III) 00037 * 00038 * Refer to the README file provided with WCSLIB for an overview of the 00039 * library. 00040 * 00041 * 00042 * Summary of the log routines 00043 * --------------------------- 00044 * These routines implement the part of the FITS WCS standard that deals with 00045 * logarithmic coordinates. They define methods to be used for computing 00046 * logarithmic world coordinates from intermediate world coordinates (a linear 00047 * transformation of image pixel coordinates), and vice versa. 00048 * 00049 * logx2s() and logs2x() implement the WCS logarithmic coordinate 00050 * transformations. 00051 * 00052 * Argument checking: 00053 * ------------------ 00054 * The input log-coordinate values are only checked for values that would 00055 * result in floating point exceptions and the same is true for the 00056 * log-coordinate reference value. 00057 * 00058 * Accuracy: 00059 * --------- 00060 * No warranty is given for the accuracy of these routines (refer to the 00061 * copyright notice); intending users must satisfy for themselves their 00062 * adequacy for the intended purpose. However, closure effectively to within 00063 * double precision rounding error was demonstrated by test routine tlog.c 00064 * which accompanies this software. 00065 * 00066 * 00067 * logx2s() - Transform to logarithmic coordinates 00068 * ----------------------------------------------- 00069 * logx2s() transforms intermediate world coordinates to logarithmic 00070 * coordinates. 00071 * 00072 * Given and returned: 00073 * crval double Log-coordinate reference value (CRVALia). 00074 * 00075 * Given: 00076 * nx int Vector length. 00077 * 00078 * sx int Vector stride. 00079 * 00080 * slogc int Vector stride. 00081 * 00082 * x const double[] 00083 * Intermediate world coordinates, in SI units. 00084 * 00085 * Returned: 00086 * logc double[] Logarithmic coordinates, in SI units. 00087 * 00088 * stat int[] Status return value status for each vector element: 00089 * 0: Success. 00090 * 00091 * Function return value: 00092 * int Status return value: 00093 * 0: Success. 00094 * 2: Invalid log-coordinate reference value. 00095 * 00096 * 00097 * logs2x() - Transform logarithmic coordinates 00098 * -------------------------------------------- 00099 * logs2x() transforms logarithmic world coordinates to intermediate world 00100 * coordinates. 00101 * 00102 * Given and returned: 00103 * crval double Log-coordinate reference value (CRVALia). 00104 * 00105 * Given: 00106 * nlogc int Vector length. 00107 * 00108 * slogc int Vector stride. 00109 * 00110 * sx int Vector stride. 00111 * 00112 * logc const double[] 00113 * Logarithmic coordinates, in SI units. 00114 * 00115 * Returned: 00116 * x double[] Intermediate world coordinates, in SI units. 00117 * 00118 * stat int[] Status return value status for each vector element: 00119 * 0: Success. 00120 * 1: Invalid value of logc. 00121 * 00122 * Function return value: 00123 * int Status return value: 00124 * 0: Success. 00125 * 2: Invalid log-coordinate reference value. 00126 * 4: One or more of the world-coordinate values 00127 * are incorrect, as indicated by the stat vector. 00128 * 00129 * 00130 * Global variable: const char *log_errmsg[] - Status return messages 00131 * ------------------------------------------------------------------ 00132 * Error messages to match the status value returned from each function. 00133 * 00134 *===========================================================================*/ 00135 00136 #ifndef WCSLIB_LOG 00137 #define WCSLIB_LOG 00138 00139 #ifdef __cplusplus 00140 extern "C" { 00141 #endif 00142 00143 extern const char *log_errmsg[]; 00144 00145 enum log_errmsg_enum { 00146 LOGERR_SUCCESS = 0, /* Success. */ 00147 LOGERR_NULL_POINTER = 1, /* Null pointer passed. */ 00148 LOGERR_BAD_LOG_REF_VAL = 2, /* Invalid log-coordinate reference value. */ 00149 LOGERR_BAD_X = 3, /* One or more of the x coordinates were 00150 invalid. */ 00151 LOGERR_BAD_WORLD = 4 /* One or more of the world coordinates were 00152 invalid. */ 00153 }; 00154 00155 int logx2s(double crval, int nx, int sx, int slogc, const double x[], 00156 double logc[], int stat[]); 00157 00158 int logs2x(double crval, int nlogc, int slogc, int sx, const double logc[], 00159 double x[], int stat[]); 00160 00161 00162 #ifdef __cplusplus 00163 } 00164 #endif 00165 00166 #endif /* WCSLIB_LOG */