This module contains the CalibrationData class, which encapsulates the data collected during calibration, and a set of functions used to save and load instances of this class.
Encapsulates the data collected during calibration. The calibration data consists of a list of the measurements (accessible using the measurements property) and a set of three estimation functions: getCurrentFromTargetTemperature(), getFinalTemperatureFromCurrent(), and getTemperatureFromVoltage().
These are fitted to the measurements taken during calibration (using numpy.polyfit()) if at least minMeasurementsForEstimation measurements have been taken. To check whether the functions have been sucessfully fitted, use isComplete.
When measurements are added to or removed from the calibration data, the estimation functions are automatically refitted.
The name of the file the instance has last been saved to, or the name of the file the instance has been read from, or None.
CalibrationData itself does not use this attribute at all; it needs to be kept up to date by the client code responsible for saving and loading.
Adds a new measurement to the calibration data. Arguments are the heating current used for the measurement (in mA), and the final temperature sensor voltage (in V) and final temperature (in °C) that are reached with that current. Any measurements for that current that may have been added previously are replaced.
Also recalculates the estimation functions, and sends a CalibrationDataChanged event if the instance is associated with a ProductionSystem.
Removes the measurements taken for the given heating current (in mA) from the calibration data. Raises a KeyError if there are no measurements for that current.
Also recalculates the estimation functions, and sends a CalibrationDataChanged event if the instance is associated with a ProductionSystem.
CalibrationData objects are saved as XML documents, using the extension cal. The files are structured according to the following XML Schema:
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="calibration-data">
<xs:complexType>
<xs:sequence minOccurs="0" maxOccurs="unbounded">
<xs:element name="measurement">
<xs:complexType>
<xs:sequence>
<xs:element name="current" type="xs:double" />
<xs:element name="voltage" type="xs:double" />
<xs:element name="temperature" type="xs:double" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
The docment is not formally validated when it is parsed, however. Some errors, such as extraneous elements, will slip through.
Creates a CalibrationData object from the given string, which must be a valid XML document.
If an error occurs while parsing the document, the function returns None.