csv engine - DaveL17/matplotlib GitHub Wiki
CSV Engine Configuration Dialog |
---|
CSV Data - Once you set and save your overall plugin settings, the next thing that you might want to do is generate some data for your charts. This is done using the plugin's built-in CSV Data Engine device type. To establish your CSV Engine, create a new Indigo Device, select Matplotlib as the device type and CSV Engine as the device model.
Overall Settings
There are three settings that affect every CSV data element that is created using the CSV Engine device.
- Observations - Enter the maximum number of observations that you would like to retain in your CSV files. 1. Duration - Enter the maximum time duration to apply to your CSV files. For example, entering 24 will cause observations older than 24 hours to be discarded. Leave empty or enter a value of zero for no limit. 1. Refresh Interval - Enter the desired frequency of CSV updates (in seconds). The default value is 900 (refresh every 15 minutes).
The duration limit is applied before the observations limit is applied.
To use different limits for other data, create another CSV Engine device. It is highly recommended that you only create additional CSV Engine devices when you want to use different settings for observations, duration and refresh intervals. In other words, all CSV data sources that you want set to 300/72/900 should be managed with the same CSV Engine device. It can be helpful to make a notation in the individual CSV Engine device name (or notes field) to remind yourself of the settings for that individual engine (for example, "CSV Engine 300 obs/72 hours/15 minutes").
Add Data Item
For each data element, you must add three things: a title, a Data Source (Device or variable), and a device state (or variable value).
To add your first data element, enter the Title and then select the appropriate Data Source (Device or Variable) from the dropdown menu. You can limit the number of items that appear in the Data Source menu by using the Filter tool. The Data dropdown list will then be automatically populated with potential values to chart. Select your target value from the list of available items and click Add Item. Please note that the Data dropdown list will show all potential data sources related to the device--many of which may not be suited to charting (like text strings).
You can repeat this process to add more data elements, but please note that things you add are not fully committed until you hit the save button.
Edit Data Item
Use the second configuration area to modify or delete existing data elements. Select the item that you want to modify from the Item List dropdown and the fields below will populate with information about the data element. You can change any or all of the information fields as desired. You can limit the number of items that appear in the Data Source menu by using the Filter tool. Once finished, click the Update Item button. You can change as many items as you like. If you change a data element's Title within the CSV Engine, it will create a new data file and begin logging data from scratch. If you choose to delete a data element, select it and then click the Delete Item button. Again, changes will not be fully committed until you select save.
External Data Sources
It is also possible to add your own CSV data files directly to the designated data folder (if the files are properly formatted, they will work just fine) but only CSV data generated by the plugin can be managed with the CSV Engine device. If you use your own files, you need to manage them some other way. If you choose to use the CSV Engine feature, you only need to create one CSV engine device for your entire installation. If you choose to add additional data elements, add them using the same procedure and add them to the same CSV Engine device. After you add your data elements, it will take some time for the chartable data to be generated. The first observation will be added the next time the plugin cycles (which is set in the plugin configuration dialog above). Each time the plugin cycles, it will first add a new observation to the data file and then it will build new charts (to ensure the most recent observations are included in the charts).
If you are successful, the plugin will generate simple CSV data files like the one to the right. The plugin expects a certain structure for the data files it uses, so if you choose to include your own CSV data, your files should contain the following:
- one header row with the first column as the observation timestamp and the second column as the observation to be
charted (note that the header value of the data column will be used for chart legend labels), 1) each timestamp
formatted as YYYY-MM-DD HH:MM:S.S (standard datetime format:
%Y-%m-%d %H:%M:%S.%f
), and 1) each observation on its own row.
[!WARNING] Each data file should contain only one data element. In other words, each item that you plan to chart should have its own unique data source.
Sample CSV Data |
---|