diff --git a/orekit_jpype/orekit_converters.py b/orekit_jpype/orekit_converters.py index d07acf25f90d1d07e08090c878ad9c43c25d4502..2a9a3174ff6a73c6d68749bc31b077cc37d370dc 100644 --- a/orekit_jpype/orekit_converters.py +++ b/orekit_jpype/orekit_converters.py @@ -5,7 +5,7 @@ It is assumed that the JVM is running. Importing this file will automatically implement the changes. """ -import numpy as np + import datetime, math import orekit_jpype @@ -60,21 +60,26 @@ class _JAbsoluteDate(object): int(math.floor(seconds)), int(1000000.0 * (seconds - math.floor(seconds)))) +try: + import numpy as np -@JImplementationFor("double[][]") -class _JDouble2DArray(object): + @JImplementationFor("double[][]") + class _JDouble2DArray(object): - def to_numpy(self) -> np.ndarray: - """ - Get the Java Double 2D Array as a Python numpy array + def to_numpy(self) -> np.ndarray: + """ + Get the Java Double 2D Array as a Python numpy array - Returns: the Double Array as numpy 2D array + Returns: the Double Array as numpy 2D array - """ - return np.array(self) + """ + return np.array(self) + + def __repr__(self): + return f"<{self.getClass().getSimpleName()}: {np.array(self).__str__()}>" - def __repr__(self): - return f"<{self.getClass().getSimpleName()}: {np.array(self).__str__()}>" +except ImportError: + pass # @JImplementationFor("double[]") # class _JDoubleArray(object): diff --git a/pyproject.toml b/pyproject.toml index f76cf97869dcd521440c96ffa5b9ebba21620d48..8ec741e2752497d384a548b98716587afe1c5ee5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -25,8 +25,7 @@ classifiers = [ ] dependencies = [ - 'jpype1', - 'numpy' + 'Jpype1' ] [project.urls]