rocketpy 1.3.0__tar.gz → 1.4.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 (86) hide show
  1. {rocketpy-1.3.0/rocketpy.egg-info → rocketpy-1.4.0}/PKG-INFO +9 -2
  2. {rocketpy-1.3.0 → rocketpy-1.4.0}/pyproject.toml +4 -4
  3. rocketpy-1.4.0/requirements.txt +7 -0
  4. rocketpy-1.4.0/rocketpy/__init__.py +51 -0
  5. rocketpy-1.4.0/rocketpy/_encoders.py +43 -0
  6. rocketpy-1.4.0/rocketpy/control/__init__.py +1 -0
  7. rocketpy-1.4.0/rocketpy/control/controller.py +132 -0
  8. rocketpy-1.4.0/rocketpy/environment/__init__.py +2 -0
  9. rocketpy-1.4.0/rocketpy/environment/environment.py +3894 -0
  10. rocketpy-1.4.0/rocketpy/environment/environment_analysis.py +2915 -0
  11. rocketpy-1.4.0/rocketpy/mathutils/__init__.py +7 -0
  12. rocketpy-1.4.0/rocketpy/mathutils/function.py +3362 -0
  13. rocketpy-1.4.0/rocketpy/mathutils/vector_matrix.py +994 -0
  14. rocketpy-1.4.0/rocketpy/motors/__init__.py +13 -0
  15. rocketpy-1.4.0/rocketpy/motors/fluid.py +63 -0
  16. rocketpy-1.4.0/rocketpy/motors/hybrid_motor.py +622 -0
  17. rocketpy-1.4.0/rocketpy/motors/liquid_motor.py +488 -0
  18. rocketpy-1.4.0/rocketpy/motors/motor.py +1380 -0
  19. rocketpy-1.4.0/rocketpy/motors/solid_motor.py +717 -0
  20. rocketpy-1.4.0/rocketpy/motors/tank.py +1475 -0
  21. rocketpy-1.4.0/rocketpy/motors/tank_geometry.py +436 -0
  22. rocketpy-1.4.0/rocketpy/plots/__init__.py +1 -0
  23. rocketpy-1.4.0/rocketpy/plots/aero_surface_plots.py +487 -0
  24. rocketpy-1.4.0/rocketpy/plots/compare/__init__.py +2 -0
  25. rocketpy-1.4.0/rocketpy/plots/compare/compare.py +185 -0
  26. rocketpy-1.4.0/rocketpy/plots/compare/compare_flights.py +1638 -0
  27. rocketpy-1.4.0/rocketpy/plots/environment_analysis_plots.py +1831 -0
  28. rocketpy-1.4.0/rocketpy/plots/environment_plots.py +380 -0
  29. rocketpy-1.4.0/rocketpy/plots/flight_plots.py +892 -0
  30. rocketpy-1.4.0/rocketpy/plots/fluid_plots.py +37 -0
  31. rocketpy-1.4.0/rocketpy/plots/hybrid_motor_plots.py +182 -0
  32. rocketpy-1.4.0/rocketpy/plots/liquid_motor_plots.py +75 -0
  33. rocketpy-1.4.0/rocketpy/plots/monte_carlo_plots.py +165 -0
  34. rocketpy-1.4.0/rocketpy/plots/motor_plots.py +487 -0
  35. rocketpy-1.4.0/rocketpy/plots/rocket_plots.py +607 -0
  36. rocketpy-1.4.0/rocketpy/plots/solid_motor_plots.py +179 -0
  37. rocketpy-1.4.0/rocketpy/plots/tank_geometry_plots.py +51 -0
  38. rocketpy-1.4.0/rocketpy/plots/tank_plots.py +104 -0
  39. rocketpy-1.4.0/rocketpy/prints/__init__.py +0 -0
  40. rocketpy-1.4.0/rocketpy/prints/aero_surface_prints.py +306 -0
  41. rocketpy-1.4.0/rocketpy/prints/compare_prints.py +3 -0
  42. rocketpy-1.4.0/rocketpy/prints/controller_prints.py +68 -0
  43. rocketpy-1.4.0/rocketpy/prints/environment_analysis_prints.py +187 -0
  44. rocketpy-1.4.0/rocketpy/prints/environment_prints.py +224 -0
  45. rocketpy-1.4.0/rocketpy/prints/flight_prints.py +433 -0
  46. rocketpy-1.4.0/rocketpy/prints/fluid_prints.py +37 -0
  47. rocketpy-1.4.0/rocketpy/prints/hybrid_motor_prints.py +138 -0
  48. rocketpy-1.4.0/rocketpy/prints/liquid_motor_prints.py +89 -0
  49. rocketpy-1.4.0/rocketpy/prints/monte_carlo_prints.py +27 -0
  50. rocketpy-1.4.0/rocketpy/prints/motor_prints.py +69 -0
  51. rocketpy-1.4.0/rocketpy/prints/parachute_prints.py +75 -0
  52. rocketpy-1.4.0/rocketpy/prints/rocket_prints.py +197 -0
  53. rocketpy-1.4.0/rocketpy/prints/solid_motor_prints.py +121 -0
  54. rocketpy-1.4.0/rocketpy/prints/tank_geometry_prints.py +52 -0
  55. rocketpy-1.4.0/rocketpy/prints/tank_prints.py +36 -0
  56. rocketpy-1.4.0/rocketpy/rocket/__init__.py +14 -0
  57. rocketpy-1.4.0/rocketpy/rocket/aero_surface.py +2179 -0
  58. rocketpy-1.4.0/rocketpy/rocket/components.py +189 -0
  59. rocketpy-1.4.0/rocketpy/rocket/parachute.py +247 -0
  60. rocketpy-1.4.0/rocketpy/rocket/rocket.py +1635 -0
  61. rocketpy-1.4.0/rocketpy/simulation/__init__.py +3 -0
  62. rocketpy-1.4.0/rocketpy/simulation/flight.py +3479 -0
  63. rocketpy-1.4.0/rocketpy/simulation/flight_data_importer.py +392 -0
  64. rocketpy-1.4.0/rocketpy/simulation/monte_carlo.py +876 -0
  65. rocketpy-1.4.0/rocketpy/stochastic/__init__.py +21 -0
  66. rocketpy-1.4.0/rocketpy/stochastic/stochastic_aero_surfaces.py +434 -0
  67. rocketpy-1.4.0/rocketpy/stochastic/stochastic_environment.py +188 -0
  68. rocketpy-1.4.0/rocketpy/stochastic/stochastic_flight.py +131 -0
  69. rocketpy-1.4.0/rocketpy/stochastic/stochastic_generic_motor.py +193 -0
  70. rocketpy-1.4.0/rocketpy/stochastic/stochastic_model.py +536 -0
  71. rocketpy-1.4.0/rocketpy/stochastic/stochastic_motor_model.py +19 -0
  72. rocketpy-1.4.0/rocketpy/stochastic/stochastic_parachute.py +121 -0
  73. rocketpy-1.4.0/rocketpy/stochastic/stochastic_rocket.py +586 -0
  74. rocketpy-1.4.0/rocketpy/stochastic/stochastic_solid_motor.py +222 -0
  75. rocketpy-1.4.0/rocketpy/tools.py +937 -0
  76. rocketpy-1.4.0/rocketpy/units.py +149 -0
  77. rocketpy-1.4.0/rocketpy/utilities.py +661 -0
  78. {rocketpy-1.3.0 → rocketpy-1.4.0/rocketpy.egg-info}/PKG-INFO +9 -2
  79. rocketpy-1.4.0/rocketpy.egg-info/SOURCES.txt +83 -0
  80. {rocketpy-1.3.0 → rocketpy-1.4.0}/rocketpy.egg-info/requires.txt +7 -0
  81. rocketpy-1.3.0/rocketpy.egg-info/SOURCES.txt +0 -8
  82. {rocketpy-1.3.0 → rocketpy-1.4.0}/LICENSE +0 -0
  83. {rocketpy-1.3.0 → rocketpy-1.4.0}/README.md +0 -0
  84. {rocketpy-1.3.0 → rocketpy-1.4.0}/rocketpy.egg-info/dependency_links.txt +0 -0
  85. {rocketpy-1.3.0 → rocketpy-1.4.0}/rocketpy.egg-info/top_level.txt +0 -0
  86. {rocketpy-1.3.0 → rocketpy-1.4.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rocketpy
3
- Version: 1.3.0
3
+ Version: 1.4.0
4
4
  Summary: Advanced 6-DOF trajectory simulation for High-Power Rocketry.
5
5
  Author-email: Giovani Hidalgo Ceotto <ghceotto@gmail.com>
6
6
  Project-URL: homepage, https://rocketpy.org/
@@ -9,9 +9,16 @@ Project-URL: repository, https://github.com/RocketPy-Team/RocketPy
9
9
  Classifier: Programming Language :: Python :: 3
10
10
  Classifier: License :: OSI Approved :: MIT License
11
11
  Classifier: Operating System :: OS Independent
12
- Requires-Python: >=3.8
12
+ Requires-Python: >=3.9
13
13
  Description-Content-Type: text/markdown
14
14
  License-File: LICENSE
15
+ Requires-Dist: numpy>=1.13
16
+ Requires-Dist: scipy>=1.0
17
+ Requires-Dist: matplotlib>=3.0
18
+ Requires-Dist: netCDF4>=1.6.4
19
+ Requires-Dist: requests
20
+ Requires-Dist: pytz
21
+ Requires-Dist: simplekml
15
22
  Provides-Extra: tests
16
23
  Requires-Dist: pytest; extra == "tests"
17
24
  Requires-Dist: pytest-coverage; extra == "tests"
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "rocketpy"
3
- version = "1.3.0"
3
+ version = "1.4.0"
4
4
  description="Advanced 6-DOF trajectory simulation for High-Power Rocketry."
5
5
  dynamic = ["dependencies"]
6
6
  readme = "README.md"
7
- requires-python = ">=3.8"
7
+ requires-python = ">=3.9"
8
8
  authors = [
9
9
  {name = "Giovani Hidalgo Ceotto", email = "ghceotto@gmail.com"}
10
10
  ]
@@ -20,11 +20,11 @@ documentation = "https://docs.rocketpy.org/"
20
20
  repository = "https://github.com/RocketPy-Team/RocketPy"
21
21
 
22
22
  [build-system]
23
- requires = ["setuptools"]
23
+ requires = ["setuptools>=42", "wheel"]
24
24
  build-backend = "setuptools.build_meta"
25
25
 
26
26
  [tool.setuptools]
27
- py-modules = ['rocketpy']
27
+ packages = { find = { where = ["."], include = ["rocketpy*"] } }
28
28
 
29
29
  [tool.setuptools.dynamic]
30
30
  dependencies = { file = ["requirements.txt"] }
@@ -0,0 +1,7 @@
1
+ numpy>=1.13
2
+ scipy>=1.0
3
+ matplotlib>=3.0
4
+ netCDF4>=1.6.4
5
+ requests
6
+ pytz
7
+ simplekml
@@ -0,0 +1,51 @@
1
+ from .control import _Controller
2
+ from .environment import Environment, EnvironmentAnalysis
3
+ from .mathutils import (
4
+ Function,
5
+ PiecewiseFunction,
6
+ funcify_method,
7
+ reset_funcified_methods,
8
+ )
9
+ from .motors import (
10
+ CylindricalTank,
11
+ EmptyMotor,
12
+ Fluid,
13
+ GenericMotor,
14
+ HybridMotor,
15
+ LevelBasedTank,
16
+ LiquidMotor,
17
+ MassBasedTank,
18
+ MassFlowRateBasedTank,
19
+ Motor,
20
+ SolidMotor,
21
+ SphericalTank,
22
+ Tank,
23
+ TankGeometry,
24
+ UllageBasedTank,
25
+ )
26
+ from .plots.compare import Compare, CompareFlights
27
+ from .rocket import (
28
+ AeroSurface,
29
+ AirBrakes,
30
+ Components,
31
+ EllipticalFins,
32
+ Fins,
33
+ NoseCone,
34
+ Parachute,
35
+ RailButtons,
36
+ Rocket,
37
+ Tail,
38
+ TrapezoidalFins,
39
+ )
40
+ from .simulation import Flight, MonteCarlo
41
+ from .stochastic import (
42
+ StochasticEllipticalFins,
43
+ StochasticEnvironment,
44
+ StochasticFlight,
45
+ StochasticNoseCone,
46
+ StochasticParachute,
47
+ StochasticRocket,
48
+ StochasticSolidMotor,
49
+ StochasticTail,
50
+ StochasticTrapezoidalFins,
51
+ )
@@ -0,0 +1,43 @@
1
+ """Defines a custom JSON encoder for RocketPy objects."""
2
+
3
+ import json
4
+ import types
5
+
6
+ import numpy as np
7
+
8
+ from rocketpy.mathutils.function import Function
9
+
10
+
11
+ class RocketPyEncoder(json.JSONEncoder):
12
+ """NOTE: This is still under construction, please don't use it yet."""
13
+
14
+ def default(self, o):
15
+ if isinstance(
16
+ o,
17
+ (
18
+ np.int_,
19
+ np.intc,
20
+ np.intp,
21
+ np.int8,
22
+ np.int16,
23
+ np.int32,
24
+ np.int64,
25
+ np.uint8,
26
+ np.uint16,
27
+ np.uint32,
28
+ np.uint64,
29
+ ),
30
+ ):
31
+ return int(o)
32
+ elif isinstance(o, (np.float16, np.float32, np.float64)):
33
+ return float(o)
34
+ elif isinstance(o, np.ndarray):
35
+ return o.tolist()
36
+ elif hasattr(o, "to_dict"):
37
+ return o.to_dict()
38
+ # elif isinstance(o, Function):
39
+ # return o.__dict__()
40
+ elif isinstance(o, (Function, types.FunctionType)):
41
+ return repr(o)
42
+ else:
43
+ return json.JSONEncoder.default(self, o)
@@ -0,0 +1 @@
1
+ from .controller import _Controller
@@ -0,0 +1,132 @@
1
+ from ..prints.controller_prints import _ControllerPrints
2
+
3
+
4
+ class _Controller:
5
+ """A class for storing and running controllers on a rocket. Controllers
6
+ have a controller function that is called at a specified sampling rate
7
+ during the simulation. The controller function can access and modify
8
+ the objects that are passed to it. The controller function also stores the
9
+ variables of interest in the objects that are passed to it."""
10
+
11
+ def __init__(
12
+ self,
13
+ interactive_objects,
14
+ controller_function,
15
+ sampling_rate,
16
+ initial_observed_variables=None,
17
+ name="Controller",
18
+ ):
19
+ """Initialize the class with the controller function and the objects to
20
+ be observed.
21
+
22
+ Parameters
23
+ ----------
24
+ interactive_objects : list or object
25
+ A collection of objects that the controller function can access and
26
+ potentially modify. This can be either a list of objects or a single
27
+ object. The objects listed here are provided to the controller function
28
+ as the last argument, maintaining the order specified in this list if
29
+ it's a list. The controller function gains the ability to interact with
30
+ and make adjustments to these objects during its execution.
31
+ controller_function : function, callable
32
+ An user-defined function responsible for controlling the simulation.
33
+ This function is expected to take the following arguments, in order:
34
+
35
+ 1. `time` (float): The current simulation time in seconds.
36
+ 2. `sampling_rate` (float): The rate at which the controller
37
+ function is called, measured in Hertz (Hz).
38
+ 3. `state` (list): The state vector of the simulation, structured as
39
+ `[x, y, z, vx, vy, vz, e0, e1, e2, e3, wx, wy, wz]`.
40
+ 4. `state_history` (list): A record of the rocket's state at each
41
+ step throughout the simulation. The state_history is organized as
42
+ a list of lists, with each sublist containing a state vector. The
43
+ last item in the list always corresponds to the previous state
44
+ vector, providing a chronological sequence of the rocket's
45
+ evolving states.
46
+ 5. `observed_variables` (list): A list containing the variables that
47
+ the controller function returns. The return of each controller
48
+ function call is appended to the observed_variables list. The
49
+ initial value in the first step of the simulation of this list is
50
+ provided by the `initial_observed_variables` argument.
51
+ 6. `interactive_objects` (list): A list containing the objects that
52
+ the controller function can interact with. The objects are
53
+ listed in the same order as they are provided in the
54
+ `interactive_objects`.
55
+
56
+ This function will be called during the simulation at the specified
57
+ sampling rate. The function should evaluate and change the interactive
58
+ objects as needed. The function return statement can be used to save
59
+ relevant information in the `observed_variables` list.
60
+
61
+ .. note:: The function will be called according to the sampling rate
62
+ specified.
63
+ sampling_rate : float
64
+ The sampling rate of the controller function in Hertz (Hz). This
65
+ means that the controller function will be called every
66
+ `1/sampling_rate` seconds.
67
+ initial_observed_variables : list, optional
68
+ A list of the initial values of the variables that the controller
69
+ function returns. This list is used to initialize the
70
+ `observed_variables` argument of the controller function. The
71
+ default value is None, which initializes the list as an empty list.
72
+ name : str
73
+ The name of the controller. This will be used for printing and
74
+ plotting.
75
+
76
+ Returns
77
+ -------
78
+ None
79
+ """
80
+ self.interactive_objects = interactive_objects
81
+ self.controller_function = controller_function
82
+ self.sampling_rate = sampling_rate
83
+ self.name = name
84
+ self.prints = _ControllerPrints(self)
85
+
86
+ if initial_observed_variables is not None:
87
+ self.observed_variables = [initial_observed_variables]
88
+ else:
89
+ self.observed_variables = []
90
+
91
+ def __call__(self, time, state_vector, state_history):
92
+ """Call the controller function. This is used by the simulation class.
93
+
94
+ Parameters
95
+ ----------
96
+ time : float
97
+ The time of the simulation in seconds.
98
+ state_vector : list
99
+ The state vector of the simulation, which is defined as:
100
+
101
+ `[x, y, z, vx, vy, vz, e0, e1, e2, e3, wx, wy, wz]`.
102
+ state_history : list
103
+ A list containing the state history of the simulation. The state
104
+ history is a list of every state vector of every step of the
105
+ simulation. The state history is a list of lists, where each
106
+ sublist is a state vector and is ordered from oldest to newest.
107
+
108
+ Returns
109
+ -------
110
+ None
111
+ """
112
+ observed_variables = self.controller_function(
113
+ time,
114
+ self.sampling_rate,
115
+ state_vector,
116
+ state_history,
117
+ self.observed_variables,
118
+ self.interactive_objects,
119
+ )
120
+ if observed_variables is not None:
121
+ self.observed_variables.append(observed_variables)
122
+
123
+ def __str__(self):
124
+ return f"Controller '{self.name}' with sampling rate {self.sampling_rate} Hz."
125
+
126
+ def info(self):
127
+ """Prints out summarized information about the controller."""
128
+ self.prints.all()
129
+
130
+ def all_info(self):
131
+ """Prints out all information about the controller."""
132
+ self.info()
@@ -0,0 +1,2 @@
1
+ from .environment import Environment
2
+ from .environment_analysis import EnvironmentAnalysis