I've got a log that looks like this:
**  Wed; Feb 20 2019 at 12:38:10:734 PM : ** **  GnssLocationListener; \- 41** \- onSatelliteStatusChanged() : fixCount = 7
**  Wed; Feb 20 2019 at 12:38:12:742 PM : ** **  GnssLocationListener; \- 41** \- onSatelliteStatusChanged() : fixCount = 7
**  Wed; Feb 20 2019 at 12:38:14:721 PM : ** **  GnssLocationListener; \- 41** \- onSatelliteStatusChanged() : fixCount = 7
**  Wed; Feb 20 2019 at 12:38:16:777 PM : ** **  GnssLocationListener; \- 41** \- onSatelliteStatusChanged() : fixCount = 7
**  Wed; Feb 20 2019 at 12:38:18:729 PM : ** **  GnssLocationListener; \- 41** \- onSatelliteStatusChanged() : fixCount = 7
**  Wed; Feb 20 2019 at 12:38:20:700 PM : ** **  GnssLocationListener; \- 41** \- onSatelliteStatusChanged() : fixCount = 7
**  Wed; Feb 20 2019 at 12:38:22:697 PM : ** **  GnssLocationListener; \- 41** \- onSatelliteStatusChanged() : fixCount = 7
**  Wed; Feb 20 2019 at 12:38:24:706 PM : ** **  GnssLocationListener; \- 41** \- onSatelliteStatusChanged() : fixCount = 7
**  Wed; Feb 20 2019 at 12:38:26:783 PM : ** **  GnssLocationListener; \- 41** \- onSatelliteStatusChanged() : fixCount = 7
I'm trying to get the following data from this:
12:38:10 PM , 7
12:38:12 PM , 7
12:38:14 PM , 7
12:38:16 PM , 7
12:38:18 PM , 7
...
And I'm trying to do this with what I know in Python...Which is pretty rudimentary.
import matplotlib.pyplot as plt
import matplotlib.dates as md
import numpy as np
import datetime as dt
import time
import csv
data = []
datafile = open('fix_count_02-20-2019-day.txt' , 'r')
datareader = csv.reader((x.replace('\0','') for x in datafile), delimiter=':')
for row in datareader:
data.append(row)
np_data = np.asarray(data)
print(np_data)
plt.subplots_adjust(bottom=0.2)
plt.xticks( rotation=25 )
ax=plt.gca()
#xfmt = md.DateFormatter('%H:%M:%S')
#ax.xaxis.set_major_formatter(xfmt)
plt.plot(np_data)
plt.show()
I've tried some gymnastics with split
and join
, but this didn't really work out for me...I ultimately want to plot this similar to this question, probably (I'm guessing) with a numpy array :