Last active
January 20, 2019 09:46
-
-
Save naoki-mizuno/3ebd941aef559dba65727a2921e8089b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import numpy as np | |
import pandas as pd | |
import matplotlib.pyplot as plt | |
import seaborn as sns | |
sns.set(style='darkgrid') | |
import os.path | |
import sys | |
def main(): | |
# Read in relevant data | |
df_tmp = pd.read_csv(sys.argv[1], header=None) | |
# print(df_tmp) | |
df = pd.DataFrame({ | |
'time': df_tmp[0].apply(lambda s: s.split()[0]), | |
'msg': df_tmp[0].apply(lambda s: ' '.join(s.split()[-2:])), | |
'size': df_tmp[1].apply(lambda s: s.split()[1]) | |
}, columns=['time', 'msg', 'size']) | |
df['time'] = pd.to_datetime(df['time']) | |
# print(df) | |
# Filter out messages other than RXM-RAWX | |
ubx = df[df['msg'] == 'UBX RXM-RAWX'] | |
# print(ubx) | |
# Get counts | |
counts = ubx['time'].value_counts().sort_index() | |
# print(counts) | |
# Make plot | |
plt.plot(counts) | |
fname = os.path.basename(sys.argv[1]) | |
plt.title('Number of messages for every second in ' + fname) | |
plt.xlabel('Time') | |
plt.ylabel('Rate (Hz)') | |
plt.show() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment