spherapy


Namespherapy JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryAn orbital propagator wrapper and TLE fetcher
upload_time2025-10-22 04:05:27
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords satellite sgp space orbit
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ## About
Spherapy is a convenience wrapper around the fantastic libraries [skyfield](https://pypi.org/project/skyfield/), [spacetrack](https://pypi.org/project/spacetrack/), and [hapsira](https://pypi.org/project/hapsira/) (a maintained poliastro fork).
It provides a consistent and straightforward method to create/propagate orbits without worrying about the implementation details of each library:

- historical TLEs for known satellites (skyfield)
- propagated orbital parameters hypothetical satellites (skyfield)
- analytical orbital parameters (hapsira)
- list of positions

Addtionaly, it provides a straightforward interface for updating used TLEs via [spacetrack](https://www.space-track.org)

Created orbits contain commonly used state variables:

- satellite positions in various frames
- velocities
- etc.

## Installation
1. install the package
```bash
pip install spherapy
```
2. configure. see [Configuration](#configuration)

## Usage
- ensure spherapy has been configured, see [Configuration](#configuration)
- import the spherapy package
```python
import spherapy.updater
import spherapy.timespan
import spherapy.orbit
```
- if using real world satellites; update the desired TLEs (you can also use the TLEs supplied with the package, but these will be out of date).
	- TLE id's can be found using [NORAD's CelesTrak catalogue search](https://celestrak.org/satcat/search.php)
```python
updated_TLEs = spherapy.updater.updateTLEs([25544]) 	#ISS
TLE_paths = spherapy.updater.getTLEFilePaths([25544], use_packaged=True) 	#ISS
```
- set up a timespan
```python
t = spherapy.timespan.TimeSpan(datetime.datetime(2024,10,15,0,0,1),'1S','90M')
```
- construct an orbit
	- from a TLE (good practice to update the TLE with the most recent)
```python
o = spherapy.orbit.Orbit.fromTLE(t, TLE_paths[0])
```  
-	from orbital parameters
```python
o = spherapy.orbit.Orbit.fromAnalyticalOrbitalParam(timespan, body='Earth',
					 a=6978,
					 ecc=0,
					 inc=0,
					 raan=0,
					 argp=0,
					 mean_nu=0,
					 name='My Analytical Orbit',
					 astrobodies=True)
```  

#### Full TLE example (for copy paste)
```
import datetime
import spherapy.updater
import spherapy.timespan
import spherapy.orbit
TLE_paths = spherapy.updater.getTLEFilePaths([25544], use_packaged=True) 	#ISS
t = spherapy.timespan.TimeSpan(datetime.datetime(2024,10,15,0,0,1),'1S','90M')
o = spherapy.orbit.Orbit.fromTLE(t, TLE_paths[0])
```

#### Full Analytical exmaple (for copy paste)
```
import datetime
import spherapy.timespan
import spherapy.orbit
t = spherapy.timespan.TimeSpan(datetime.datetime(2024,10,15,0,0,1),'1S','90M')
o = spherapy.orbit.Orbit.fromAnalyticalOrbitalParam(timespan, body='Earth',
					 a=6978,
					 ecc=0,
					 inc=0,
					 raan=0,
					 argp=0,
					 mean_nu=0,
					 name='My Analytical Orbit',
					 astrobodies=True)
```

## SpaceTrack Credentials
In order to calculate the position of a historical satellite at any given time, spherapy requires [TLE information](https://en.wikipedia.org/wiki/Two-line_element_set) for each satellite which is accurate for the given time period (or 'epoch').  
TLE data can be obtained from either [Celestrak](https://celestrak.org/) or [Spacetrack](https://www.space-track.org/). 
Celestrak holds only the most recent TLE data for each satellite, while Spacetrack will provide historical TLE data. spherapy will fall back to using Celestrak if it cannot authenticate access to Spacetrack.  
In order to use Spacetrack, you must provide your [Spacetrack credentials](https://www.space-track.org/auth/createAccount) to spherapy.

## Configuration
Configuration for spherapy can either use the default settings, or settings specified in a `spherapy.conf` file.

### Default settings
If the default settings are used, spherapy will use the system user data directory and expect spacetrack credentials to be stored in the system keyring.  
The default data directories are listed in [Directories](#directories)

### Custom settings
Custom settings can be specified in a `spherapy.conf` file.  
This file can be located either in the system user's config file (described in [Directories](#directories)) or at a location specified by the environment variable `SPHERAPY_CONFIG_DIR`.

The fields of `spherapy.conf` are described below
```ini
[credentials]
SpacetrackUser = None 		# the spacetrack user, if left as "None" will source from system keyring
SpacetrackPasswd = None 	# the spacetrack password, if left as "None" will source from system keyring

[paths]
# relative paths are assumed to be relative to the location of this file
# do not quote path
TLE_path = ./spherapy/data/TLEs 	# the location where TLE files will be saved, if left empty (""), will default to system user's directory.
```

### Directories
If `SPHERAPY_CONFIG_DIR` is not set or `TLE_path` is left empty in `spherapy.conf`, the spherapy default directories will be used:

#### Linux
- TLE data dir:
``` bash
/home/{username}/.local/share/spherapy/TLEs
```
- config dir:
``` bash
/home/{username}/.config/spherapy/spherapy/{spherapy_version}/
```

#### OSX
- TLE data dir:
``` bash
/Users/{username}/Library/Application Support/spherapy/TLEs
```
- config dir:
``` bash
/Users/{username}/Library/Application Support/spherapy/{spherapy_version}/
```

#### Windows
- TLE data dir:
``` bash
'C:\\Users\\{username}\\AppData\\Local\\spherapy\\TLEs'
```
- config dir:
``` bash
'C:\\Users\\{username}\\AppData\\Local\\spherapy\\{spherapy_version}'
```

### Passwords
By default spherapy will use the system keyring to store the Spacetrack username and credentials (see [SpaceTrack Credentials](#spacetrack-credentials))  
If a config file is supplied, the credentials in the file will be used.

Credentials can be added to the keyring by running the command (in the terminal, not the python shell)
```
spherapy-create-credentials
```

### Configration File Format
The configuration file `spherapy.conf` should have the following format:
```ini
[credentials]
SpacetrackUser = None
SpacetrackPasswd = None

[paths]
# relative paths are assumed to be relative to the location of this file
# do not quote path
TLE_path =
```

## Data Storage
- TLEs
	- TLEs will be stored in the data directory, with a single file for each satellite ID.
	 `{sat_id}.tle`, containing all historical TLEs for that satellite.
	- If celestrak is used instead, the file will be saved as a temporary file `{sat_id}.temptle`, which will be overwritten on each fetch from celestrak.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "spherapy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Robert Mearns <rz.mearns@gmail.com>",
    "keywords": "satellite, sgp, space, orbit",
    "author": null,
    "author_email": "Robert Mearns <rz.mearns@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/bb/a3/63f3bb0d02c263d8b9ff2ec5d0622d12e6955a1798c9f33709a3e5a9442a/spherapy-0.2.1.tar.gz",
    "platform": null,
    "description": "## About\nSpherapy is a convenience wrapper around the fantastic libraries [skyfield](https://pypi.org/project/skyfield/), [spacetrack](https://pypi.org/project/spacetrack/), and [hapsira](https://pypi.org/project/hapsira/) (a maintained poliastro fork).\nIt provides a consistent and straightforward method to create/propagate orbits without worrying about the implementation details of each library:\n\n- historical TLEs for known satellites (skyfield)\n- propagated orbital parameters hypothetical satellites (skyfield)\n- analytical orbital parameters (hapsira)\n- list of positions\n\nAddtionaly, it provides a straightforward interface for updating used TLEs via [spacetrack](https://www.space-track.org)\n\nCreated orbits contain commonly used state variables:\n\n- satellite positions in various frames\n- velocities\n- etc.\n\n## Installation\n1. install the package\n```bash\npip install spherapy\n```\n2. configure. see [Configuration](#configuration)\n\n## Usage\n- ensure spherapy has been configured, see [Configuration](#configuration)\n- import the spherapy package\n```python\nimport spherapy.updater\nimport spherapy.timespan\nimport spherapy.orbit\n```\n- if using real world satellites; update the desired TLEs (you can also use the TLEs supplied with the package, but these will be out of date).\n\t- TLE id's can be found using [NORAD's CelesTrak catalogue search](https://celestrak.org/satcat/search.php)\n```python\nupdated_TLEs = spherapy.updater.updateTLEs([25544]) \t#ISS\nTLE_paths = spherapy.updater.getTLEFilePaths([25544], use_packaged=True) \t#ISS\n```\n- set up a timespan\n```python\nt = spherapy.timespan.TimeSpan(datetime.datetime(2024,10,15,0,0,1),'1S','90M')\n```\n- construct an orbit\n\t- from a TLE (good practice to update the TLE with the most recent)\n```python\no = spherapy.orbit.Orbit.fromTLE(t, TLE_paths[0])\n```  \n-\tfrom orbital parameters\n```python\no = spherapy.orbit.Orbit.fromAnalyticalOrbitalParam(timespan, body='Earth',\n\t\t\t\t\t a=6978,\n\t\t\t\t\t ecc=0,\n\t\t\t\t\t inc=0,\n\t\t\t\t\t raan=0,\n\t\t\t\t\t argp=0,\n\t\t\t\t\t mean_nu=0,\n\t\t\t\t\t name='My Analytical Orbit',\n\t\t\t\t\t astrobodies=True)\n```  \n\n#### Full TLE example (for copy paste)\n```\nimport datetime\nimport spherapy.updater\nimport spherapy.timespan\nimport spherapy.orbit\nTLE_paths = spherapy.updater.getTLEFilePaths([25544], use_packaged=True) \t#ISS\nt = spherapy.timespan.TimeSpan(datetime.datetime(2024,10,15,0,0,1),'1S','90M')\no = spherapy.orbit.Orbit.fromTLE(t, TLE_paths[0])\n```\n\n#### Full Analytical exmaple (for copy paste)\n```\nimport datetime\nimport spherapy.timespan\nimport spherapy.orbit\nt = spherapy.timespan.TimeSpan(datetime.datetime(2024,10,15,0,0,1),'1S','90M')\no = spherapy.orbit.Orbit.fromAnalyticalOrbitalParam(timespan, body='Earth',\n\t\t\t\t\t a=6978,\n\t\t\t\t\t ecc=0,\n\t\t\t\t\t inc=0,\n\t\t\t\t\t raan=0,\n\t\t\t\t\t argp=0,\n\t\t\t\t\t mean_nu=0,\n\t\t\t\t\t name='My Analytical Orbit',\n\t\t\t\t\t astrobodies=True)\n```\n\n## SpaceTrack Credentials\nIn order to calculate the position of a historical satellite at any given time, spherapy requires [TLE information](https://en.wikipedia.org/wiki/Two-line_element_set) for each satellite which is accurate for the given time period (or 'epoch').  \nTLE data can be obtained from either [Celestrak](https://celestrak.org/) or [Spacetrack](https://www.space-track.org/). \nCelestrak holds only the most recent TLE data for each satellite, while Spacetrack will provide historical TLE data. spherapy will fall back to using Celestrak if it cannot authenticate access to Spacetrack.  \nIn order to use Spacetrack, you must provide your [Spacetrack credentials](https://www.space-track.org/auth/createAccount) to spherapy.\n\n## Configuration\nConfiguration for spherapy can either use the default settings, or settings specified in a `spherapy.conf` file.\n\n### Default settings\nIf the default settings are used, spherapy will use the system user data directory and expect spacetrack credentials to be stored in the system keyring.  \nThe default data directories are listed in [Directories](#directories)\n\n### Custom settings\nCustom settings can be specified in a `spherapy.conf` file.  \nThis file can be located either in the system user's config file (described in [Directories](#directories)) or at a location specified by the environment variable `SPHERAPY_CONFIG_DIR`.\n\nThe fields of `spherapy.conf` are described below\n```ini\n[credentials]\nSpacetrackUser = None \t\t# the spacetrack user, if left as \"None\" will source from system keyring\nSpacetrackPasswd = None \t# the spacetrack password, if left as \"None\" will source from system keyring\n\n[paths]\n# relative paths are assumed to be relative to the location of this file\n# do not quote path\nTLE_path = ./spherapy/data/TLEs \t# the location where TLE files will be saved, if left empty (\"\"), will default to system user's directory.\n```\n\n### Directories\nIf `SPHERAPY_CONFIG_DIR` is not set or `TLE_path` is left empty in `spherapy.conf`, the spherapy default directories will be used:\n\n#### Linux\n- TLE data dir:\n``` bash\n/home/{username}/.local/share/spherapy/TLEs\n```\n- config dir:\n``` bash\n/home/{username}/.config/spherapy/spherapy/{spherapy_version}/\n```\n\n#### OSX\n- TLE data dir:\n``` bash\n/Users/{username}/Library/Application Support/spherapy/TLEs\n```\n- config dir:\n``` bash\n/Users/{username}/Library/Application Support/spherapy/{spherapy_version}/\n```\n\n#### Windows\n- TLE data dir:\n``` bash\n'C:\\\\Users\\\\{username}\\\\AppData\\\\Local\\\\spherapy\\\\TLEs'\n```\n- config dir:\n``` bash\n'C:\\\\Users\\\\{username}\\\\AppData\\\\Local\\\\spherapy\\\\{spherapy_version}'\n```\n\n### Passwords\nBy default spherapy will use the system keyring to store the Spacetrack username and credentials (see [SpaceTrack Credentials](#spacetrack-credentials))  \nIf a config file is supplied, the credentials in the file will be used.\n\nCredentials can be added to the keyring by running the command (in the terminal, not the python shell)\n```\nspherapy-create-credentials\n```\n\n### Configration File Format\nThe configuration file `spherapy.conf` should have the following format:\n```ini\n[credentials]\nSpacetrackUser = None\nSpacetrackPasswd = None\n\n[paths]\n# relative paths are assumed to be relative to the location of this file\n# do not quote path\nTLE_path =\n```\n\n## Data Storage\n- TLEs\n\t- TLEs will be stored in the data directory, with a single file for each satellite ID.\n\t `{sat_id}.tle`, containing all historical TLEs for that satellite.\n\t- If celestrak is used instead, the file will be saved as a temporary file `{sat_id}.temptle`, which will be overwritten on each fetch from celestrak.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "An orbital propagator wrapper and TLE fetcher",
    "version": "0.2.1",
    "project_urls": {
        "Documentation": "https://rzmearns.github.io/spherapy/",
        "Issues": "https://github.com/rzmearns/spherapy/issues",
        "Repository": "https://github.com/rzmearns/spherapy"
    },
    "split_keywords": [
        "satellite",
        " sgp",
        " space",
        " orbit"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "92206113f71118311e8af1f2e7d5efe41ed56d687e2a08cb79a9c30cc4c95d5a",
                "md5": "49dec8e08839d56343dcff4912219137",
                "sha256": "ea4407442373f4de3a795cd2fd42f1602fc685cb0c76963a39256b18509f699b"
            },
            "downloads": -1,
            "filename": "spherapy-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "49dec8e08839d56343dcff4912219137",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 2048875,
            "upload_time": "2025-10-22T04:05:25",
            "upload_time_iso_8601": "2025-10-22T04:05:25.235144Z",
            "url": "https://files.pythonhosted.org/packages/92/20/6113f71118311e8af1f2e7d5efe41ed56d687e2a08cb79a9c30cc4c95d5a/spherapy-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "bba363f3bb0d02c263d8b9ff2ec5d0622d12e6955a1798c9f33709a3e5a9442a",
                "md5": "05e38612a25271462e8e6e188f770059",
                "sha256": "62f58fac48b75b58a7e3dbef36e6cd68e1a71c4acfc736221787b4a5b914496e"
            },
            "downloads": -1,
            "filename": "spherapy-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "05e38612a25271462e8e6e188f770059",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 2039574,
            "upload_time": "2025-10-22T04:05:27",
            "upload_time_iso_8601": "2025-10-22T04:05:27.342382Z",
            "url": "https://files.pythonhosted.org/packages/bb/a3/63f3bb0d02c263d8b9ff2ec5d0622d12e6955a1798c9f33709a3e5a9442a/spherapy-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-10-22 04:05:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rzmearns",
    "github_project": "spherapy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "spherapy"
}
        
Elapsed time: 1.76584s