Skip to main content

A Pointing Tool simphony wrapper

Project description

Pointing Tool Wrapper

A JUICE SOC Pointing Tool wrapper for LINUX and MACOSX for use in a local computer.

Allows to simulate a Pointing Timeline Request (PTR) and to generate the corresponding SPICE CK, resolved PTR, and quaternions dump file.

Documentation

The documentation is automatically generated from the content of the docs directory and from the docstrings of the public signatures of the source code.

Additional documentation is available at the JUICE SOC Toolkit Help.

Installation

Users of Nexus scidockreg repository

pip install ptwrapper

Other Users

git clone https://juigitlab.esac.esa.int/core-system/uplink/auxiliary-tools/ptwrapper
cd ptwrapper
pip install .

Development and testing

  • Clone this repository
  • Requirements:
  • Create a virtual environment and install the dependencies

Install the package and its dependencies:

poetry install

Then, after your edits, check that flake8 us happy:

poetry run flake8

and all the tests passed:

poetry run pytest -s

Using the library

After installing the library can be used with the Python Shell or with its CLI.

Python Shell

A basic test of the library contents can be done as follows:

from ptwrapper.simphony import SimphonyWrapper
sw = SimphonyWrapper()
version = sw.get_app_version()
print(version)

The next sample shows a more complex one, a PTR processing. The sample creates in the working directory a structure folder to invoke simphony and dumps inside the OUTPUT folder the expected products (SPICE CK, resolved PTR, and quaternions CSV)

import os

from ptwrapper.simphony import SimphonyWrapper
from ptwrapper.simphony import create_structure

ptr_content = """<prm>
   <body>
      <segment>
         <data>
            <timeline frame="SC">
               <block ref="OBS">
                  <startTime>2030-10-15T03:40:00</startTime>
                  <endTime>2030-10-15T04:15:00</endTime>
                  <attitude ref="track">
                     <boresight ref="SC_Zaxis"/>
                     <target ref="Jupiter"/>
                     <phaseAngle ref="powerOptimised">
                        <yDir>false</yDir>
                     </phaseAngle>
                     </attitude>
                     <metadata>
                        <comment>Track Power Optimised C3.0</comment>
                     </metadata>
               </block>
            </timeline>
         </data>
     </segment>
   </body>
</prm>
"""
mk_path = 'metakernel.tm'
session_file_path = create_structure('.', mk_path, ptr_content)
sw = SimphonyWrapper()
result = sw.get_attitude(os.path.dirname(session_file_path), session_file_path)
print(result)

Command line interface

The package has a CLI entry point:

ptwrapper -h

usage: ptwrapper [-h] [-s SESSION_FILE] [-m META_KERNEL] [-p PTR] [-w WORKING_DIR] [-o OUTPUT_DIR]

Simulate a PTR and generate the corresponding SPICE CK, resolved PTR, and quaternions dump file.

optional arguments:
  -h, --help            show this help message and exit
  -s SESSION_FILE, --session-file SESSION_FILE
                        Path to the session file. If provided the other arguments are ignored.
  -m META_KERNEL, --meta-kernel META_KERNEL
                        Path to the meta-kernel file.
  -p PTR, --ptr PTR     Path to the PTR/PTX file.
  -w WORKING_DIR, --working-dir WORKING_DIR
                        Path to the working directory. Default is the current directory.
  -o OUTPUT_DIR, --output-dir OUTPUT_DIR
                        Path to the output directory. Overwrites default output file names. Default is the structure of the built-in session file.

You can either run the CLI using an OSVE configuration file (SESSION_FILE) or by specifying a number of inputs and assume the rest of parameters as provided by the default configuration file included in the package.

In addition, if you do not specify an output directory (OUTPUT_DIR), the package will replicate the canonical output directory and file structure and will also generate a SESSION_FILE that can be reused. Contrarily, if you specify an OUTPUT_DIR the output will be simplified and provided in that directory; additionally the output files will inherit the name of the input PTR file.

WARNING: Remember that the input META_KERNEL needs to have an adequate relative or absolute path for its PATH_VALUES variable value.

A couple of examples are provided hereunder. First specifying the output directory:

ptwrapper -m kernels/juice_mini_local.tm -p ptr_simphony.xml -o . 

AGM version:  9.3.0.p1
OSVE version: 1.6.0
[INFO]    <AGE>  Attitude Generation Module initialization started 
[INFO]    <AGE>  AGE module setup started 
[INFO]    <AGE>  AGE module setup successfully completed 
[INFO]    <AGE>  Attitude Generation Module initialization completed 
[INFO]    <AGE>  Loading Attitude Timeline 
[INFO]    <AGE>  Checking Attitude Timeline 
[INFO]    <AGE>  Initializing Attitude Timeline 
[INFO]    <AGE>   TOTAL ENERGY for POINTING block from 2030-10-15T03:40:00Z to 2030-10-15T04:15:00Z 
[INFO]    <AGE>   Attitude from actual PTR: 812.096753 Wh (812.096753 Wh) 
[INFO]    <AGE>   Attitude from loaded CK:  812.096096 Wh (812.096096 Wh) 
[INFO]    <PIF>  XML PTR file: "ptr_resolved.ptx" generated 
[INFO]    <PIF>  Generating CK file with the following USER DEFINED parameters: 
[INFO]    <PIF>  CK frame ID:  -28001 
[INFO]    <PIF>  CK time step: 5 s 
[INFO]    <AGE>  Writing Attitude Spice CK File: juice_sc_ptr.bc 
[INFO]    <PIF>  CK file: "juice_sc_ptr.bc" generated 
[INFO]    <AGE>  Writing Attitude Text File 
Renaming quaternions.csv to ptr_simphony.csv
Renaming ptr_resolved.ptx to ptr_simphony_resolved.ptx
Renaming juice_sc_ptr.bc to ptr_simphony.bc
Cleaning up OSVE execution files and directores

This will generate the following output files.

.
|-- ptr_simphony.bc
|-- ptr_simphony.csv
|-- ptr_simphony.xml
`-- ptr_simphony_resolved.ptx

The same run without specifying the OUTPUT_DIRECTORY yields the following directory structure:

.
|-- config
|   `-- age
|       |-- CFG_AGM_JUI_MULTIBODY_EVENT_DEFINITIONS.xml
|       |-- CFG_AGM_JUI_MULTIBODY_FIXED_DEFINITIONS.xml
|       `-- CFG_AGM_JUI_MULTIBODY_PREDEFINED_BLOCK.xml
|-- kernel
|   `-- juice_mini_local.tm
|-- output
|   |-- juice_sc_ptr.bc
|   |-- ptr_resolved.ptx
|   `-- quaternions.csv
|-- ptr
|   `-- PTR_PT_V1.ptx
`-- session_file.json

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ptwrapper-1.0.0.tar.gz (17.1 MB view details)

Uploaded Source

Built Distribution

ptwrapper-1.0.0-py3-none-any.whl (17.1 MB view details)

Uploaded Python 3

File details

Details for the file ptwrapper-1.0.0.tar.gz.

File metadata

  • Download URL: ptwrapper-1.0.0.tar.gz
  • Upload date:
  • Size: 17.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.9.13 Darwin/22.4.0

File hashes

Hashes for ptwrapper-1.0.0.tar.gz
Algorithm Hash digest
SHA256 a2d260c678ddcc53cc7e55d282237315765109d52e5c07c122f52ca70e9e158e
MD5 572f938bf071c6cd74b9a89c0166486b
BLAKE2b-256 25369d40fd4ffe733aa764453cec285d677f7b818aae52847b9c73436e26974c

See more details on using hashes here.

File details

Details for the file ptwrapper-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ptwrapper-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 17.1 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.1 CPython/3.9.13 Darwin/22.4.0

File hashes

Hashes for ptwrapper-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1c1a5d0351563bc2fee09fb47a5285c22b759b944bd59a95dae5bfb9b1b2c5f1
MD5 dde908364433adb4d7b450f82ea64345
BLAKE2b-256 3b80fccd8542671a1370c965d644500282842d287e9ffd813b3b0f52fcde6743

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page