S2DW code documentation

By Jason McEwen and Yves Wiaux

The S2DW code provides functionality to perform the scale discretised wavelet transform on the sphere developed in our paper: Exact reconstruction with directional wavelets on the sphere (ArXiv|DOI). Routines are provided to compute wavelet and scaling coefficients from the spherical harmonic coefficients of a signal on the sphere and to synthesise the spherical harmonic coefficients of the original signal from its wavelet and scaling coefficients. The reconstruction of the spherical harmonic coefficients of the original signal is exact to numerical precision. Typically, maximum reconstruction errors are of the order 10^(-12) or smaller. Please see our paper for further details of the wavelet transform and a discussion of typical reconstruction errors and execution times of this implementation.

It is considerably more accurate and efficient to perform our wavelet transform on the sphere in harmonic space, hence this is the approach adopted in the S2DW code. The S2DW library itself considers only the spherical harmonic representation of data defined on the sphere and not real space representations. Many different pixelisations schemes for the sphere exist, with corresponding algorithms to perform forward and inverse spherical harmonic transforms. These algorithms are not always exact, hence the core functionality of the S2DW code operates on the spherical harmonic coefficients of signals only. Users are then free to use any pixelisation of the sphere and the computation of spherical harmonic coefficients is the users' concern.

A number of optional utility programs are also provided in the S2DW code. These enable users to perform the scale discretised wavelet transform on data defined on the sphere in real space. The HEALPix pixelisation of the sphere is adopted for this purpose. The spherical harmonic transform on a HEALPix pixelisation is not exact, hence the reconstruction accuracy of our S2DW code for real space data is limited by the accuracy of the forward and inverse spherical harmonic transforms provided by HEALPix.

For further details see the README.txt file.


Installation

The S2DW library requires only the FFTW and CFITSIO packages. If one wishes to also use the utility programs then the HEALPix and S2 packages are also required. Please note that all S2DW code is written in Fortran 90 and a suitable Fortran compiler will be required.

Compiling library

Before compiling you may need to edit the makefile to specify your compiler and to link with the appropriate libraries. Once you have set the makefile up for your system then the S2DW library may be compilied by running:
>> make lib
For details on how to use the S2DW library code see the documentation below.

Testing

A test program is provided to test the installation of the S2DW library. To make this program simply run:
>> make test
The test may then be performed by running:
>> make runtest
If you see the message 'Tests passed!' printed then the S2DW library has been installed correctly and is reconstructing the spherical harmonic coefficients of a random test signal exactly from its wavelet and scaling coefficients. By default the test is performed at a band limit of B=64. To run the test for other band limits run:
>> ./bin/s2dw_test xx
where xx is the band limit of the test.

Compiling utility programs

The utility programs require the HEALPix and S2 packages to handle real space representations of data on the sphere (these are not required for the S2DW library). Before attempting to compile the utility programs please ensure that these libraries are linked correctly in the makefile. Once these libraries are linked you may compile the S2DW utility programs by running:

>> make prog
For details on how to use the S2DW utility programs see the documentation below.

Documentation

By default, the S2DW code ships with only this single documentation page. The remainder of the documentation is automatically generated from the source code using f90doc. Please ensure that you have f90doc installed in order to generate this documentation. Once f90doc is installed the documentation may be generated by running:

>> make docs

Cleaning up

To clean up your version of the S2DW code and return all code to its original state run:
>> make clean
To remove all documentation, except the front page (i.e. this file), run:
>> make cleandocs

Library documentation

The S2DW library contains all functionality to compute the scale discretised wavelet transform on the sphere from the spherical harmonic coefficients of a signal. Real space representations of signals on the sphere are not considered. An overview of the modules that comprise the S2DW library is given here. Please click on the link for each module for detailed documentation.

s2dw_core_mod: Provides core functionality to perform a scale discretised wavelet transform on the sphere.

s2dw_dl_mod: Functionality to compute specified plane of the Wigner dl matrix.

s2dw_stat_mod: Functionality to compute statistics of wavelet coefficients.

s2dw_error_mod: Functionality to handle errors that may occur in the S2DW library. Public S2DW error codes are defined, with corresponding private error comments and default halt execution status.

s2dw_fileio_mod: Functionality to read and write S2DW formatted fits files containing wavelet and scaling coefficients.

s2dw_types_mod: Definition of intrinsic types and constants used in the S2DW library.


Utility program documentation

The S2DW utility programs provide functionality for dealing with data on the sphere in real space, where the HEALPix pixelisation of the sphere is adopted. Once spherical harmonic coefficients are computed, the utility programs make use to the S2DW library to perform the scale discretised wavelet transform on the sphere. Please click on the link for each program for detailed documentation.

s2dw_analysis: Computes the S2DW wavelet and scaling coefficients of a Healpix sky map.

s2dw_synthesis: Reconstructs a Healpix sky map from S2DW wavelet and scaling coefficients.

s2dw_test: Performs S2DW transform analysis and synthesis and check that the original signal is reconstructed exactly (to numerical precision). Note that this utility program does not deal with real space representations of data on the sphere and hence does not require the HEALPix or S2 packages.

s2dw_wav2sky: Converts wavelet coefficients read from a S2DW formatted fits/matlab file to a sky Healpix fits file.

s2dw_wavplot: Computes a Healpix sky map of wavelet for a given j for subsequent plotting.

s2dw_fits2mat: Converts a fits S2DW file containing wavelet and scaling coefficients to a matlab S2DW file.

s2dw_mat2fits: Converts a matlab S2DW file containing wavelet and scaling coefficients to a fits S2DW file.


MATLAB usage

The data associated with a scale discretised wavelet tranform of a signal (including wavelet and scaling coefficients and other parameters) may be written to either a FITS or Matlab m file. The binary FITS files are considerably smaller and faster to read/write. However, for users who wish to analyse wavelet coefficients in Matlab it is also possible to write matlab readable m files. Utility routines also exist to convert between these two file types. A Matlab routine to write the data back to an m file from within Matlab is provided in the ./matlab subdirectory:

s2dw_matlab_wav_write.m: Write S2DW data manipulated in Matlab to a S2DW m file that can be read by Matlab and the S2DW Fortran code.


Support

For support or to report any bugs please contact Jason McEwen (jason.mcewen AT ucl.ac.uk).

Version

Authors: J. D. McEwen & Y. Wiaux

Version: 1.1 - August 2013

Version History


License

S2DW package to compute the scale discretised wavelet transform on the sphere
Copyright (C) 2008 Yves Wiaux & Jason McEwen

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details (LICENSE.txt).

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.


Acknowledgements

We thank Gilles Puy very much for testing the S2DW code.

The code to compute Wigner dl functions was provided by Daniel Mortlock.

This documentation has been generated largely by f90doc, with some minor modifications.


Last modified: December 2008