当前位置:网站首页>RSA306B,500,600系列API接口代码
RSA306B,500,600系列API接口代码
2022-08-04 15:11:00 【二十四桥_】
获取资料,下图是代码文件截图。
部分示例代码:
"""################SPECTRUM EXAMPLE################"""
def config_spectrum(cf=1e9, refLevel=0, span=40e6, rbw=300e3):
rsa.SPECTRUM_SetEnable(c_bool(True))
rsa.CONFIG_SetCenterFreq(c_double(cf))
rsa.CONFIG_SetReferenceLevel(c_double(refLevel))
rsa.SPECTRUM_SetDefault()
specSet = Spectrum_Settings()
rsa.SPECTRUM_GetSettings(byref(specSet))
specSet.window = SpectrumWindows.SpectrumWindow_Kaiser
specSet.verticalUnit = SpectrumVerticalUnits.SpectrumVerticalUnit_dBm
specSet.span = span
specSet.rbw = rbw
rsa.SPECTRUM_SetSettings(specSet)
rsa.SPECTRUM_GetSettings(byref(specSet))
return specSet
def create_frequency_array(specSet):
# Create array of frequency data for plotting the spectrum.
freq = np.arange(specSet.actualStartFreq, specSet.actualStartFreq
+ specSet.actualFreqStepSize * specSet.traceLength,
specSet.actualFreqStepSize)
return freq
def acquire_spectrum(specSet):
ready = c_bool(False)
traceArray = c_float * specSet.traceLength
traceData = traceArray()
outTracePoints = c_int(0)
traceSelector = SpectrumTraces.SpectrumTrace1
rsa.DEVICE_Run()
rsa.SPECTRUM_AcquireTrace()
while not ready.value:
rsa.SPECTRUM_WaitForDataReady(c_int(100), byref(ready))
rsa.SPECTRUM_GetTrace(traceSelector, specSet.traceLength, byref(traceData),
byref(outTracePoints))
rsa.DEVICE_Stop()
return np.array(traceData)
def spectrum_example():
print('\n\n########Spectrum Example########')
search_connect()
cf = 2.4453e9
refLevel = -30
span = 40e6
rbw = 10e3
specSet = config_spectrum(cf, refLevel, span, rbw)
trace = acquire_spectrum(specSet)
freq = create_frequency_array(specSet)
peakPower, peakFreq = peak_power_detector(freq, trace)
plt.figure(1, figsize=(15, 10))
ax = plt.subplot(111, facecolor='k')
ax.plot(freq, trace, color='y')
ax.set_title('Spectrum Trace')
ax.set_xlabel('Frequency (Hz)')
ax.set_ylabel('Amplitude (dBm)')
ax.axvline(peakFreq)
ax.text((freq[0] + specSet.span / 20), peakPower,
'Peak power in spectrum: {:.2f} dBm @ {} MHz'.format(
peakPower, peakFreq / 1e6), color='white')
ax.set_xlim([freq[0], freq[-1]])
ax.set_ylim([refLevel - 100, refLevel])
plt.tight_layout()
plt.show()
rsa.DEVICE_Disconnect()
边栏推荐
- Legal education combined with VR panorama, intuitively feel and learn the spirit of the rule of law
- This week to discuss the user experience: Daedalus Nemo to join Ambire, explore the encryption of the ocean
- leetcode:212. 单词搜索 II
- C# SolidWorks二次开发---工程图简单版标注孔信息
- Nuget 通过 dotnet 命令行发布
- Win10无法访问移动硬盘怎么解决
- 卖家寄卖流程梳理
- leetcode:259. 较小的三数之和
- Byte、Short、Integer、Long内部缓存类的对比与源码分析
- 1401 - Web technology 】 【 introduction to graphical Canvas
猜你喜欢
MySQL优化学习笔记
基本介绍PLSQL
Find My Technology | Prevent your pet from getting lost, Apple Find My technology can help you
推荐一个鸿蒙即时通讯软件《果聊》
从-99打造Sentinel高可用集群限流中间件
Cisco - Small Network Topology (DNS, DHCP, Web Server, Wireless Router)
微软表示将向内部网络安全专家共享数据 为企业提供更安全保护
FTP协议抓包-工具wireshark与filezilla
直播回放含 PPT 下载|基于 Flink & DeepRec 构建 Online Deep Learning
普法教育结合VR全景,直观感受和学习法治精神
随机推荐
C# 谁改了我的代码
16、学习MySQL 正则表达式
从-99打造Sentinel高可用集群限流中间件
Hangzhou electric the competition team arrangement (ACM)
Nuget 通过 dotnet 命令行发布
【北亚数据恢复】IBM System Storage存储lvm信息丢失,卷访问不了的数据恢复方案
QT笔记——Q_INVOKABLE了解
【Harmony OS】【FAQ】Hongmeng Questions Collection 2
Codeforces Round #811 A~F
leetcode: 241. Designing precedence for arithmetic expressions
基于 Next.js实现在线Excel
C语言写简单三子棋
卖家寄卖流程梳理
Android Sqlite3 basic commands
AOSP内置APP特许权限白名单
Hangzhou Electric School Competition (Counter Attack Index)
I love Tanabata hahaha
【历史上的今天】8 月 4 日:第一位图灵奖女性得主;NVIDIA 收购 MediaQ;首届网络安全挑战大赛完成
Redis-主从复制
leetcode:254. 因子的组合