The CPHD 0.3 VectorParameters object¶
The SRP definition for CPHD 0.3.
- class sarpy.io.phase_history.cphd0_3_elements.VectorParameters.FxParametersType(Fx0=8, Fx_SS=8, Fx1=8, Fx2=8, **kwargs)¶
Bases:
Serializable
The FX vector parameters.
- Fx0: int¶
The size of the Fx0 field Must take one of the values in (8,). Required.
- Type:
int
- Fx1: int¶
The size of the Fx1 field Must take one of the values in (8,). Required.
- Type:
int
- Fx2: int¶
The size of the Fx2 field Must take one of the values in (8,). Required.
- Type:
int
- Fx_SS: int¶
The size of the Fx_SS field Must take one of the values in (8,). Required.
- Type:
int
- static get_size()¶
The size in bytes of this component of the vector.
- Return type:
int
- get_position_offset_and_size(field)¶
Get the offset and size of the given field from the beginning of the vector.
- Parameters:
field (str) –
- Return type:
None|int
- get_dtype_components()¶
Gets the dtype components.
- Return type:
List[Tuple]
- copy()¶
Create a deep copy.
- classmethod from_dict(input_dict)¶
For json deserialization, from dict instance.
- Parameters:
input_dict (dict) – Appropriate parameters dict instance for deserialization
- Return type:
Corresponding class instance
- classmethod from_node(node, xml_ns, ns_key=None, kwargs=None)¶
For XML deserialization.
- Parameters:
node (ElementTree.Element) – dom element for serialized class instance
xml_ns (None|dict) – The xml namespace dictionary.
ns_key (None|str) – The xml namespace key. If xml_ns is None, then this is ignored. If None and xml_ns is not None, then the string default will be used. This will be recursively passed down, unless overridden by an entry of the cls._child_xml_ns_key dictionary.
kwargs (None|dict) – None or dictionary of previously serialized attributes. For use in inheritance call, when certain attributes require specific deserialization.
- Return type:
Corresponding class instance
- is_valid(recursive=False, stack=False)¶
Returns the validity of this object according to the schema. This is done by inspecting that all required fields (i.e. entries of _required) are not None.
- Parameters:
recursive (bool) – True if we recursively check that child are also valid. This may result in verbose (i.e. noisy) logging.
stack (bool) – Print a recursive error message?
- Returns:
condition for validity of this element
- Return type:
bool
- log_validity_error(msg)¶
Log a validity check error message.
- Parameters:
msg (str) –
- log_validity_info(msg)¶
Log a validation info message.
- Parameters:
msg (str) –
- log_validity_warning(msg)¶
Log a validity check warning message.
- Parameters:
msg (str) –
- set_numeric_format(attribute, format_string)¶
Sets the numeric format string for the given attribute.
- Parameters:
attribute (str) – attribute for which the format applies - must be in _fields.
format_string (str) – format string to be applied
- Return type:
None
- to_dict(check_validity=False, strict=False, exclude=())¶
For json serialization.
- Parameters:
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
exclude (tuple) – Attribute names to exclude from this generic serialization. This allows for child classes to provide specific serialization for special properties, after using this super method.
- Returns:
dict representation of class instance appropriate for direct json serialization.
- Return type:
OrderedDict
- to_node(doc, tag, ns_key=None, parent=None, check_validity=False, strict=False, exclude=())¶
For XML serialization, to a dom element.
- Parameters:
doc (ElementTree.ElementTree) – The xml Document
tag (None|str) – The tag name. Defaults to the value of self._tag and then the class name if unspecified.
ns_key (None|str) – The namespace prefix. This will be recursively passed down, unless overridden by an entry in the _child_xml_ns_key dictionary.
parent (None|ElementTree.Element) – The parent element. Defaults to the document root element if unspecified.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
exclude (tuple) – Attribute names to exclude from this generic serialization. This allows for child classes to provide specific serialization for special properties, after using this super method.
- Returns:
The constructed dom element, already assigned to the parent element.
- Return type:
ElementTree.Element
- to_xml_bytes(urn=None, tag=None, check_validity=False, strict=False)¶
Gets a bytes array, which corresponds to the xml string in utf-8 encoding, identified as using the namespace given by urn (if given).
- Parameters:
urn (None|str|dict) – The xml namespace string or dictionary describing the xml namespace.
tag (None|str) – The root node tag to use. If not given, then the class name will be used.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
- Returns:
bytes array from
ElementTree.tostring()
call.- Return type:
bytes
- to_xml_string(urn=None, tag=None, check_validity=False, strict=False)¶
Gets a xml string with utf-8 encoding, identified as using the namespace given by urn (if given).
- Parameters:
urn (None|str|dict) – The xml namespace or dictionary describing the xml namespace.
tag (None|str) – The root node tag to use. If not given, then the class name will be used.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
- Returns:
xml string from
ElementTree.tostring()
call.- Return type:
str
- class sarpy.io.phase_history.cphd0_3_elements.VectorParameters.TOAParametersType(DeltaTOA0=8, TOA_SS=8, **kwargs)¶
Bases:
Serializable
The TOA vector parameters.
- DeltaTOA0: int¶
The size of the DeltaTOA0 field Must take one of the values in (8,). Required.
- Type:
int
- TOA_SS: int¶
The size of the TOA_SS field Must take one of the values in (8,). Required.
- Type:
int
- static get_size()¶
The size in bytes of this component of the vector.
- Return type:
int
- get_position_offset_and_size(field)¶
Get the offset and size of the given field from the beginning of the vector.
- Parameters:
field (str) –
- Return type:
None|(int, int)
- get_dtype_components()¶
Gets the dtype components.
- Return type:
List[Tuple]
- copy()¶
Create a deep copy.
- classmethod from_dict(input_dict)¶
For json deserialization, from dict instance.
- Parameters:
input_dict (dict) – Appropriate parameters dict instance for deserialization
- Return type:
Corresponding class instance
- classmethod from_node(node, xml_ns, ns_key=None, kwargs=None)¶
For XML deserialization.
- Parameters:
node (ElementTree.Element) – dom element for serialized class instance
xml_ns (None|dict) – The xml namespace dictionary.
ns_key (None|str) – The xml namespace key. If xml_ns is None, then this is ignored. If None and xml_ns is not None, then the string default will be used. This will be recursively passed down, unless overridden by an entry of the cls._child_xml_ns_key dictionary.
kwargs (None|dict) – None or dictionary of previously serialized attributes. For use in inheritance call, when certain attributes require specific deserialization.
- Return type:
Corresponding class instance
- is_valid(recursive=False, stack=False)¶
Returns the validity of this object according to the schema. This is done by inspecting that all required fields (i.e. entries of _required) are not None.
- Parameters:
recursive (bool) – True if we recursively check that child are also valid. This may result in verbose (i.e. noisy) logging.
stack (bool) – Print a recursive error message?
- Returns:
condition for validity of this element
- Return type:
bool
- log_validity_error(msg)¶
Log a validity check error message.
- Parameters:
msg (str) –
- log_validity_info(msg)¶
Log a validation info message.
- Parameters:
msg (str) –
- log_validity_warning(msg)¶
Log a validity check warning message.
- Parameters:
msg (str) –
- set_numeric_format(attribute, format_string)¶
Sets the numeric format string for the given attribute.
- Parameters:
attribute (str) – attribute for which the format applies - must be in _fields.
format_string (str) – format string to be applied
- Return type:
None
- to_dict(check_validity=False, strict=False, exclude=())¶
For json serialization.
- Parameters:
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
exclude (tuple) – Attribute names to exclude from this generic serialization. This allows for child classes to provide specific serialization for special properties, after using this super method.
- Returns:
dict representation of class instance appropriate for direct json serialization.
- Return type:
OrderedDict
- to_node(doc, tag, ns_key=None, parent=None, check_validity=False, strict=False, exclude=())¶
For XML serialization, to a dom element.
- Parameters:
doc (ElementTree.ElementTree) – The xml Document
tag (None|str) – The tag name. Defaults to the value of self._tag and then the class name if unspecified.
ns_key (None|str) – The namespace prefix. This will be recursively passed down, unless overridden by an entry in the _child_xml_ns_key dictionary.
parent (None|ElementTree.Element) – The parent element. Defaults to the document root element if unspecified.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
exclude (tuple) – Attribute names to exclude from this generic serialization. This allows for child classes to provide specific serialization for special properties, after using this super method.
- Returns:
The constructed dom element, already assigned to the parent element.
- Return type:
ElementTree.Element
- to_xml_bytes(urn=None, tag=None, check_validity=False, strict=False)¶
Gets a bytes array, which corresponds to the xml string in utf-8 encoding, identified as using the namespace given by urn (if given).
- Parameters:
urn (None|str|dict) – The xml namespace string or dictionary describing the xml namespace.
tag (None|str) – The root node tag to use. If not given, then the class name will be used.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
- Returns:
bytes array from
ElementTree.tostring()
call.- Return type:
bytes
- to_xml_string(urn=None, tag=None, check_validity=False, strict=False)¶
Gets a xml string with utf-8 encoding, identified as using the namespace given by urn (if given).
- Parameters:
urn (None|str|dict) – The xml namespace or dictionary describing the xml namespace.
tag (None|str) – The root node tag to use. If not given, then the class name will be used.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
- Returns:
xml string from
ElementTree.tostring()
call.- Return type:
str
- class sarpy.io.phase_history.cphd0_3_elements.VectorParameters.VectorParametersType(TxTime=8, TxPos=24, RcvTime=8, RcvPos=24, SRPTime=None, SRPPos=24, AmpSF=None, TropoSRP=None, FxParameters=None, TOAParameters=None, **kwargs)¶
Bases:
Serializable
The vector parameters sizes object.
- copy()¶
Create a deep copy.
- classmethod from_dict(input_dict)¶
For json deserialization, from dict instance.
- Parameters:
input_dict (dict) – Appropriate parameters dict instance for deserialization
- Return type:
Corresponding class instance
- classmethod from_node(node, xml_ns, ns_key=None, kwargs=None)¶
For XML deserialization.
- Parameters:
node (ElementTree.Element) – dom element for serialized class instance
xml_ns (None|dict) – The xml namespace dictionary.
ns_key (None|str) – The xml namespace key. If xml_ns is None, then this is ignored. If None and xml_ns is not None, then the string default will be used. This will be recursively passed down, unless overridden by an entry of the cls._child_xml_ns_key dictionary.
kwargs (None|dict) – None or dictionary of previously serialized attributes. For use in inheritance call, when certain attributes require specific deserialization.
- Return type:
Corresponding class instance
- is_valid(recursive=False, stack=False)¶
Returns the validity of this object according to the schema. This is done by inspecting that all required fields (i.e. entries of _required) are not None.
- Parameters:
recursive (bool) – True if we recursively check that child are also valid. This may result in verbose (i.e. noisy) logging.
stack (bool) – Print a recursive error message?
- Returns:
condition for validity of this element
- Return type:
bool
- log_validity_error(msg)¶
Log a validity check error message.
- Parameters:
msg (str) –
- log_validity_info(msg)¶
Log a validation info message.
- Parameters:
msg (str) –
- log_validity_warning(msg)¶
Log a validity check warning message.
- Parameters:
msg (str) –
- set_numeric_format(attribute, format_string)¶
Sets the numeric format string for the given attribute.
- Parameters:
attribute (str) – attribute for which the format applies - must be in _fields.
format_string (str) – format string to be applied
- Return type:
None
- to_dict(check_validity=False, strict=False, exclude=())¶
For json serialization.
- Parameters:
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
exclude (tuple) – Attribute names to exclude from this generic serialization. This allows for child classes to provide specific serialization for special properties, after using this super method.
- Returns:
dict representation of class instance appropriate for direct json serialization.
- Return type:
OrderedDict
- to_node(doc, tag, ns_key=None, parent=None, check_validity=False, strict=False, exclude=())¶
For XML serialization, to a dom element.
- Parameters:
doc (ElementTree.ElementTree) – The xml Document
tag (None|str) – The tag name. Defaults to the value of self._tag and then the class name if unspecified.
ns_key (None|str) – The namespace prefix. This will be recursively passed down, unless overridden by an entry in the _child_xml_ns_key dictionary.
parent (None|ElementTree.Element) – The parent element. Defaults to the document root element if unspecified.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
exclude (tuple) – Attribute names to exclude from this generic serialization. This allows for child classes to provide specific serialization for special properties, after using this super method.
- Returns:
The constructed dom element, already assigned to the parent element.
- Return type:
ElementTree.Element
- to_xml_bytes(urn=None, tag=None, check_validity=False, strict=False)¶
Gets a bytes array, which corresponds to the xml string in utf-8 encoding, identified as using the namespace given by urn (if given).
- Parameters:
urn (None|str|dict) – The xml namespace string or dictionary describing the xml namespace.
tag (None|str) – The root node tag to use. If not given, then the class name will be used.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
- Returns:
bytes array from
ElementTree.tostring()
call.- Return type:
bytes
- to_xml_string(urn=None, tag=None, check_validity=False, strict=False)¶
Gets a xml string with utf-8 encoding, identified as using the namespace given by urn (if given).
- Parameters:
urn (None|str|dict) – The xml namespace or dictionary describing the xml namespace.
tag (None|str) – The root node tag to use. If not given, then the class name will be used.
check_validity (bool) – Check whether the element is valid before serializing, by calling
is_valid()
.strict (bool) – Only used if check_validity = True. In that case, if True then raise an Exception (of appropriate type) if the structure is not valid, if False then log a hopefully helpful message.
- Returns:
xml string from
ElementTree.tostring()
call.- Return type:
str
- TxTime: int¶
The size of the TxTime field Must take one of the values in (8,). Required.
- Type:
int
- TxPos: int¶
The size of the TxPos field Must take one of the values in (24,). Required.
- Type:
int
- RcvTime: int¶
The size of the RcvTime field Must take one of the values in (8,). Required.
- Type:
int
- RcvPos: int¶
The size of the RcvPos field Must take one of the values in (24,). Required.
- Type:
int
- SRPTime: int¶
The size of the SRPTime field Must take one of the values in (8,). Optional.
- Type:
int
- SRPPos: int¶
The size of the SRPPos field Must take one of the values in (24,). Required.
- Type:
int
- AmpSF: int¶
The size of the AmpSF field Must take one of the values in (8,). Optional.
- Type:
int
- TropoSRP: int¶
The size of the TropoSRP field Must take one of the values in (8,). Optional.
- Type:
int
- FxParameters: None | FxParametersType¶
The frequency parameters, only present when DomainType is FX. Optional.
- Type:
- TOAParameters: None | TOAParametersType¶
The TOA parameters, only present when DomainType is TOA. Optional.
- Type:
- get_size()¶
The size in bytes of this component of the vector.
- Return type:
int
- get_position_offset_and_size(field)¶
Get the offset and size of the given field from the beginning of the vector.
- Parameters:
field (str) –
- Return type:
None|(int, int)
- get_vector_dtype()¶
Gets the dtype for the corresponding structured array for the full PVP array.
- Returns:
This will be a compound dtype for a structured array.
- Return type:
numpy.dtype