# (Unofficial) control library for the FY6900 function generator
![FY6900 front panel](https://raw.githubusercontent.com/tspspi/pyfy6900/master/doc/fy6900frontside.jpg)
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.
# Installation
```
pip install pyfy6900-tspspi
```
# 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": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Thomas Spielauer",
"author_email": "pypipackages01@tspi.at",
"download_url": "https://files.pythonhosted.org/packages/ae/5a/a830c1e94d60c2a9b5b5fc184747f4b2e702a82e3f860666a88d636dcf46/pyfy6900_tspspi-0.0.1a2.tar.gz",
"platform": null,
"description": "# (Unofficial) control library for the FY6900 function generator\n\n![FY6900 front panel](https://raw.githubusercontent.com/tspspi/pyfy6900/master/doc/fy6900frontside.jpg)\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# Installation\n\n```\npip install pyfy6900-tspspi\n```\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": null,
"summary": "(Unofficial) control library for the FY6900 function generator",
"version": "0.0.1a2",
"project_urls": {
"Homepage": "https://github.com/tspspi/pyfy6900"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "aa9c284e0529a6179ace20a194a23e63796232ce5ac50ca3bdc1de12f4b62d87",
"md5": "5e2e60ab26421d1bec3846b2cac248a1",
"sha256": "00bdd8756b1488caeb4cc392a718cc76ae54087492941ad2a774d93b6bcf7584"
},
"downloads": -1,
"filename": "pyfy6900_tspspi-0.0.1a2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5e2e60ab26421d1bec3846b2cac248a1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7289,
"upload_time": "2024-11-27T11:26:53",
"upload_time_iso_8601": "2024-11-27T11:26:53.761951Z",
"url": "https://files.pythonhosted.org/packages/aa/9c/284e0529a6179ace20a194a23e63796232ce5ac50ca3bdc1de12f4b62d87/pyfy6900_tspspi-0.0.1a2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ae5aa830c1e94d60c2a9b5b5fc184747f4b2e702a82e3f860666a88d636dcf46",
"md5": "bbf8e73974d3862b9aded12baba16df5",
"sha256": "dada55241a87d6c79d260c98726cd1c0d0ec21710325f10284356b676af83016"
},
"downloads": -1,
"filename": "pyfy6900_tspspi-0.0.1a2.tar.gz",
"has_sig": false,
"md5_digest": "bbf8e73974d3862b9aded12baba16df5",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 7527,
"upload_time": "2024-11-27T11:26:56",
"upload_time_iso_8601": "2024-11-27T11:26:56.317844Z",
"url": "https://files.pythonhosted.org/packages/ae/5a/a830c1e94d60c2a9b5b5fc184747f4b2e702a82e3f860666a88d636dcf46/pyfy6900_tspspi-0.0.1a2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-27 11:26:56",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tspspi",
"github_project": "pyfy6900",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "pylabdevs-tspspi",
"specs": [
[
">=",
"0.0.5"
]
]
},
{
"name": "pyserial",
"specs": [
[
">=",
"3.5"
]
]
}
],
"lcname": "pyfy6900-tspspi"
}