WCSLIB  7.3.1
log.h
Go to the documentation of this file.
1 /*============================================================================
2  WCSLIB 7.3 - an implementation of the FITS WCS standard.
3  Copyright (C) 1995-2020, Mark Calabretta
4 
5  This file is part of WCSLIB.
6 
7  WCSLIB is free software: you can redistribute it and/or modify it under the
8  terms of the GNU Lesser General Public License as published by the Free
9  Software Foundation, either version 3 of the License, or (at your option)
10  any later version.
11 
12  WCSLIB is distributed in the hope that it will be useful, but WITHOUT ANY
13  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14  FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
15  more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with WCSLIB. If not, see http://www.gnu.org/licenses.
19 
20  Direct correspondence concerning WCSLIB to mark@calabretta.id.au
21 
22  Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
23  http://www.atnf.csiro.au/people/Mark.Calabretta
24  $Id: log.h,v 7.3.1.2 2020/08/17 11:19:09 mcalabre Exp mcalabre $
25 *=============================================================================
26 *
27 * WCSLIB 7.3 - C routines that implement the FITS World Coordinate System
28 * (WCS) standard. Refer to the README file provided with WCSLIB for an
29 * overview of the library.
30 *
31 *
32 * Summary of the log routines
33 * ---------------------------
34 * Routines in this suite implement the part of the FITS World Coordinate
35 * System (WCS) standard that deals with logarithmic coordinates, as described
36 * in
37 *
38 * "Representations of world coordinates in FITS",
39 * Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)
40 *
41 * "Representations of spectral coordinates in FITS",
42 * Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.
43 * 2006, A&A, 446, 747 (WCS Paper III)
44 *
45 * These routines define methods to be used for computing logarithmic world
46 * coordinates from intermediate world coordinates (a linear transformation of
47 * image pixel coordinates), and vice versa.
48 *
49 * logx2s() and logs2x() implement the WCS logarithmic coordinate
50 * transformations.
51 *
52 * Argument checking:
53 * ------------------
54 * The input log-coordinate values are only checked for values that would
55 * result in floating point exceptions and the same is true for the
56 * log-coordinate reference value.
57 *
58 * Accuracy:
59 * ---------
60 * No warranty is given for the accuracy of these routines (refer to the
61 * copyright notice); intending users must satisfy for themselves their
62 * adequacy for the intended purpose. However, closure effectively to within
63 * double precision rounding error was demonstrated by test routine tlog.c
64 * which accompanies this software.
65 *
66 *
67 * logx2s() - Transform to logarithmic coordinates
68 * -----------------------------------------------
69 * logx2s() transforms intermediate world coordinates to logarithmic
70 * coordinates.
71 *
72 * Given and returned:
73 * crval double Log-coordinate reference value (CRVALia).
74 *
75 * Given:
76 * nx int Vector length.
77 *
78 * sx int Vector stride.
79 *
80 * slogc int Vector stride.
81 *
82 * x const double[]
83 * Intermediate world coordinates, in SI units.
84 *
85 * Returned:
86 * logc double[] Logarithmic coordinates, in SI units.
87 *
88 * stat int[] Status return value status for each vector element:
89 * 0: Success.
90 *
91 * Function return value:
92 * int Status return value:
93 * 0: Success.
94 * 2: Invalid log-coordinate reference value.
95 *
96 *
97 * logs2x() - Transform logarithmic coordinates
98 * --------------------------------------------
99 * logs2x() transforms logarithmic world coordinates to intermediate world
100 * coordinates.
101 *
102 * Given and returned:
103 * crval double Log-coordinate reference value (CRVALia).
104 *
105 * Given:
106 * nlogc int Vector length.
107 *
108 * slogc int Vector stride.
109 *
110 * sx int Vector stride.
111 *
112 * logc const double[]
113 * Logarithmic coordinates, in SI units.
114 *
115 * Returned:
116 * x double[] Intermediate world coordinates, in SI units.
117 *
118 * stat int[] Status return value status for each vector element:
119 * 0: Success.
120 * 1: Invalid value of logc.
121 *
122 * Function return value:
123 * int Status return value:
124 * 0: Success.
125 * 2: Invalid log-coordinate reference value.
126 * 4: One or more of the world-coordinate values
127 * are incorrect, as indicated by the stat vector.
128 *
129 *
130 * Global variable: const char *log_errmsg[] - Status return messages
131 * ------------------------------------------------------------------
132 * Error messages to match the status value returned from each function.
133 *
134 *===========================================================================*/
135 
136 #ifndef WCSLIB_LOG
137 #define WCSLIB_LOG
138 
139 #ifdef __cplusplus
140 extern "C" {
141 #endif
142 
143 extern const char *log_errmsg[];
144 
146  LOGERR_SUCCESS = 0, // Success.
147  LOGERR_NULL_POINTER = 1, // Null pointer passed.
148  LOGERR_BAD_LOG_REF_VAL = 2, // Invalid log-coordinate reference value.
149  LOGERR_BAD_X = 3, // One or more of the x coordinates were
150  // invalid.
151  LOGERR_BAD_WORLD = 4 // One or more of the world coordinates were
152  // invalid.
153 };
154 
155 int logx2s(double crval, int nx, int sx, int slogc, const double x[],
156  double logc[], int stat[]);
157 
158 int logs2x(double crval, int nlogc, int slogc, int sx, const double logc[],
159  double x[], int stat[]);
160 
161 
162 #ifdef __cplusplus
163 }
164 #endif
165 
166 #endif // WCSLIB_LOG
LOGERR_NULL_POINTER
@ LOGERR_NULL_POINTER
Definition: log.h:147
logx2s
int logx2s(double crval, int nx, int sx, int slogc, const double x[], double logc[], int stat[])
Transform to logarithmic coordinates.
LOGERR_BAD_WORLD
@ LOGERR_BAD_WORLD
Definition: log.h:151
LOGERR_BAD_LOG_REF_VAL
@ LOGERR_BAD_LOG_REF_VAL
Definition: log.h:148
log_errmsg_enum
log_errmsg_enum
Definition: log.h:145
LOGERR_SUCCESS
@ LOGERR_SUCCESS
Definition: log.h:146
LOGERR_BAD_X
@ LOGERR_BAD_X
Definition: log.h:149
logs2x
int logs2x(double crval, int nlogc, int slogc, int sx, const double logc[], double x[], int stat[])
Transform logarithmic coordinates.
log_errmsg
const char * log_errmsg[]
Status return messages.