mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
Tools: LogAnalyzer: use repr in place of deprecated backticks
This commit is contained in:
parent
cb56cf38d0
commit
a6fd812051
@ -25,7 +25,7 @@ class Format(object):
|
||||
self.labels = labels.split(',')
|
||||
|
||||
def __str__(self):
|
||||
return "%8s %s" % (self.name, `self.labels`)
|
||||
return "%8s %s" % (self.name, repr(self.labels))
|
||||
|
||||
@staticmethod
|
||||
def trycastToFormatType(value,valueType):
|
||||
|
@ -157,8 +157,8 @@ class TestSuite(object):
|
||||
xml.write("<loganalysis>\n")
|
||||
xml.write("<header>\n")
|
||||
xml.write(" <logfile>" + escape(self.logfile) + "</logfile>\n")
|
||||
xml.write(" <sizekb>" + escape(`self.logdata.filesizeKB`) + "</sizekb>\n")
|
||||
xml.write(" <sizelines>" + escape(`self.logdata.lineCount`) + "</sizelines>\n")
|
||||
xml.write(" <sizekb>" + escape(repr(self.logdata.filesizeKB)) + "</sizekb>\n")
|
||||
xml.write(" <sizelines>" + escape(repr(self.logdata.lineCount)) + "</sizelines>\n")
|
||||
xml.write(" <duration>" + escape(str(datetime.timedelta(seconds=self.logdata.durationSecs))) + "</duration>\n")
|
||||
xml.write(" <vehicletype>" + escape(self.logdata.vehicleTypeString) + "</vehicletype>\n")
|
||||
if self.logdata.vehicleType == VehicleType.Copter and self.logdata.getCopterType():
|
||||
@ -166,14 +166,14 @@ class TestSuite(object):
|
||||
xml.write(" <firmwareversion>" + escape(self.logdata.firmwareVersion) + "</firmwareversion>\n")
|
||||
xml.write(" <firmwarehash>" + escape(self.logdata.firmwareHash) + "</firmwarehash>\n")
|
||||
xml.write(" <hardwaretype>" + escape(self.logdata.hardwareType) + "</hardwaretype>\n")
|
||||
xml.write(" <freemem>" + escape(`self.logdata.freeRAM`) + "</freemem>\n")
|
||||
xml.write(" <skippedlines>" + escape(`self.logdata.skippedLines`) + "</skippedlines>\n")
|
||||
xml.write(" <freemem>" + escape(repr(self.logdata.freeRAM)) + "</freemem>\n")
|
||||
xml.write(" <skippedlines>" + escape(repr(self.logdata.skippedLines)) + "</skippedlines>\n")
|
||||
xml.write("</header>\n")
|
||||
|
||||
# output parameters
|
||||
xml.write("<params>\n")
|
||||
for param, value in self.logdata.parameters.items():
|
||||
xml.write(" <param name=\"%s\" value=\"%s\" />\n" % (param,escape(`value`)))
|
||||
xml.write(" <param name=\"%s\" value=\"%s\" />\n" % (param,escape(repr(value))))
|
||||
xml.write("</params>\n")
|
||||
|
||||
# output test results
|
||||
|
@ -70,15 +70,15 @@ class TestDualGyroDrift(Test):
|
||||
|
||||
# #pylab.plot(range(0,(nSamples*sliceLength1),sliceLength1), imu1ZAverages, 'b')
|
||||
|
||||
# print("Gyro averages1X: " + `imu1XAverages`)
|
||||
# print("Gyro averages1Y: " + `imu1YAverages`)
|
||||
# print("Gyro averages1Z: " + `imu1ZAverages` + "\n")
|
||||
# print("Gyro averages2X: " + `imu2XAverages`)
|
||||
# print("Gyro averages2Y: " + `imu2YAverages`)
|
||||
# print("Gyro averages2Z: " + `imu2ZAverages` + "\n")
|
||||
# print("Gyro averages diff X: " + `imuXDiffAverages`)
|
||||
# print("Gyro averages diff Y: " + `imuYDiffAverages`)
|
||||
# print("Gyro averages diff Z: " + `imuZDiffAverages`)
|
||||
# print("Gyro averages1X: " + repr(imu1XAverages))
|
||||
# print("Gyro averages1Y: " + repr(imu1YAverages))
|
||||
# print("Gyro averages1Z: " + repr(imu1ZAverages) + "\n")
|
||||
# print("Gyro averages2X: " + repr(imu2XAverages))
|
||||
# print("Gyro averages2Y: " + repr(imu2YAverages))
|
||||
# print("Gyro averages2Z: " + repr(imu2ZAverages) + "\n")
|
||||
# print("Gyro averages diff X: " + repr(imuXDiffAverages))
|
||||
# print("Gyro averages diff Y: " + repr(imuYDiffAverages))
|
||||
# print("Gyro averages diff Z: " + repr(imuZDiffAverages))
|
||||
|
||||
# # lowpass filter using numpy
|
||||
# # cutoff = 100
|
||||
|
@ -25,8 +25,8 @@ class TestBalanceTwist(Test):
|
||||
|
||||
for i in range(8):
|
||||
for prefix in "Chan", "Ch", "C":
|
||||
if prefix+`(i+1)` in logdata.channels["RCOU"]:
|
||||
ch.append(map(lambda x: x[1], logdata.channels["RCOU"][prefix+`(i+1)`].listData))
|
||||
if prefix+repr((i+1)) in logdata.channels["RCOU"]:
|
||||
ch.append(map(lambda x: x[1], logdata.channels["RCOU"][prefix+repr((i+1))].listData))
|
||||
|
||||
ch = zip(*ch)
|
||||
num_channels = 0
|
||||
|
@ -17,17 +17,17 @@ class TestParams(Test):
|
||||
value = logdata.parameters[paramName]
|
||||
if value != expectedValue:
|
||||
self.result.status = TestResult.StatusType.FAIL
|
||||
self.result.statusMessage = self.result.statusMessage + "%s set to %s, expecting %s\n" % (paramName, `value`, `expectedValue`)
|
||||
self.result.statusMessage = self.result.statusMessage + "%s set to %s, expecting %s\n" % (paramName, repr(value), repr(expectedValue))
|
||||
def __checkParamIsLessThan(self, paramName, maxValue, logdata):
|
||||
value = logdata.parameters[paramName]
|
||||
if value >= maxValue:
|
||||
self.result.status = TestResult.StatusType.FAIL
|
||||
self.result.statusMessage = self.result.statusMessage + "%s set to %s, expecting less than %s\n" % (paramName, `value`, `maxValue`)
|
||||
self.result.statusMessage = self.result.statusMessage + "%s set to %s, expecting less than %s\n" % (paramName, repr(value), repr(maxValue))
|
||||
def __checkParamIsMoreThan(self, paramName, minValue, logdata):
|
||||
value = logdata.parameters[paramName]
|
||||
if value <= minValue:
|
||||
self.result.status = TestResult.StatusType.FAIL
|
||||
self.result.statusMessage = self.result.statusMessage + "%s set to %s, expecting less than %s\n" % (paramName, `value`, `minValue`)
|
||||
self.result.statusMessage = self.result.statusMessage + "%s set to %s, expecting less than %s\n" % (paramName, repr(value), repr(minValue))
|
||||
|
||||
|
||||
def run(self, logdata, verbose):
|
||||
|
@ -38,5 +38,5 @@ class TestVCC(Test):
|
||||
self.result.statusMessage = "VCC min/max diff %sv, should be <%sv" % (vccDiff/1000.0, vccMaxDiff/1000.0)
|
||||
elif vccMin < vccMinThreshold:
|
||||
self.result.status = TestResult.StatusType.FAIL
|
||||
self.result.statusMessage = "VCC below minimum of %sv (%sv)" % (`vccMinThreshold/1000.0`,`vccMin/1000.0`)
|
||||
self.result.statusMessage = "VCC below minimum of %sv (%sv)" % (repr(vccMinThreshold/1000.0),repr(vccMin/1000.0))
|
||||
|
||||
|
@ -45,7 +45,7 @@ class TestVibration(Test):
|
||||
# TODO: accumulate all LOITER chunks over min size, or just use the largest one?
|
||||
startLine = chunks[0][0]
|
||||
endLine = chunks[0][1]
|
||||
#print("TestVibration using LOITER chunk from lines %s to %s" % (`startLine`, `endLine`))
|
||||
#print("TestVibration using LOITER chunk from lines %s to %s" % (repr(startLine), repr(endLine)))
|
||||
|
||||
def getStdDevIMU(logdata, channelName, startLine,endLine):
|
||||
loiterData = logdata.channels["IMU"][channelName].getSegment(startLine,endLine)
|
||||
|
Loading…
Reference in New Issue
Block a user