Skip to content

Commit

Permalink
Support latest version of numpy
Browse files Browse the repository at this point in the history
With the latest version of numpy this error appears

	Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future.

These fixes correct this issue and pytest runs again without lots of depreciation warnings.
  • Loading branch information
schaubh committed Oct 8, 2023
1 parent 19a9ff9 commit bdf4faa
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion examples/scenarioAttLocPoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def run(show_plots):
)
vizSupport.addLocation(viz, stationName="Boulder Station"
, parentBodyName=earth.displayName
, r_GP_P=groundStation.r_LP_P_Init
, r_GP_P=unitTestSupport.EigenVector3d2list(groundStation.r_LP_P_Init)
, fieldOfView=np.radians(160.)
, color='pink'
, range=2000.0*1000 # meters
Expand Down
3 changes: 2 additions & 1 deletion examples/scenarioGroundDownlink.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
from Basilisk.simulation import simpleInstrument, simpleStorageUnit, partitionedStorageUnit, spaceToGroundTransmitter
from Basilisk.simulation import groundLocation
from Basilisk.utilities import vizSupport
from Basilisk.utilities import unitTestSupport

from Basilisk.simulation import spacecraft
from Basilisk.utilities import macros
Expand Down Expand Up @@ -221,7 +222,7 @@ def run(show_plots):
)
vizSupport.addLocation(viz, stationName="Boulder Station"
, parentBodyName=planet.planetName
, r_GP_P=groundStation.r_LP_P_Init
, r_GP_P=unitTestSupport.EigenVector3d2list(groundStation.r_LP_P_Init)
, fieldOfView=np.radians(160.)
, color='pink'
, range=1000.0*1000 # meters
Expand Down
6 changes: 3 additions & 3 deletions examples/scenarioGroundLocationImaging.py
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ def run(show_plots):
viz,
stationName="Boulder Target",
parentBodyName=earth.displayName,
r_GP_P=imagingTarget.r_LP_P_Init,
r_GP_P=unitTestSupport.EigenVector3d2list(imagingTarget.r_LP_P_Init),
fieldOfView=np.radians(160.0),
color="pink",
range=2000.0 * 1000, # meters
Expand All @@ -464,7 +464,7 @@ def run(show_plots):
viz,
stationName="Santiago Target",
parentBodyName=earth.displayName,
r_GP_P=[[1761771.6422437236], [-5022201.882030934], [-3515898.6046771165]],
r_GP_P=[1761771.6422437236, -5022201.882030934, -3515898.6046771165],
fieldOfView=np.radians(160.0),
color="pink",
range=2000.0 * 1000, # meters
Expand All @@ -475,7 +475,7 @@ def run(show_plots):
viz,
stationName="Singapore Station",
parentBodyName=earth.displayName,
r_GP_P=singaporeStation.r_LP_P_Init,
r_GP_P=unitTestSupport.EigenVector3d2list(singaporeStation.r_LP_P_Init),
fieldOfView=np.radians(160.0),
color="green",
range=2000.0 * 1000, # meters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def tamCommTestFunction(show_plots):

# Initialize the test module configuration data
dcm3, _ = np.linalg.qr(np.random.normal(0, 1, (3, 3)))
module.dcm_BS = dcm3.reshape(9, 1)
module.dcm_BS = unitTestSupport.flattenList(dcm3)

# Create input message and size it because the regular creator of that message
# is not part of the test.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def planetEphemerisTest(show_plots, setRAN, setDEC, setLST, setRate):
testMessages.append("FAILED: planetEphemeris() didn't set the desired plane name " + planet)

# check that the time information is correct
timeTrue = [[0.0], [0.5], [1.0]]
timeTrue = [0.0, 0.5, 1.0]
testFailCount, testMessages = unitTestSupport.compareDoubleArray(
timeTrue, J2000Current, accuracy, "J2000Current", testFailCount, testMessages)

Expand All @@ -199,7 +199,7 @@ def planetEphemerisTest(show_plots, setRAN, setDEC, setLST, setRate):
rTrue = []
vTrue = []
for time in timeTrue:
Mt = M0 + np.sqrt(mu/oe.a/oe.a/oe.a)*time[0]
Mt = M0 + np.sqrt(mu/oe.a/oe.a/oe.a)*time
Et = orbitalMotion.M2E(Mt, oe.e)
oe.f = orbitalMotion.E2f(Et, oe.e)

Expand All @@ -223,7 +223,7 @@ def planetEphemerisTest(show_plots, setRAN, setDEC, setLST, setRate):
omega_NP_P = np.array([0.0, 0.0, -omegaList[c]])
tilde = rbk.v3Tilde(omega_NP_P)
for time in timeTrue:
lst = lst0 + omegaList[c]*time[0]
lst = lst0 + omegaList[c]*time
DCM = rbk.euler3232C([RAN, np.pi/2.0 - DEC, lst])
dcmTrue.append(DCM)
dDCMdt = np.matmul(tilde, DCM)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def run(show_plots, accuracy):
testFailCount, testMessages = unitTestSupport.compareArray([[0., 0., 0.]], dataCSS1pos,
accuracy, "CSS1 pos",
testFailCount, testMessages)
testFailCount, testMessages = unitTestSupport.compareArray([CSS1.nHat_B], dataCSS1nHat,
testFailCount, testMessages = unitTestSupport.compareArray([unitTestSupport.EigenVector3d2np(CSS1.nHat_B)], dataCSS1nHat,
accuracy, "CSS1 nHat_B",
testFailCount, testMessages)
testFailCount, testMessages = unitTestSupport.compareDoubleArray([CSS1.fov], dataCSS1fov,
Expand All @@ -149,10 +149,10 @@ def run(show_plots, accuracy):
testFailCount, testMessages)

# check CSS 2 output
testFailCount, testMessages = unitTestSupport.compareArray([CSS2.r_B], dataCSS2pos,
testFailCount, testMessages = unitTestSupport.compareArray([unitTestSupport.EigenVector3d2np(CSS2.r_B)], dataCSS2pos,
accuracy, "CSS2 pos",
testFailCount, testMessages)
testFailCount, testMessages = unitTestSupport.compareArray([CSS2.nHat_B], dataCSS2nHat,
testFailCount, testMessages = unitTestSupport.compareArray([unitTestSupport.EigenVector3d2np(CSS2.nHat_B)], dataCSS2nHat,
accuracy, "CSS2 nHat_B",
testFailCount, testMessages)
testFailCount, testMessages = unitTestSupport.compareDoubleArray([CSS2.fov], dataCSS2fov,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def simpleMassPropsTestFunction(show_plots, accuracy):
unitTestSim.TotalSim.SingleStepProcesses()

# set the filtered output truth states
trueMass = [[100], [500]]
trueMass = [100, 500]
trueInertia = [[40, 0, 0, 0, 50, 0, 0, 0, 60],
[200, 0, 0, 0, 300, 0, 0, 0, 400]]
trueCoM = [[0.0, 0.0, 0.0],
Expand Down

0 comments on commit bdf4faa

Please sign in to comment.