Skip to content

Latest commit

 

History

History
15 lines (10 loc) · 3.61 KB

File metadata and controls

15 lines (10 loc) · 3.61 KB

Plugins

AccelExplorer supports a plugin system that allows end users to extend the functionality. Yapsy is used to find and load the plugins at runtime. It is suggested that the Yapsy docs are read and understood before developing a plugin. Specifically take a look at THIS section which describes how to properly import the plugin base class. Also, look at the plugins folder for examples of each plugin type. Plugins are expected to be stored in the "plugins" folder in the same directory as the executable. There are two base types of plugins which are described in detail below.

ParserPlugin

Parser plugins are plugins that can automatically parse files. This can be useful when a specific CSV format is frequently used or to add support for an unsupported file type. Parser plugins are expected to return a ViewModel containing a pandas DataFrame.

Indexing

When creating the pandas DataFrame it is important to understand indexing. In order to perform any of the time domain functions, the DataFrame must use a TimeDeltaIndex. If a parser plugin is created for a CSV file, it is recommended to inherit from the CSVParser class and call it's super method. This ensures that the returned DataFrame has the proper index type. From there the DataFrame can be modified as needed before being passed to the ViewModel. For an example of this see allenparser.py.

ViewModelPlugin

The ViewModelPlugin is the base class for view and filter plugins. These plugins support user parameters by providing a list of options which are displayed in a dialog when the user runs the plugin. The values the user selected are then passed back to the plugin as kwargs when calling the process method. These plugins are required to implement two main functions: "process" and "can_process". Both functions are passed a ViewModel instance. "can_process" should perform any checks to make sure the plugin is capable of processing the data within the model and return the results. "process" is expected to generate a new ViewModel from the given model and using the options provided by kwargs. The only difference between FilterPlugins and ViewPlugins is that filter plugins are applied to the view, while ViewPlugins create a new view. For examples of how to implement these see the filters and views folders.

ViewModel Class

AccelExplorer uses pandas DataFrames for most of it's functions and calculations. These DataFrames contain all of the underlying data that needs to be displayed on the chart. However, PySide's QtCharts module is used for displaying the data which does not support displaying DataFrames directly. The ViewModel class is used to link these two libraries together. A DataFrame is passed to the ViewModel which is then copied and stored internally. By default the points used to display the DataFrame are not generated until they are needed because this can be a slow process. This means that ViewModels can be quickly created but can consume a large amount of resources depending on the size of the underlying DataFrame. It is best to create and modify the DataFrame inplace before creating the ViewModel.