Skip to content

Commit bdf4faa

Browse files
committed
Support latest version of numpy
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.
1 parent 19a9ff9 commit bdf4faa

File tree

7 files changed

+14
-13
lines changed

7 files changed

+14
-13
lines changed

examples/scenarioAttLocPoint.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def run(show_plots):
296296
)
297297
vizSupport.addLocation(viz, stationName="Boulder Station"
298298
, parentBodyName=earth.displayName
299-
, r_GP_P=groundStation.r_LP_P_Init
299+
, r_GP_P=unitTestSupport.EigenVector3d2list(groundStation.r_LP_P_Init)
300300
, fieldOfView=np.radians(160.)
301301
, color='pink'
302302
, range=2000.0*1000 # meters

examples/scenarioGroundDownlink.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
from Basilisk.simulation import simpleInstrument, simpleStorageUnit, partitionedStorageUnit, spaceToGroundTransmitter
7171
from Basilisk.simulation import groundLocation
7272
from Basilisk.utilities import vizSupport
73+
from Basilisk.utilities import unitTestSupport
7374

7475
from Basilisk.simulation import spacecraft
7576
from Basilisk.utilities import macros
@@ -221,7 +222,7 @@ def run(show_plots):
221222
)
222223
vizSupport.addLocation(viz, stationName="Boulder Station"
223224
, parentBodyName=planet.planetName
224-
, r_GP_P=groundStation.r_LP_P_Init
225+
, r_GP_P=unitTestSupport.EigenVector3d2list(groundStation.r_LP_P_Init)
225226
, fieldOfView=np.radians(160.)
226227
, color='pink'
227228
, range=1000.0*1000 # meters

examples/scenarioGroundLocationImaging.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ def run(show_plots):
450450
viz,
451451
stationName="Boulder Target",
452452
parentBodyName=earth.displayName,
453-
r_GP_P=imagingTarget.r_LP_P_Init,
453+
r_GP_P=unitTestSupport.EigenVector3d2list(imagingTarget.r_LP_P_Init),
454454
fieldOfView=np.radians(160.0),
455455
color="pink",
456456
range=2000.0 * 1000, # meters
@@ -464,7 +464,7 @@ def run(show_plots):
464464
viz,
465465
stationName="Santiago Target",
466466
parentBodyName=earth.displayName,
467-
r_GP_P=[[1761771.6422437236], [-5022201.882030934], [-3515898.6046771165]],
467+
r_GP_P=[1761771.6422437236, -5022201.882030934, -3515898.6046771165],
468468
fieldOfView=np.radians(160.0),
469469
color="pink",
470470
range=2000.0 * 1000, # meters
@@ -475,7 +475,7 @@ def run(show_plots):
475475
viz,
476476
stationName="Singapore Station",
477477
parentBodyName=earth.displayName,
478-
r_GP_P=singaporeStation.r_LP_P_Init,
478+
r_GP_P=unitTestSupport.EigenVector3d2list(singaporeStation.r_LP_P_Init),
479479
fieldOfView=np.radians(160.0),
480480
color="green",
481481
range=2000.0 * 1000, # meters

src/fswAlgorithms/sensorInterfaces/TAMSensorData/_UnitTest/test_tamComm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def tamCommTestFunction(show_plots):
9292

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

9797
# Create input message and size it because the regular creator of that message
9898
# is not part of the test.

src/simulation/environment/planetEphemeris/_UnitTest/test_planetEphemeris.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def planetEphemerisTest(show_plots, setRAN, setDEC, setLST, setRate):
184184
testMessages.append("FAILED: planetEphemeris() didn't set the desired plane name " + planet)
185185

186186
# check that the time information is correct
187-
timeTrue = [[0.0], [0.5], [1.0]]
187+
timeTrue = [0.0, 0.5, 1.0]
188188
testFailCount, testMessages = unitTestSupport.compareDoubleArray(
189189
timeTrue, J2000Current, accuracy, "J2000Current", testFailCount, testMessages)
190190

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

@@ -223,7 +223,7 @@ def planetEphemerisTest(show_plots, setRAN, setDEC, setLST, setRate):
223223
omega_NP_P = np.array([0.0, 0.0, -omegaList[c]])
224224
tilde = rbk.v3Tilde(omega_NP_P)
225225
for time in timeTrue:
226-
lst = lst0 + omegaList[c]*time[0]
226+
lst = lst0 + omegaList[c]*time
227227
DCM = rbk.euler3232C([RAN, np.pi/2.0 - DEC, lst])
228228
dcmTrue.append(DCM)
229229
dDCMdt = np.matmul(tilde, DCM)

src/simulation/sensors/coarseSunSensor/_UnitTest/test_CSSConfig.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def run(show_plots, accuracy):
129129
testFailCount, testMessages = unitTestSupport.compareArray([[0., 0., 0.]], dataCSS1pos,
130130
accuracy, "CSS1 pos",
131131
testFailCount, testMessages)
132-
testFailCount, testMessages = unitTestSupport.compareArray([CSS1.nHat_B], dataCSS1nHat,
132+
testFailCount, testMessages = unitTestSupport.compareArray([unitTestSupport.EigenVector3d2np(CSS1.nHat_B)], dataCSS1nHat,
133133
accuracy, "CSS1 nHat_B",
134134
testFailCount, testMessages)
135135
testFailCount, testMessages = unitTestSupport.compareDoubleArray([CSS1.fov], dataCSS1fov,
@@ -149,10 +149,10 @@ def run(show_plots, accuracy):
149149
testFailCount, testMessages)
150150

151151
# check CSS 2 output
152-
testFailCount, testMessages = unitTestSupport.compareArray([CSS2.r_B], dataCSS2pos,
152+
testFailCount, testMessages = unitTestSupport.compareArray([unitTestSupport.EigenVector3d2np(CSS2.r_B)], dataCSS2pos,
153153
accuracy, "CSS2 pos",
154154
testFailCount, testMessages)
155-
testFailCount, testMessages = unitTestSupport.compareArray([CSS2.nHat_B], dataCSS2nHat,
155+
testFailCount, testMessages = unitTestSupport.compareArray([unitTestSupport.EigenVector3d2np(CSS2.nHat_B)], dataCSS2nHat,
156156
accuracy, "CSS2 nHat_B",
157157
testFailCount, testMessages)
158158
testFailCount, testMessages = unitTestSupport.compareDoubleArray([CSS2.fov], dataCSS2fov,

src/simulation/sensors/simpleMassProps/_UnitTest/test_simpleMassProps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def simpleMassPropsTestFunction(show_plots, accuracy):
139139
unitTestSim.TotalSim.SingleStepProcesses()
140140

141141
# set the filtered output truth states
142-
trueMass = [[100], [500]]
142+
trueMass = [100, 500]
143143
trueInertia = [[40, 0, 0, 0, 50, 0, 0, 0, 60],
144144
[200, 0, 0, 0, 300, 0, 0, 0, 400]]
145145
trueCoM = [[0.0, 0.0, 0.0],

0 commit comments

Comments
 (0)