atomiq.components.basics.calibration ==================================== .. py:module:: atomiq.components.basics.calibration .. autoapi-nested-parse:: In all experiments, calibrations are ubiquious. Examples are * voltage - power relation on a photodiode * Relation between the current through a coil and the created magentic field * RF power in an AOM and light power in the diffracted order * The current-voltage relation for a voltage-controlled current supply * ... In atomiq calibrations are comoponents just like every other piece of your experiment. Every calibration inherits from the abstract :class:`Calibration` class. A special subclass of calibration functions are invertable calibrations that can be analytically inverted. The most frequently used example is a linear calibration function. Invertable calibrations inherit from :class:`InvertableCalibration`. Classes ------- .. autoapisummary:: atomiq.components.basics.calibration.Calibration atomiq.components.basics.calibration.InvertableCalibration atomiq.components.basics.calibration.DummyCalibration atomiq.components.basics.calibration.SplineCalibration atomiq.components.basics.calibration.InvertableSplineCalibration atomiq.components.basics.calibration.PolynomialCalibration atomiq.components.basics.calibration.LinearCalibration atomiq.components.basics.calibration.SigmoidCalibration atomiq.components.basics.calibration.InvSigmoidCalibration Functions --------- .. autoapisummary:: atomiq.components.basics.calibration.exp atomiq.components.basics.calibration.ln Module Contents --------------- .. py:function:: exp(x) .. py:function:: ln(x, n = 10000.0) .. py:class:: Calibration(input_unit, output_unit, *args, **kwargs) Bases: :py:obj:`atomiq.components.primitives.Component` An abstract Calibration This is an abstract class to describe a calibration. :param input_unit: A string determining the input unit (e.g. 'mW', 'V', or 'uA') :param output_unit: A string determining the output unit (e.g. 'mW', 'V', or 'uA') .. py:attribute:: kernel_invariants .. py:attribute:: input_unit .. py:attribute:: output_unit .. py:method:: transform(input_value) :abstractmethod: Transform a value according to the calibration :param input_value: value to be transformed :returns: transformed value :rtype: TFloat .. py:class:: InvertableCalibration(input_unit, output_unit, *args, **kwargs) Bases: :py:obj:`Calibration` An abstract Calibration This is an abstract class to describe a calibration. :param input_unit: A string determining the input unit (e.g. 'mW', 'V', or 'uA') :param output_unit: A string determining the output unit (e.g. 'mW', 'V', or 'uA') .. py:method:: transform_inv(input_value) :abstractmethod: Perform inverse transform of a value according to the calibration :param input_value: value to be inversely transformed. Must be given in units of the output unit :returns: transformed value. The returned value is in units of the input unit :rtype: TFloat .. py:class:: DummyCalibration(*args, **kwargs) Bases: :py:obj:`Calibration` An abstract Calibration This is an abstract class to describe a calibration. :param input_unit: A string determining the input unit (e.g. 'mW', 'V', or 'uA') :param output_unit: A string determining the output unit (e.g. 'mW', 'V', or 'uA') .. py:method:: transform(input_value) Transform a value according to the calibration :param input_value: value to be transformed :returns: transformed value :rtype: TFloat .. py:class:: SplineCalibration(calibration_points, *args, **kwargs) Bases: :py:obj:`Calibration` Calibration via data points Data points are interpolated with linear splines :param calibration_points: List of tuples (x, y) containing the calibration data. The data must be ordered monotonously in `x` .. py:attribute:: kernel_invariants .. py:attribute:: calibration_points .. py:method:: transform(input_value, invert = False) Transform a value according to the calibration :param input_value: value to be transformed :returns: transformed value :rtype: TFloat .. py:class:: InvertableSplineCalibration(*args, **kwargs) Bases: :py:obj:`InvertableCalibration`, :py:obj:`SplineCalibration` Calibration via data points that can be inverted Data points are interpolated with linear splines. For the inversion to work, both `x` and `y` of the calibration data must be monotonous. .. py:method:: transform_inv(input_value) Perform inverse transform of a value according to the calibration :param input_value: value to be inversely transformed. Must be given in units of the output unit :returns: transformed value. The returned value is in units of the input unit :rtype: TFloat .. py:class:: PolynomialCalibration(*args, coefficients, **kwargs) Bases: :py:obj:`Calibration` Calibration described by a polynomial The calibration is given by the function $$f(x) = \sum_i c_i x^i$$ :param coefficients: List of coefficients $c_i$ of the polynomial, start from the lowest order. .. py:attribute:: kernel_invariants .. py:attribute:: coefficients .. py:method:: transform(input_value) Transform a value according to the calibration :param input_value: value to be transformed :returns: transformed value :rtype: TFloat .. py:class:: LinearCalibration(a, b, *args, **kwargs) Bases: :py:obj:`InvertableCalibration` Linear calibration The calibration is given by the function $$f(x) = ax + b$$ :param input_unit: Unit of the input :param output_unit: Unit of the output :param a: Calibration coefficient a :param b: Calibration coefficient b .. py:attribute:: kernel_invariants .. py:attribute:: a .. py:attribute:: b .. py:method:: transform(input_value) Transform a value according to the calibration :param input_value: value to be transformed :returns: transformed value :rtype: TFloat .. py:method:: transform_inv(output_value) Perform inverse transform of a value according to the calibration :param input_value: value to be inversely transformed. Must be given in units of the output unit :returns: transformed value. The returned value is in units of the input unit :rtype: TFloat .. py:class:: SigmoidCalibration(*args, A, k, x_offset = 0, y_offset = 0, **kwargs) Bases: :py:obj:`Calibration` Sigmoid calibration ``` output = A / ( 1 + e^k*(input - x_offset)) + y_offset ``` :param input_unit: Unit of the input :param output_unit: Unit of the output :param A: Amplitude of the sigmoid :param k: stretching of the sigmoid :param x_offset: offset on the x axis :param y_offset: offset on the y axis .. py:attribute:: kernel_invariants .. py:attribute:: A .. py:attribute:: k .. py:attribute:: x_offset :value: 0 .. py:attribute:: y_offset :value: 0 .. py:method:: transform(input_value) Transform a value according to the calibration :param input_value: value to be transformed :returns: transformed value :rtype: TFloat .. py:class:: InvSigmoidCalibration(*args, A, k, x_offset = 0, y_offset = 0, **kwargs) Bases: :py:obj:`Calibration` Inverse sigmoid calibration ``` output = -ln( A / (input - y_offset) - 1) / k + x_offset ``` The paremeters are defined in a way that they match the sigmoid definition. :param input_unit: Unit of the input :param output_unit: Unit of the output :param A: Amplitude of the sigmoid :param k: stretching of the sigmoid :param x_offset: offset on the x axis :param y_offset: offset on the y axis .. py:attribute:: kernel_invariants .. py:attribute:: A .. py:attribute:: k .. py:attribute:: x_offset :value: 0 .. py:attribute:: y_offset :value: 0 .. py:method:: transform(input_value) Transform a value according to the calibration :param input_value: value to be transformed :returns: transformed value :rtype: TFloat