<jupyter_start><jupyter_text>Template Example  Minimal example contents for new device.  `device_name` and `device_class` should be replaced with actual device references.  To use, all cells below can be retained and made active and this one deleted.  Any further comments that can be deleted are prefixed with `Template Note:`  Device Name  Description Text - some background, ok to copy from datasheet description  Manufacturer link:  Breakout board used: (delete if not used)<jupyter_code>import matplotlib.pyplot as plt

from meerkat.device_name import device_class
from meerkat import base, parser, tools<jupyter_output><empty_output><jupyter_text>Select I2C bus and instance device class.  Note I2C bus is 1 on Raspberry Pi.<jupyter_code>dev = ExampleDevice(bus_n=1)<jupyter_output><empty_output><jupyter_text>Template Note: if there is a verbose setting, consider enabling it<jupyter_code>dev.verbose = True<jupyter_output><empty_output><jupyter_text>Template Note: If the device has registers, show an example of using them if not skip.  A filler binary value is used below.  Configuration  See bprint_example.ipynb for details on bprint output.<jupyter_code>tools.bprint(0b00110011)<jupyter_output><empty_output><jupyter_text>Measurements<jupyter_code># device specific measurement results, i.e.
dev.get_voltage()
# get method, list with description and sample number
dev.get(description='test_1', n=5)
# writer method with description and sample number
dev.write(description='test_2', n=5)<jupyter_output><empty_output><jupyter_text>CSV Writer Output<jupyter_code>dev.writer.path
# load .csv data written with dev.write
m, df = parser.csv_resource(dev.writer.path)
df.head()
# plot if possible, based on output values
# note this timestamp fix might be patched at some point.
df.datetime64_ns = df.datetime64_ns.dt.tz_localize('UTC')  # Pandas 0.24.1 hack
df[["datetime64_ns", "voltage", "current"]].plot(x="datetime64_ns");
# metadata for device
m<jupyter_output><empty_output><jupyter_text>JSON Writer Output<jupyter_code># reinitialize to JSON output
dev = ExampleDevice(bus_n=1, output='json')
# writing method with description and sample number
dev.write(description='test_4', n=5)
# show first lines of JSON text file
with open(dev.writer.path, 'r') as f:
    print(f.readline())<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.08903225806451613, 'fraction_numerical': 0.013763440860215054, 'mean_word_length': 6.651315789473684, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '340941', 'license': 'MIT', 'n_tokens_mistral': 741, 'n_tokens_neox': 719, 'n_words': 232, 'path': 'notebooks/template_example.ipynb', 'repo_name': 'crdietrich/meerkat', 'size': '2325'}