kdeLF is an MIT licensed Python implementation of Yuan et al.’s Kernel Density Estimation (KDE) method for estimating luminosity functions and these pages will show you how to use it.

This documentation won’t teach you too much about KDE but there are a lot of resources available for that (try this one). Our paper explaining the kdeLF algorithm and implementation in detail. kdeLF is being actively developed on GitHub.

https://img.shields.io/badge/GitHub-yuanzunli%2FkdeLF-blue.svg?style=flat https://img.shields.io/badge/arXiv-2203.06700-red https://img.shields.io/badge/arXiv-2003.13373-brightgreen https://img.shields.io/badge/license-MIT-blue.svg?style=flat https://pepy.tech/badge/kdeLF

Basic Usage

If you want to calculate the luminosity function based on a survey data, you would do something like:

import numpy as np
from kdeLF import kdeLF
from scipy import interpolate

with open('flim.dat', 'r') as f:
    x0, y0= np.loadtxt(f, usecols=(0,1), unpack=True)
f_lim = interpolate.interp1d(x0, y0,fill_value="extrapolate")


A more complete example is available in the Quickstart tutorial.

How to Use This Guide

To start, you’re probably going to need to follow the Installation guide to get kdeLF installed on your computer. After you finish that, you can probably learn most of what you need from the tutorials listed below (you might want to start with Quickstart and go from there). If you need more details about specific functionality, the User Guide below should have what you need.

We welcome bug reports, patches, feature requests, and other comments via the GitHub issue tracker, but you should check out the contribution guidelines first.

License & Attribution

Copyright 2022 Zunli Yuan and contributors.

kdeLF is free software made available under the MIT License. For details see the LICENSE.


Please cite the following papers if you found this code useful in your research:

  • Yuan, Z., Zhang, X., Wang, J., Cheng, X., & Wang, W. 2022, ApJS, 260, 10 (arXiv, ADS, BibTeX).

  • Yuan, Z., Jarvis, M. J., & Wang, J. 2020, ApJS, 248, 1 (arXiv, ADS, BibTeX).


  • Wenjie Wang


1.0.0 (2022-02-15)

  • Initial release.