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
| # The elves have bolted two tiny monochrome status panels onto the front of | |
| # Santa’s workshop router — one stacked above the other — to show diagnostics | |
| # during sleigh-season load spikes. | |
| # Unfortunately, the firmware team “optimized” everything into raw I2C traffic | |
| # logs, and now the only way to see what the panels displayed is to replay the | |
| # messages and reconstruct the pixels yourself. | |
| # You’re given a transcript of I2C messages sent to both screens. |
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
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| from scipy import signal | |
| # Source: https://github.com/guillaume-chevalier/filtering-stft-and-laplace-transform | |
| def butter_lowpass_filter(data, cutoff_freq, sampling_freq, order=4): | |
| nyq_freq = 0.5 * sampling_freq | |
| normal_cutoff = float(cutoff_freq) / nyq_freq | |
| b, a = signal.butter(order, normal_cutoff, btype='lowpass') |