BeSpiceWaveParserLimitedEdition
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
The Python Object-Oriented API

The Python Object-Oriented API

The Python object-oriented API is included in the same Python module as the standard API. It defines a global parser object. Instead of using section identifiers and curve indices, it uses section and curve classes and objects.

The standard and object-oriented API can be mixed.

After having imported the Python module, the builtin help function can also be used to to get an overview of the implemented functions and classes.

> help(af_waveform_path.get_module_name())

Functions And Classes

The parser, section and curve properties are similar to the ones define in the C enum _af_wp_prop_enum_type. They are simply transformed to strings by omitting "af_wp" that means the enumerated value af_wp_prop_variable_name becomes the string "prop_variable_name".

The page The Curve Calculator explains how to build expressions that can be evaluated by the curve calculator.

Python Object-Oriented Examples

The BeSpice Parser API contains some examples giving an overview over the defined functions and types.

Example 001 : Parsing spice simulation result files

This example is implemented in 001_example_wp_py_obj_print_file_data.py. It shows how to parse spice simulation results and to retrieve the contained data. The functions defined in af_waveform_parser_print_obj.py are used to print all available data to the screen.

Example 002 : Finding curves

This example is implemented in 002_example_wp_py_obj_find_curves.py. It shows how to search for curves in the parsed simulation results.

Example 003 : Using the waveform calculator

This example is implemented in 003_example_wp_py_obj_calculator_basics.py. It shows how to use the builtin waveform calculator to extract data from the parsed simulation results.

Please also check the page The Curve Calculator .

Example 004 : Numpy and Matplotlib

This example is implemented in 004_example_wp_py_obj_numpy_and_matplotlib.py. It shows how to read the simulation results to a numpy array. These arrays are better suited for storing large data sets than pure Python structures. The numpy arrays can be directly used from Matplotlib to visualize the curves.