space_packet_parser.calibrators =============================== .. py:module:: space_packet_parser.calibrators .. autoapi-nested-parse:: Calibrator definitions Attributes ---------- .. autoapisummary:: space_packet_parser.calibrators.SplinePoint space_packet_parser.calibrators.PolynomialCoefficient Classes ------- .. autoapisummary:: space_packet_parser.calibrators.Calibrator space_packet_parser.calibrators.SplineCalibrator space_packet_parser.calibrators.PolynomialCalibrator space_packet_parser.calibrators.MathOperationCalibrator space_packet_parser.calibrators.ContextCalibrator Module Contents --------------- .. py:class:: Calibrator Bases: :py:obj:`space_packet_parser.comparisons.AttrComparable` Abstract base class for XTCE calibrators .. py:method:: from_calibrator_xml_element(element: lxml.etree.Element, ns: dict) -> Calibrator :classmethod: :abstractmethod: Abstract classmethod to create a default_calibrator object from an XML element. :param element: XML element :type element: ElementTree.Element :param ns: XML namespace dict :type ns: dict :rtype: cls .. py:method:: calibrate(uncalibrated_value: Union[int, float]) -> Union[int, float] :abstractmethod: Takes an integer-encoded or float-encoded value and returns a calibrated version. :param uncalibrated_value: The uncalibrated, raw encoded value :type uncalibrated_value: Union[int, float] :returns: Calibrated value :rtype: Union[int, float] .. py:data:: SplinePoint .. py:class:: SplineCalibrator(points: list, order: int = 0, extrapolate: bool = False) Bases: :py:obj:`Calibrator` .. py:attribute:: _order_mapping .. py:attribute:: order .. py:attribute:: points .. py:attribute:: extrapolate .. py:method:: from_calibrator_xml_element(element: lxml.etree.Element, ns: dict) -> SplineCalibrator :classmethod: Create a spline default_calibrator object from an XML element. .. py:method:: calibrate(uncalibrated_value: float) -> float Take an integer-encoded value and returns a calibrated version according to the spline points. :param uncalibrated_value: Query point. :type uncalibrated_value: float :returns: Calibrated value :rtype: float .. py:method:: _zero_order_spline_interp(query_point: float) -> float Abstraction for zero order spline interpolation. If extrapolation is set to a truthy value, we use the nearest point to extrapolate outside the range of the given spline points. Within the range of spline points, we use nearest lower point interpolation. :param query_point: Query point. :type query_point: float :returns: Calibrated value. :rtype: float .. py:method:: _first_order_spline_interp(query_point: float) -> float Abstraction for first order spline interpolation. If extrapolation is set to a truthy value, we use the end points to make a linear function and use it to extrapolate. :param query_point: Query point. :type query_point: float :returns: Calibrated value. :rtype: float .. py:data:: PolynomialCoefficient .. py:class:: PolynomialCalibrator(coefficients: list) Bases: :py:obj:`Calibrator` .. py:attribute:: coefficients .. py:method:: from_calibrator_xml_element(element: lxml.etree.Element, ns: dict) -> PolynomialCalibrator :classmethod: Create a polynomial default_calibrator object from an XML element. :param element: XML element :type element: ElementTree.Element :param ns: Namespace dict :type ns: dict .. py:method:: calibrate(uncalibrated_value: float) -> float Evaluate the polynomial defined by object coefficients at the specified uncalibrated point. :param uncalibrated_value: Query point. :type uncalibrated_value: float :returns: Calibrated value :rtype: float .. py:class:: MathOperationCalibrator Bases: :py:obj:`Calibrator` .. py:attribute:: err_msg :value: 'The MathOperationCalibrator element is not supported in this package but pull requests are welcome!' .. py:method:: from_calibrator_xml_element(element: lxml.etree.Element, ns: dict) -> MathOperationCalibrator :classmethod: :abstractmethod: Create a math operation default_calibrator from an XML element. .. py:method:: calibrate(uncalibrated_value: int) :abstractmethod: Stub :param uncalibrated_value: .. py:class:: ContextCalibrator(match_criteria: list, calibrator: Calibrator) Bases: :py:obj:`space_packet_parser.comparisons.AttrComparable` .. py:attribute:: match_criteria .. py:attribute:: calibrator .. py:method:: get_context_match_criteria(element: lxml.etree.Element, ns: dict) -> List[space_packet_parser.comparisons.MatchCriteria] :staticmethod: Parse contextual requirements from a Comparison, ComparisonList, or BooleanExpression :param element: XML element from which to parse the ContextCalibrator object. :type element: ElementTree.Element :param ns: Namespace dict for XML parsing :type ns: dict :returns: List of Comparisons that can be evaluated to determine whether this calibrator should be used. :rtype: List[MatchCriteria] .. py:method:: from_context_calibrator_xml_element(element: lxml.etree.Element, ns: dict) -> ContextCalibrator :classmethod: Create a ContextCalibrator object from an XML element :param element: XML element from which to parse the ContextCalibrator object. :type element: ElementTree.Element :param ns: Namespace dict for XML parsing :type ns: dict :rtype: cls .. py:method:: calibrate(parsed_value: Union[int, float]) -> Union[int, float] Wrapper method for the internal `Calibrator.calibrate` :param parsed_value: Uncalibrated value. :type parsed_value: Union[int, float] :returns: Calibrated value :rtype: Union[int, float]