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.16.tar.gz
(39.6 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.16-py3-none-any.whl
(50.8 kB
view details)
File details
Details for the file vlppy-0.1.16.tar.gz.
File metadata
- Download URL: vlppy-0.1.16.tar.gz
- Upload date:
- Size: 39.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.9.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3933f389a0c76a1bd4fb3721e43748d00b0df21fcc9a824dd440b88d300ceeb
|
|
| MD5 |
b0186739ec37c6338fe8dd98d0520d02
|
|
| BLAKE2b-256 |
2eca1dec4ce82fa60f44d91853e25466bc3487a181a224d1c7e77740c67af29d
|
File details
Details for the file vlppy-0.1.16-py3-none-any.whl.
File metadata
- Download URL: vlppy-0.1.16-py3-none-any.whl
- Upload date:
- Size: 50.8 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 |
38f26ca413c16c3e53be0393a41ad3ba5dca07c12f94073b77e08097a6a16f9c
|
|
| MD5 |
6cca3c90633be30632fbbdc0521c2824
|
|
| BLAKE2b-256 |
12df8d03d9a82dc65632f8071b9599d197936b40c21ca8dfa20ee9e6fd44077a
|