# (Unofficial) control library for the FY6900 function generator
This is a small and simple control library for the FY6900 function generator. It's
a implementation for the [pylabdevs](https://github.com/tspspi/pylabdevs) ```FunctionGenerator```
class.
# Example usage
## Simple setting of predefined waveforms and parameters
```
import numpy as np
from pyfy6900 import fy6900
from labdevices.functiongenerator import FunctionGeneratorWaveform
from time import sleep
with fy6900.FY6900Serial("COM4", debug = True) as fg:
print(f"Device identifies as {fg.identify()}")
fg.set_channel_enabled(0, False)
fg.set_channel_enabled(1, False)
fg.set_channel_waveform(0, FunctionGeneratorWaveform.SINE)
fg.set_channel_frequency(0, 1e3)
fg.set_channel_offset(0, 2.5)
fg.set_channel_amplitude(0, 5)
fg.set_channel_enabled(0, True)
for frq in np.arange(1, 60e6, 100):
fg.set_channel_frequency(0, frq)
print(f"Set new frequency {fg.get_channel_frequency(0)}")
fg.set_channel_enabled(0, False)
```
## Uploading arbitrary waveform generated using numpy
```
import numpy as np
import matplotlib.pyplot as plt
from pyfy6900 import fy6900
from time import sleep
with fy6900.FY6900Serial("COM3", debug = "True") as fg:
fg.identify()
t = np.linspace(0, 2 * np.pi, 8192)
wv = (np.sin(t) + np.sin(2*t) + np.sin(3*t))
# Display before upload
plt.plot(t, wv)
plt.show()
# Uploading
fg.upload_waveform(61, wv, normalize = True)
# Selecting channel waveform
fg.set_channel_waveform(0, arbitrary = 61)
```
Raw data
{
"_id": null,
"home_page": "https://github.com/tspspi/pyfy6900",
"name": "pyfy6900-tspspi",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "Thomas Spielauer",
"author_email": "pypipackages01@tspi.at",
"download_url": "https://files.pythonhosted.org/packages/7d/a8/6952325cce378d9096aab0580f0a53cdad793278105615acda530aee6171/pyfy6900-tspspi-0.0.1a1.tar.gz",
"platform": null,
"description": "# (Unofficial) control library for the FY6900 function generator\n\nThis is a small and simple control library for the FY6900 function generator. It's\na implementation for the [pylabdevs](https://github.com/tspspi/pylabdevs) ```FunctionGenerator```\nclass.\n\n# Example usage\n\n## Simple setting of predefined waveforms and parameters\n\n```\nimport numpy as np\n\nfrom pyfy6900 import fy6900\nfrom labdevices.functiongenerator import FunctionGeneratorWaveform\nfrom time import sleep\n\nwith fy6900.FY6900Serial(\"COM4\", debug = True) as fg:\n\tprint(f\"Device identifies as {fg.identify()}\")\n\n\tfg.set_channel_enabled(0, False)\n\tfg.set_channel_enabled(1, False)\n\n\tfg.set_channel_waveform(0, FunctionGeneratorWaveform.SINE)\n\tfg.set_channel_frequency(0, 1e3)\n\tfg.set_channel_offset(0, 2.5)\n\tfg.set_channel_amplitude(0, 5)\n\tfg.set_channel_enabled(0, True)\n\n\tfor frq in np.arange(1, 60e6, 100):\n\t\tfg.set_channel_frequency(0, frq)\n\t\tprint(f\"Set new frequency {fg.get_channel_frequency(0)}\")\n\n\tfg.set_channel_enabled(0, False)\n```\n\n## Uploading arbitrary waveform generated using numpy\n\n```\nimport numpy as np\nimport matplotlib.pyplot as plt\n\nfrom pyfy6900 import fy6900\n\nfrom time import sleep\n\nwith fy6900.FY6900Serial(\"COM3\", debug = \"True\") as fg:\n\tfg.identify()\n\n\tt = np.linspace(0, 2 * np.pi, 8192)\n\twv = (np.sin(t) + np.sin(2*t) + np.sin(3*t))\n\n\t# Display before upload\n\tplt.plot(t, wv)\n\tplt.show()\n\n\t# Uploading\n\tfg.upload_waveform(61, wv, normalize = True)\n\n\t# Selecting channel waveform\n\tfg.set_channel_waveform(0, arbitrary = 61)\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "(Unofficial) control library for the FY6900 function generator",
"version": "0.0.1a1",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "66939cbfe9374db243d9eda40958858e",
"sha256": "7ce2f2f9eb8765cb7f42f438cd0631c9384594bb910a2973e7109f673339d7e6"
},
"downloads": -1,
"filename": "pyfy6900_tspspi-0.0.1a1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "66939cbfe9374db243d9eda40958858e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7198,
"upload_time": "2022-12-30T21:41:57",
"upload_time_iso_8601": "2022-12-30T21:41:57.749460Z",
"url": "https://files.pythonhosted.org/packages/b3/00/f2347c17e9fec57235d5de3eee29cc38c00cacd3433f9fb8255d43a9a0b3/pyfy6900_tspspi-0.0.1a1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "0112e88d21490b1b889fa006e7d53ff3",
"sha256": "dd69abd00fd52cef30c8e3097bb5feac4bfc59c55049ee67cab8279c5b5f6cd0"
},
"downloads": -1,
"filename": "pyfy6900-tspspi-0.0.1a1.tar.gz",
"has_sig": false,
"md5_digest": "0112e88d21490b1b889fa006e7d53ff3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7357,
"upload_time": "2022-12-30T21:41:59",
"upload_time_iso_8601": "2022-12-30T21:41:59.893695Z",
"url": "https://files.pythonhosted.org/packages/7d/a8/6952325cce378d9096aab0580f0a53cdad793278105615acda530aee6171/pyfy6900-tspspi-0.0.1a1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-30 21:41:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "tspspi",
"github_project": "pyfy6900",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyfy6900-tspspi"
}