Thrustcurve documentation¶
Thrustcurve is a Python module designed to make it easy to parse amateur rocketry file formats.
Example usage¶
The following example shows loading a RockSim format file from http://www.thrustcurve.org/ into a Pandas DataFrame object:
import requests
import thrustcurve
import matplotlib.pyplot as plt
rse_data = requests.get('http://www.thrustcurve.org/download.jsp?id=1800').text
engines = thrustcurve.loads(rse_data)
e = engines[0]
plt.figure()
plt.plot(e.data['time'], e.data['force'], '-or')
plt.xlabel('Time [s]')
plt.ylabel('Force [N]')
plt.grid()
plt.title('Force/time curve for {} {}'.format(e.manufacturer, e.code))
plt.figure()
plt.plot(e.data['time'], e.data['mass'], '-or')
plt.xlabel('Time [s]')
plt.ylabel('Mass [kg]')
plt.grid()
plt.title('Force/mass curve for {} {}'.format(e.manufacturer, e.code))
Reference¶
The thrustcurve
module contains functions and objects designed to
be useful to those parsing rocket motor thrust curve files.
-
class
thrustcurve.
Engine
(manufacturer=None, code=None)¶ Class representing a rocket engine.
The rocket engine thrust curve is contained within the data attribute. This is a
pandas.DataFrame
instance with the columns “time” (seconds), “force” (Newtons) and mass (kg).See also: the Pandas documentation.
-
manufacturer
¶ str or None
manufacture of rocket
-
code
¶ str or None
manufacturer’s code for this engine
-
comments
¶ str or None
additional comments
-
data
¶ pandas.DataFrame
thrust curve data
-
-
exception
thrustcurve.
ParseError
¶ Raised when an input file could not be parsed.
-
thrustcurve.
load
(fn_or_fobj)¶ Load a RockSim (.rse) format engine database.
Parameters: fn_or_fobj (str or file like object) – file containing .rse format data Returns: py:class:Engine instances, one per engine in the file. Return type: A list of Raises: ParseError
– if the file is of the wrong format