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

边栏推荐
猜你喜欢

This week to discuss the user experience: Daedalus Nemo to join Ambire, explore the encryption of the ocean

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

leetcode:254. 因子的组合

Cisco-小型网络拓扑(DNS、DHCP、网站服务器、无线路由器)

Redis-主从复制

Hangzhou Electric School Competition (Counter Attack Index)

Cisco - Small Network Topology (DNS, DHCP, Web Server, Wireless Router)

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

leetcode: 254. Combinations of factors

FRED Application: Capillary Electrophoresis System
随机推荐
特殊品种的二次开户验资金额
JCMsuite应用:倾斜平面波传播透过光阑的传输
C# 判断文件编码
饿了么智能头盔专利获授权,进一步提升骑手安全保障
Android Sqlite3基本命令
FRED应用:毛细管电泳系统
Roslyn 通过 nuget 统一管理信息
leetcode:241. 为运算表达式设计优先级
Legal education combined with VR panorama, intuitively feel and learn the spirit of the rule of law
基于 Next.js实现在线Excel
eNSP-小型网络拓扑(DNS、DHCP、网站服务器、无线路由器)
ping的原理
《分布式云最佳实践》分论坛,8月11日深圳见
游戏网络 UDP+FEC+KCP
leetcode:255 验证前序遍历序列二叉搜索树
24、shell编程-流程控制
Codeforces Round #811 A~F
OAID是什么
1401 - Web technology 】 【 introduction to graphical Canvas
Next -20- 使用自定义样式 (custom style)