PTR API#
PTR reader#
read_ptr
#
- ptr.read_ptr(ptx)#
PTX file reader.
- Parameters
ptx (str or pathlib.Path) – PTX file content text or file name.
- Returns
Parsed pointing request content.
- Return type
read_ptx
(alias)#
PTR elements#
Element
#
- class ptr.Element(tag, *elements, description=None, **attrs)[source]#
Bases:
object
Abstract PTR element object.
- Parameters
tag (str) – Element tag name.
*elements (any) – Text/numerical values or list of children elements.
description (str or list, optional) – Element description, put as a xml-comment on top of the element.
**attrs (str) – Element attributes.
- property tag#
Element tag name.
- property value#
Element parsed value.
- property description#
Element description.
- property xml_desc#
Element XML formatted description.
- property xml#
Element XML object.
- index(tag) int [source]#
Locate tag element index in the elements list.
- Parameters
tag (str) – Tag element name to search in the Element.
- Returns
Index of the tag element requested.
- Return type
int
- Raises
ValueError – If the tag element was not found in the Element.
Note
If multiple tag elements are present only the index of the first tag element found is returned. Only the top level children are explored.
- pop(key=- 1)[source]#
Pop child element(s) by index or key.
- Parameters
key (int or str) – Element index or Element tag name to remove. By default the last element is removed.
- Returns
Popped element(s).
- Return type
- Raises
IndexError – If the provided index is out of range.
KeyError – If not element match the provided key.
TypeError – If the key provided is invalid.
Note
When removed by tag name, if multiple child elements match the provided key, they will all be removed and returned.
ObsBlock
#
- class ptr.ObsBlock(start, end, *elements, metadata=None, description=None, **attrs)[source]#
Bases:
ptr.block.block.ElementBlock
PTR observation block.
- Parameters
start (string, datetime.datetime or numpy.datetime64) – Block start time.
end (string, datetime.datetime or numpy.datetime64) – Block end time.
*elements – Block elements.
metadata (str, int, float, ptr.Element, tuple or list, optional) – Block metadata comments.
description (str or list, optional) – Block description, put as a xml-comment on top of the element.
**attrs – Block keywords attributes.
PointingRequestMessage
#
- class ptr.PointingRequestMessage(*blocks, header=None, description=None, seg_name=None, seg_metadata=None, frame='SC', **attrs)[source]#
Bases:
ptr.timeline.Timeline
Pointing Request Message element.
- Parameters
*blocks (ObsBlock, optional) – Block element(s).
header (str, ptr.Element or list, optional) – Header comments.
description (str or list, optional) – Message top comment description.
seg_name (str, optional) – Segment name attribute.
seg_metadata (str or list, optional) – Segment metadata comments.
frame (str, optional) – Timeline reference frame (default: ‘SC’).
**attrs – Timeline attributes keywords.
Warning
Only 1 segment is accepted for PTR. Support for PTS is out of scope for now.
- property xml#
PRM XML representation.
- simulate(metakernel, agm_endpoint, cache=True) ptr.agm.results.AGMResults [source]#
Simulate Pointing Request with the Attitude Generator Module.
- Parameters
metakernel (str) – Baseline metakernel for AGM input
agm_endpoint (str) – AGM endpoint.
cache (bool, optional) – Use cache the response if present locally.
- Returns
AGM simulation results. If the simulation succeeded, the resulting CK can be loading into spiceypy.
- Return type