Skip to content
Snippets Groups Projects
Commit 9d065e54 authored by Petrus Hyvönen's avatar Petrus Hyvönen
Browse files

Make numpy non-mandatory

parent 12b7fbd6
No related branches found
No related tags found
No related merge requests found
...@@ -5,7 +5,7 @@ It is assumed that the JVM is running. ...@@ -5,7 +5,7 @@ It is assumed that the JVM is running.
Importing this file will automatically implement the changes. Importing this file will automatically implement the changes.
""" """
import numpy as np
import datetime, math import datetime, math
import orekit_jpype import orekit_jpype
...@@ -60,21 +60,26 @@ class _JAbsoluteDate(object): ...@@ -60,21 +60,26 @@ class _JAbsoluteDate(object):
int(math.floor(seconds)), int(math.floor(seconds)),
int(1000000.0 * (seconds - math.floor(seconds)))) int(1000000.0 * (seconds - math.floor(seconds))))
try:
import numpy as np
@JImplementationFor("double[][]") @JImplementationFor("double[][]")
class _JDouble2DArray(object): class _JDouble2DArray(object):
def to_numpy(self) -> np.ndarray: def to_numpy(self) -> np.ndarray:
""" """
Get the Java Double 2D Array as a Python numpy array 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): except ImportError:
return f"<{self.getClass().getSimpleName()}: {np.array(self).__str__()}>" pass
# @JImplementationFor("double[]") # @JImplementationFor("double[]")
# class _JDoubleArray(object): # class _JDoubleArray(object):
......
...@@ -25,8 +25,7 @@ classifiers = [ ...@@ -25,8 +25,7 @@ classifiers = [
] ]
dependencies = [ dependencies = [
'jpype1', 'Jpype1'
'numpy'
] ]
[project.urls] [project.urls]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment