- Added distinct card information to PerSetTracking.py

This commit is contained in:
Sol
2013-01-04 16:33:14 +00:00
parent decf8b38cf
commit 3856a8d23d

View File

@@ -72,6 +72,8 @@ print("Comparing datasets and outputting results.")
totalData = {} totalData = {}
currentMissing = [] currentMissing = []
currentImplemented = [] currentImplemented = []
allMissing = set()
allImplemented = set()
total = 0 total = 0
percentage = 0 percentage = 0
for currentSet in setCodes : for currentSet in setCodes :
@@ -111,6 +113,8 @@ for currentSet in setCodes :
output.write("Total: " + str(total) + "\n") output.write("Total: " + str(total) + "\n")
output.write("Percentage implemented: " + str(round(percentage,2)) + "%\n") output.write("Percentage implemented: " + str(round(percentage,2)) + "%\n")
totalData[currentSet] = (len(currentImplemented),len(currentMissing),total,percentage) totalData[currentSet] = (len(currentImplemented),len(currentMissing),total,percentage)
allMissing |= set(currentMissing)
allImplemented |= set(currentImplemented)
del currentMissing[:] del currentMissing[:]
del currentImplemented[:] del currentImplemented[:]
@@ -132,4 +136,26 @@ with open(sys.path[0] + os.sep + "PerSetTrackingResults" + os.sep + "CompleteSta
statsfile.write("\n") statsfile.write("\n")
statsfile.write("Total over all sets: " + str(totalImplemented) + " (" + str(totalMissing) + ") / " + str(fullTotal)) statsfile.write("Total over all sets: " + str(totalImplemented) + " (" + str(totalMissing) + ") / " + str(fullTotal))
# Add another file that will print out distinct cards implemented/missing
# Convert back to lists so they can be sorted
impCount = len(allImplemented)
misCount = len(allMissing)
#implemented = list(allImplemented)
#implemented.sort()
missing = list(allMissing)
missing.sort()
totalCount = impCount+misCount
with open(sys.path[0] + os.sep + "PerSetTrackingResults" + os.sep + "DistinctStats.txt", "w") as distinctfile:
distinctfile.write("Distinct: Implemented (Missing) / Total = Percentage Implemented\n")
distinctfile.write("%d (%d) / %d = %.2f %%\n" % (impCount, misCount, totalCount, float(impCount)/totalCount*100))
# Currently only print missing cards, implemented cards are less important
#distinctfile.write("\nImplemented (%d):" % impCount)
#for s in implemented:
# distinctfile.write("\n%s" % s)
distinctfile.write("\nMissing (%d):" % misCount)
for s in missing:
distinctfile.write("\n%s" % s)
print "Done!" print "Done!"