def save(self): print "saving summary of '" + self.getName() + "'..." summaryDir = self.getSummaryDir() if os.path.isdir(summaryDir): shutil.rmtree(summaryDir, True, False) mkdirRec(summaryDir) dataFile = DataFile() filename = "" for worldType in AVAILABLE_WORLDS: print "-- saving data of '" + worldType + "'" worldDir = os.path.join(summaryDir,worldType) mkdirRec(worldDir) for robotCount in AVAILABLE_ROBOT_COUNTS: if self.meanCoverageEvents_[worldType][robotCount].hasData(): filename = self.getSaveFilename(worldDir, COVERAGE_EVENTS_FILE, robotCount) dataFile.reset() dataFile.addComment("# [coverage meanTimestamp(usec)]") data = self.meanCoverageEvents_[worldType][robotCount].getMean() dataFile.setDataAs(data[:2], "fl") dataFile.save(filename) if self.meanTimeEvents_[worldType][robotCount].hasData(): filename = self.getSaveFilename(worldDir, TIME_EVENTS_FILE, robotCount) dataFile.reset() dataFile.addComment("# [coverage meanTimestamp(usec)]") data = self.meanTimeEvents_[worldType][robotCount].getMean() dataFile.setDataAs(data[:2], "fl") dataFile.save(filename) if self.meanTileTimeBetweenVisits_[worldType][robotCount].hasData(): filename = self.getSaveFilename(worldDir, MEAN_TILE_TIME_BEWTEEN_VISITS_FILE, robotCount) dataFile.reset() dataFile.addComment("# [x y meanTimeBetweenVisits(usec)]") data = self.meanTileTimeBetweenVisits_[worldType][robotCount].getMeanGrid() dataFile.setDataAs(data[:3], "iil") dataFile.save(filename) if self.meanTileVisits_[worldType][robotCount].hasData(): filename = self.getSaveFilename(worldDir, TILE_VISITS_FILE, robotCount) dataFile.reset() dataFile.addComment("# [x y meanVisitCount]") data = self.meanTileVisits_[worldType][robotCount].getMeanGrid() dataFile.setDataAs(data[:3], "iif") dataFile.save(filename) if self.meanFinalCoverage_[worldType][robotCount].hasData(): filename = self.getSaveFilename(worldDir, FINAL_COVERAGE_FILE, robotCount) dataFile.reset() dataFile.addComment("# [coverage timeStamp(usec)]") data = self.meanFinalCoverage_[worldType][robotCount].getMean() dataFile.setDataAs(data[:2], "fl") dataFile.save(filename)