Skip to main content

gpr4im

This package uses Gaussian Process Regression (GPR) as a foreground removal technique in the context single-dish 21cm intensity mapping. This user-friendly code shows you how to do this in the context of MeerKAT-like simulations, but any intensity mapping data in real space can be used. This is the accompaying code to the paper (https://arxiv.org/abs/2105.12665), where we look at how GPR performs as a foreground removal technique in our simulations in comparison with Principal Component Analysis.

See GitHub for more details: github.com/paulassoares/gpr4im

Installation

To install this package, follow these instructions on a terminal:

pip install gpr4im

or if you prefer:

git clone https://github.com/paulassoares/gpr4im.git
cd gpr4im
pip install .

If using the second option, make sure you do pip install . in the gpr4im folder, where the setup.py file is.

Installing gpr4im will also automatically install:

It will not install pymultinest, which is required for the Nested sampling.ipynb notebook. If you would like to run that notebook, please see http://johannesbuchner.github.io/PyMultiNest/install.html for details on installation.

Quickstart

An very quick example of how to run GPR foreground removal using our code is shown below, but please see the Jupyter notebooks for further explanation:

import pandas as pd
import GPy
from gpr4im import fg_tools as fg

data = pd.read_pickle('example_data.pkl')
dirty_map = data.beam.FGnopol_HI_noise

kern_fg = GPy.kern.RBF(1)
kern_fg.variance.constrain_bounded(1000,100000000)
kern_fg.lengthscale.constrain_bounded(200,10000)
kern_21 = GPy.kern.Exponential(1)
kern_21.variance.constrain_bounded(0.000001,0.5)
kern_21.lengthscale.constrain_bounded(0.01,15)

gpr_result = fg.GPRclean(dirty_map, data.freqs, kern_fg, kern_21, 
                         NprePCA=0, num_restarts=10, noise_data=None, 
                         heteroscedastic=False, zero_noise=True, invert=False)

cleaned_map = gpr_result.res

Introductory notebooks

For a quick introduction on how to run the code, please see Running GPR.ipynb. For a more thorough run through of how the code works, please see Understanding GPR.ipynb. The Jupyter Notebooks folder contains other introductory notebooks for how all the aspects of our code and data work, and are all user friendly. These use the data set example_data.pkl, which is described in the Data folder's README.

The Reproducible paper plots folder contains the notebooks showing how we obtained the analysis results for our companion paper (these are less introductory, but useful for those trying to understand how our analysis was done). The code here requires the multinest_results.pkl file, as well as the full data used in our analysis, data.pkl, which can be obtained from this link (but beware, it is 2.84 GB):

https://www.dropbox.com/sh/9zftczeypu7xgt3/AABiiBw_0SBPrLgSHsjiISz8a?dl=0

The Nested sampling.ipynb notebook also uses this data, and requires pymultinest to be installed.

Acknowledgment

If you make use of this code, please cite:

@misc{soares2021gaussian,
      title={Gaussian Process Regression for foreground removal in HI intensity mapping experiments}, 
      author={Paula S. Soares and Catherine A. Watkinson and Steven Cunnington and Alkistis Pourtsidou},
      year={2021},
      eprint={2105.12665},
      archivePrefix={arXiv},
      primaryClass={astro-ph.CO}
}

This code is heavily based on the publicly available ps_eor code (https://gitlab.com/flomertens/ps_eor), so if you use our code please also acknowledge:

@article{Mertens2018,
   title={Statistical 21-cm Signal Separation via Gaussian Process Regression Analysis},
   ISSN={1365-2966},
   url={http://dx.doi.org/10.1093/mnras/sty1207},
   DOI={10.1093/mnras/sty1207},
   journal={Monthly Notices of the Royal Astronomical Society},
   publisher={Oxford University Press (OUP)},
   author={Mertens, F G and Ghosh, A and Koopmans, L V E},
   year={2018},
   month={May}
}

Metadata

Release files for gpr4im 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gpr4im 1.0.1
File Size Uploaded
gpr4im-1.0.1.tar.gz 11.7 kB Details

Release files / gpr4im-1.0.1.tar.gz

Download URL gpr4im-1.0.1.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7c983e4bed9419496f70f7cad9854c3032e48bf7f13cf97f8fcef30ad3312db7
BLAKE2b-256 checksum
How to use checksums
6a1764c329deca251f90f82ef29f03b758f97ec48126031b48fe6457ea89a1ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.5.0.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.6

Release history Release notifications | RSS feed

This release

1.0.1 This release

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page