Package: pymaster
NaMasterNaMaster is a C library, Python module and standalone program to compute full-sky angular cross-power spectra of masked fields with arbitrary spin and an arbitrary number of known contaminants using a pseudo-Cl (aka MASTER) approach. The code also implements E/B-mode purification and is available in both full-sky and flat-sky modes.InstallationThere are different ways to install NaMaster. In rough order of complexity, they are:Conda forgeUnless you care about optimizing the code, it's worth giving this one a go. The conda recipe for NaMaster is currently hosted onconda-forge(infinite kudos toMat Beckerfor this). In this case, installing NaMaster means simply running:conda install -c conda-forge namasterIf that works for you and you don't care about optimizing the code too much, skip the rest of this section. If you don't have admin permissions, you can give virtual environments a try (or else follow the instructions below).PyPINaMaster is also hosted onPyPI. Installing it should be as simple as running:python -m pip install pymaster [--user](add--userif you don't have admin permissions). Note that this will compile the code on your machine, so you'll need to have installed itsdependencies.From sourceIf all the above fail, try to install NaMaster from its source. You should first clone thisgithub repository. Then follow these steps:1. Install dependencies.Install the dependencies listedhere. Note that some of them (libsharp and HEALPix) may not be necessary, as pymaster will attempt to install them automatically.2. Install the python moduleInstalling the python modulepymastershould be as simple as runningpython setup.py install [--user]or, even better, if you can usepip:pip install . [--user]where the optional--userflag can be used if you don't have admin privileges.You can check that the python installation works by running the unit tests:pytest -vv pymasterNote that thetestdirectory, containing all unit tests, also contains all the sample python scripts described in thedocumentation.If you installedpymasterviapip, you can uninstall everything by runningpip uninstall pymasterNote that the C library is automatically compiled when installing the python module.If you care about the C library at all, or you have trouble compiling it, see the next section.3. Install the C code (optional)The scriptscripts/install_libnmt.shcontains the instructions run bysetup.pyto compile the C library (libnmt.a). You may have to edit this file or make sure to include any missing compilation flags ifsetup.pyencounters issues compiling the library.If you need the C library for your own code,scripts/install_libnmt.shinstalls it in_deps/liband_deps/include. Note that the script process will also generate an executablenamaster, residing in_deps/binthat can be used to compute power spectra. The use of this program is discouraged over using the python module.You can check that the C code works by runningmake checkIf all the checks pass, you're good to go.Installing on MacNaMaster can be installed on Mac using any of the methods above as long as you have either theclangcompiler with OpenMP capabilities or thegcccompiler. Both can be accessed via homebrew. If you don't have either, you can still try the conda installation above.Note: NaMaster is not supported on Windows machines yet.DocumentationThe following sources of documentation are available for users:Python documentation: also available inreadthedocsScientific documentation: description of the methods implemented in NaMasterC API documentation: description of the C library functionality and the NaMaster executable.DependenciesNaMaster has the following dependencies, which should be present in your system before you can install the code from source:GSL. Version 2 required (note in certain systems you may also need to installopenblas- seethis issue.FFTW. Version 3 required. Install with--enable-openmpand potentially also--enable-shared.cfitsio. Any version >3 should work.Besides these, NaMaster will attempt to install the following two dependencies. If this fails, or if you'd like to use your own preinstalled versions, follow these instructions:libsharp. Libsharp is automatically installed with NaMaster.setup.pyattempts to download and install libsharp automatically. This is done by running the scriptscripts/install_libsharp.sh. If you encounter any trouble during this step, inspect the contents of that file. Libsharp gets installed in_deps/liband_deps/include. However, if you want to use your own preinstalled version of libsharp, you should simlink it into the directory_deps, such that_deps/lib/libsharp.acan be seen. See instructions inNERSC_installation.mdfor more details on libsharp.HEALPix. Like libsharp, HEALPix is automatically installed bysetup.pyby running the scriptscripts/install_libchealpix.sh(have a look there if you run into trouble). HEALPix gets installed in_deps/liband_deps/include. However, if you want to use your own preinstalled version , you should simlink it into the directory_deps, such that_deps/lib/libchealpix.acan be seen. Any version >2 should work. Only the C libraries are needed.Licensing, credits and feedbackYou are welcome to re-use the code, which is open source and freely available under terms consistent with BSD 3-Clause licensing (seeLICENSE).If you use NaMaster for any scientific publication, we kindly ask you to cite this github repository and the companion paperhttps://arxiv.org/abs/1809.09603. Special kudos should go to the following heroes for their contributions to the code:Mat Becker (@beckermr)Giulio Fabbian (@gfabbian)Martina Gerbino (@mgerbino)Daniel Lenz (@DanielLenz)Zack Li (@xzackli)Thibaut Louis (@thibautlouis)For feedback, please contact the author via github issues or email (david.alonso@physics.ox.ac.uk).