当前位置:网站首页>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()

边栏推荐
- 16. Learn MySQL Regular Expressions
- 从-99打造Sentinel高可用集群限流中间件
- Roslyn 节点的 Span 和 FullSpan 有什么区别
- JCMsuite Application: Oblique Plane Wave Propagation Transmission Through Aperture
- 小程序|炎炎夏日、清爽一夏、头像大换装
- Compound Refractive Lenses for X-ray Focusing
- 明明加了唯一索引,为什么还是产生重复数据?
- leetcode:259. 较小的三数之和
- 直播系统开发——直播间架构的设计及难点分析
- leetcode:255 验证前序遍历序列二叉搜索树
猜你喜欢

24、shell编程-流程控制

JCMsuite Application: Oblique Plane Wave Propagation Transmission Through Aperture

【Web技术】1401- 图解 Canvas 入门

基本介绍PLSQL

我在羊毛和二手群里报复性消费

杭电校赛(逆袭指数)

Technology sharing | Description of the electronic fence function in the integrated dispatching system

用于X射线聚焦的复合折射透镜

QT笔记——Q_INVOKABLE了解

FRED应用:毛细管电泳系统
随机推荐
苏秋贵:揭秘绿联科技用5年时间从0做到6亿,如何一枝独秀?
leetcode:212. 单词搜索 II
leetcode:241. 为运算表达式设计优先级
浅谈一下跨端技术方案
Oracle 数据库用户创建、重启、导入导出
Legal education combined with VR panorama, intuitively feel and learn the spirit of the rule of law
Why, when you added a unique index or create duplicate data?
vim common operation commands
##ansible自动化运维架构与简介
C# 将dll打包到程序中
小程序|炎炎夏日、清爽一夏、头像大换装
洛谷题解P1028 数的计算
Win10无法访问移动硬盘怎么解决
【Web技术】1401- 图解 Canvas 入门
Byte、Short、Integer、Long内部缓存类的对比与源码分析
Leetcode: 215 disorderly to find the first big k element in the array
Technology sharing | Description of the electronic fence function in the integrated dispatching system
多线程编程之优先级翻转问题
I love Tanabata hahaha
leetcode:250. 统计同值子树