PL1

Updated Pointing Tool log from Plain text to JSON

The Pointing Tool has an updated Log format now provided in JSON. esa-ptr needs to be adapted given that now it provides an error when calling the API:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [29], in <cell line: 1>()
----> 1 results = agm_simulation('JUICE Planning Cruise', 'example.ptx', 'JUICE_API')
      2 results

File /opt/anaconda3/lib/python3.9/site-packages/ptr/agm/simulation.py:39, in agm_simulation(metakernel, ptr, endpoint, cache)
     36 if not ptr_content.startswith('<'):
     37     ptr_content = Path(ptr).read_text(encoding='utf-8').strip()
---> 39 return agm_api(metakernel, ptr_content, endpoint, cache=cache)

File /opt/anaconda3/lib/python3.9/site-packages/ptr/agm/api.py:51, in agm_api(metakernel, ptr, endpoint, cache)
     48 fname = AGM_CACHE(metakernel, ptr, url)
     50 if cache and fname.exists():
---> 51     return AGMResults(fname)
     53 payload = json.dumps({
     54     'metakernel': metakernel,
     55     'ptr_content': str(ptr),
     56 }).encode('utf-8')
     58 req = request.Request(url, data=payload)

File /opt/anaconda3/lib/python3.9/site-packages/ptr/agm/results.py:42, in AGMResults.__init__(self, results)
     39 session_id = self['results'].get('session_id')
     41 if self.status.success:
---> 42     self.log = AGMResultsLog(self['results']['output'], session_id=session_id)
     43     self.ck = AGMResultsCK(self)
     44     self.ptr_resolved = AGMResultsResolvedPTR(self)

File /opt/anaconda3/lib/python3.9/site-packages/ptr/agm/results.py:280, in AGMResultsLog.__init__(self, log, session_id)
    277 def __init__(self, log, session_id=None):
    278     self.log = [
    279         (flag, tag.replace('AGE> <', ''), msg)
--> 280         for line in log.replace('\\"', '"').split('\n')
    281         for flag, tag, msg in self.line.findall(line)
    282     ]
    284     self.session_id = session_id

AttributeError: 'list' object has no attribute 'replace'

The specification of the updated log can be derived from:

[
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "OSVE Version 2.0.1",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "AGM Version  9.3.6_ed7f0736",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "EPS Version  9.3.6_ed7f0736",
        "time": ""
    },
    {
        "module": "AGE",
        "severity": "INFO",
        "text": "Attitude Generation Module initialization started",
        "time": ""
    },
    {
        "module": "AGE",
        "severity": "DEBUG",
        "text": "Parsing XML Configuration file: /Users/marc.costa/temp/ptwrapper/config/age/cfg_agm_jui_jupiter.xml",
        "time": ""
    },
    {
        "module": "AGE",
        "severity": "DEBUG",
        "text": "XML Configuration file parsed successfully",
        "time": ""
    },
    {
        "module": "AGE",
        "severity": "INFO",
        "text": "AGE module setup started",
        "time": ""
    },
    {
        "module": "AGE",
        "severity": "INFO",
        "text": "AGE module setup successfully completed",
        "time": ""
    },
    {
        "module": "AGE",
        "severity": "INFO",
        "text": "Attitude Generation Module initialization completed",
        "time": ""
    },
    {
        "module": "ISE",
        "severity": "INFO",
        "text": "Experiment Planning System initialization started",
        "time": ""
    },
    {
        "module": "ISE",
        "severity": "INFO",
        "text": "Experiment Planning System initialization completed",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "Load Event File: \"TOP_events.evf\"",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "Load Timeline File: \"TOP_timelines.itl\"",
        "time": ""
    },
    {
        "module": "AGE",
        "severity": "INFO",
        "text": "Loading Attitude Timeline",
        "time": ""
    },
    {
        "module": "AGE",
        "severity": "INFO",
        "text": "Checking Attitude Timeline",
        "time": ""
    },
    {
        "module": "AGE",
        "severity": "INFO",
        "text": "Initializing Attitude Timeline",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "WARNING",
        "text": "Attitude Timeline starts after Operations Timeline",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "WARNING",
        "text": "Attitude Timeline ends before Operations Timeline",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "STARTING SIMULATION",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "Experiment Timeline Time Period 2022-08-26T01:53:51 - 2035-10-05T00:44:43",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "Attitude Timeline Time Period 2034-03-20T15:22:25Z - 2034-03-20T18:15:00Z",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "Simulation Timeline Time Period 2034-03-20T15:22:25Z - 2034-03-20T18:15:00Z",
        "time": ""
    },
    {
        "module": "ISE",
        "severity": "WARNING",
        "text": "TimelineExecutor: 4075 timeline entries skipped at initialisation",
        "time": ""
    },
    {
        "module": "ISE",
        "severity": "INFO",
        "text": "Entries defined before start time 20-March-2034_15:22:25",
        "time": ""
    },
    {
        "module": "ISE",
        "severity": "WARNING",
        "text": "4075 timeline entries skipped at initialisation",
        "time": ""
    },
    {
        "module": "ISE",
        "severity": "INFO",
        "text": "Entries defined before start time 20-March-2034_15:22:25",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "Simulation Time Step 1s",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "INFO",
        "text": "Simulation Output Time Step 1s",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "DEBUG",
        "text": "Simulation time 2034-03-20T15:24:09 at 1 %",
        "time": ""
    },
    {
        "module": "OSVE",
        "severity": "DEBUG",
        "text": "Simulation time 2034-03-20T15:25:53 at 2 %",
        "time": ""
    },
    {
        "module": "AGM",
        "severity": "ERROR",
        "text": "Attitude angular acceleration value: 0.00133333 above maximum allowed: 0.001 [deg/s^2]",
        "time": "2034-03-20T15:26:25Z"
    },
    {
        "module": "AGM",
        "severity": "ERROR",
        "text": "WMM RW torque(s) out of allowed range(s)",
        "time": "2034-03-20T15:26:27Z"
    },
    {
        "module": "AGM",
        "severity": "ERROR",
        "text": "WMM reaction wheel 1, torque value: 0.242508. Out of range: -0.14 [N*m] to 0.14 [N*m]",
        "time": "2034-03-20T15:26:27Z"
    },