|
9 | 9 | from .tools import extract_run_id_from_system_status |
10 | 10 | from .tools import get_entry |
11 | 11 |
|
| 12 | +import re |
| 13 | + |
12 | 14 | from collections import namedtuple |
13 | 15 | from functools import partial |
14 | 16 |
|
@@ -160,14 +162,26 @@ def sipm_currents(url=None, timeout=None, fallback=False): |
160 | 162 | get = partial(get_entry, fallback=fallback) |
161 | 163 | calibrated = get(table, 1, 1) |
162 | 164 |
|
| 165 | + power_str = get(table, 6, 1, default='') |
| 166 | + # we expect something like 5W [4mW] |
| 167 | + match = re.match('(\d+)([a-zA-Z]+)\s*\[(\d+)([a-zA-Z]+)\]', power_str) |
| 168 | + if match is not None: |
| 169 | + cam_value, cam_unit, gapd_value, gapd_unit = match.groups() |
| 170 | + power_camera = Quantity(s2f(cam_value), cam_unit) |
| 171 | + power_gapd = Quantity(s2f(gapd_value), gapd_unit) |
| 172 | + else: |
| 173 | + power_camera = Quantity(float('nan'), 'W') |
| 174 | + power_gapd = Quantity(float('nan'), 'W') |
| 175 | + |
163 | 176 | return to_namedtuple('CurrentPage', { |
164 | 177 | 'timestamp': sft2dt(get(table, 0, 0)), |
165 | 178 | 'calibrated': calibrated == 'yes' if calibrated is not None else None, |
166 | 179 | 'min_per_sipm': Quantity(s2f(get(table, 2, 1)), 'uA'), |
167 | 180 | 'median_per_sipm': Quantity(s2f(get(table, 3, 1)), 'uA'), |
168 | 181 | 'mean_per_sipm': Quantity(s2f(get(table, 4, 1)), 'uA'), |
169 | 182 | 'max_per_sipm': Quantity(s2f(get(table, 5, 1)), 'uA'), |
170 | | - 'power': Quantity(s2f(get(table, 6, 1, default='')[:-1]), 'W'), |
| 183 | + 'power_camera': power_camera, |
| 184 | + 'power_gapd': power_gapd, |
171 | 185 | }) |
172 | 186 |
|
173 | 187 |
|
|
0 commit comments