A wrapper for sgp4 that handles TLE switching
Project description
Thistle
A wrapper for sgp4 and skyfield that handles automatic TLE switching for accurate long-duration satellite orbit propagation.
The Problem
A single Two-Line Element (TLE) set degrades in accuracy as you propagate further from its epoch. For tracking a satellite over days or weeks you need multiple TLEs, and you need to decide when to switch between them.
The Solution
Thistle manages multiple TLEs for a satellite and automatically selects the most appropriate one based on the propagation time.
Installation
pip install thistle
Usage
from thistle import Propagator, read_tle
# Load TLEs (multiple epochs for one satellite)
tles = read_tle("satellite_data.tle")
# Create a propagator with a switching strategy
prop = Propagator(tles, method="midpoint")
# Propagate — Thistle picks the best TLE for each time
geo = prop.at(times)
Switching Strategies
| Strategy | Description |
|---|---|
"epoch" |
Uses the most recent TLE at or before the target time (conservative) |
"midpoint" |
Uses the nearest TLE by epoch; transitions at midpoints between consecutive epochs |
"tca" |
Transitions at the time of closest approach between neighboring TLEs |
Lookup Methods
You can look up the active TLE for any point in time:
import numpy as np
time = np.datetime64("2024-01-15T12:00:00")
# Get the EarthSatellite (skyfield)
satellite = prop.find_satellite(time)
# Get the Satrec (sgp4)
satrec = prop.find_satrec(time)
# Get the TLE lines as a (line1, line2) tuple
tle = prop.find_tle(time)
Requirements
Python >= 3.9
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file thistle-0.2.0b1.tar.gz.
File metadata
- Download URL: thistle-0.2.0b1.tar.gz
- Upload date:
- Size: 26.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e9f130d1a8a7adfbb546dbcc0f6b245856fd5867b61f347c1fe557c35046a35
|
|
| MD5 |
856d134d65046387ecd72974c34f3a2a
|
|
| BLAKE2b-256 |
609788ab6d72024db77cd8f3b9f907b3a398a1ec456253e6b38d9ca0c7d33edb
|
File details
Details for the file thistle-0.2.0b1-py3-none-any.whl.
File metadata
- Download URL: thistle-0.2.0b1-py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
685522965965c35879b81bed1c164010317dcbf67a84e8a0086921c7d43145eb
|
|
| MD5 |
e44f76826bcca31c3a6e2e508df59d5d
|
|
| BLAKE2b-256 |
cfa7b5a4ac52c3dd20badf1f422090d72f11ff0df76c3b4959fa6cf4a790fd01
|