<jupyter_start><jupyter_text>`python-mhs5200`Python module for controlling inexpensive MHS5200 signal generators.The MHS5200 are an family of DDS signal generators that have 16 arbitrary wave functions. However, the software is for Windows and not especially good (giant Labview compiled program with lots of issues).Developed using the [KKmoon High Precision Digital DDS Dual-channel Signal Source Generator Arbitrary Waveform Frequency Meter 200MSa/s 25MHz.](http://www.amznly.com/3nz).  Installation```pip install git+https://github.com/jed-frey/python_mhs5200.gitegg=mhs5200```  Useage Examples:<jupyter_code>from mhs5200 import MHS5200
import mhs5200.enums as WAVE
signal_gen = MHS5200(port="/dev/ttyUSB0")<jupyter_output><empty_output><jupyter_text>Disable Generator Output<jupyter_code>signal_gen.off()<jupyter_output><empty_output><jupyter_text>Enable Generator Output<jupyter_code>signal_gen.on()<jupyter_output><empty_output><jupyter_text>Save settings to a memory slot.<jupyter_code>signal_gen.save(1)<jupyter_output><empty_output><jupyter_text>Load settings from a memory slot.<jupyter_code>signal_gen.load(1)<jupyter_output><empty_output><jupyter_text>Channels:<jupyter_code>signal_gen.chan1 == signal_gen.channels[0]
signal_gen.chan2 == signal_gen.channels[1]
chan1 = signal_gen.channels[0]

chan1.frequency = 1 # Hz
chan1.amplitude = 10 # V-pp
chan1.offset = 0 # V
chan1.wave = WAVE.SINE

chan2 = signal_gen.chan2
chan2.frequency = 2 # Hz
chan2.amplitude = 5 # V-pp
chan2.offset = 2.5 # V
chan2.wave = WAVE.SQUARE<jupyter_output><empty_output><jupyter_text>Save default settings for power on. The above code block sets the power on settings.<jupyter_code>signal_gen.save(0)
signal_gen.save()<jupyter_output><empty_output><jupyter_text>Read Channels<jupyter_code>for channel in signal_gen.channels:
    print(f"{channel.frequency}Hz, {channel.amplitude}V")
signal_gen.off()<jupyter_output><empty_output><jupyter_text>Twinkle Twinkle Little Star<jupyter_code>from mhs5200.utils import songs, play_song
play_song(signal_gen, songs["twinkle"])<jupyter_output><empty_output><jupyter_text>TestsMultiple tests are included, TODO close loop with oscilloscope.<jupyter_code>!pytest --port=/dev/ttyUSB0<jupyter_output>[1m============================= test session starts ==============================[0m
platform linux -- Python 3.8.0, pytest-5.3.2, py-1.8.1, pluggy-0.13.1
rootdir: /projects/OSH-HIL/components/python_mhs5200, inifile: setup.cfg
plugins: metadata-1.8.0, csv-2.0.2, html-2.0.1
collected 72 items                                                             [0m

tests/test_amplitude.py [32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m.[0m[32m [ 66%]
[0m[32m                                                                         [ 66%][0m
tests/test_both_ch[...]
{'fraction_non_alphanumeric': 0.18401486988847585, 'fraction_numerical': 0.0811648079306072, 'mean_word_length': 5.483935742971887, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 40, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '451986', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 1512, 'n_tokens_neox': 1280, 'n_words': 179, 'path': 'README.ipynb', 'repo_name': 'jed-frey/python-mhs5200a', 'size': '3228'}