WCSLIB: log.h Source File

WCSLIB 8.9

Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1/*============================================================================
2 WCSLIB 8.9 - an implementation of the FITS WCS standard.
3 Copyright (C) 1995-2026, 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 Author: Mark Calabretta, Australia Telescope National Facility, CSIRO.
21 http://www.atnf.csiro.au/computing/software/wcs
22 $Id: log.h,v 8.9 2026/06/18 13:00:03 mcalabre Exp $
23*=============================================================================
24*
25* WCSLIB 8.9 - C routines that implement the FITS World Coordinate System
26* (WCS) standard. Refer to the README file provided with WCSLIB for an
27* overview of the library.
28*
29*
30* Summary of the log routines
31* ---------------------------
32* Routines in this suite implement the part of the FITS World Coordinate
33* System (WCS) standard that deals with logarithmic coordinates, as described
34* in
35*
36* "Representations of world coordinates in FITS",
37* Greisen, E.W., & Calabretta, M.R. 2002, A&A, 395, 1061 (WCS Paper I)
38*
39* "Representations of spectral coordinates in FITS",
40* Greisen, E.W., Calabretta, M.R., Valdes, F.G., & Allen, S.L.
41* 2006, A&A, 446, 747 (WCS Paper III)
42*
43* These routines define methods to be used for computing logarithmic world
44* coordinates from intermediate world coordinates (a linear transformation of
45* image pixel coordinates), and vice versa.
46*
47* logx2s() and logs2x() implement the WCS logarithmic coordinate
48* transformations.
49*
50* Argument checking:
51* ------------------
52* The input log-coordinate values are only checked for values that would
53* result in floating point exceptions and the same is true for the
54* log-coordinate reference value.
55*
56* Accuracy:
57* ---------
58* No warranty is given for the accuracy of these routines (refer to the
59* copyright notice); intending users must satisfy for themselves their
60* adequacy for the intended purpose. However, closure effectively to within
61* double precision rounding error was demonstrated by test routine tlog.c
62* which accompanies this software.
63*
64*
65* logx2s() - Transform to logarithmic coordinates
66* -----------------------------------------------
67* logx2s() transforms intermediate world coordinates to logarithmic
68* coordinates.
69*
70* Given and returned:
71* crval double Log-coordinate reference value (CRVALia).
72*
73* Given:
74* nx int Vector length.
75*
76* sx int Vector stride.
77*
78* slogc int Vector stride.
79*
80* x const double[]
81* Intermediate world coordinates, in SI units.
82*
83* Returned:
84* logc double[] Logarithmic coordinates, in SI units.
85*
86* stat int[] Status return value status for each vector element:
87* 0: Success.
88*
89* Function return value:
90* int Status return value:
91* 0: Success.
92* 2: Invalid log-coordinate reference value.
93*
94*
95* logs2x() - Transform logarithmic coordinates
96* --------------------------------------------
97* logs2x() transforms logarithmic world coordinates to intermediate world
98* coordinates.
99*
100* Given and returned:
101* crval double Log-coordinate reference value (CRVALia).
102*
103* Given:
104* nlogc int Vector length.
105*
106* slogc int Vector stride.
107*
108* sx int Vector stride.
109*
110* logc const double[]
111* Logarithmic coordinates, in SI units.
112*
113* Returned:
114* x double[] Intermediate world coordinates, in SI units.
115*
116* stat int[] Status return value status for each vector element:
117* 0: Success.
118* 1: Invalid value of logc.
119*
120* Function return value:
121* int Status return value:
122* 0: Success.
123* 2: Invalid log-coordinate reference value.
124* 4: One or more of the world-coordinate values
125* are incorrect, as indicated by the stat vector.
126*
127*
128* Global variable: const char *log_errmsg[] - Status return messages
129* ------------------------------------------------------------------
130* Error messages to match the status value returned from each function.
131*
132*===========================================================================*/
133
134#ifndef WCSLIB_LOG
135#define WCSLIB_LOG
136
137#ifdef __cplusplus
138extern "C" {
139#endif
140
141extern const char *log_errmsg[];
142
143 enum log_errmsg_enum {
144 LOGERR_SUCCESS = 0, // Success.
145 LOGERR_NULL_POINTER = 1, // Null pointer passed.
146 LOGERR_BAD_LOG_REF_VAL = 2, // Invalid log-coordinate reference value.
147 LOGERR_BAD_X = 3, // One or more of the x coordinates were
148 // invalid.
149 LOGERR_BAD_WORLD = 4 // One or more of the world coordinates were
150 // invalid.
151};
152
153 int logx2s(double crval, int nx, int sx, int slogc, const double x[],
154 double logc[], int stat[]);
155
156 int logs2x(double crval, int nlogc, int slogc, int sx, const double logc[],
157 double x[], int stat[]);
158
159
160#ifdef __cplusplus
161}
162#endif
163
164#endif // WCSLIB_LOG
logx2s
int logx2s(double crval, int nx, int sx, int slogc, const double x[], double logc[], int stat[])
Transform to logarithmic coordinates.
log_errmsg
const char * log_errmsg[]
Status return messages.
log_errmsg_enum
log_errmsg_enum
Definition log.h:143
LOGERR_BAD_WORLD
@ LOGERR_BAD_WORLD
Definition log.h:149
LOGERR_SUCCESS
@ LOGERR_SUCCESS
Definition log.h:144
LOGERR_BAD_X
@ LOGERR_BAD_X
Definition log.h:147
LOGERR_NULL_POINTER
@ LOGERR_NULL_POINTER
Definition log.h:145
LOGERR_BAD_LOG_REF_VAL
@ LOGERR_BAD_LOG_REF_VAL
Definition log.h:146
logs2x
int logs2x(double crval, int nlogc, int slogc, int sx, const double logc[], double x[], int stat[])
Transform logarithmic coordinates.