29
29
@click .group ()
30
30
@click .version_option ()
31
31
def cli ():
32
- """Rocket files Serializer .
33
- This library has as objective to convert .ork file into parameters
34
- that rocketpy is able to use for simulating the rocket . It will be generated
35
- a .json file which you can use with a template simulation to execute the
36
- simulation for your rocket .
32
+ """RocketSerializer .
33
+ This library has as objective to convert .ork files into parameters.json, so
34
+ that they can be used in rocketpy simulations . It also provides the option
35
+ to convert the parameters .json file into a .ipynb file, so that the user can
36
+ run the simulation using Jupyter Notebooks .
37
37
38
38
Examples
39
39
--------
40
40
To easily use the library, you can use the command line interface. For
41
41
example, to generate a .json file from a .ork file, you can use the
42
- following command:
42
+ following command on your terminal :
43
43
>>> ork2json("rocket.ork", "rocket", "motor.eng")
44
44
45
45
If you want to use the library with Python, you can import the library and
46
46
use the functions directly. For example, to generate a .json file from a
47
47
.ork file, you can use the following code:
48
48
49
49
>>> from rocketserializer import ork2json
50
- >>> ork2json("rocket.ork", "rocket", "motor.eng")
51
-
52
- If you want to convert a .ork file to a .py file, you can use the following
53
- command:
54
-
55
- >>> serializer ork2py("rocket.ork", "rocket", "motor.eng")
50
+ >>> ork2json([ "--filepath", "rocket.ork", "--eng", "motor.eng"])
56
51
57
- Finally, if you want to convert a .ork file to a .ipynb file, you can use:
52
+ If you want to convert a .ork file to a Jupyter Notebook, you can use the
53
+ following command on your terminal:
58
54
59
- >>> serializer ork2ipynb ("rocket.ork", "rocket", "motor.eng")
55
+ >>> ork2notebook ("rocket.ork", "rocket", "motor.eng")
60
56
"""
61
57
62
58
@@ -67,13 +63,6 @@ def cli():
67
63
@click .option (
68
64
"--output" , type = click .Path (), required = False , help = "The path to the output folder."
69
65
)
70
- @click .option (
71
- "--eng" ,
72
- type = str ,
73
- default = None ,
74
- required = False ,
75
- help = "The path to the .eng file, if necessary." ,
76
- )
77
66
@click .option (
78
67
"--ork_jar" ,
79
68
type = click .Path (),
@@ -83,9 +72,7 @@ def cli():
83
72
)
84
73
@click .option ("--encoding" , type = str , default = "utf-8" , required = False )
85
74
@click .option ("--verbose" , type = bool , default = False , required = False )
86
- def ork2json (
87
- filepath , output = None , eng = None , ork_jar = None , encoding = "utf-8" , verbose = False
88
- ):
75
+ def ork2json (filepath , output = None , ork_jar = None , encoding = "utf-8" , verbose = False ):
89
76
"""Generates a .json file from the .ork file.
90
77
The .json file will be generated in the output folder using the information
91
78
of the .ork file. It is possible to specify the .eng file to extract the
@@ -98,10 +85,6 @@ def ork2json(
98
85
The path to the .ork file.
99
86
output : str
100
87
The path to the output folder.
101
- eng : str, optional
102
- The path to the .eng file. If unspecified, the thrust curve will be
103
- extracted from the .ork file. If specified, the thrust curve will be
104
- extracted from the .eng file.
105
88
ork_jar : str, optional
106
89
The path to the OpenRocket .jar file. If unspecified, the .jar file
107
90
will be searched in the current directory.
@@ -194,7 +177,6 @@ def ork2json(
194
177
filepath = str (filepath ),
195
178
output_folder = output ,
196
179
ork = ork ,
197
- eng = eng ,
198
180
)
199
181
200
182
with open (
@@ -213,12 +195,13 @@ def ork2json(
213
195
)
214
196
215
197
216
- @cli .command ("ork2ipynb " )
198
+ @cli .command ("ork2notebook " )
217
199
@click .option ("--filepath" , type = str , required = True )
218
200
@click .option ("--output" , type = str , required = False )
219
- @click .option ("--eng" , type = str , default = None , required = False )
220
201
@click .option ("--ork_jar" , type = str , default = None , required = False )
221
- def ork2ipynb (filepath , output , eng = None , ork_jar = None ):
202
+ @click .option ("--encoding" , type = str , default = "utf-8" , required = False )
203
+ @click .option ("--verbose" , type = bool , default = False , required = False )
204
+ def ork2notebook (filepath , output , ork_jar = None , encoding = "utf-8" , verbose = False ):
222
205
"""Generates a .ipynb file from the .ork file.
223
206
224
207
Notes
@@ -233,10 +216,12 @@ def ork2ipynb(filepath, output, eng=None, ork_jar=None):
233
216
filepath ,
234
217
"--output" ,
235
218
output ,
236
- "--eng" ,
237
- eng ,
238
219
"--ork_jar" ,
239
220
ork_jar ,
221
+ "--encoding" ,
222
+ encoding ,
223
+ "--verbose" ,
224
+ verbose ,
240
225
],
241
226
standalone_mode = True ,
242
227
)
0 commit comments