astro-pi-orbit 2.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- astro_pi_orbit-2.0.0/LICENSE +22 -0
- astro_pi_orbit-2.0.0/PKG-INFO +51 -0
- astro_pi_orbit-2.0.0/README.md +16 -0
- astro_pi_orbit-2.0.0/astro_pi_orbit/__init__.py +9 -0
- astro_pi_orbit-2.0.0/astro_pi_orbit/telemetry.py +87 -0
- astro_pi_orbit-2.0.0/astro_pi_orbit.egg-info/PKG-INFO +51 -0
- astro_pi_orbit-2.0.0/astro_pi_orbit.egg-info/SOURCES.txt +10 -0
- astro_pi_orbit-2.0.0/astro_pi_orbit.egg-info/dependency_links.txt +1 -0
- astro_pi_orbit-2.0.0/astro_pi_orbit.egg-info/requires.txt +1 -0
- astro_pi_orbit-2.0.0/astro_pi_orbit.egg-info/top_level.txt +1 -0
- astro_pi_orbit-2.0.0/pyproject.toml +54 -0
- astro_pi_orbit-2.0.0/setup.cfg +4 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Raspberry Pi Foundation
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: astro_pi_orbit
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Module for interfacing with the Astro Pi
|
|
5
|
+
Author-email: Ben Nuttall <ben@bennuttall.com>, George Boukeas <boukeas@gmail.com>, Geraint Ballinger <G3zz@users.noreply.github.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024 Raspberry Pi Foundation
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
Classifier: Programming Language :: Python :: 3
|
|
30
|
+
Classifier: Operating System :: OS Independent
|
|
31
|
+
Requires-Python: >=3.7
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
License-File: LICENSE
|
|
34
|
+
Requires-Dist: skyfield
|
|
35
|
+
|
|
36
|
+
# astro_pi_orbit
|
|
37
|
+
|
|
38
|
+
The `astro_pi_orbit` library provides functionality to assist Astro Pi Mission Space Lab participants in working with orbital data.
|
|
39
|
+
|
|
40
|
+
Documentation is available at [docs](./docs).
|
|
41
|
+
|
|
42
|
+
## Contributing
|
|
43
|
+
|
|
44
|
+
We welcome all contributions!
|
|
45
|
+
Please install and run the dependencies in `requirements-dev.txt`, and run `pre-commit` prior to opening a PR. On Unix, `pre-commit` can be installed by running the following:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install pre-commit
|
|
49
|
+
pre-commit install
|
|
50
|
+
```
|
|
51
|
+
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# astro_pi_orbit
|
|
2
|
+
|
|
3
|
+
The `astro_pi_orbit` library provides functionality to assist Astro Pi Mission Space Lab participants in working with orbital data.
|
|
4
|
+
|
|
5
|
+
Documentation is available at [docs](./docs).
|
|
6
|
+
|
|
7
|
+
## Contributing
|
|
8
|
+
|
|
9
|
+
We welcome all contributions!
|
|
10
|
+
Please install and run the dependencies in `requirements-dev.txt`, and run `pre-commit` prior to opening a PR. On Unix, `pre-commit` can be installed by running the following:
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
pip install pre-commit
|
|
14
|
+
pre-commit install
|
|
15
|
+
```
|
|
16
|
+
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import os
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from skyfield.api import Loader, load
|
|
5
|
+
|
|
6
|
+
_tle_dir: Path = Path(os.environ.get("TLE_DIR", Path.home()))
|
|
7
|
+
print("_TLE_DIR", _tle_dir)
|
|
8
|
+
_tle_filename = "iss.tle"
|
|
9
|
+
_tle_url = "http://celestrak.com/NORAD/elements/stations.txt"
|
|
10
|
+
|
|
11
|
+
_bsp_dir = os.environ.get("BSP_DIR", Path.home())
|
|
12
|
+
print("_BSP_DIR", _bsp_dir)
|
|
13
|
+
_bsp_421_filename = "de421.bsp"
|
|
14
|
+
_bsp_440s_filename = "de440s.bsp"
|
|
15
|
+
|
|
16
|
+
_timescale = load.timescale()
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def _load_iss():
|
|
20
|
+
"""
|
|
21
|
+
Retrieves ISS telemetry data from a local or remote TLE file and
|
|
22
|
+
returns a Skyfield EarthSatellite object corresponding to the ISS.
|
|
23
|
+
"""
|
|
24
|
+
loader = Loader(_tle_dir, verbose=False)
|
|
25
|
+
try:
|
|
26
|
+
# find telemetry data locally
|
|
27
|
+
satellites = loader.tle_file(_tle_filename)
|
|
28
|
+
except FileNotFoundError:
|
|
29
|
+
pass
|
|
30
|
+
else:
|
|
31
|
+
iss = next((sat for sat in satellites if sat.name == "ISS (ZARYA)"), None)
|
|
32
|
+
if iss is None:
|
|
33
|
+
raise RuntimeError(
|
|
34
|
+
f"Unable to retrieve ISS TLE data from {loader.path_to(_tle_filename)}"
|
|
35
|
+
)
|
|
36
|
+
return iss
|
|
37
|
+
|
|
38
|
+
try:
|
|
39
|
+
# find telemetry data remotely
|
|
40
|
+
satellites = loader.tle_file(_tle_url)
|
|
41
|
+
Path(_tle_dir / Path(_tle_url).name).rename(_tle_dir / _tle_filename)
|
|
42
|
+
except Exception as e:
|
|
43
|
+
print(e)
|
|
44
|
+
pass
|
|
45
|
+
else:
|
|
46
|
+
iss = next((sat for sat in satellites if sat.name == "ISS (ZARYA)"), None)
|
|
47
|
+
if iss is None:
|
|
48
|
+
raise RuntimeError(f"Unable to retrieve ISS TLE data from {_tle_url}")
|
|
49
|
+
return iss
|
|
50
|
+
|
|
51
|
+
raise FileNotFoundError(
|
|
52
|
+
"Unable to retrieve ISS TLE data: "
|
|
53
|
+
+ f"cannot find {loader.path_to(_tle_filename)} or download {_tle_url}."
|
|
54
|
+
)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def load_iss():
|
|
58
|
+
ISS = _load_iss()
|
|
59
|
+
# bind the `coordinates` function to the ISS object as a method
|
|
60
|
+
setattr(ISS, "coordinates", coordinates.__get__(ISS, ISS.__class__))
|
|
61
|
+
return ISS
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
def coordinates(satellite):
|
|
65
|
+
"""
|
|
66
|
+
Return a Skyfield GeographicPosition object corresponding to the Earth
|
|
67
|
+
latitude and longitude beneath the current celestial position of the ISS.
|
|
68
|
+
|
|
69
|
+
See: rhodesmill.org/skyfield/api-topos.html#skyfield.toposlib.GeographicPosition
|
|
70
|
+
"""
|
|
71
|
+
return satellite.at(_timescale.now()).subpoint()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def load_ephemeris(bsp_filename):
|
|
75
|
+
loader = Loader(_bsp_dir, verbose=False)
|
|
76
|
+
return loader(bsp_filename)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
# create ISS as a Skyfield EarthSatellite object
|
|
80
|
+
# See: rhodesmill.org/skyfield/api-satellites.html#skyfield.sgp4lib.EarthSatellite
|
|
81
|
+
ISS = load_iss
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
# Expose ephemeris in the API
|
|
85
|
+
de421 = load_ephemeris(_bsp_421_filename)
|
|
86
|
+
de440s = load_ephemeris(_bsp_440s_filename)
|
|
87
|
+
ephemeris = de421
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: astro_pi_orbit
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: Module for interfacing with the Astro Pi
|
|
5
|
+
Author-email: Ben Nuttall <ben@bennuttall.com>, George Boukeas <boukeas@gmail.com>, Geraint Ballinger <G3zz@users.noreply.github.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
|
|
8
|
+
Copyright (c) 2024 Raspberry Pi Foundation
|
|
9
|
+
|
|
10
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
11
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
12
|
+
in the Software without restriction, including without limitation the rights
|
|
13
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
14
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
15
|
+
furnished to do so, subject to the following conditions:
|
|
16
|
+
|
|
17
|
+
The above copyright notice and this permission notice shall be included in all
|
|
18
|
+
copies or substantial portions of the Software.
|
|
19
|
+
|
|
20
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
21
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
22
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
23
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
24
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
25
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
26
|
+
SOFTWARE.
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
Classifier: Programming Language :: Python :: 3
|
|
30
|
+
Classifier: Operating System :: OS Independent
|
|
31
|
+
Requires-Python: >=3.7
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
License-File: LICENSE
|
|
34
|
+
Requires-Dist: skyfield
|
|
35
|
+
|
|
36
|
+
# astro_pi_orbit
|
|
37
|
+
|
|
38
|
+
The `astro_pi_orbit` library provides functionality to assist Astro Pi Mission Space Lab participants in working with orbital data.
|
|
39
|
+
|
|
40
|
+
Documentation is available at [docs](./docs).
|
|
41
|
+
|
|
42
|
+
## Contributing
|
|
43
|
+
|
|
44
|
+
We welcome all contributions!
|
|
45
|
+
Please install and run the dependencies in `requirements-dev.txt`, and run `pre-commit` prior to opening a PR. On Unix, `pre-commit` can be installed by running the following:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install pre-commit
|
|
49
|
+
pre-commit install
|
|
50
|
+
```
|
|
51
|
+
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
astro_pi_orbit/__init__.py
|
|
5
|
+
astro_pi_orbit/telemetry.py
|
|
6
|
+
astro_pi_orbit.egg-info/PKG-INFO
|
|
7
|
+
astro_pi_orbit.egg-info/SOURCES.txt
|
|
8
|
+
astro_pi_orbit.egg-info/dependency_links.txt
|
|
9
|
+
astro_pi_orbit.egg-info/requires.txt
|
|
10
|
+
astro_pi_orbit.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
skyfield
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
astro_pi_orbit
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "astro_pi_orbit"
|
|
7
|
+
description = "Module for interfacing with the Astro Pi"
|
|
8
|
+
dynamic = ["version"]
|
|
9
|
+
authors = [
|
|
10
|
+
{ name="Ben Nuttall", email="ben@bennuttall.com" },
|
|
11
|
+
{ name="George Boukeas", email="boukeas@gmail.com" },
|
|
12
|
+
{ name="Geraint Ballinger", email="G3zz@users.noreply.github.com" }
|
|
13
|
+
]
|
|
14
|
+
license = {file="LICENSE"}
|
|
15
|
+
readme = "README.md"
|
|
16
|
+
requires-python = ">=3.7"
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Operating System :: OS Independent"
|
|
20
|
+
]
|
|
21
|
+
dependencies = [
|
|
22
|
+
"skyfield"
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[tool.setuptools]
|
|
26
|
+
packages = ["astro_pi_orbit"]
|
|
27
|
+
|
|
28
|
+
[tool.setuptools.dynamic]
|
|
29
|
+
version = {attr = "astro_pi_orbit.__init__.__version__"}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# Configure static checkers/tools
|
|
33
|
+
[tool.isort]
|
|
34
|
+
atomic = true
|
|
35
|
+
line_length = 88
|
|
36
|
+
profile = "black"
|
|
37
|
+
skip_gitignore = true
|
|
38
|
+
src_paths = ["astro_pi_orbit", "test"]
|
|
39
|
+
skip_glob = ["test/resources", "venv", "dist", "site", "docs", "scripts"]
|
|
40
|
+
|
|
41
|
+
[tool.black]
|
|
42
|
+
line-length = 88
|
|
43
|
+
target-version = ['py39']
|
|
44
|
+
include = '\.pyi?$'
|
|
45
|
+
extend-exclude = '''
|
|
46
|
+
(
|
|
47
|
+
^/test/resources
|
|
48
|
+
)
|
|
49
|
+
'''
|
|
50
|
+
|
|
51
|
+
[tool.bandit]
|
|
52
|
+
skips = ["B101", "B404"]
|
|
53
|
+
exclude = ["test/resources"]
|
|
54
|
+
|