Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions cms50dplus/cms50dplus.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ def getDictData(self):
class RecordedDataPoint(object):
def __init__(self, time, data):
if data[0] & 0xfe != 0xf0 or data[1] & 0x80 == 0 or data[2] & 0x80 != 0:
print data
print(data)
raise ValueError("Invalid data packet.")

self.time = time
Expand Down Expand Up @@ -266,7 +266,7 @@ def getRecordedData(self, time):
m = int(s / 60)
s -= m * 60

print "Number of measurements: {0} ({1}h{2}m{3}s)".format(length / 3, h, m, s)
print("Number of measurements: {0} ({1}h{2}m{3}s)".format(length / 3, h, m, s))

# Content...
packet = [0]*3
Expand All @@ -285,11 +285,11 @@ def getRecordedData(self, time):
self.disconnect()

def dumpLiveData(port, filename):
print "Saving live data..."
print "Press CTRL-C or disconnect the device to terminate data collection."
print("Saving live data...")
print("Press CTRL-C or disconnect the device to terminate data collection.")
oximeter = CMS50Dplus(port)
measurements = 0
with open(filename, 'wb') as csvfile:
with open(filename, 'w') as csvfile:
writer = csv.writer(csvfile, quoting=csv.QUOTE_NONNUMERIC)
writer.writerow(LiveDataPoint.getCsvColumns())
for liveData in oximeter.getLiveData():
Expand All @@ -307,11 +307,11 @@ def getLiveData(port, framerate=None):


def dumpRecordedData(starttime, port, filename):
print "Saving recorded data..."
print "Please wait as the latest session is downloaded..."
print("Saving recorded data...")
print("Please wait as the latest session is downloaded...")
oximeter = CMS50Dplus(port)
measurements = 0
with open(filename, 'wb') as csvfile:
with open(filename, 'w') as csvfile:
writer = csv.writer(csvfile, quoting=csv.QUOTE_NONNUMERIC)
writer.writerow(RecordedDataPoint.getCsvColumns())
for recordedData in oximeter.getRecordedData(starttime):
Expand Down Expand Up @@ -341,7 +341,7 @@ def valid_datetime(s):
elif args.mode == 'RECORDED' and args.starttime is not None:
dumpRecordedData(args.starttime, args.serialport, args.output)
else:
print "Missing start time for RECORDED mode."
print("Missing start time for RECORDED mode.")

print ""
print "Done."
print("")
print("Done.")