Skip to content
Open
11 changes: 6 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@
DOCNAME = moc

# count up; you probably do not want to bother with versions <1.0
DOCVERSION = 2.0
DOCVERSION = 2.1

# Publication date, ISO format; update manually for "releases"
DOCDATE = 2022-07-27
DOCDATE = 2026-06-01

# What is it you're writing: NOTE, WD, PR, or REC
DOCTYPE = REC
DOCTYPE = WD

# Source files for the TeX document (but the main file must always
# be called $(DOCNAME).tex

SOURCES = $(DOCNAME).tex role_diagram.pdf appendix_algo.tex appendix_json.tex \
appendix_perf.tex table1.tex table2.tex table3.tex
SOURCES = $(DOCNAME).tex role_diagram.pdf \
appendix_algo.tex appendix_json.tex appendix_perf.tex appendix_fmoc1.tex appendix_custom.tex \
table1.tex table2.tex table3.tex tablef.tex

# List of pixel image files to be included in submitted package
FIGURES = healpix.jpg kilo.png kilo1.png kilo2.png kilo3.png kilo4.png role_diagram.svg \
Expand Down
17 changes: 17 additions & 0 deletions appendix_custom.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
\section{User define quantity MOC conventions\label{sec:udmoc1}}

The conventions adopted for FMOCs are generic and could be applied to any quantity
$q$ numerically represented as a 64-bit floating-point value.
A user wishing to define a custom QMOC (where $Q$ stands for Quantity) would only need to specify:
\begin{itemize}
\item the validity range of the quantity: $[q_{min}, q_{max}[$;
\item the mapping function: $g_q: [q_{min}, q_{max}[ \rightarrow [0,1[$.
\end{itemize}

However, one of the advantages of MOCs is the use of standardized quantities expressed
in well-defined units and reference systems.
In order to perform efficient and meaningful set operations between two MOCs, both MOCs must
be defined using the same quantity, expressed in the same units, and using
the same validity interval and mapping function.

Poorly constrained or insufficiently documented user-defined quantities may therefore compromise the interoperability of MOCs.
98 changes: 98 additions & 0 deletions appendix_fmoc1.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
\section{Previous frequency indexing convention\label{sec:apx:fmoc1}}

This section describes the frequency axis indexing scheme that was initially explored before
the current standardized version. Documenting it here serves two purposes:
\begin{itemize}
\item to document earlier versions of FMOC and SFMOC files that may still exist;
\item to record an already explored solution and thus avoid attempting to reintroduce it in the future.
\end{itemize}

The original idea was to (almost) directly use, as the index at the deepest level,
the integer representation of the 64-bit floating-point value of a frequency expressed in Hz.
Performing MOC operations (except \textit{degrade}) on floating-point ranges is equivalent to
performing them on the corresponding integer representation ranges because:
\begin{itemize}
\item frequencies are strictly positive values;
\item for positive floating-point numbers, the numerical ordering is identical to the ordering of their
integer bit representations.
\end{itemize}

The only difference was that the exponent range of a 64-bit floating-point value was considered too
large for the intended use. Therefore, it was restricted to raw exponent values
$\in [929, 1184]$ instead of the full IEEE~754 range $\in [0, 2047]$.
The selected interval contains 255 distinct values and therefore requires 8 bits
instead of the 11 bits used in standard double-precision representation.
Using the 52 mantissa bits together with these 8 exponent bits leads to 60 hierarchical
orders, with a maximum order of 59. This also defines the, somewhat arbitrary, validity range
$f \in [5.0487097934144756 \times 10^{-29},\; 5.846006549323611 \times 10^{48}[$.
The following pseudo-code describes the transformation, which replaces the
11-bit exponent $\in [929,1184]$ of a floating-point value with an 8-bit exponent
$\in [0,255]$.
\lstdefinelanguage{Pseudocode}{
keywords={input, output, return, datatype, function, in, if, else, foreach, while, begin, end
},
sensitive=false,
comment=[l]{//},
morecomment=[s]{/*}{*/},
morestring=[b]',
morestring=[b]"
}
\begin{lstlisting}[language=Pseudocode,mathescape=true,caption=Frequency in Hz to order 59 index routine,label={code:freq2index}]
Input: long float freq_hz
Output: long int index
begin
// Set the 64-bits float exponent bits mask
long int emask $\gets$ 0x7FF << 52
// Set the mantissa (+sign) bits mask
long int mmask $\gets$ !emask
// Get the bits level representation of the input frequency
long int index = freq_hz.to_bits();
// Extract the exponent from the input frequency
long int exp $\gets$ (index & emask) >> 52;
// Replace the exponent value in [929, 1184] by a value in [0, 255]
exp $\gets$ exp - 929
// Replace the 11 exponent bits by the new 8 exponent bits
index $\gets$ (index & mmask) | (exp << 52)
return index
end
\end{lstlisting}


\begin{lstlisting}[language=Pseudocode,mathescape=true,caption=Frequency in Hz from order 59 index routine,label={code:index2freq}]
Input: long int index
Output: long float freq_hz
begin
// Set the 64-bits float exponent bits mask
long int emask $\gets$ 0x7FF << 52
// Set the mantissa (+sign) bits mask
long int mmask $\gets$ !emask
// Extract the exponent part in [0, 255]
long int exp = (index & emask) >> 52;
// Replace epxonent value in [0, 255] by value in [929, 1184]
exp $\gets$ exp + 929
// Replace 8 exponent bits by 11 exponent bits
index $\gets$ (index & mmask) | (exp << 52)
// Transform bit representation into float value
return index.f64_value_from_bits()
end
\end{lstlisting}

One advantage of this approach was the existence of a perfect bijection between the
64-bit floating-point representation of a frequency (in Hz) within the valid range and
its index at the deepest resolution. The conversions were also extremely fast, requiring
only a few bitwise operations. In addition, the number of orders (60) was not limited to
the number of mantissa bits.

However, a major issue arose from the representation of the axis using WCS, as used in HiPS 2.0.
Because the representation allocates 8 bits to the exponent and 52 bits to the mantissa,
the resulting WCS cannot be expressed purely as either linear or logarithmic.
For orders 0 to 7, the WCS behaves logarithmically.
For orders 8 to 59, inside a cell or order at least 7, it behaves linearly.
For ranges spanning order 7, however, the WCS becomes a mixture of logarithmic and linear
components, which cannot be represented easily.
This limitation was the primary motivation for abandoning this approach.





5 changes: 4 additions & 1 deletion appendix_json.tex
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ \section{JSON encoding}
of the MOC (MOCORDER) is greater than the greatest stored order, the
MOCORDER should be provided with an empty index list.

\paragraph{Example of a JSON SMOC or TMOC:}
Although we expect index arrays to be sorted, we cannot impose
the same constraint on orders, since JSON object members are considered unordered.

\paragraph{Example of a JSON SMOC:}
\par\noindent
\begin{lstlisting}[]
{"1":[1,2,4], "2":[12,13,14,21,23,25], "8":[]}
Expand Down
64 changes: 64 additions & 0 deletions appendix_packing.tex
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
\section{SUNIQ and ZUNIQ packaging}

Although they are not used in this standard, the SUNIQ and ZUNIQ packing schemes
are implemented in some MOC libraries and are therefore briefly described here.
They are valid with all quantities.

\subsection{SUNIQ packaging}

SUNIQ provides a generalized alternative to the UNIQ packing, which is specific to HEALPix indices.
Its main drawback is that it requires one additional bit.
SUNIQ relies on a sentinel bit (hence the “S” in SUNIQ).
Given a cell index $index$, the SUNIQ value is obtained by setting a sentinel bit immediately to the
left of the most significant bit (MSB) of the index.
The resulting expressions for HEALPix and TMOC/FMOC indices are:
\begin{eqnarray*}
suniq_{hpx} & = & 4^{order + 2} + index \\
suniq_{t/f} & = & 2^{order + 1} + index
\end{eqnarray*}

The inverse operation uses the {\textit leading\_zeros} function,
which returns the number of leading zeros in the binary representation of a 64-bit (unsigned) integer.
\begin{eqnarray*}
order_{hpx} & = & \frac{59 - leading\_zeros(suniq)}{2} \\
index_{hpx} & = & suniq - 4^{order + 2} \\
order_{t/f} & = & 62 - leading\_zeros(suniq) \\
index_{t/f} & = & suniq - 2^{order + 1}
\end{eqnarray*}

Sorting UNIQ or SUNIQ values produces the same ordering of cells: cells of lower order appear first,
and within a given order, cells are ordered by increasing index.


\subsection{ZUNIQ packaging}

ZUNIQ encodes both the cell index and its order in a single integer while preserving the
ordering of cells according to their ranges at the maximum resolution.
HEALPix indices correspond to the concatenation of 12 Z-order curves and therefore follow the
natural ordering of a multi-resoltuion Morton (Z-order) curve, which motivates the name ZUNIQ.
ZUNIQ is constructed from the starting index of the cell at the maximum resolution, left-shifted by one bit,
with the bit at the right of the least significant bit used as a sentinel.
This scheme is similar to the numbering used by
\textit{S2CellId} in the Google \textit{S2Geometry} library.
\begin{eqnarray*}
zuniq_{hpx} & = & 2 \times index_{29} + 4^{29-order}\\
zuniq_{t} & = & 2 \times index_{62} + 2^{62-order}\\
zuniq_{f} & = & 2 \times index_{52} + 2^{52-order}
\end{eqnarray*}
More generally:
\begin{eqnarray*}
zuniq_{hpx} & = & 2 \times index_{order_{max}} + 4^{order_{max}-order} \\
zuniq_{t/f} & = & 2 \times index_{order_{max}} + 2^{order_{max}-order}
\end{eqnarray*}

The inverse transformation uses the {\textit trailing\_zeros} function,
which returns the number of trailing zeros in the binary representation of a 64-bit unsigned integer:
\begin{eqnarray*}
order_{hpx} & = & 29 - \frac{trailing\_zeros(zuniq)}{2} \\
index_{hpx} & = & \frac{zuniq - 4^{order_{max}-order}}{2} \\
order_{t/f} & = & order_{max} - trailing\_zeros(zuniq) \\
index_{t/f} & = & \frac{zuniq - 2^{order_{max}-order}}{2}
\end{eqnarray*}
Sorting cells according to their ZUNIQ values enables efficient transformations between lists of cells
at mixed resolutions and lists of ranges.
More generally, such orderings allow efficient streamed operations.
46 changes: 46 additions & 0 deletions moc.bib
Original file line number Diff line number Diff line change
@@ -1,3 +1,49 @@
@article{cecconi_2023,
year = 2023,
title = {{Time-frequency catalogue: JSON implementation and python library}},
author = {Cecconi, Baptiste and Louis, Corentin K. and Bonnin, Xavier and Loh, Alan and Taylor, Mark B.},
journal = {Frontiers in Astronomy and Space Sciences},
doi = {10.3389/fspas.2022.1049677},
pages = {1049677},
volume = {9},
}

@misc{loh_2025,
year = 2025,
title = {{AlanLoh/nenupy}},
author = {Loh, Alan and Coutouly, Lucile and Girard, Julien N and Mauduit, Emilie and Viou, Cedric},
url = {https://github.com/AlanLoh/nenupy},
publisher = {{GitHub}},
}


@INPROCEEDINGS{zarka_2028,
author = {{Zarka}, Philippe and {Coffre}, Andree and {Denis}, Laurent and {Dumez-Viou}, Cedric and {Girard}, Julien and {Griessmeier}, Jean-Mathias and {Loh}, Alan and {Tagger}, Michel},
title = "{The Low-Frequency Beamformer and Imager NenuFAR}",
booktitle = {2018 2nd URSI Atlantic Radio Science Meeting (AT-RASC)},
year = 2018,
volume = {2},
month = may,
publisher = {IEEE},
eid = {308},
pages = {308},
doi = {10.23919/URSI-AT-RASC.2018.8471463},
}

@MISC{2022ivoa.spec.0727F,
author = {{Fernique}, Pierre and {Nebot}, Ada and {Durand}, Daniel and {Baumann}, Matthieu and {Boch}, Thomas and {Greco}, Giuseppe and {Donaldson}, Tom and {Pineau}, Francois-Xavier and {Taylor}, Mark and {O'Mullane}, Wil and {Reinecke}, Martin and {Derri{\`e}re}, S{\'e}bastien},
title = "{MOC: Multi-Order Coverage map Version 2.0}",
howpublished = {IVOA Recommendation 27 July 2022},
year = 2022,
month = jul,
pages = {727},
doi = {10.5479/ADS/bib/2022ivoa.spec.0727F},
adsurl = {https://ui.adsabs.harvard.edu/abs/2022ivoa.spec.0727F},
adsnote = {Provided by the SAO/NASA Astrophysics Data System}
}



@MISC{2021ivoa.spec.1101D,
author = {{Dowler}, Patrick and {Evans}, Janet and {Arviset}, Christophe and {Gaudet}, Severin and {Technical Coordination Group}},
title = "{IVOA Architecture Version 2.0}",
Expand Down
Loading
Loading