sidereel 0.1.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.
Files changed (57) hide show
  1. sidereel-0.1.0/LICENSE +21 -0
  2. sidereel-0.1.0/PKG-INFO +110 -0
  3. sidereel-0.1.0/README.md +79 -0
  4. sidereel-0.1.0/pyproject.toml +57 -0
  5. sidereel-0.1.0/setup.cfg +4 -0
  6. sidereel-0.1.0/sidereel.egg-info/PKG-INFO +110 -0
  7. sidereel-0.1.0/sidereel.egg-info/SOURCES.txt +55 -0
  8. sidereel-0.1.0/sidereel.egg-info/dependency_links.txt +1 -0
  9. sidereel-0.1.0/sidereel.egg-info/entry_points.txt +5 -0
  10. sidereel-0.1.0/sidereel.egg-info/requires.txt +8 -0
  11. sidereel-0.1.0/sidereel.egg-info/top_level.txt +1 -0
  12. sidereel-0.1.0/simulations/__init__.py +1 -0
  13. sidereel-0.1.0/simulations/star_system/__init__.py +1 -0
  14. sidereel-0.1.0/simulations/star_system/__main__.py +95 -0
  15. sidereel-0.1.0/simulations/star_system/authoring.py +357 -0
  16. sidereel-0.1.0/simulations/star_system/catalog-sources.json +1040 -0
  17. sidereel-0.1.0/simulations/star_system/collisions.py +337 -0
  18. sidereel-0.1.0/simulations/star_system/context.py +63 -0
  19. sidereel-0.1.0/simulations/star_system/core.py +115 -0
  20. sidereel-0.1.0/simulations/star_system/data.py +77 -0
  21. sidereel-0.1.0/simulations/star_system/desktop.py +1181 -0
  22. sidereel-0.1.0/simulations/star_system/desktop_panels.py +294 -0
  23. sidereel-0.1.0/simulations/star_system/experiments.py +115 -0
  24. sidereel-0.1.0/simulations/star_system/frames.py +113 -0
  25. sidereel-0.1.0/simulations/star_system/history.py +70 -0
  26. sidereel-0.1.0/simulations/star_system/initialization.py +205 -0
  27. sidereel-0.1.0/simulations/star_system/model.py +157 -0
  28. sidereel-0.1.0/simulations/star_system/persistence.py +263 -0
  29. sidereel-0.1.0/simulations/star_system/playback.py +38 -0
  30. sidereel-0.1.0/simulations/star_system/plotting.py +858 -0
  31. sidereel-0.1.0/simulations/star_system/population_editor.py +201 -0
  32. sidereel-0.1.0/simulations/star_system/populations.py +77 -0
  33. sidereel-0.1.0/simulations/star_system/recording.py +220 -0
  34. sidereel-0.1.0/simulations/star_system/rendering.py +478 -0
  35. sidereel-0.1.0/simulations/star_system/scenarios.py +142 -0
  36. sidereel-0.1.0/simulations/star_system/sidebar.py +471 -0
  37. sidereel-0.1.0/simulations/star_system/templates.py +144 -0
  38. sidereel-0.1.0/tests/test_body_authoring.py +440 -0
  39. sidereel-0.1.0/tests/test_catalog_provenance.py +28 -0
  40. sidereel-0.1.0/tests/test_collision_workflows.py +301 -0
  41. sidereel-0.1.0/tests/test_collisions.py +290 -0
  42. sidereel-0.1.0/tests/test_context_overlays.py +103 -0
  43. sidereel-0.1.0/tests/test_desktop.py +581 -0
  44. sidereel-0.1.0/tests/test_experiment_controls.py +323 -0
  45. sidereel-0.1.0/tests/test_experiment_persistence.py +249 -0
  46. sidereel-0.1.0/tests/test_experiment_templates.py +86 -0
  47. sidereel-0.1.0/tests/test_jupiter_experiments.py +281 -0
  48. sidereel-0.1.0/tests/test_moons.py +176 -0
  49. sidereel-0.1.0/tests/test_package_data.py +10 -0
  50. sidereel-0.1.0/tests/test_population_controls.py +358 -0
  51. sidereel-0.1.0/tests/test_populations.py +247 -0
  52. sidereel-0.1.0/tests/test_recorded_playback.py +245 -0
  53. sidereel-0.1.0/tests/test_recording.py +113 -0
  54. sidereel-0.1.0/tests/test_reference_frames.py +175 -0
  55. sidereel-0.1.0/tests/test_solver_clock.py +40 -0
  56. sidereel-0.1.0/tests/test_star_system.py +154 -0
  57. sidereel-0.1.0/tests/test_star_system_display.py +473 -0
sidereel-0.1.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nate Bosma
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.
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: sidereel
3
+ Version: 0.1.0
4
+ Summary: Sidereel, an interactive N-body sandbox with a Qt desktop.
5
+ Author: Nate Bosma
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/AllHailSeizure/sidereel
8
+ Project-URL: Repository, https://github.com/AllHailSeizure/sidereel
9
+ Project-URL: Issues, https://github.com/AllHailSeizure/sidereel/issues
10
+ Keywords: n-body,astronomy,simulation,pyqt
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: X11 Applications :: Qt
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
19
+ Classifier: Topic :: Scientific/Engineering :: Physics
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: numpy>=1.24
24
+ Requires-Dist: matplotlib>=3.8
25
+ Requires-Dist: pillow>=10
26
+ Requires-Dist: PyQt6>=6.5
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.4; extra == "dev"
29
+ Requires-Dist: ruff==0.17.3; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # Sidereel
33
+
34
+ A planar N-body sandbox. Build a system, watch gravity work, keep the picture.
35
+
36
+ ![Sun, Earth, and Jupiter through one year](docs/orbit.gif)
37
+
38
+ One year of the Sun, Earth, and Jupiter, rendered by `sidereel-cli`.
39
+
40
+ ## Features
41
+
42
+ - Unsoftened Newtonian gravity in the plane. Masses pull on each other. Test particles only fall.
43
+ - A fixed-step Yoshida integrator. A close encounter halts the run and keeps the last good state.
44
+ - A PyQt6 window filled by the sky. Menu, or M, lays a sidebar over the scene. The view stays put.
45
+ - Four starting experiments: the Solar System, a star at twice the Sun's mass, Earth and the Moon, 32 asteroids in a ring at 3.2 AU.
46
+ - A CLI that integrates the system and writes a PNG. No display required.
47
+ - Starting setups saved as JSON. Calculate a recording, then play the samples.
48
+ - An isolated planet holds its period to a relative 1e-7. At 1 AU, solar gravity sits about 30 ppm above JPL's GM, inside a 1e-4 bound.
49
+
50
+ ## Prerequisites and installation
51
+
52
+ Python 3.10 or newer.
53
+
54
+ ```bash
55
+ pipx install sidereel
56
+ ```
57
+
58
+ `sidereel` opens the desktop. `sidereel-cli` renders.
59
+
60
+ The project is not on PyPI yet. Until the first release, install from git:
61
+
62
+ ```bash
63
+ pipx install git+https://github.com/AllHailSeizure/sidereel
64
+ ```
65
+
66
+ From a checkout:
67
+
68
+ ```bash
69
+ pip install -e .
70
+ ```
71
+
72
+ On Debian and Ubuntu the desktop also needs `libegl1` and `libopengl0`.
73
+
74
+ ## Usage
75
+
76
+ Open the GUI:
77
+
78
+ ```bash
79
+ sidereel
80
+ ```
81
+
82
+ You get the experiment list. `sidereel-cli` with no arguments opens the same window.
83
+
84
+ Render the year in the picture:
85
+
86
+ ```bash
87
+ sidereel-cli --star sun --planet earth --planet jupiter --years 1 --output output/sidereel.png
88
+ ```
89
+
90
+ Starting positions only. The default is the Sun, Earth, and Jupiter:
91
+
92
+ ```bash
93
+ sidereel-cli --output output/start.png
94
+ ```
95
+
96
+ Inner planets, half a year:
97
+
98
+ ```bash
99
+ sidereel-cli --star sun --planet mercury --planet venus --planet earth --years 0.5 --output output/inner.png
100
+ ```
101
+
102
+ `--star` is `proxima`, `sun`, `sirius`, or `rigel`. Repeat `--planet` for each body: `mercury`, `venus`, `earth`, `mars`, `jupiter`, `saturn`, `uranus`, `neptune`, `pluto`, `ceres`.
103
+
104
+ `--years` works only with `--output`. So do `--sample-stride` and `--max-recording-mib`. Name bodies without `--output` and the Matplotlib window opens instead.
105
+
106
+ In a checkout, `python -m simulations.star_system` is the same program. `sidereel-cli --help` lists every flag.
107
+
108
+ ## License
109
+
110
+ MIT. Copyright 2026 Nate Bosma. See [LICENSE](LICENSE).
@@ -0,0 +1,79 @@
1
+ # Sidereel
2
+
3
+ A planar N-body sandbox. Build a system, watch gravity work, keep the picture.
4
+
5
+ ![Sun, Earth, and Jupiter through one year](docs/orbit.gif)
6
+
7
+ One year of the Sun, Earth, and Jupiter, rendered by `sidereel-cli`.
8
+
9
+ ## Features
10
+
11
+ - Unsoftened Newtonian gravity in the plane. Masses pull on each other. Test particles only fall.
12
+ - A fixed-step Yoshida integrator. A close encounter halts the run and keeps the last good state.
13
+ - A PyQt6 window filled by the sky. Menu, or M, lays a sidebar over the scene. The view stays put.
14
+ - Four starting experiments: the Solar System, a star at twice the Sun's mass, Earth and the Moon, 32 asteroids in a ring at 3.2 AU.
15
+ - A CLI that integrates the system and writes a PNG. No display required.
16
+ - Starting setups saved as JSON. Calculate a recording, then play the samples.
17
+ - An isolated planet holds its period to a relative 1e-7. At 1 AU, solar gravity sits about 30 ppm above JPL's GM, inside a 1e-4 bound.
18
+
19
+ ## Prerequisites and installation
20
+
21
+ Python 3.10 or newer.
22
+
23
+ ```bash
24
+ pipx install sidereel
25
+ ```
26
+
27
+ `sidereel` opens the desktop. `sidereel-cli` renders.
28
+
29
+ The project is not on PyPI yet. Until the first release, install from git:
30
+
31
+ ```bash
32
+ pipx install git+https://github.com/AllHailSeizure/sidereel
33
+ ```
34
+
35
+ From a checkout:
36
+
37
+ ```bash
38
+ pip install -e .
39
+ ```
40
+
41
+ On Debian and Ubuntu the desktop also needs `libegl1` and `libopengl0`.
42
+
43
+ ## Usage
44
+
45
+ Open the GUI:
46
+
47
+ ```bash
48
+ sidereel
49
+ ```
50
+
51
+ You get the experiment list. `sidereel-cli` with no arguments opens the same window.
52
+
53
+ Render the year in the picture:
54
+
55
+ ```bash
56
+ sidereel-cli --star sun --planet earth --planet jupiter --years 1 --output output/sidereel.png
57
+ ```
58
+
59
+ Starting positions only. The default is the Sun, Earth, and Jupiter:
60
+
61
+ ```bash
62
+ sidereel-cli --output output/start.png
63
+ ```
64
+
65
+ Inner planets, half a year:
66
+
67
+ ```bash
68
+ sidereel-cli --star sun --planet mercury --planet venus --planet earth --years 0.5 --output output/inner.png
69
+ ```
70
+
71
+ `--star` is `proxima`, `sun`, `sirius`, or `rigel`. Repeat `--planet` for each body: `mercury`, `venus`, `earth`, `mars`, `jupiter`, `saturn`, `uranus`, `neptune`, `pluto`, `ceres`.
72
+
73
+ `--years` works only with `--output`. So do `--sample-stride` and `--max-recording-mib`. Name bodies without `--output` and the Matplotlib window opens instead.
74
+
75
+ In a checkout, `python -m simulations.star_system` is the same program. `sidereel-cli --help` lists every flag.
76
+
77
+ ## License
78
+
79
+ MIT. Copyright 2026 Nate Bosma. See [LICENSE](LICENSE).
@@ -0,0 +1,57 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "sidereel"
7
+ version = "0.1.0"
8
+ description = "Sidereel, an interactive N-body sandbox with a Qt desktop."
9
+ readme = "README.md"
10
+ license = "MIT"
11
+ license-files = ["LICENSE"]
12
+ requires-python = ">=3.10"
13
+ authors = [{name = "Nate Bosma"}]
14
+ keywords = ["n-body", "astronomy", "simulation", "pyqt"]
15
+ classifiers = [
16
+ "Development Status :: 4 - Beta",
17
+ "Environment :: X11 Applications :: Qt",
18
+ "Intended Audience :: Science/Research",
19
+ "Operating System :: OS Independent",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.10",
22
+ "Programming Language :: Python :: 3.14",
23
+ "Topic :: Scientific/Engineering :: Astronomy",
24
+ "Topic :: Scientific/Engineering :: Physics",
25
+ ]
26
+ dependencies = [
27
+ "numpy>=1.24",
28
+ "matplotlib>=3.8",
29
+ "pillow>=10",
30
+ "PyQt6>=6.5",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "pytest>=7.4",
36
+ "ruff==0.17.3",
37
+ ]
38
+
39
+ [project.urls]
40
+ Homepage = "https://github.com/AllHailSeizure/sidereel"
41
+ Repository = "https://github.com/AllHailSeizure/sidereel"
42
+ Issues = "https://github.com/AllHailSeizure/sidereel/issues"
43
+
44
+ # sidereel is a GUI script so Windows launches it with pythonw (no console).
45
+ # sidereel-cli keeps the full command line, including headless --output.
46
+ # The import package remains simulations.star_system.
47
+ [project.gui-scripts]
48
+ sidereel = "simulations.star_system.desktop:main"
49
+
50
+ [project.scripts]
51
+ sidereel-cli = "simulations.star_system.__main__:main"
52
+
53
+ [tool.setuptools.packages.find]
54
+ include = ["simulations*"]
55
+
56
+ [tool.setuptools.package-data]
57
+ "simulations.star_system" = ["catalog-sources.json"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,110 @@
1
+ Metadata-Version: 2.4
2
+ Name: sidereel
3
+ Version: 0.1.0
4
+ Summary: Sidereel, an interactive N-body sandbox with a Qt desktop.
5
+ Author: Nate Bosma
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/AllHailSeizure/sidereel
8
+ Project-URL: Repository, https://github.com/AllHailSeizure/sidereel
9
+ Project-URL: Issues, https://github.com/AllHailSeizure/sidereel/issues
10
+ Keywords: n-body,astronomy,simulation,pyqt
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Environment :: X11 Applications :: Qt
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Scientific/Engineering :: Astronomy
19
+ Classifier: Topic :: Scientific/Engineering :: Physics
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: numpy>=1.24
24
+ Requires-Dist: matplotlib>=3.8
25
+ Requires-Dist: pillow>=10
26
+ Requires-Dist: PyQt6>=6.5
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest>=7.4; extra == "dev"
29
+ Requires-Dist: ruff==0.17.3; extra == "dev"
30
+ Dynamic: license-file
31
+
32
+ # Sidereel
33
+
34
+ A planar N-body sandbox. Build a system, watch gravity work, keep the picture.
35
+
36
+ ![Sun, Earth, and Jupiter through one year](docs/orbit.gif)
37
+
38
+ One year of the Sun, Earth, and Jupiter, rendered by `sidereel-cli`.
39
+
40
+ ## Features
41
+
42
+ - Unsoftened Newtonian gravity in the plane. Masses pull on each other. Test particles only fall.
43
+ - A fixed-step Yoshida integrator. A close encounter halts the run and keeps the last good state.
44
+ - A PyQt6 window filled by the sky. Menu, or M, lays a sidebar over the scene. The view stays put.
45
+ - Four starting experiments: the Solar System, a star at twice the Sun's mass, Earth and the Moon, 32 asteroids in a ring at 3.2 AU.
46
+ - A CLI that integrates the system and writes a PNG. No display required.
47
+ - Starting setups saved as JSON. Calculate a recording, then play the samples.
48
+ - An isolated planet holds its period to a relative 1e-7. At 1 AU, solar gravity sits about 30 ppm above JPL's GM, inside a 1e-4 bound.
49
+
50
+ ## Prerequisites and installation
51
+
52
+ Python 3.10 or newer.
53
+
54
+ ```bash
55
+ pipx install sidereel
56
+ ```
57
+
58
+ `sidereel` opens the desktop. `sidereel-cli` renders.
59
+
60
+ The project is not on PyPI yet. Until the first release, install from git:
61
+
62
+ ```bash
63
+ pipx install git+https://github.com/AllHailSeizure/sidereel
64
+ ```
65
+
66
+ From a checkout:
67
+
68
+ ```bash
69
+ pip install -e .
70
+ ```
71
+
72
+ On Debian and Ubuntu the desktop also needs `libegl1` and `libopengl0`.
73
+
74
+ ## Usage
75
+
76
+ Open the GUI:
77
+
78
+ ```bash
79
+ sidereel
80
+ ```
81
+
82
+ You get the experiment list. `sidereel-cli` with no arguments opens the same window.
83
+
84
+ Render the year in the picture:
85
+
86
+ ```bash
87
+ sidereel-cli --star sun --planet earth --planet jupiter --years 1 --output output/sidereel.png
88
+ ```
89
+
90
+ Starting positions only. The default is the Sun, Earth, and Jupiter:
91
+
92
+ ```bash
93
+ sidereel-cli --output output/start.png
94
+ ```
95
+
96
+ Inner planets, half a year:
97
+
98
+ ```bash
99
+ sidereel-cli --star sun --planet mercury --planet venus --planet earth --years 0.5 --output output/inner.png
100
+ ```
101
+
102
+ `--star` is `proxima`, `sun`, `sirius`, or `rigel`. Repeat `--planet` for each body: `mercury`, `venus`, `earth`, `mars`, `jupiter`, `saturn`, `uranus`, `neptune`, `pluto`, `ceres`.
103
+
104
+ `--years` works only with `--output`. So do `--sample-stride` and `--max-recording-mib`. Name bodies without `--output` and the Matplotlib window opens instead.
105
+
106
+ In a checkout, `python -m simulations.star_system` is the same program. `sidereel-cli --help` lists every flag.
107
+
108
+ ## License
109
+
110
+ MIT. Copyright 2026 Nate Bosma. See [LICENSE](LICENSE).
@@ -0,0 +1,55 @@
1
+ LICENSE
2
+ README.md
3
+ pyproject.toml
4
+ sidereel.egg-info/PKG-INFO
5
+ sidereel.egg-info/SOURCES.txt
6
+ sidereel.egg-info/dependency_links.txt
7
+ sidereel.egg-info/entry_points.txt
8
+ sidereel.egg-info/requires.txt
9
+ sidereel.egg-info/top_level.txt
10
+ simulations/__init__.py
11
+ simulations/star_system/__init__.py
12
+ simulations/star_system/__main__.py
13
+ simulations/star_system/authoring.py
14
+ simulations/star_system/catalog-sources.json
15
+ simulations/star_system/collisions.py
16
+ simulations/star_system/context.py
17
+ simulations/star_system/core.py
18
+ simulations/star_system/data.py
19
+ simulations/star_system/desktop.py
20
+ simulations/star_system/desktop_panels.py
21
+ simulations/star_system/experiments.py
22
+ simulations/star_system/frames.py
23
+ simulations/star_system/history.py
24
+ simulations/star_system/initialization.py
25
+ simulations/star_system/model.py
26
+ simulations/star_system/persistence.py
27
+ simulations/star_system/playback.py
28
+ simulations/star_system/plotting.py
29
+ simulations/star_system/population_editor.py
30
+ simulations/star_system/populations.py
31
+ simulations/star_system/recording.py
32
+ simulations/star_system/rendering.py
33
+ simulations/star_system/scenarios.py
34
+ simulations/star_system/sidebar.py
35
+ simulations/star_system/templates.py
36
+ tests/test_body_authoring.py
37
+ tests/test_catalog_provenance.py
38
+ tests/test_collision_workflows.py
39
+ tests/test_collisions.py
40
+ tests/test_context_overlays.py
41
+ tests/test_desktop.py
42
+ tests/test_experiment_controls.py
43
+ tests/test_experiment_persistence.py
44
+ tests/test_experiment_templates.py
45
+ tests/test_jupiter_experiments.py
46
+ tests/test_moons.py
47
+ tests/test_package_data.py
48
+ tests/test_population_controls.py
49
+ tests/test_populations.py
50
+ tests/test_recorded_playback.py
51
+ tests/test_recording.py
52
+ tests/test_reference_frames.py
53
+ tests/test_solver_clock.py
54
+ tests/test_star_system.py
55
+ tests/test_star_system_display.py
@@ -0,0 +1,5 @@
1
+ [console_scripts]
2
+ sidereel-cli = simulations.star_system.__main__:main
3
+
4
+ [gui_scripts]
5
+ sidereel = simulations.star_system.desktop:main
@@ -0,0 +1,8 @@
1
+ numpy>=1.24
2
+ matplotlib>=3.8
3
+ pillow>=10
4
+ PyQt6>=6.5
5
+
6
+ [dev]
7
+ pytest>=7.4
8
+ ruff==0.17.3
@@ -0,0 +1 @@
1
+ simulations
@@ -0,0 +1 @@
1
+ """Small, checkable physics simulations."""
@@ -0,0 +1 @@
1
+ """Interactive stellar sandbox with a display-independent physics core."""
@@ -0,0 +1,95 @@
1
+ """Default: Qt desktop starting menu. Explicit flags: legacy Matplotlib GUI or headless PNG (--output)."""
2
+ import argparse
3
+ import math
4
+ import sys
5
+ from pathlib import Path
6
+ from .core import make_system, SOLAR_RADIUS_AU
7
+ from .data import STARS, PLANETS
8
+ from .populations import Population, with_population
9
+
10
+
11
+ def main(argv=None):
12
+ arguments = list(sys.argv[1:] if argv is None else argv)
13
+ if not arguments:
14
+ from .desktop import main as desktop_main
15
+ return desktop_main()
16
+ parser = argparse.ArgumentParser(description=__doc__, allow_abbrev=False)
17
+ parser.add_argument('--star', choices=STARS, default='sun')
18
+ parser.add_argument('--load', type=Path, help='Load a versioned starting setup JSON')
19
+ parser.add_argument('--planet', choices=PLANETS, action='append')
20
+ parser.add_argument('--output', type=Path, help='Save a still image instead of opening the GUI')
21
+ parser.add_argument('--years', type=float, default=0., help='With --output: evolve before saving the PNG (nonnegative; default 0)')
22
+ parser.add_argument('--sample-stride', type=int, default=10, help='With --output: recording output stride in physics steps (default 10)')
23
+ parser.add_argument('--max-recording-mib', type=int, default=256, help='With --output: in-memory recording budget (default 256 MiB)')
24
+ parser.add_argument('--population', choices=('ring', 'disk', 'belt'))
25
+ parser.add_argument('--count', type=int, default=200, help='Massless particles (1-2000)')
26
+ parser.add_argument('--inner', type=float, default=2., help='Inner population radius in AU from star')
27
+ parser.add_argument('--outer', type=float, help='Outer radius in AU; defaults to inner for rings, 3.5 otherwise')
28
+ parser.add_argument('--seed', type=int, default=0, help='Nonnegative population seed')
29
+ parser.add_argument('--angles', choices=('random', 'even'), default='random')
30
+ args = parser.parse_args(arguments)
31
+ recording_only = ('--sample-stride', '--max-recording-mib')
32
+ if not args.output:
33
+ if args.years:
34
+ parser.error('--years applies only with --output; interactive GUIs open in PREP at t=0')
35
+ if any(argument.split('=', 1)[0] in recording_only for argument in arguments):
36
+ parser.error('--sample-stride and --max-recording-mib apply only with --output')
37
+ construction = {'--star', '--planet', '--population', '--count', '--inner', '--outer', '--seed', '--angles'}
38
+ if args.load is not None and any(argument.split('=', 1)[0] in construction for argument in arguments):
39
+ parser.error('--load cannot be combined with explicit body/population construction flags')
40
+ planets = args.planet or ['earth','jupiter']
41
+ import matplotlib
42
+ if args.output:
43
+ matplotlib.use('Agg')
44
+ from .plotting import App, draw_system
45
+ import matplotlib.pyplot as plt
46
+ try:
47
+ if not math.isfinite(args.years) or args.years < 0:
48
+ raise ValueError('--years must be nonnegative')
49
+ population = None
50
+ loaded = None
51
+ if args.load is not None:
52
+ from .persistence import load_setup
53
+ from .initialization import build_system
54
+ loaded = load_setup(args.load)
55
+ if args.population:
56
+ outer = args.outer if args.outer is not None else args.inner if args.population == 'ring' else 3.5
57
+ population = Population(args.population, args.count, args.inner, outer, args.seed, args.angles)
58
+ # Validate before opening a window, as well as on each rebuild.
59
+ with_population(make_system(args.star, planets), population,
60
+ STARS[args.star].radius*SOLAR_RADIUS_AU)
61
+ if args.output:
62
+ from .initialization import build_system, legacy_setup
63
+ from .recording import Calculation, CalculationRequest
64
+ setup = loaded if loaded is not None else legacy_setup(args.star, planets, population=population)
65
+ prepared = build_system(setup)
66
+ result = None
67
+ if args.years:
68
+ calc = Calculation(setup, CalculationRequest(args.years, args.sample_stride, args.max_recording_mib*1048576))
69
+ while not calc.done:
70
+ calc.advance(150)
71
+ prepared, result = calc.prepared, calc.result
72
+ fig,ax = plt.subplots(figsize=(9,9))
73
+ scene = draw_system(ax, prepared, result.frames if result else ())
74
+ ax.set_title(setup.name, color='#edf4f7')
75
+ if result:
76
+ scene.result_info.set_text(f'{result.status.upper()} / {result.completed_steps:,} steps\n'
77
+ f'Requested {result.requested_end_time:.8g} yr / actual {result.actual_end_time:.8g} yr\n'
78
+ f'Source {result.setup_digest[:12]}\n{result.reason}')
79
+ args.output.parent.mkdir(parents=True,exist_ok=True)
80
+ fig.savefig(args.output,dpi=150)
81
+ plt.close(fig)
82
+ if result is not None and result.status != 'complete':
83
+ print(f'{result.status}: {result.reason}', file=sys.stderr)
84
+ return 2
85
+ else:
86
+ # Keep callbacks and animation alive until the GUI closes.
87
+ _app = App(args.star,planets, population=population, setup=loaded)
88
+ plt.show()
89
+ return 0
90
+ except (ValueError, OSError) as exc:
91
+ parser.error(str(exc))
92
+ return 0
93
+
94
+ if __name__ == '__main__':
95
+ raise SystemExit(main())