Installing and using the C library

The core functionalities of S2LET are written in C and self-documented. The C library requires SSHT, SO3, and FFTW. The extra IO and Healpix features require the CFITSIO and HEALPIX libraries. To support HEALPIX, S2LET uses a hybrid C/Fortran interface to the Fortran HEALPIX library. Several examples, tests and demos are provided to demonstrate the usability of the C library.

Dependencies

S2LET requires the SSHT, SO3, and FFTW packages. Obviously suitable C and Fortran 90 compilers will be required to build the respective implementations. Linking with CFITSIO adds the FITS input-output functionalities for the MW sampling. Linking with HEALPIX adds support for the Healpix spherical harmonic transform as well as the FITS input-output routines.

Compiling

Makefiles are provided to build the code. However the locations of SSHT, SO3, FFTW and optionally CFITSIO and HEALPIX must be defined in Bash/Shell to be found by the Makefile. Alternatively you may declare them explicitely in the first section of the Makefile. The compilers and their options may also be changed there.

Once you have set the Makefile up for your system, S2LET may be compiled by running:

 >> make all

This will build the C library, Matlab interfaces, test/demo programs and documentation. The FITS features will be added to the library if CFITSIO is found (namely libcfitsio.a in $CFITSIO/lib). The HEALPIX support will be build if HEALPIX is found (libhealpix.a in $HEALPIX/lib and the F90 modules in $HEALPIX/include). In terms of binary programs, all MW programs will be built too. This corresponds to the particular command

 >> make mw_bin

If you wish to build the HEALPIX related programs, run

 >> make hpx_bin

We recommend to run the tests (s2let_test and s2let_hpx_test if relevant) to check that compilation worked and that the wavelet transform for the MW sampling achieves floating-point precision.

To use the IDL and Java interfaces, you need to build the dynamic library by running:

 >> make dylib

You may alternatively build the individual components of S2LET. To build the library only run (which will automatically incorporate CFITSIO and HEALPIX if they are found):

 >> make lib

To build the test framework for the exact wavelet transform (MW sampling, default) run:

 >> make test

To build the test framework for the Healpix wavelet transform (optional) run:

 >> make hpx_test

To build the Matlab interfaces (MW by default, Healpix added if found):

 >> make matlab

The other programs may be compiled individually with similar commands, but we recommand to use the make mw_bin and make hpx_bin instead.

Documentation

The S2LET code is self documenting. The package ships with source documentation, but you may also re-generate the html source documentation by running:

 >> make doc

The documentation is generated with doxygen, thus you must have doxygen installed on your system if you wish to re-generate the documentation.

Cleaning up

To tidy up all temporary files and objects run:

 >> make tidy

To remove all compiled files and programs run:

 >> make clean

To remove all source documentation run:

 >> make cleandoc


Source code documentation

S2LET ships with source documentation that is generated by doxygen. The C documentation is available here. The Matlab routines that interface with the C implementation are self documenting (documentation can be access through the help command in Matlab), which is discussed on this page.


Testing and using the library

Five programs may be run to test and familiarize yourself with the C framework. They are extensively documented and may serve as starting point to learn to use the functionalities of S2LET. The command

 >> ./bin/s2let_test

will run various performance and accuracy tests for the exact Wavelet transform built on the MW sampling. All algorithms and high-level features are tested, including the pixel space and harmonic space transforms with and without the multiresolution algorithm.

If HEALPIX is provided, the command

 >> ./bin/s2let_hpx_test

will test the interfaces to the Fortran implementation of HEALPIX as well as the corresponding wavelet transform.

A full demo is provided to read a Healpix map of a random CMB simulation, perform its wavelet decomposition and write the wavelet maps to FITS files in the /data directory.

 >> ./bin/s2let_hpx_demo

A denoising example is also provided and extensively documented. It reads an MW map containing Earth tomography data, adds a random noise, perform the wavelet transform, denoise the wavelet scales through hard thresholding, reconstruct the denoised map and write it to an output FITS file in the /data directory.

 >> ./bin/s2let_denoising_demo

This demo uses directional wavelets on a scalar signal, but similar demos are provided for axisymmetric wavelets and also spin signals.

We also provide a program to read a valid MW map, perform its wavelet decomposition and output the wavelet maps (which can be plotted in Matlab, for instance). The command, whose parameters are fully documented in the code, reads

 >> ./bin/s2let_transform_axisym_mw_analysis_real 
		<inputFile>  <lambda>  <J_0>  <multiResolution>

To reproduce the example on the main page, use:

 >> ./bin/s2let_transform_axisym_mw_analysis_real data/earth_tomo_mw_128.fits 3 2 1

A similar program is provided to synthesise a map from the wavelet coefficents:

 >> ./bin/s2let_transform_axisym_mw_synthesis_real 
		<outputRoot>  <lambda>  <J_0>  <bandLimit>

will look in the same directory for the wavelet scales, requires the maximum bandlimit of the wavelets (i.e. of the output map) and will determine if multiresolution was activated. To re-synthesise the signal decomposed in the previous example, you may run

 >> ./bin/s2let_transform_axisym_mw_synthesis_real data/earth_tomo_mw_128 3 2 128

We provide the same routine for a Healpix map, for which the multiresolution flag has to be replaced by the band-limit of the analysis. The output maps may be plotted in Matlab or IDL, for instance.

 >> ./bin/s2let_transform_axisym_hpx_analysis_real 
		< inputFile>  <lambda>  <J_0>  <bandLimit>

As an example, to decompose a Healpix CMB simulation into wavelets, run :

 >> ./bin/s2let_transform_axisym_hpx_analysis_real data/somecmbsimu_hpx_128.fits 3 2 128

A similar program is provided to synthesise a healpix map from the wavelet coefficents:

 >> ./bin/s2let_transform_axisym_hpx_synthesis_real 
		<outputRoot>  <lambda>  <J_0>  <bandLimit>

will look in the same directory for the wavelet scales.To re-synthesise the signal decomposed in the previous example, you may run

 >> ./bin/s2let_transform_axisym_hpx_synthesis_real data/somecmbsimu_hpx_128 3 2 128

Finally, to check the version and build numbers of your version run:

 >> ./bin/s2let_about