Skip to content

Commit 6c70282

Browse files
committed
Brings branch up-to-date with bug_fixes branch..
..Except for Live Viewers IPs, File Writer path specific to dev PC.
1 parent aa4ccbd commit 6c70282

File tree

7 files changed

+96
-59
lines changed

7 files changed

+96
-59
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[server]
2+
debug_mode = 1
3+
http_port = 8888
4+
http_addr = 127.0.0.1
5+
adapters = hexitec, system_info, live_view, live_histogram, fr, fp, file_interface
6+
7+
[tornado]
8+
logging = debug
9+
10+
[adapter.hexitec]
11+
module = hexitec.adapter.HexitecAdapter
12+
13+
fem =
14+
farm_mode = control/config/hexitec_single_node_no_hardware_farm_mode.json
15+
16+
[adapter.live_view]
17+
module = odin_data.live_view_adapter.LiveViewAdapter
18+
live_view_endpoints = tcp://127.0.0.1:5020
19+
default_colormap = Jet
20+
21+
[adapter.live_histogram]
22+
module = hexitec.live_histogram_adapter.LiveViewAdapter
23+
live_view_endpoints = tcp://127.0.0.1:5021
24+
default_colormap = Jet
25+
26+
[adapter.fr]
27+
module = odin_data.frame_receiver_adapter.FrameReceiverAdapter
28+
endpoints = 127.0.0.1:5000
29+
update_interval = 5.0
30+
31+
[adapter.fp]
32+
module = odin_data.frame_processor_adapter.FrameProcessorAdapter
33+
endpoints = 127.0.0.1:5004
34+
update_interval = 5.0
35+
36+
[adapter.system_info]
37+
module = odin.adapters.system_info.SystemInfoAdapter
38+
39+
[adapter.file_interface]
40+
module = hexitec.FileInterface.FileInterfaceAdapter
41+
directories =
42+
odin_data = data/config/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"camera_ctrl_ip": "10.0.3.100",
3+
"camera_ctrl_mac": "62:00:00:00:01:0A",
4+
"camera_ctrl_port": "61648",
5+
"server_ctrl_port": "61649",
6+
"control_interface": "em1",
7+
"control_lane": "1",
8+
"data1_interface": "em2",
9+
"data1_lane": "2",
10+
"data2_interface": "em1",
11+
"data2_lane": "3",
12+
"farm_server_1_ip": "10.0.2.1",
13+
"farm_server_1_mac": "9c:69:b4:60:b8:26",
14+
"farm_camera_1_ip": "10.0.2.101",
15+
"farm_camera_1_mac": "62:00:00:00:01:0B",
16+
"farm_server_2_ip": "10.0.1.1",
17+
"farm_server_2_mac": "9c:69:b4:60:b8:25",
18+
"farm_camera_2_ip": "10.0.1.102",
19+
"farm_camera_2_mac": "62:00:00:00:01:0C",
20+
"farm_target_ip": "10.0.2.1",
21+
"farm_target_mac": "9c:69:b4:60:b8:26",
22+
"farm_target_port": "61651"
23+
}

control/src/hexitec/HexitecFem.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ def __init__(self, parent, config):
153153
self.acquire_start_time = ""
154154
self.acquire_stop_time = ""
155155
self.acquire_time = 0.0
156-
self.acquire_timestamp = 0
157156
self.offsets_timestamp = 0
158157

159158
# Track history of errors
@@ -642,7 +641,7 @@ def power_up_modules(self):
642641
self.flag_error(message, error)
643642
return
644643

645-
# Switch HV on
644+
# Switch HV (Power Board) on
646645
success = self.broadcast_VSRs.hv_enable()
647646
hv_statuses = self.broadcast_VSRs._get_status(hv=True, all_vsrs=True)
648647
logging.debug("HV Status: 0x{}".format(hv_statuses))
@@ -775,9 +774,6 @@ def acquire_data(self):
775774
logging.debug(f"Set number frames to: {self.number_frames}")
776775
self.set_nof_frames(self.number_frames)
777776

778-
# How to convert datetime object to float?
779-
self.acquire_timestamp = time.time() # Utilised by adapter's check_fem_watchdog
780-
781777
logging.debug("Enable data")
782778
self.data_en(enable=True)
783779
time.sleep(0.2)

control/src/hexitec/adapter.py

+1-21
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,7 @@ def polling(self): # pragma: no cover
309309
# Poll FEM acquisition & health status
310310
self.poll_fem()
311311

312-
# Watchdog: Watch FEM in case no data from hardware triggered by fem.acquire_data()
313-
self.check_fem_watchdog()
314-
315-
# TODO: WATCHDOG, monitor HexitecDAQ rate of frames_processed updated.. (Break if stalled)
312+
# Monitor HexitecDAQ rate of frames_processed updated.. (Break if stalled)
316313
if self.daq.processing_interruptable:
317314
self.check_daq_watchdog()
318315

@@ -343,23 +340,6 @@ def poll_fem(self):
343340
self.status_message = self.fem._get_status_message()
344341
self.system_health = self.system_health and self.fem_health
345342

346-
# TODO: Revisit and update once firmware data readout available - Redundant?
347-
def check_fem_watchdog(self):
348-
"""Check data sent when FEM acquiring data."""
349-
if self.acquisition_in_progress:
350-
# TODO: Monitor FEM in case no data following fem.acquire_data() call
351-
if (self.fem.hardware_busy):
352-
fem_begun = self.fem.acquire_timestamp
353-
delta_time = time.time() - fem_begun
354-
logging.debug(" FEM w-dog: {0:.2f} < {1:.2f}".format(delta_time,
355-
self.fem_tx_timeout))
356-
# if (delta_time > self.fem_tx_timeout):
357-
# self.fem.stop_acquisition = True
358-
# self.shutdown_processing()
359-
# logging.error("FEM data transmission timed out")
360-
# error = "Timed out waiting ({0:.2f} seconds) for FEM data".format(delta_time)
361-
# self.fem._set_status_message(error)
362-
363343
def check_daq_watchdog(self):
364344
"""Monitor DAQ's frames_processed while data processed.
365345

control/static/js/odin_server.js

+14-6
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ var odin_cold_initialisation = true;
2727
// Called once, when page 1st loaded
2828
document.addEventListener("DOMContentLoaded", function () {
2929
hexitec_endpoint = new AdapterEndpoint("hexitec");
30-
liveview_endpoint = new AdapterEndpoint("live_histogram");
30+
livehisto_endpoint = new AdapterEndpoint("live_histogram");
3131
'use strict';
3232

3333
document.querySelector('#odin-control-message').innerHTML = "Disconnected, Idle";
@@ -223,6 +223,16 @@ function toggle_ui_elements(bBool) {
223223
document.querySelector('#hdf-file-path-text').disabled = bBool;
224224
document.querySelector('#hdf-file-name-text').disabled = bBool;
225225
document.querySelector('#hexitec-config-text').disabled = bBool;
226+
227+
document.querySelector('#lv_dataset_select').disabled = bBool;
228+
document.querySelector('#lvframes-frame-frequency-text').disabled = bBool;
229+
document.querySelector('#lvframes-per-second-text').disabled = bBool;
230+
document.querySelector('#lvspectra-per-second-text').disabled = bBool;
231+
document.querySelector('#lvspectra-frame-frequency-text').disabled = bBool;
232+
document.querySelector('#lvframes-frame-frequency-text').disabled = bBool;
233+
document.querySelector('#threshold-lower-text').disabled = bBool;
234+
document.querySelector('#threshold-upper-text').disabled = bBool;
235+
document.querySelector('#image-frequency-text').disabled = bBool;
226236
}
227237

228238
function update_ui_with_leak_detector_settings(result){
@@ -290,8 +300,6 @@ function poll_fem() {
290300
const frames = result["value"][i].frames;
291301
const decoder = result["value"][i].decoder;
292302
const buffers = result["value"][i].buffers;
293-
// document.querySelector('#frames_received' + (i+1)).innerHTML = frames.received;
294-
// document.querySelector('#frames_released' + (i+1)).innerHTML = frames.released;
295303
document.querySelector('#frames_dropped' + (i+1)).innerHTML = frames.dropped;
296304
document.querySelector('#frames_timedout' + (i+1)).innerHTML = frames.timedout;
297305

@@ -793,7 +801,7 @@ function bin_start_changed() {
793801
bin_start.classList.add('alert-danger');
794802
});
795803
// Support histogram (1D) Live view data
796-
liveview_endpoint.put(parseFloat(bin_start.value), 'bin_start')
804+
livehisto_endpoint.put(parseFloat(bin_start.value), 'bin_start')
797805
.catch(error => {
798806
console.log("Couldn't update bin_start");
799807
});
@@ -811,7 +819,7 @@ function bin_end_changed() {
811819
bin_end.classList.add('alert-danger');
812820
});
813821
// Support histogram (1D) Live view data
814-
liveview_endpoint.put(parseFloat(bin_end.value), 'bin_end')
822+
livehisto_endpoint.put(parseFloat(bin_end.value), 'bin_end')
815823
.catch(error => {
816824
console.log("Couldn't update bin_end");
817825
});
@@ -829,7 +837,7 @@ function bin_width_changed() {
829837
bin_width.classList.add('alert-danger');
830838
});
831839
// Support histogram (1D) Live view data
832-
liveview_endpoint.put(parseFloat(bin_width.value), 'bin_width')
840+
livehisto_endpoint.put(parseFloat(bin_width.value), 'bin_width')
833841
.catch(error => {
834842
console.log("Couldn't update bin_width");
835843
});

control/test/hexitec/package/test_adapter.py

-12
Original file line numberDiff line numberDiff line change
@@ -294,18 +294,6 @@ def test_poll_fem_handles_processing_completed(self):
294294
assert self.test_adapter.detector.acquisition_in_progress is False
295295
assert self.test_adapter.detector.fem.acquisition_completed is False
296296

297-
# TODO: Revisit when fem_watchdog reworked
298-
def test_check_fem_watchdog(self):
299-
"""Test fem watchdog works."""
300-
self.test_adapter.detector.acquisition_in_progress = True
301-
self.test_adapter.detector.fem.hardware_busy = True
302-
self.test_adapter.detector.fem.acquire_timestamp = time.time()
303-
self.test_adapter.detector.fem_tx_timeout = 0
304-
self.test_adapter.detector.check_fem_watchdog()
305-
# # Ensure shutdown_processing() was called [it changes the following two bools]
306-
# assert self.test_adapter.detector.daq.shutdown_processing is True
307-
# assert self.test_adapter.detector.acquisition_in_progress is False
308-
309297
def test_check_daq_watchdog(self):
310298
"""Test daq watchdog works."""
311299
self.test_adapter.detector.daq.in_progress = True

control/test/hexitec/package/test_fem.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def test_read_sensors_Exception(self):
188188
self.test_fem.fem.read_temperatures_humidity_values = Mock()
189189
self.test_fem.fem.read_temperatures_humidity_values.side_effect = Exception()
190190
self.test_fem.fem.read_sensors()
191-
time.sleep(0.5)
191+
time.sleep(0.2)
192192
error = "Reading sensors failed"
193193
assert self.test_fem.fem._get_status_error() == error
194194

@@ -200,7 +200,7 @@ def test_read_sensors_HexitecFemError(self):
200200
self.test_fem.fem.read_temperatures_humidity_values = Mock()
201201
self.test_fem.fem.read_temperatures_humidity_values.side_effect = HexitecFemError()
202202
self.test_fem.fem.read_sensors()
203-
time.sleep(0.5)
203+
time.sleep(0.2)
204204
error = "Failed to read sensors"
205205
assert self.test_fem.fem._get_status_error() == error
206206
assert self.test_fem.fem.parent.software_state == "Error"
@@ -626,12 +626,12 @@ def test_acquire_data(self):
626626

627627
def test_acquire_data_handles_exception(self):
628628
"""Test function handles exception."""
629+
self.test_fem.fem.create_timestamp = Mock()
630+
self.test_fem.fem.create_timestamp.side_effect = Exception()
629631
with patch("hexitec.HexitecFem.IOLoop"):
630-
with patch("time.time") as mock_time:
631-
mock_time.side_effect = Exception()
632-
with pytest.raises(Exception) as exc_info:
633-
self.test_fem.fem.acquire_data()
634-
assert exc_info.type is Exception
632+
with pytest.raises(Exception) as exc_info:
633+
self.test_fem.fem.acquire_data()
634+
assert exc_info.type is Exception
635635

636636
def test_check_acquire_finished_handles_cancel(self):
637637
"""Test check_acquire_finished calls acquire_data_completed if acquire cancelled."""
@@ -737,7 +737,7 @@ def test_collect_offsets(self):
737737
self.test_fem.fem.await_dc_captured = Mock()
738738
self.test_fem.fem.clr_dc_controls = Mock()
739739
self.test_fem.fem.collect_offsets()
740-
time.sleep(0.3)
740+
# time.sleep(0.3)
741741
assert self.test_fem.fem.hardware_busy is False
742742
assert self.test_fem.fem.parent.software_state == "Idle"
743743

@@ -928,7 +928,7 @@ def test_initialise_system(self, mocked_vsr_module):
928928
self.test_fem.fem.x10g_rdma.udp_rdma_read = Mock()
929929
self.test_fem.fem.x10g_rdma.udp_rdma_read.return_value = [255]
930930
self.test_fem.fem.initialise_system()
931-
time.sleep(0.5)
931+
time.sleep(0.3)
932932
assert self.test_fem.fem.parent.software_state == "Idle"
933933

934934
# TODO: Passes but sabotages 3 x test_read_sensors unit tests (lines 167-209)
@@ -962,12 +962,12 @@ def test_initialise_system(self, mocked_vsr_module):
962962
# self.test_fem.fem.x10g_rdma.read.return_value = [0xF0]
963963

964964
# self.test_fem.fem.initialise_system()
965-
# time.sleep(0.5)
965+
# time.sleep(0.2)
966966
# self.test_fem.fem.x10g_rdma.write.assert_has_calls([
967967
# call(0x00000020, 0x10, burst_len=1, comment="Enabling training"),
968968
# call(0x00000020, 0x00, burst_len=1, comment="Disabling training")
969969
# ])
970-
# time.sleep(0.5)
970+
# time.sleep(0.2)
971971
# vsr_status_addr = 0x000003E8
972972
# index = 0
973973
# self.test_fem.fem.x10g_rdma.read.assert_has_calls([
@@ -984,15 +984,15 @@ def test_initialise_system_handles_HexitecFemError(self):
984984
self.test_fem.fem.initialise_vsr = Mock()
985985
self.test_fem.fem.initialise_vsr.side_effect = HexitecFemError("E")
986986
self.test_fem.fem.initialise_system()
987-
time.sleep(0.5)
987+
time.sleep(0.3)
988988
assert self.test_fem.fem.status_error == "Failed to initialise camera: {}".format("E")
989989

990990
def test_initialise_system_handles_Exception(self):
991991
"""Test function handles Exception."""
992992
self.test_fem.fem.initialise_vsr = Mock()
993993
self.test_fem.fem.initialise_vsr.side_effect = Exception("E")
994994
self.test_fem.fem.initialise_system()
995-
time.sleep(0.5)
995+
time.sleep(0.2)
996996
assert self.test_fem.fem.status_error == "Camera initialisation failed: {}".format("E")
997997

998998
# # TODO: Prevent unrelated unit tests failing: ??
@@ -1011,7 +1011,7 @@ def test_initialise_system_handles_Exception(self):
10111011
# fake_sleep.start()
10121012
# with patch('logging.error') as mock_log:
10131013
# self.test_fem.fem.initialise_system()
1014-
# time.sleep(0.5)
1014+
# time.sleep(0.2)
10151015
# # assert self.test_fem.fem.status_error == "Failed to initialise camera"
10161016
# mock_log.assert_called()
10171017
# fake_sleep.stop()
@@ -1028,7 +1028,7 @@ def test_initialise_system_handles_Exception(self):
10281028
# fake_sleep.start()
10291029
# with patch('logging.error') as mock_log:
10301030
# self.test_fem.fem.initialise_system()
1031-
# time.sleep(0.5)
1031+
# time.sleep(0.2)
10321032
# # assert self.test_fem.fem.status_error == "Failed to initialise camera"
10331033
# mock_log.assert_called()
10341034
# fake_sleep.stop()

0 commit comments

Comments
 (0)