https://github.com/tspspi/pyfy6900
(Unofficial) control library for the FY6900 function generator
https://github.com/tspspi/pyfy6900
functiongenerator fy6900
Last synced: 6 months ago
JSON representation
(Unofficial) control library for the FY6900 function generator
- Host: GitHub
- URL: https://github.com/tspspi/pyfy6900
- Owner: tspspi
- License: other
- Created: 2022-12-29T19:21:23.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-26T12:21:48.000Z (over 1 year ago)
- Last Synced: 2025-12-04T01:52:06.397Z (6 months ago)
- Topics: functiongenerator, fy6900
- Language: Python
- Homepage: https://www.tspi.at/2022/12/30/fy6900withoutch340.html
- Size: 204 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# (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.
# 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)
```