weldx.measurement.MeasurementChain.add_transformation_from_equipment#
- MeasurementChain.add_transformation_from_equipment(equipment, data=None, input_signal_source=None, transformation_name=None)#
Add a transformation from a piece of equipment.
- Parameters:
equipment (
MeasurementEquipment
) – The equipment that contains the transformationdata – A set of measurement data that is associated with the output signal of the transformation
input_signal_source (
Optional
[str
]) – The source of the signal that should be used as input of the transformation. IfNone
is provided, the name of the last added transformation (or the source, if no transformation was added to the chain) is used.transformation_name – In case the provided piece of equipment contains multiple transformations, this parameter can be used to select one by name. If it only contains a single transformation, this parameter can be set to ´None´ (default)
Examples
>>> from weldx import Q_ >>> from weldx.core import MathematicalExpression >>> from weldx.measurement import Error, MeasurementChain, MeasurementEquipment, SignalTransformation
>>> mc = MeasurementChain.from_parameters( ... name="Current measurement chain", ... source_error=Error(deviation=Q_(0.5, "percent")), ... source_name="Current sensor", ... output_signal_type="analog", ... output_signal_unit="V" ... )
Create a mathematical expression that accepts a quantity with volts as unit and that returns a dimentsionless quantity.
>>> func = MathematicalExpression(expression="a*x + b", ... parameters=dict(a=Q_(5, "1/V"), b=Q_(1, "")) ... )
Use the mathematical expression to create a signal transformation which also performs analog-digital conversion.
>>> current_ad_transform = SignalTransformation( ... name="Current AD conversion", ... error=Error(deviation=Q_(1,"percent")), ... func=func, ... type_transformation="AD" ... )
Create new equipment that performs the transformation
>>> current_ad_converter = MeasurementEquipment( ... name="Current AD converter", ... transformations=[current_ad_transform] ... )
Use the equipment to add the transformation to the measurement chain.
>>> mc.add_transformation_from_equipment(current_ad_converter)