weldx.measurement.MeasurementChain.add_transformation#
- MeasurementChain.add_transformation(transformation, data=None, input_signal_source=None)#
Add a transformation from an
SignalTransformation
instance.- Parameters:
transformation (
SignalTransformation
) – The class containing the transformation data.data (
Optional
[TimeSeries
]) – A set of measurement data that is associated with the output signal of the transformationinput_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.
Examples
>>> from weldx import Q_ >>> from weldx.core import MathematicalExpression >>> from weldx.measurement import Error, MeasurementChain, 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" ... )
Add the transformation to the measurement chain.
>>> mc.add_transformation(current_ad_transform)