-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathSensor.py
More file actions
103 lines (84 loc) · 4.98 KB
/
Sensor.py
File metadata and controls
103 lines (84 loc) · 4.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
"""
cBLUE (comprehensive Bathymetric Lidar Uncertainty Estimator)
Copyright (C) 2019
Oregon State University (OSU)
Center for Coastal and Ocean Mapping/Joint Hydrographic Center, University of New Hampshire (CCOM/JHC, UNH)
NOAA Remote Sensing Division (NOAA RSD)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Contact:
Christopher Parrish, PhD
School of Construction and Civil Engineering
204 Owen Hall
Oregon State University
Corvallis, OR 97331
(541) 737-5688
christopher.parrish@oregonstate.edu
Last Edited By:
Keana Kief (OSU)
August 4th, 2025
"""
import logging
import os
import json
logger = logging.getLogger(__name__)
class Sensor:
def __init__(self, sensor_name):
#Initalizes the sensor object based on the sensor name selected in CBlueApp.py.
#:param sensor_name: The name of the sensor model selected by the user in the GUI in CBlueApp.py
#:return: None
#:rtype: None
#Assign the sensor name given to the sensor object
self.name = sensor_name
#JSON file containing lidar sensor configurations for cBLUE
self.sensor_file = "lidar_sensors.json"
#Check if the lidar sensor config file exists
if os.path.isfile(self.sensor_file):
with open(self.sensor_file) as sf:
#If the file exists load the information into self.sensor_config
self.sensor_config = json.load(sf)
else:
logger.sensor("Sensor file doesn't exist")
#The type of sensor: "single", "single_hawkeye", or "multi" beam
self.type = self.sensor_config[self.name]["sensor_model"]["type"]
#If this is a Leica HawkEye sensor, get the path of the deep narrow, deep wide, and shallow subaqueous lookup tables
if self.type == "single_hawkeye":
#The path of the vertical deep narrow look up table used for modeling
self.vert_lut_deep_narrow = self.sensor_config[self.name]["subaqueous_LUTs"]["vertical_deep_narrow"]
#The path of the horizontal deep narrow look up table used for modeling
self.horz_lut_deep_narrow = self.sensor_config[self.name]["subaqueous_LUTs"]["horizontal_deep_narrow"]
# The path of the range bias deep narrow uncertainty look up table used for modeling
self.range_bias_lut_narrow = self.sensor_config[self.name]["subaqueous_LUTs"]["range_bias_deep_narrow"]
#The path of the vertical deep wide look up table used for modeling
self.vert_lut_deep_wide = self.sensor_config[self.name]["subaqueous_LUTs"]["vertical_deep_wide"]
#The path of the horizontal deep wide look up table used for modeling
self.horz_lut_deep_wide = self.sensor_config[self.name]["subaqueous_LUTs"]["horizontal_deep_wide"]
# The path of the range bias deep wide uncertainty look up table used for modeling
self.range_bias_lut_wide = self.sensor_config[self.name]["subaqueous_LUTs"]["range_bias_deep_wide"]
#The path of the vertical wide look up table used for modeling
self.vert_lut_shallow = self.sensor_config[self.name]["subaqueous_LUTs"]["vertical_shallow"]
#The path of the horizontal wide look up table used for modeling
self.horz_lut_shallow = self.sensor_config[self.name]["subaqueous_LUTs"]["horizontal_shallow"]
# The path of the range bias shallow uncertainty look up table used for modeling
self.range_bias_lut_shallow = self.sensor_config[self.name]["subaqueous_LUTs"]["range_bias_shallow"]
#Otherwise if this is a non-HawkEye sensor
else:
#The path of the vertical look up table used for modeling
self.vert_lut = self.sensor_config[self.name]["subaqueous_LUTs"]["vertical"]
#The path of the horizontal look up table used for modeling
self.horz_lut = self.sensor_config[self.name]["subaqueous_LUTs"]["horizontal"]
# The path of the range bias uncertainty look up table used for modeling
self.range_bias_lut = self.sensor_config[self.name]["subaqueous_LUTs"]["range_bias"]
#Scan angle and range uncertainties
self.a_std_dev = self.sensor_config[self.name]["sensor_model"]["a_std_dev"]
self.b_std_dev = self.sensor_config[self.name]["sensor_model"]["b_std_dev"]
self.std_rho = self.sensor_config[self.name]["sensor_model"]["std_rho"]