1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
2
3<!--Converted with LaTeX2HTML 2018.3 (Released July 19, 2018) -->
4<HTML lang="EN">
5<HEAD>
6<TITLE>pix2xxx,&nbsp;ang2xxx,&nbsp;vec2xxx,&nbsp;nest2ring,&nbsp;ring2nest</TITLE>
7<META NAME="description" CONTENT="pix2xxx,&nbsp;ang2xxx,&nbsp;vec2xxx,&nbsp;nest2ring,&nbsp;ring2nest">
8<META NAME="keywords" CONTENT="csub">
9<META NAME="resource-type" CONTENT="document">
10<META NAME="distribution" CONTENT="global">
11
12<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
13<META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0">
14<META NAME="Generator" CONTENT="LaTeX2HTML v2018.3">
15   <link rel='apple-touch-icon' sizes='180x180' href='images/favicons/apple-touch-icon.png?v=2017'>
16   <link rel='icon' type='image/png' sizes='32x32' href='images/favicons/favicon-32x32.png?v=2017'>
17   <link rel='icon' type='image/png' sizes='16x16' href='images/favicons/favicon-16x16.png?v=2017'>
18   <link rel='manifest' href='images/favicons/manifest.json?v=2017'>
19   <link rel='mask-icon' href='images/favicons/safari-pinned-tab.svg?v=2017' color='#5bbad5'>
20   <link rel='shortcut icon' href='images/favicons/favicon.ico?v=2017'>
21   <meta name='apple-mobile-web-app-title' content='HEALPix'>
22   <meta name='application-name' content='HEALPix'>
23   <meta name='msapplication-config' content='images/favicons/browserconfig.xml?v=2017'>
24   <meta name='theme-color' content='#ffffff'>
25
26<LINK REL="STYLESHEET" HREF="csub.css">
27
28<LINK REL="next" HREF="csub_read_healpix_map.htm">
29<LINK REL="previous" HREF="csub_nside2npix.htm">
30<LINK REL="next" HREF="csub_read_healpix_map.htm">
31</HEAD>
32
33<body text="#000000" bgcolor="#FFFFFA">
34
35<DIV CLASS="navigation"><!--Navigation Panel-->
36<A
37 HREF="csub_nside2npix.htm">
38<IMG WIDTH="63" HEIGHT="24" ALT="previous" SRC="prev.png"></A>
39<A
40 HREF="csub_HEALPix_C_subroutines.htm">
41<IMG WIDTH="26" HEIGHT="24" ALT="up" SRC="up.png"></A>
42<A
43 HREF="csub_read_healpix_map.htm">
44<IMG WIDTH="37" HEIGHT="24" ALT="next" SRC="next.png"></A>
45<A ID="tex2html48"
46  HREF="csub_Contents.htm">
47<IMG WIDTH="65" HEIGHT="24" ALT="contents" SRC="contents.png"></A>
48<BR>
49<B> Previous:</B> <A
50 HREF="csub_nside2npix.htm">nside2npix</A>
51
52<B>Up:</B> <A
53 HREF="csub_HEALPix_C_subroutines.htm">HEALPix/C subroutines</A>
54
55<B> Next:</B> <A
56 HREF="csub_read_healpix_map.htm">read_healpix_map</A>
57<B> Top:</B> <a href="main.htm">Main Page</a></DIV>
58<!--End of Navigation Panel-->
59
60<H1><A ID="SECTION1000"></A>
61<A ID="csub:pix_tools"></A>
62<BR>
63
64</H1>
65
66<P>
67<b><font size=+6><FONT COLOR="#CC0000">pix2xxx,&nbsp;ang2xxx,&nbsp;vec2xxx, nest2ring,&nbsp;ring2nest</FONT></font></b><hr>
68<H3>These subroutines can be used to convert between pixel number in the
69<b>HEALPix</b> map and <SPAN CLASS="MATH"><IMG STYLE="height: 2.33ex; vertical-align: -0.68ex; " SRC="csub_img5.png"
70 ALT="$(\theta,\phi) $"></SPAN> coordinates on the sphere. This is only a
71subset of the routines equivalent in Fortran90 or in IDL. </H3>
72Location in HEALPix directory tree: <a href="https://sourceforge.net/p/healpix/code/1005/tree/trunk/src/C/subs/chealpix.c"><b>src/C/subs/chealpix.c</b></a>&nbsp;
73
74<P>
75<hr><H1>ARGUMENTS</H1>
76
77<TABLE CELLPADDING=3 BORDER="1">
78<TR><TH ALIGN="LEFT" VALIGN="TOP" WIDTH=140><SPAN  CLASS="textbf">name&nbsp;&amp;&nbsp;dimensionality</SPAN></TH>
79<TH ALIGN="LEFT" VALIGN="TOP" WIDTH=50><SPAN  CLASS="textbf">type</SPAN></TH>
80<TH ALIGN="LEFT" VALIGN="TOP" WIDTH=25><SPAN  CLASS="textbf">in/out</SPAN></TH>
81<TH ALIGN="LEFT" VALIGN="TOP" WIDTH=235><SPAN  CLASS="textbf">description</SPAN></TH>
82</TR>
83<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=140>&nbsp;</TD>
84<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>&nbsp;</TD>
85<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>&nbsp;</TD>
86<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=235>&nbsp;</TD>
87</TR>
88<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=140>
89nside</TD>
90<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>long</TD>
91<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>IN</TD>
92<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=235><!-- MATH
93 $N_{\mathrm{side}}$
94 -->
95<SPAN CLASS="MATH"><I>N</I><SUB>side</SUB></SPAN> parameter for the <b>HEALPix</b> map.</TD>
96</TR>
97<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=140>ipnest</TD>
98<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>long</TD>
99<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>--</TD>
100<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=235>pixel identification number in NESTED scheme over the range {0,<!-- MATH
101 $N_{\mathrm{pix}}-1$
102 -->
103<SPAN CLASS="MATH"><I>N</I><SUB>pix</SUB>-1</SPAN>}.</TD>
104</TR>
105<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=140>ipring</TD>
106<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>long</TD>
107<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>--</TD>
108<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=235>pixel identification number in RING scheme over the range {0,<!-- MATH
109 $N_{\mathrm{pix}}-1$
110 -->
111<SPAN CLASS="MATH"><I>N</I><SUB>pix</SUB>-1</SPAN>}.</TD>
112</TR>
113<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=140>theta</TD>
114<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>double</TD>
115<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>--</TD>
116<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=235>colatitude in radians measured southward from north pole in [0,<SPAN CLASS="MATH"><IMG STYLE="height: 1.11ex; vertical-align: -0.10ex; " SRC="csub_img2.png"
117 ALT="$\pi$"></SPAN>].</TD>
118</TR>
119<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=140>phi</TD>
120<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>double</TD>
121<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>--</TD>
122<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=235>longitude in radians, measured eastward in [0,<SPAN CLASS="MATH"><IMG STYLE="height: 1.57ex; vertical-align: -0.10ex; " SRC="csub_img9.png"
123 ALT="$2\pi$"></SPAN>].</TD>
124</TR>
125<TR><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=140>vector</TD>
126<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=50>double</TD>
127<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=25>--</TD>
128<TD ALIGN="LEFT" VALIGN="TOP" WIDTH=235>3D cartesian position vector <SPAN CLASS="MATH">(<I>x</I>,<I>y</I>,<I>z</I>)</SPAN>. The north pole is <SPAN CLASS="MATH">(0,0,1)</SPAN>. An output vector is normalised to unity.</TD>
129</TR>
130</TABLE>
131
132<P>
133
134<BIG CLASS="LARGE"><SPAN  CLASS="textbf">ROUTINES: </SPAN></BIG>
135<BR>
136<TT>void  pix2ang_ring(long nside, long ipring, double *theta, double *phi);</TT>
137
138<P>
139<TABLE CELLPADDING=3>
140<TR><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=150>&nbsp;</TD>
141<TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=350>renders <EM>theta</EM> and <EM>phi</EM> coordinates of the nominal pixel center given the pixel number <EM>ipring</EM> and a map resolution parameter <EM>nside</EM>.</TD>
142<TD ALIGN="LEFT">&nbsp;</TD></TR>
143</TABLE>
144<BR>
145<BR><TT>void  pix2vec_ring(long nside, long ipring, double *vector);</TT>
146
147<P>
148<TABLE CELLPADDING=3>
149<TR><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=150>&nbsp;</TD>
150<TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=350>renders cartesian vector coordinates of the nominal pixel center given the pixel number <EM>ipring</EM> and a map resolution parameter <EM>nside</EM>. Optionally renders cartesian vector coordinates of the considered pixel four vertices.</TD>
151<TD ALIGN="LEFT">&nbsp;</TD></TR>
152</TABLE>
153<BR>
154<BR><TT>void  ang2pix_ring(long nside, double theta, double phi, long *ipring);</TT>
155
156<P>
157<TABLE CELLPADDING=3>
158<TR><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=150>&nbsp;</TD>
159<TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=350>renders the pixel number <EM>ipring</EM> for a pixel which, given the map resolution parameter <EM>nside</EM>, contains the point on the sphere at angular coordinates <EM>theta</EM> and <EM>phi</EM>.</TD>
160<TD ALIGN="LEFT">&nbsp;</TD></TR>
161</TABLE>
162<BR>
163<BR><TT>void  vec2pix_ring(long nside, double *vector, long *ipring);</TT>
164
165<P>
166<TABLE CELLPADDING=3>
167<TR><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=150>&nbsp;</TD>
168<TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=350>renders the pixel number <EM>ipring</EM> for a pixel which, given the map resolution parameter <EM>nside</EM>, contains the point on the sphere at cartesian coordinates <EM>vector</EM>.</TD>
169<TD ALIGN="LEFT">&nbsp;</TD></TR>
170</TABLE>
171<BR>
172<BR><TT>void  pix2ang_nest(long nside, long ipnest, double *theta, double *phi);</TT>
173
174<P>
175<TABLE CELLPADDING=3>
176<TR><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=150>&nbsp;</TD>
177<TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=350>renders <EM>theta</EM> and <EM>phi</EM> coordinates of the nominal pixel center given the pixel number <EM>ipnest</EM> and a map resolution parameter <EM>nside</EM>.</TD>
178<TD ALIGN="LEFT">&nbsp;</TD></TR>
179</TABLE>
180<BR>
181<BR><TT>void  pix2vec_nest(long nside, long ipnest, double *vector);</TT>
182
183<P>
184<TABLE CELLPADDING=3>
185<TR><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=150>&nbsp;</TD>
186<TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=350>renders cartesian vector coordinates of the nominal pixel center given the pixel number <EM>ipnest</EM> and a map resolution parameter <EM>nside</EM>. Optionally renders cartesian vector coordinates of the considered pixel four vertices.</TD>
187<TD ALIGN="LEFT">&nbsp;</TD></TR>
188</TABLE>
189<BR>
190<BR><TT>void  ang2pix_nest(long nside, double theta, double phi, long *ipnest);</TT>
191
192<P>
193<TABLE CELLPADDING=3>
194<TR><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=150>&nbsp;</TD>
195<TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=350>renders the pixel number <EM>ipnest</EM> for a pixel which, given the map resolution parameter <EM>nside</EM>, contains the point on the sphere at angular coordinates <EM>theta</EM> and <EM>phi</EM>.</TD>
196<TD ALIGN="LEFT">&nbsp;</TD></TR>
197</TABLE>
198<BR>
199<BR><TT>void  vec2pix_nest(long nside, double *vector, long *ipnest)</TT>
200
201<P>
202<TABLE CELLPADDING=3>
203<TR><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=150>&nbsp;</TD>
204<TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=350>renders the pixel number
205                        <EM>ipnest</EM> for a pixel which, given the map
206                        resolution parameter <EM>nside</EM>, contains the
207                        point on the sphere at cartesian coordinates
208                        <EM>vector</EM> .</TD>
209<TD ALIGN="LEFT">&nbsp;</TD></TR>
210</TABLE>
211<BR>
212<BR>
213<P>
214<TT>void  nest2ring(long nside, long ipnest, long *ipring);</TT>
215
216<P>
217<TABLE CELLPADDING=3>
218<TR><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=150>&nbsp;</TD>
219<TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=350>performs conversion from NESTED to RING pixel number.</TD>
220<TD ALIGN="LEFT">&nbsp;</TD></TR>
221</TABLE>
222<BR>
223<BR><TT>void  ring2nest(long nside, long ipring, long *ipnest);</TT>
224
225<P>
226<TABLE CELLPADDING=3>
227<TR><TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=150>&nbsp;</TD>
228<TD ALIGN="LEFT">&nbsp;</TD><TD ALIGN="LEFT" VALIGN="TOP" WIDTH=350>performs conversion from RING to NESTED pixel number.</TD>
229<TD ALIGN="LEFT">&nbsp;</TD></TR>
230</TABLE>
231<BR>
232<BR>
233<P>
234<hr><H1>MODULES & ROUTINES</H1><H3>This section lists the modules and routines used by <FONT COLOR="#CC0000">pix2xxx,&nbsp;ang2xxx,&nbsp;vec2xxx, nest2ring,&nbsp;ring2nest</FONT>.</h3>
235  <DL COMPACT><DT>
236<B>mk_pix2xy, mk_xy2pix</B>
237<DD>routines used in the conversion between pixel values and &ldquo;cartesian&rdquo; coordinates on the Healpix face.
238  </DL>
239
240<P>
241<hr><H1>RELATED ROUTINES</H1><h3>This section lists the routines related to <b><FONT COLOR="#CC0000">pix2xxx,&nbsp;ang2xxx,&nbsp;vec2xxx, nest2ring,&nbsp;ring2nest</FONT></b></h3>
242
243  <DL COMPACT><DT>
244<B><A HREF="csub_ang2vec.htm#csub:ang2vec">ang2vec</A></B>
245<DD>converts <SPAN CLASS="MATH"><IMG STYLE="height: 2.33ex; vertical-align: -0.68ex; " SRC="csub_img5.png"
246 ALT="$(\theta,\phi) $"></SPAN> spherical coordinates into <SPAN CLASS="MATH">(<I>x</I>,<I>y</I>,<I>z</I>)</SPAN> cartesian coordinates.
247  <DT>
248<B><A HREF="csub_vec2ang.htm#csub:vec2ang">vec2ang</A></B>
249<DD>converts <SPAN CLASS="MATH">(<I>x</I>,<I>y</I>,<I>z</I>)</SPAN> cartesian coordinates into <SPAN CLASS="MATH"><IMG STYLE="height: 2.33ex; vertical-align: -0.68ex; " SRC="csub_img5.png"
250 ALT="$(\theta,\phi) $"></SPAN> spherical coordinates.
251  <DT>
252<B><A HREF="csub_nside2npix.htm#csub:nside2npix">nside2npix</A></B>
253<DD>converts number of full sky
254pixels <!-- MATH
255 $N_{\mathrm{pix}}$
256 -->
257<SPAN CLASS="MATH"><I>N</I><SUB>pix</SUB></SPAN> into resolution parameter <!-- MATH
258 $N_{\mathrm{side}}$
259 -->
260<SPAN CLASS="MATH"><I>N</I><SUB>side</SUB></SPAN>
261  <DT>
262<B><A HREF="csub_npix2nside.htm#csub:npix2nside">npix2nside</A></B>
263<DD>converts <!-- MATH
264 $N_{\mathrm{side}}$
265 -->
266<SPAN CLASS="MATH"><I>N</I><SUB>side</SUB></SPAN> into number of
267full sky pixels <!-- MATH
268 $N_{\mathrm{pix}}$
269 -->
270<SPAN CLASS="MATH"><I>N</I><SUB>pix</SUB></SPAN>.
271  </DL>
272
273<P>
274
275<P>
276
277
278<P>
279
280<P>
281
282<DIV CLASS="navigation"><HR>
283<!--Navigation Panel-->
284<A
285 HREF="csub_nside2npix.htm">
286<IMG WIDTH="63" HEIGHT="24" ALT="previous" SRC="prev.png"></A>
287<A
288 HREF="csub_HEALPix_C_subroutines.htm">
289<IMG WIDTH="26" HEIGHT="24" ALT="up" SRC="up.png"></A>
290<A
291 HREF="csub_read_healpix_map.htm">
292<IMG WIDTH="37" HEIGHT="24" ALT="next" SRC="next.png"></A>
293<A ID="tex2html48"
294  HREF="csub_Contents.htm">
295<IMG WIDTH="65" HEIGHT="24" ALT="contents" SRC="contents.png"></A>
296<BR>
297<B> Previous:</B> <A
298 HREF="csub_nside2npix.htm">nside2npix</A>
299
300<B>Up:</B> <A
301 HREF="csub_HEALPix_C_subroutines.htm">HEALPix/C subroutines</A>
302
303<B> Next:</B> <A
304 HREF="csub_read_healpix_map.htm">read_healpix_map</A>
305<B> Top:</B> <a href="main.htm">Main Page</a></DIV>
306<!--End of Navigation Panel-->
307<ADDRESS>
308Version 3.50, 2018-12-10
309</ADDRESS>
310</BODY>
311</HTML>
312