Construction of visible light positioning model
Project description
vlppy 库
介绍
- start date: 2022-08-26
- auther: yangwuju
- url:https://gitee.com/yangwuju/vlppy.git
- description: Quickly build visible light localization models.
安装教程
python -m pip install vlppy
软件架构
- model/room:房间、墙壁参数
- model/led:led位置、发射的信号(None、DC、AC、AIM)
- model/pd:pd 各种参数、LOS链路和NLOS链路接收LED信号、噪声
- model/pd2: 在原有的基础上增加了pd的角度特征
- signal/filter:滤波器设计(包括fir,iir)
- signal/plot:绘制波形图
- demo/vlp_model:可见光定位模型
- demo/demo_main:可见光定位测试例程
- demo/demo_filter:滤波器测试例程
- io/io:数据保存与加载
- setting/json_setting:加载json配置文件
- error/error:VLP常见异常
- vis/vis:可视化绘图
- tools/decorator:VLP可能用到的装饰器
例程
1.滤波器例程
from vlppy import demo
demo.demo_filter.main()
2.可见光定位例程
from vlppy import demo
demo.demo_main.main()
demo.demo_main.test_func()
使用教程
1. 模型参数定义
- 新建一个 settings.json 文件
- 在 settings.json 文件添加模型参数
{
"Room": {
"size":{
...
}, // 房间尺寸
"wall":{
...
} // 反射墙壁
}, // 房间
"PD":{
"PD1":{
...
},
"PD2":{
...
}
}, // 光电探测器
"LED": {
"LED1": {
...
}
} // 发光二极管
}
- 加载模型参数
from vlppy.setting import Settings
Args = Settings('settings.json') # 模型参数包含在字典 Args.items 中
2. 搭建模型
新建一个模型类 VLP_Model
import numpy as np
import matplotlib.pyplot as plt
from vlppy.model import LED,PD,Room
from vlppy.signal import filter,plot
class VLP_Model:
def __init__(self, *args, **kwargs):
"""初始化模型
"""
self.room = Room(...)
self.pd = PD(...)
self.led = LED(...)
def get_data(self):
"""计算PD接收LED功率
"""
P_PD = self.pd.recv_led_signal(led=self.led, room=self.room)
X, Y, Z = self.room.get_tp_pos(fmt='c')
return (P_PD, X, Y, Z)
def show(self,z,savepath=...,showfig=True):
"""绘图
z: 功率数据
savepath: 保存路径
showfig: 是否显示
"""
xr, yr, _ = self.room.get_tp_grid()
z = np.reshape(z, xr.shape)
ax = plt.axes(projection='3d')
ax.plot_surface(xr, yr, z, cmap='viridis', edgecolor='none')
ax.set_xlabel('X')
ax.set_ylabel('Y')
ax.set_zlabel('Z')
if savepath != ...:
plt.savefig(savepath)
if showfig:
plt.show()
3. 加载模型
def main():
cm = VLP_Model(**Args.items)
(P,X,Y,Z) = cm.get_data()
# 绘图
cm.show(P)
4. 保存数据
from vlppy.io import IO
# 保存文件路径
filepath = ...
data = {
"P": P,
"X": X,
"Y": Y,
"Z": Z
}
# 保存数据
io = IO()
io.save_excel(filepath, data)
5. 查看数据
from vlppy.io import IO
# 文件路径
filepath = ...
# 加载数据
io = IO()
data = io.load_excel(filepath)
# 查看数据形状
print(data.shape)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
vlppy-0.1.15.tar.gz
(34.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
vlppy-0.1.15-py3-none-any.whl
(48.7 kB
view details)
File details
Details for the file vlppy-0.1.15.tar.gz.
File metadata
- Download URL: vlppy-0.1.15.tar.gz
- Upload date:
- Size: 34.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a6d6a8019e97c61edb9c399fee7fb6e847917986c9c523105006b3886f16b6a
|
|
| MD5 |
a9929f25de4e6f513b12c4b53c0a10da
|
|
| BLAKE2b-256 |
632042a647404acc3fe147a8a639d514a946ec98de7cf29fb5d04c76328b68f8
|
File details
Details for the file vlppy-0.1.15-py3-none-any.whl.
File metadata
- Download URL: vlppy-0.1.15-py3-none-any.whl
- Upload date:
- Size: 48.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34e35691bb54c2dedd6feb20dc03f024ba6ea8e0400e091b321f456ee23ef687
|
|
| MD5 |
2579a11c4e79525a4d0b54931129740e
|
|
| BLAKE2b-256 |
acaa46692ffc049958d66031758fa9b9167ab95c5c072882264e8172a67077dc
|