orekit_jpype
An alternative implementation of orekit python wrapper based on jpype. The interface is largely similar to the original orekit version.
This is Work In Progress.
The main orekit python wrapper is located at: https://gitlab.orekit.org/orekit-labs/python-wrapper/-/wikis/home
Please see the repository example notebooks and test cases for usage, as well as jpype documentation https://jpype.readthedocs.io/en/latest/index.html
Notes
The biggest difference between JCC and Jpype is that JCC is a static wrapping, creating c++ classes that are pre-defined when building the package, while JPype is dynamic and investigating the java machine on-the-fly.
Each model has advantages and disadvantages.
JCC Pro's
- Can (probably) implement anything that is doable in Java in Python using the special classes (subclassing, interfaces)
- Stable when a compiled version has been created
- Well tested with orekit
- Good support for JCC but mainly one person who maintains and understand the code.
JCC Con's
- Special classes for subclassing.
- Special classes for interfaces
- Casting of types for classes with multiple inheritance
- Can be tricky to get it to compile (but when it does it is stable)
- Poor docstring support
- Very hard to understand the inner working of the wrapping code
JPype Pro's
- Support for docstrings, reasonable rendering of javadoc
- Automatic adaptors enabling things like automatic translation between python datetime and AbsoluteDate.
- Well documented
- Medium hard to understand the wrapping code
- The wrapping is separate from the orekit part, maybe less issues with compiling (using conda)
- Currently high development momentum
- Direct mapping of numpy arrays to java arrays
JPype Cons
- No subclassing of Java classes (Abstract classes in orekit cannot be used)
- Issues with restarting the JVM
- The unknown issues we don't know.
- Seems to have a slight performance hit (~10% increase in time in some very basic tests)
Installation
mamba install -c conda-forge jpype1
git clone https://gitlab.orekit.org/Petrush/orekit_jpype.git
python setup.py install
To generate stub files (not working yet), use the stubgenj package
https://gitlab.cern.ch/scripting-tools/stubgenj
and command line:
python -m stubgenj --convert-strings --classpat "orekit_jpype/jars/*.jar" org.orekit org.hipparchus java
usage
See the example notebooks and the package test folder for examples.