Sensor classes
An overview of the sensor classes:
Sensor superclass
Sensor module.
The superclass for the sensor classes. This module provides the higher level Sensor and SensorGroup classes. The Sensor class is a single sensor, the SensorGroup is a dictionary of Sensors. The SensorGroup class is created to deal with the properties over all sensors together.
Sensor
dataclass
Defines the properties and methods of the sensor class.
Attributes:
Name | Type | Description |
---|---|---|
label |
str
|
String label for sensor |
time |
DatetimeArray
|
Array containing time values associated with concentration reading |
location |
Coordinate
|
Coordinate object specifying the observation locations |
concentration |
ndarray
|
Array containing concentration values associated with time reading |
source_on |
ndarray
|
Array of size nof_observations containing boolean values indicating whether a source is on or off for each observation, i.e. we are assuming the sensor can/can't see a source |
Source code in src/pyelq/sensor/sensor.py
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 104 105 106 107 108 |
|
nof_observations: int
property
plot_sensor_location(fig, color=None)
Plotting the sensor location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fig |
Figure
|
Plotly figure object to add the trace to |
required |
color |
`optional`
|
When specified, the color to be used |
None
|
Returns:
Name | Type | Description |
---|---|---|
fig |
Figure
|
Plotly figure object with sensor location trace added to it |
Source code in src/pyelq/sensor/sensor.py
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 |
|
plot_timeseries(fig, color=None, mode='markers')
Timeseries plot of the sensor concentration observations.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fig |
Figure
|
Plotly figure object to add the trace to |
required |
color |
`optional`
|
When specified, the color to be used |
None
|
mode |
str
|
Mode used for plotting, i.e. markers, lines or markers+lines |
'markers'
|
Returns:
Name | Type | Description |
---|---|---|
fig |
Figure
|
Plotly figure object with sensor concentration timeseries trace added to it |
Source code in src/pyelq/sensor/sensor.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
|
SensorGroup
dataclass
Bases: dict
A dictionary containing multiple Sensors.
This class is used when we want to combine a collection of sensors and be able to store/access overall properties.
Attributes:
Name | Type | Description |
---|---|---|
color_map |
list
|
Default colormap to use for plotting |
Source code in src/pyelq/sensor/sensor.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|
nof_observations: int
property
concentration: np.ndarray
property
np.ndarray: Column vector of concentration values across all sensors, unwrapped per sensor.
time: pd.arrays.DatetimeArray
property
location: Coordinate
property
sensor_index: np.ndarray
property
np.ndarray: Column vector of integer indices linking concentration observation to a particular sensor.
source_on: np.ndarray
property
Column vector of booleans indicating whether sources are expected to be on, unwrapped over sensors.
Assumes source is on when None is specified for a specific sensor.
Returns:
Type | Description |
---|---|
ndarray
|
np.ndarray: Source on attribute, unwrapped over sensors. |
nof_sensors: int
property
add_sensor(sensor)
Add a sensor to the SensorGroup.
Source code in src/pyelq/sensor/sensor.py
196 197 198 |
|
plot_sensor_location(fig, color_map=None)
Plotting of the locations of all sensors in the SensorGroup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fig |
Figure
|
Plotly figure object to add the trace to |
required |
color_map |
list
|
When specified, the colormap to be used, plotting will cycle through the colors |
None
|
Returns:
Name | Type | Description |
---|---|---|
fig |
Figure
|
Plotly figure object with sensor location traces added to it |
Source code in src/pyelq/sensor/sensor.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 |
|
plot_timeseries(fig, color_map=None, mode='markers')
Plotting of the concentration timeseries of all sensors in the SensorGroup.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fig |
Figure
|
Plotly figure object to add the trace to |
required |
color_map |
list
|
When specified, the colormap to be used, plotting will cycle through the colors |
None
|
mode |
str
|
Mode used for plotting, i.e. markers, lines or markers+lines |
'markers'
|
Returns:
Name | Type | Description |
---|---|---|
fig |
Figure
|
Plotly figure object with sensor concentration time series traces added to it |
Source code in src/pyelq/sensor/sensor.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
|