Skip to main content

No project description provided

Project description

Test status PyPI version

lkPRF

lkPRF is a tool to work with PRF files from missions like NASA Kepler and TESS. This tool enables you to load in PRF files from the engineering data, and evaluate them at given pixel positions.

What is lkPRF doing?

This tool is doing two things for you:

  1. Downloading and formating the engineering files for you.
  2. Evaluating the PRF files on a pixel grid.

Installation

You can install lkprf using pip:

pip install lkprf --upgrade

Usage

:question: Note: lkprf uses tuples to specify positions and uses the Python convention of (row, column).

To use the package you first initialize a PRF model based on the mission you want to use

import lkprf
prf = lkprf.KeplerPRF(channel=42)

or

import lkprf
prf = lkprf.TESSPRF(camera=1, ccd=1)

You can then use either the evaluate or gradient functions to get the estimate of the PRF at a location, as shown below.

prf.evaluate(targets=[(5, 5)], origin=(0, 0), shape=(11, 11))

This will return an array with shape (1, 11, 11), which contains an (11, 11) image containing one target at location (row=5, column=5). The image origin is at (row=0, column=0).

prf.evaluate(targets=[(5, 5), (9, 9)], origin=(0, 0), shape=(11, 11))

This will return an array with shape (2, 11, 11), which contains two (11, 11) images. The first image contains one target at location (row=5, column=5). The second image contains one target at location (row=9, column=9). You can pass in a list of any number of target tuples to create PRFs for each target. PRFs are normalized such that, if all target flux falls in a pixel, the total flux will be one.

:question: Note: If the "target" doesn't appear in your image, make sure the origin and shape keywords would create an array that contains your target coordinates.

Similarly you can get the gradient of the PRF

prf.gradient(targets=[(5, 5)], origin=(0, 0), shape=(11, 11))

This will return a tuple containing two arrays, each with shape (1, 11, 11). The first array is the gradient with respect to row, and the second is the gradient with respect to column. You can similarly pass in any number of targets to calculate the gradient for more targets.

Examples

The below examples are created using the snippet

prf.evaluate(targets=[(5, 5)], origin=(0, 0), shape=(11, 11))

Kepler

Below is an example image for the Kepler PRF, for channel 42, with a source at position (row=5, column=5).

Kepler PRF Example

TESS

Below is an example image for the TES PRF, for Camera 1, CCD 1, with a source at position (row=5, column=5).

TESS PRF Example

Problems with downloading PRF data

To use lkPRF you will have to be connected to the internet to download the relevant files. After you download the data for a given Camera/CCD/Channel these files will be stored within the package, so you will be able to use the data offline.

If you evaluate a PRF from a particular Camera/CCD/Channel once, you will notice a slow down as lkPRF downloads and builds the right files for you. If you interupt the download you may find that the file is corrupted. To ensure that the file is downloaded again, you will have to clear the cache. You can do this using

import lkprf
lkprf.clear_kepler_cache()
lkprf.clear_tess_cache()

When lkprf can not find a PRF file on disk it will attempt to download it again.

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

lkprf-1.0.3.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

lkprf-1.0.3-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file lkprf-1.0.3.tar.gz.

File metadata

  • Download URL: lkprf-1.0.3.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.13 Darwin/23.5.0

File hashes

Hashes for lkprf-1.0.3.tar.gz
Algorithm Hash digest
SHA256 999057377646cf0bdfc8316d46916a00d8d555d6f486e2127f7893997ed1c5f3
MD5 121786f68cbc40e4d88adce8e19156e6
BLAKE2b-256 d4409d85e737ef71b6d1e45e802f3ccc43714ebdee9684b3232aeaabdbbfca65

See more details on using hashes here.

Provenance

File details

Details for the file lkprf-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: lkprf-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 9.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.9.13 Darwin/23.5.0

File hashes

Hashes for lkprf-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 9eb97025393b39fc98c7f99fadf8eb7ee77dcaadcd2f16ea4308b1d749d19bb3
MD5 e9e9948985cb867217d8f52333f344e6
BLAKE2b-256 2468d58146cdc967e39bb46a4030ea272cf9a4219313e5aeaf75ad9c0328c862

See more details on using hashes here.

Provenance

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