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.
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") sr=6248/((180/np.pi)**2) lf=kdeLF.KdeLF(sample_name='data.txt',solid_angle=sr,zbin=[0.6,0.8],f_lim=f_lim,adaptive=True) lf.get_optimal_h() lf.run_mcmc() lf.plot_posterior_LF(z=0.718,sigma=3)
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
Please cite the following papers if you found this code useful in your research: