Skip to main content

Take a bite out of TESS Full Frame Images using HTTP range requests.

Project description

Take a quick bite out of TESS Full Frame Images using HTTP range requests.

pypi

tess-bite is a user-friendly package which provides fast access to sections of TESS Full-Frame Image (FFI) data. It uses the HTTP range request mechanism to download only those parts of an FFI that are required to obtain a cut-out image.

Installation

python -m pip install tess-bite

Example use

Obtain a Target Pixel File for a stationary object:

>>> from tess_bite import bite
>>> bite("Alpha Cen", shape=(10, 10))
TargetPixelFile("Alpha Cen")

Obtain a Target Pixel File centered on a moving asteroid:

>>> from tess_bite import bite_asteroid
>>> bite_asteroid("Vesta", start="2019-04-28", stop="2019-06-28)
TargetPixelFile("Vesta")

Obtain a cut-out image from a single FFI:

>>> from tess_bite import bite_ffi
>>> bite_ffi(url, col=50, row=20, shape=(20, 20))

Quickly download the header of an FFI:

>>> from tess_bite import bite_header
>>> bite_header(url, ext=0)
FitsHeader

What are HTTP range requests?

Tess-bite is powered by the HTTP range request protocol. This is a mechanism which allows a client to request specific bytes from a file on a web server. For example, downloading a 3-by-3 pixel square of 4-byte pixel values from a TESS image can be done very quickly using a HTTP request as follows:

>>> import httpx
>>> url = "https://mast.stsci.edu/portal/Download/file?uri=mast:TESS/product/tess2019142115932-s0012-2-1-0144-s_ffic.fits"
>>> resp = httpx.get(url, headers={"Range": "bytes=80000-80012,80020-80032,80040-80052"})
>>> print(resp.text)

--00000000000000000103
Content-Type: application/octet-stream
Content-Range: bytes 80000-80012/35553600

DA@DLR½DW˜oD
--00000000000000000103
Content-Type: application/octet-stream
Content-Range: bytes 80020-80032/35553600

³D .]DªJD
--00000000000000000103
Content-Type: application/octet-stream
Content-Range: bytes 80040-80052/35553600

D-aöD+W/DRD
--00000000000000000103--

Of course the difficult part is to translate pixel coordinates to byte positions, and to convert bytes to pixel values. Tess-bite takes care of these steps for you!

Documentation

Coming soon!

Similar services

TESScut is an excellent API service which allows cut outs to be obtained for stationary objects. Tess-bite provides an alternative implementation of this service by leveraging the HTTP range requests mechanism to download pixel values directly from FFI files.

Compared to TESScut, the goal of tess-bite is provide an alternative way to obtain cut-outs which does not require a central API service, but can instead be run on a local machine or in the cloud. At this time tess-bite is an experiment, we recommend that you keep using TESScut for now!

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

tess-bite-0.1.0.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

tess_bite-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file tess-bite-0.1.0.tar.gz.

File metadata

  • Download URL: tess-bite-0.1.0.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.6 Darwin/20.2.0

File hashes

Hashes for tess-bite-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cb656f32ffe9553dc41de49fa7c39f9b99eaefffa681352996b26075d5d55715
MD5 618237e57b23023fef5899f3b14e5a51
BLAKE2b-256 27ee40a92dc57c06b006065f3b568e280f866f2e0559dc2e0b6d13ca78ca068f

See more details on using hashes here.

File details

Details for the file tess_bite-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tess_bite-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.6 Darwin/20.2.0

File hashes

Hashes for tess_bite-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6157c45fca7484f5211595744fdbb891d072580a3b3b9953552d67e9c2dc8690
MD5 b125e6a2afb24670ede7638baf4e941a
BLAKE2b-256 1bb74d31325758fef4ecc8f822adea75579781442ada1863d9c511956a35d540

See more details on using hashes here.

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