Skip to content

Instantly share code, notes, and snippets.

@jinschoi
Created June 2, 2022 23:23
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jinschoi/8396f25a4cb7ac7986a7d881026ae950 to your computer and use it in GitHub Desktop.
Save jinschoi/8396f25a4cb7ac7986a7d881026ae950 to your computer and use it in GitHub Desktop.
Plot a histogram of Flipper raw .sub files
import re
import sys
import pandas as pd
import matplotlib.pyplot as plt
filename = sys.argv[1]
segs = []
with open(filename, 'r') as f:
for line in f:
m = re.match(r'RAW_Data:\s*([-0-9 ]+)\s*$', line)
if m:
segs.extend(abs(int(seg)) for seg in m[1].split(r' '))
series = pd.Series(segs)
# Get rid of outliers
series = series[series < 5000]
series.plot.hist(bins=100)
plt.show()
@evilpete
Copy link

@jinschoi checkout https://github.com/evilpete/flipper_toolbox/blob/main/subghz_histogram.py

it's an updated version that plots positive / negative timings separately

(I've noticed discrepancies with flipper raw FSK sampling where negative segments are shorter then they should be )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment