space_packet_parser.parameters ============================== .. py:module:: space_packet_parser.parameters .. autoapi-nested-parse:: ParameterType definitions Classes ------- .. autoapisummary:: space_packet_parser.parameters.ParameterType space_packet_parser.parameters.StringParameterType space_packet_parser.parameters.IntegerParameterType space_packet_parser.parameters.FloatParameterType space_packet_parser.parameters.EnumeratedParameterType space_packet_parser.parameters.BinaryParameterType space_packet_parser.parameters.BooleanParameterType space_packet_parser.parameters.TimeParameterType space_packet_parser.parameters.AbsoluteTimeParameterType space_packet_parser.parameters.RelativeTimeParameterType space_packet_parser.parameters.Parameter Module Contents --------------- .. py:class:: ParameterType(name: str, encoding: space_packet_parser.encodings.DataEncoding, unit: Optional[str] = None) Bases: :py:obj:`space_packet_parser.comparisons.AttrComparable` Abstract base class for XTCE parameter types .. py:attribute:: name .. py:attribute:: encoding .. py:attribute:: unit .. py:method:: __repr__() .. py:method:: from_parameter_type_xml_element(element: lxml.etree.Element, ns: dict) -> ParameterType :classmethod: Create a *ParameterType* from an XML element. :param element: The XML element from which to create the object. :type element: ElementTree.Element :param ns: XML namespace dict :type ns: dict :rtype: ParameterType .. py:method:: get_units(parameter_type_element: lxml.etree.Element, ns: dict) -> Union[str, None] :staticmethod: Finds the units associated with a parameter type element and parsed them to return a unit string. We assume only one but this could be extended to support multiple units. See section 4.3.2.2.4 of CCSDS 660.1-G-1 :param parameter_type_element: The parameter type element :type parameter_type_element: ElementTree.Element :param ns: XML namespace dictionary :type ns: dict :returns: Unit string or None if no units are defined :rtype: Union[str, None] .. py:method:: get_data_encoding(parameter_type_element: lxml.etree.Element, ns: dict) -> Union[space_packet_parser.encodings.DataEncoding, None] :staticmethod: Finds the data encoding XML element associated with a parameter type XML element and parses it, returning an object representation of the data encoding. :param parameter_type_element: The parameter type element :type parameter_type_element: ElementTree.Element :param ns: XML namespace dictionary :type ns: dict :returns: DataEncoding object or None if no data encoding is defined (which is probably an issue) :rtype: Union[DataEncoding, None] .. py:method:: parse_value(packet: space_packet_parser.packets.CCSDSPacket, **kwargs) -> space_packet_parser.packets.ParameterDataTypes Using the parameter type definition and associated data encoding, parse a value from a bit stream starting at the current cursor position. :param packet: Binary representation of the packet used to get the coming bits and any previously parsed data items to infer field lengths. :type packet: CCSDSPacket :returns: **parsed_value** -- Resulting parsed parameter value :rtype: packets.ParameterDataTypes .. py:class:: StringParameterType(name: str, encoding: space_packet_parser.encodings.StringDataEncoding, unit: Optional[str] = None) Bases: :py:obj:`ParameterType` .. py:attribute:: encoding .. py:class:: IntegerParameterType(name: str, encoding: space_packet_parser.encodings.DataEncoding, unit: Optional[str] = None) Bases: :py:obj:`ParameterType` .. py:class:: FloatParameterType(name: str, encoding: space_packet_parser.encodings.DataEncoding, unit: Optional[str] = None) Bases: :py:obj:`ParameterType` .. py:class:: EnumeratedParameterType(name: str, encoding: space_packet_parser.encodings.DataEncoding, enumeration: dict, unit: Union[str, None] = None) Bases: :py:obj:`ParameterType` .. py:attribute:: enumeration .. py:method:: __repr__() .. py:method:: from_parameter_type_xml_element(element: lxml.etree.Element, ns: dict) :classmethod: Create an EnumeratedParameterType from an XML element. Overrides ParameterType.from_parameter_type_xml_element :param element: The XML element from which to create the object. :type element: ElementTree.Element :param ns: XML namespace dict :type ns: dict :rtype: EnumeratedParameterType .. py:method:: get_enumeration_list_contents(element: lxml.etree.Element, ns: dict) -> dict :staticmethod: Finds the element child of an and parses it, returning a dict. This method is confusingly named as if it might return a list. Sorry, XML and python semantics are not always compatible. It's called an enumeration list because the XML element is called but it contains key value pairs, so it's best represeneted as a dict. :param element: The XML element from which to search for EnumerationList tags :type element: ElementTree.Element :param ns: XML namespace dict :type ns: dict :rtype: dict .. py:method:: parse_value(packet: space_packet_parser.packets.CCSDSPacket, **kwargs) -> space_packet_parser.packets.StrParameter Using the parameter type definition and associated data encoding, parse a value from a bit stream starting at the current cursor position. :param packet: Binary representation of the packet used to get the coming bits and any previously parsed data items to infer field lengths. :type packet: CCSDSPacket :returns: **derived_value** -- Resulting enum label associated with the (usually integer-)encoded data value. :rtype: packets.StrParameter .. py:class:: BinaryParameterType(name: str, encoding: space_packet_parser.encodings.BinaryDataEncoding, unit: Optional[str] = None) Bases: :py:obj:`ParameterType` .. py:attribute:: encoding .. py:class:: BooleanParameterType(name: str, encoding: space_packet_parser.encodings.DataEncoding, unit: Optional[str] = None) Bases: :py:obj:`ParameterType` .. py:method:: parse_value(packet: space_packet_parser.packets.CCSDSPacket, **kwargs) Using the parameter type definition and associated data encoding, parse a value from a bit stream starting at the current cursor position. :param packet: Binary representation of the packet used to get the coming bits and any previously parsed data items to infer field lengths. :type packet: CCSDSPacket :returns: **derived_value** -- Resulting boolean representation of the encoded raw value :rtype: BoolParameter .. py:class:: TimeParameterType(name: str, encoding: space_packet_parser.encodings.DataEncoding, *, unit: Optional[str] = None, epoch: Optional[str] = None, offset_from: Optional[str] = None) Bases: :py:obj:`ParameterType` Abstract class for time parameter types .. py:attribute:: epoch .. py:attribute:: offset_from .. py:method:: from_parameter_type_xml_element(element: lxml.etree.Element, ns: dict) :classmethod: Create a *TimeParameterType* from an XML element. :param element: The XML element from which to create the object. :type element: ElementTree.Element :param ns: XML namespace dict :type ns: dict :rtype: TimeParameterType .. py:method:: get_units(parameter_type_element: lxml.etree.Element, ns: dict) -> Union[str, None] :staticmethod: Finds the units associated with a parameter type element and parsed them to return a unit string. We assume only one but this could be extended to support multiple units. See section 4.3.2.2.4 of CCSDS 660.1-G-1 :param parameter_type_element: The parameter type element :type parameter_type_element: ElementTree.Element :param ns: XML namespace dictionary :type ns: dict :returns: Unit string or None if no units are defined :rtype: Union[str, None] .. py:method:: get_time_unit_linear_scaler(parameter_type_element: lxml.etree.Element, ns: dict) -> Union[space_packet_parser.calibrators.PolynomialCalibrator, None] :staticmethod: Finds the linear calibrator associated with the Encoding element for the parameter type element. See section 4.3.2.4.8.3 of CCSDS 660.1-G-2 :param parameter_type_element: The parameter type element :type parameter_type_element: ElementTree.Element :param ns: XML namespace dictionary :type ns: dict :returns: The PolynomialCalibrator, or None if we couldn't create a valid calibrator from the XML element :rtype: Union[PolynomialCalibrator, None] .. py:method:: get_epoch(parameter_type_element: lxml.etree.Element, ns: dict) -> Union[str, None] :staticmethod: Finds the epoch associated with a parameter type element and parses them to return an epoch string. See section 4.3.2.4.9 of CCSDS 660.1-G-2 :param parameter_type_element: The parameter type element :type parameter_type_element: ElementTree.Element :param ns: XML namespace dictionary :type ns: dict :returns: The epoch string, which may be a datetime string or a named epoch such as TAI. None if the element was not found. :rtype: Union[str, None] .. py:method:: get_offset_from(parameter_type_element: lxml.etree.Element, ns: dict) -> Union[str, None] :staticmethod: Finds the parameter referenced in OffsetFrom in a parameter type element and returns the name of the referenced parameter (which must be of type TimeParameterType). See section 4.3.2.4.9 of CCSDS 660.1-G-1 :param parameter_type_element: The parameter type element :type parameter_type_element: ElementTree.Element :param ns: XML namespace dictionary :type ns: dict :returns: The named of the referenced parameter. None if no OffsetFrom element was found. :rtype: Union[str, None] .. py:class:: AbsoluteTimeParameterType(name: str, encoding: space_packet_parser.encodings.DataEncoding, *, unit: Optional[str] = None, epoch: Optional[str] = None, offset_from: Optional[str] = None) Bases: :py:obj:`TimeParameterType` .. py:class:: RelativeTimeParameterType(name: str, encoding: space_packet_parser.encodings.DataEncoding, *, unit: Optional[str] = None, epoch: Optional[str] = None, offset_from: Optional[str] = None) Bases: :py:obj:`TimeParameterType` .. py:class:: Parameter Bases: :py:obj:`space_packet_parser.packets.Parseable` :param name: Parameter name. Typically something like MSN__PARAMNAME :type name: str :param parameter_type: Parameter type object that describes how the parameter is stored. :type parameter_type: ParameterType :param short_description: Short description of parameter as parsed from XTCE :type short_description: str :param long_description: Long description of parameter as parsed from XTCE :type long_description: str .. py:attribute:: name :type: str .. py:attribute:: parameter_type :type: ParameterType .. py:attribute:: short_description :type: Optional[str] :value: None .. py:attribute:: long_description :type: Optional[str] :value: None .. py:method:: parse(packet: space_packet_parser.packets.CCSDSPacket, **parse_value_kwargs) -> None Parse this parameter from the packet data. Parse the parameter and add it to the packet dictionary.