JSB to PNG: Difference between revisions

Jump to navigation Jump to search
+- More section headings for faster navigation; +-Rearranging sections and images; +- Lead section: More to the point and bolded article name; +- Copyediting; +- New section with related content; + Link to forum topic; +cat: Python Software
(Added instructions for use)
(+- More section headings for faster navigation; +-Rearranging sections and images; +- Lead section: More to the point and bolded article name; +- Copyediting; +- New section with related content; + Link to forum topic; +cat: Python Software)
Line 1: Line 1:
JSB to PNG is a tool programmed in python.
It will take a JSBSim file as input and will then output PNG images of the tables in that file.
Will output both lines and carpet plots for 2D/3D tables. For 1D tables just line plot.
[[File:JSB-carpet.png|thumb|A carpet plot plot of a 2D table]]
[[File:JSB-carpet.png|thumb|A carpet plot plot of a 2D table]]
[[File:JSB-lines.png|thumb|A lines plot of a 2D table]]
[[File:JSB-lines.png|thumb|A lines plot of a 2D table]]
[[File:JSB-line.png|thumb|A lineplot of a 1D table]]
[[File:JSB-line.png|thumb|A lineplot of a 1D table]]


==Instructions==
'''JSB to PNG''' will take a JSBSim file as input and will then output PNG images of the tables in that file.
Requires python with plotly.express and plotly.graph_objects libraries (recent version).<br />


When run, a folder will be created in working folder named same as the jsb input filename, but without the xml extension.<br />
It will output both lines and carpet plots for 2D/3D tables. For 1D tables just line plot.


In that folder PNG of the tables will be output, it '''will''' overwrite images if the folder is not empty.<br />
JSB to PNG is written in Python.


Each table in the JSB input file that you want to graph '''must''' have name attribute in the <table> tag. That name will also be used a Y-axis title in the graphs. Do not have multiple tables with same name since its used in naming the image files also.<br />
== Instructions ==
=== Required libraries ===
JSB to PNG requires Python with '''plotly.express''' and '''plotly.graph_objects''' libraries (recent version).


For 2D and 3D tables <independentVar> tags '''must''' all have lookup attributes.<br />
=== JSBSim table requirements ===
Each table in the JSBSim input file that you want to graph '''must''' have <code>name</code> attribute in the <table> tag. That name will also be used a Y-axis title in the graphs. Do not have multiple tables with same name since its used in naming the image files also.
 
For 2D and 3D tables <code><nowiki><independentVar></nowiki></code> tags '''must''' all have lookup attributes.


Example:
Example:
Line 33: Line 31:
</syntaxhighlight>
</syntaxhighlight>


For 2D and 3D tables it will graph both a lines and a carpet plot.<br />
=== Running JSB to PNG ===
JSB to PNG is used from the command line with this syntax:


python jsb-to-png.py [filename]


'''Commandline:''' python jsb-to-png.py [filename]<br />
If no filename is specified as commandline argument then <code>jsb-test.xml</code> is assumed.


When run, a folder will be created in working folder named same as the JSBSim input filename, but without the xml extension.


If no filename is specified as commandline argument then "jsb-test.xml" is assumed.
For 2D and 3D tables it will graph both a lines and a carpet plot.


==See also==
In that folder PNG of the tables will be output, it '''will''' overwrite images if the folder is not empty.
[https://github.com/alanjt/Jiff Jiff (C++ program that does approx the same thing]


==External links==
== Related content ==
[https://github.com/NikolaiVChr/jsb-to-png JSB to PNG on Github]
=== Forum topic ===
* {{forum link|t=36940|title=JSBSim tables to PNG program}}
 
=== Source code ===
* [https://github.com/NikolaiVChr/jsb-to-png JSB to PNG on Github]
 
== External links ==
* [https://github.com/alanjt/Jiff Jiff (C++ program that does approx the same thing)]


{{JSBSim}}
{{JSBSim}}
[[Category:Python Software]]

Navigation menu