Skip to main content

Uniform interface for the selection functions of astronomical surveys.

Project description



The selectionfunctions package aspires to provide a uniform interface to the selection functions of the major astronomical surveys. This package is entirely derivative of the truly excellent dustmaps package created by Gregory M. Green. The selectionfunctions package is a product of the Completeness of the Gaia-verse (CoG) collaboration.

Supported Selection Functions

The currently supported selection functions are:

  1. Gaia DR2 source catalogue (cog_ii.dr2_sf, Boubert & Everall 2020, submitted)

To request addition of another selection function in this package, file an issue on GitHub, or submit a pull request.


Download the repository from GitHub and then run:

python install --large-data-dir=/path/where/you/want/large/data/files/stored

Alternatively, you can use the Python package manager pip:

pip install selectionfunctions

Getting the Data

To fetch the data for the GaiaDR2 selectionfunction, run:

python fetch --map-name=cog_ii

You can download the other selection functions by changing "cog_ii" to (other selection functions will be added in future).

Alternatively, if you have used pip to install selectionfunctions, then you can configure the data directory and download the data by opening up a python interpreter and running:

>>> from selectionfunctions.config import config
>>> config['data_dir'] = '/path/where/you/want/large/data/files/stored'
>>> import selectionfunctions.cog_ii
>>> selectionfunctions.cog_ii.fetch()

Querying the selection functions

Selection functions are queried using Source objects, which are a variant on the astropy.coordinates.SkyCoord object. This means that any coordinate system supported by astropy can be used as input. For example, we can query the Gaia DR2 selection function as follows:

>>> import selectionfunctions.cog_ii as CoGII
>>> from selectionfunctions.source import Source
>>> dr2_sf = CoGII.dr2_sf()
>>> c = Source(
>>> print(dr2_sf(c))

Above, we have used the ICRS coordinate system (the inputs are RA and Dec). We can use other coordinate systems, such as Galactic coordinates, and we can provide coordinate arrays. The following example uses both features:

>>> c = Source(
        [75.00000000, 130.00000000],
        [-89.00000000, 10.00000000],
>>> print(dr2_sf(c))


Read the full documentation at


If you make use of this software in a publication, please always cite Green (2018) in The Journal of Open Source Software.

You should also cite the papers behind the selection functions you use.

  1. cog_ii.dr2_sf - Please cite Completeness of the Gaia-verse Paper I and Paper II.


Development of selectionfunctions takes place on GitHub, at Any bugs, feature requests, pull requests, or other issues can be filed there. Contributions to the software are welcome.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

selectionfunctions-1.0.0.tar.gz (43.1 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page