Skip to main content

Python bindings for the MAST interface to the Kepler dataset.

Installation

You can install the module by running:

pip install kplr

If you want to access the MAST API, you’ll need the requests module and if you want to load light curve data sets, you’ll need numpy and pyfits.

Usage

You’ll access the API using a kplr.API object:

import kplr
client = kplr.API()

To get information about the planet “Kepler 62b” (for example), you would run the command:

planet = client.planet("62b")  # or "Kepler-62 b"

This object has a lot of attributes (with names given by the MAST documentation) such as a period:

print(planet.koi_period)
# 5.715

For some reason, the KOI table tends to have more precise measurements so we can look at that instead:

koi = planet.koi
print("{0.koi_period} ± {0.koi_period_err1}".format(koi))
# 5.71493 ± 0.00019

The attributes of the KOI object are given in the MAST description of the kepler/koi table. You can also directly query the KOI table using:

koi = client.koi("256.01")

To download all the data for this KOI (or equivalently, the above planet), you can try:

datasets = [dataset.fetch() for dataset in koi.data]

This will download the FITS files containing the light curves to the directory given by the KPLR_DATA_DIR environment variable (or ~/.kplr/data by default). To load one of the files, you’ll need to make sure that you have pyfits installed and then you can use the Dataset object:

data = kplr.Dataset(datasets[0].filename)

Download files

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

Source Distribution

kplr-0.0.3.tar.gz (10.8 kB view details)

Uploaded Source

File details

Details for the file kplr-0.0.3.tar.gz.

File metadata

  • Download URL: kplr-0.0.3.tar.gz
  • Upload date:
  • Size: 10.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for kplr-0.0.3.tar.gz
Algorithm Hash digest
SHA256 422d7456c2ebee6e39e49ac2c425c68f2bd8a147bbd47515e3e54a6145fd0c75
MD5 e913b13f4f4b8733f0035dd9aebde390
BLAKE2b-256 fb22218089e264e9e356bf4b057893e937bbe14d6bdc35552942fbaf4d5c2b18

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.3

2 files

0.2.2

1 file

0.2.1

1 file

0.2.0

1 file

0.1.11

1 file

0.1.10

1 file

0.1.8

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

This release

0.0.3 This release

1 file

0.0.2

1 file

0.0.1

1 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