<jupyter_start><jupyter_text>Analysis of microbit motion sensor dataThis Jupyter notebook shows how to analyse BBC micro:bit motion sensor data saved into a csv text file. I generated this data by fastening one microbit to my kettle as the water heated up then boiled. That microbit ran my logging program `microbit-logger.py` in `'tx'` mode to transmit csv data by radio. The data was received by a second microbit, which was connected to my computer via USB. This microbit ran `microbit-logger.py` in `'relay'` mode. Finally my computer ran `usb-receiver.py` redirecting output to the text file `data-kettle.csv`:   ```$ python usb-receiver.py > data-kettle.csv``` The text file can be loaded most easily using `pandas`.<jupyter_code>%matplotlib inline
import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
df = pd.read_csv('data-kettle.csv')
df['Time'] /= 1000.0    # Convert from ms (int) to sec (float)
df.set_index('Time', inplace=True)
df.info()
accXYZ = df[['AccX','AccY','AccZ']]
accXYZ.plot()
accXYZ = df[['AccX','AccY','AccZ']]
g = accXYZ[50.0:200.0].mean()
g
s = (accXYZ - g).pow(2).sum(axis=1)
s.plot()
plt.specgram(s, NFFT=512, Fs=100, noverlap=32)[3]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1255161023947151, 'fraction_numerical': 0.018992568125516102, 'mean_word_length': 5.183673469387755, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '450276', 'license': 'MIT', 'n_tokens_mistral': 438, 'n_tokens_neox': 413, 'n_words': 146, 'path': 'example-1-vibrating-kettle.ipynb', 'repo_name': 'stevesimmons/pyconuk-motion-sensor-data-fusion', 'size': '1211'}