Skip to content

Commit 2f8f76f

Browse files
committed
test commit.
1 parent e685980 commit 2f8f76f

13 files changed

+642
-721
lines changed

control/config/odin_config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"daq/compression_type": "none",
88
"daq/discrimination_enable": false,
99
"daq/file_dir": "/data/hexitec/",
10-
"daq/file_name": "04-02-000",
10+
"daq/file_name": "05-02-000",
1111
"daq/gradients_filename": "m.txt",
1212
"daq/image_frequency": 0,
1313
"daq/intercepts_filename": "c.txt",

control/setup.cfg

+1-32
Original file line numberDiff line numberDiff line change
@@ -18,53 +18,22 @@ package_dir =
1818

1919
install_requires =
2020
odin-control @ git+https://[email protected]/odin-detector/[email protected]
21+
odin-data @ git+https://[email protected]/odin-detector/[email protected]#subdirectory=python
2122
attrs
22-
cachetools
23-
certifi
24-
chardet
25-
charset-normalizer
26-
colorama
27-
contourpy
2823
coverage
29-
cycler
30-
distlib
3124
exceptiongroup
32-
filelock
33-
fonttools
3425
future
3526
h5py
36-
idna
3727
iniconfig
38-
kiwisolver
3928
matplotlib
4029
numpy==1.24.2
4130
opencv-python
4231
persist-queue
43-
packaging
44-
Pillow
45-
platformdirs
4632
pluggy
47-
ply
48-
posix-ipc
4933
psutil
50-
pyasn1
51-
pycryptodomex
52-
pygelf
53-
pyparsing
54-
pyproject_api
55-
pysmi
56-
pysnmp
57-
pytest==7.2.1
58-
pytest-cov
59-
python-dateutil
6034
pyzmq
6135
requests
62-
six
63-
tomli
64-
tornado
65-
tox
6636
urllib3==1.26.14
67-
virtualenv
6837

6938
[options.extras_require]
7039
dev =

control/src/hexitec/HexitecDAQ.py

+56-56
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ def calculate_average_occupancy(self):
297297
return return_value
298298

299299
def prepare_odin(self):
300-
"""Ensure the odin data FP and FR are configured."""
300+
"""Ensure the odin data FP(s) and FR(s) are configured."""
301301
logging.debug("Setting up Acquisition")
302302
fr_status = self.get_adapter_status("fr")
303303
fp_status = self.get_adapter_status("fp")
@@ -513,7 +513,7 @@ def prepare_hdf_file(self):
513513
self.hdf_retry = 0
514514
self.in_progress = False
515515
self.daq_ready = True
516-
self.parent.fem.flag_error("Error reopening HDF file: %s" % e)
516+
self.parent.fem.flag_error("Reopening HDF file: %s" % e)
517517
self.parent.software_state = "Error"
518518
return
519519

@@ -959,21 +959,21 @@ def _set_bin_end(self, bin_end):
959959
if bin_end < 1:
960960
raise ParameterTreeError("bin_end must be positive!")
961961
self.bin_end = bin_end
962-
self.update_histogram_dimensions()
962+
self.update_number_histograms()
963963

964964
def _set_bin_start(self, bin_start):
965965
"""Update bin_start and datasets' histograms' dimensions."""
966966
if bin_start < 0:
967967
raise ParameterTreeError("bin_start must be positive!")
968968
self.bin_start = bin_start
969-
self.update_histogram_dimensions()
969+
self.update_number_histograms()
970970

971971
def _set_bin_width(self, bin_width):
972972
"""Update bin_width and datasets' histograms' dimensions."""
973973
if bin_width <= 0:
974974
raise ParameterTreeError("bin_width must be positive!")
975975
self.bin_width = bin_width
976-
self.update_histogram_dimensions()
976+
self.update_number_histograms()
977977

978978
def update_datasets_frame_dimensions(self):
979979
"""Update frames' datasets' dimensions."""
@@ -983,69 +983,24 @@ def update_datasets_frame_dimensions(self):
983983
request = ApiAdapterRequest(str(payload), content_type="application/json")
984984
self.adapters["fp"].put(command, request)
985985

986-
def update_histogram_dimensions(self):
987-
"""Update histograms' dimensions in the relevant datasets."""
986+
def update_number_histograms(self):
987+
"""Update number of histograms."""
988988
self.number_histograms = int((self.bin_end - self.bin_start) / self.bin_width)
989-
self.gcf = GenerateConfigFiles(self.param_tree.get(''), self.number_histograms,
990-
compression_type=self.compression_type,
991-
master_dataset=self.master_dataset,
992-
extra_datasets=self.extra_datasets,
993-
live_view_selected=False,
994-
odin_path=self.odin_path)
995-
# spectra_bins dataset
996-
payload = '{"dims": [%s], "chunks": [1, %s]}' % \
997-
(self.number_histograms, self.number_histograms)
998-
command = "config/hdf/dataset/" + "spectra_bins"
999-
request = ApiAdapterRequest(str(payload), content_type="application/json")
1000-
self.adapters["fp"].put(command, request)
1001-
1002-
# pixel_spectra dataset
1003-
ps_params = self.gcf.generate_pixel_spectra_params()
1004-
payload = '{%s}' % (ps_params)
1005-
command = "config/hdf/dataset/" + "pixel_spectra"
1006-
request = ApiAdapterRequest(str(payload), content_type="application/json")
1007-
self.adapters["fp"].put(command, request)
1008-
1009-
# summed_spectra dataset
1010-
payload = '{"dims": [%s], "chunks": [1, %s]}' % \
1011-
(self.number_histograms, self.number_histograms)
1012-
command = "config/hdf/dataset/" + "summed_spectra"
1013-
request = ApiAdapterRequest(str(payload), content_type="application/json")
1014-
self.adapters["fp"].put(command, request)
1015-
del self.gcf
1016-
self.gcf = None
1017989

1018990
def _set_max_frames_received(self, max_frames_received):
1019991
self.max_frames_received = max_frames_received
1020992

1021993
def _set_pass_processed(self, pass_processed=None):
994+
"""Toggle passing processed dataset on/off."""
1022995
if pass_processed is not None:
1023996
self.pass_processed = pass_processed
1024-
self.commit_config_before_acquire = True
1025-
command = "config/histogram"
1026-
formatted_string = ('{"pass_processed": %s}' % self.pass_processed).lower()
1027-
request = ApiAdapterRequest(formatted_string, content_type="application/json")
1028-
1029-
response = self.adapters["fp"].put(command, request)
1030-
status_code = response.status_code
1031-
if (status_code != 200):
1032-
error = "Error {} updating histogram's processed dataset".format(status_code)
1033-
self.parent.fem.flag_error(error)
997+
self.commit_config_before_acquire = True
1034998

1035999
def _set_pass_raw(self, pass_raw=None):
1036-
"""Change pass_raw if provided, then update FP setting."""
1000+
"""Toggle passing raw dataset on/off."""
10371001
if pass_raw is not None:
10381002
self.pass_raw = pass_raw
10391003
self.commit_config_before_acquire = True
1040-
command = "config/histogram"
1041-
formatted_string = ('{"pass_raw": %s}' % self.pass_raw).lower()
1042-
request = ApiAdapterRequest(formatted_string, content_type="application/json")
1043-
1044-
response = self.adapters["fp"].put(command, request)
1045-
status_code = response.status_code
1046-
if (status_code != 200):
1047-
error = "Error {} updating fp histogram's raw dataset".format(status_code)
1048-
self.parent.fem.flag_error(error)
10491004

10501005
def _set_threshold_filename(self, threshold_filename):
10511006
threshold_filename = self.data_config_path + threshold_filename
@@ -1102,7 +1057,7 @@ def _set_sensors_layout(self, layout):
11021057

11031058
self.update_rows_columns_pixels()
11041059
self.update_datasets_frame_dimensions()
1105-
self.update_histogram_dimensions()
1060+
self.update_number_histograms()
11061061

11071062
def _get_compression_type(self):
11081063
return self.compression_type
@@ -1152,6 +1107,7 @@ def commit_configuration(self):
11521107
# Enable live view for first node only
11531108
live_view_selected = True
11541109
logging.debug("Sending configuration to %s FP(s)" % self.number_nodes)
1110+
ps_params = ""
11551111
# Loop over node(s)
11561112
for index in range(self.number_nodes):
11571113
self.gcf = GenerateConfigFiles(parameter_tree, self.number_histograms,
@@ -1181,10 +1137,34 @@ def commit_configuration(self):
11811137
if (status_code != 200):
11821138
error = "Error {} loading plugins config in fp adapter".format(status_code)
11831139
self.parent.fem.flag_error(error)
1140+
ps_params = self.gcf.generate_pixel_spectra_params()
11841141
# Delete GCF object before next iteration
11851142
del self.gcf
11861143
self.gcf = None
11871144

1145+
# Update dataset dimensions
1146+
1147+
# spectra_bins dataset
1148+
payload = '{"dims": [%s], "chunks": [1, %s]}' % \
1149+
(self.number_histograms, self.number_histograms)
1150+
command = "config/hdf/dataset/" + "spectra_bins"
1151+
request = ApiAdapterRequest(str(payload), content_type="application/json")
1152+
self.adapters["fp"].put(command, request)
1153+
1154+
# pixel_spectra dataset
1155+
# print(f" [E ps_params = {ps_params}");time.sleep(1)
1156+
payload = '{%s}' % (ps_params)
1157+
command = "config/hdf/dataset/" + "pixel_spectra"
1158+
request = ApiAdapterRequest(str(payload), content_type="application/json")
1159+
self.adapters["fp"].put(command, request)
1160+
1161+
# summed_spectra dataset
1162+
payload = '{"dims": [%s], "chunks": [1, %s]}' % \
1163+
(self.number_histograms, self.number_histograms)
1164+
command = "config/hdf/dataset/" + "summed_spectra"
1165+
request = ApiAdapterRequest(str(payload), content_type="application/json")
1166+
self.adapters["fp"].put(command, request)
1167+
11881168
# Allow FP time to process above PUT requests before configuring plugin settings
11891169
IOLoop.instance().call_later(0.4, self.submit_configuration)
11901170

@@ -1214,6 +1194,26 @@ def submit_configuration(self):
12141194
else:
12151195
self.plugin = "histogram"
12161196

1197+
command = "config/histogram"
1198+
formatted_string = ('{"pass_processed": %s}' % self.pass_processed).lower()
1199+
request = ApiAdapterRequest(formatted_string, content_type="application/json")
1200+
1201+
response = self.adapters["fp"].put(command, request)
1202+
status_code = response.status_code
1203+
if (status_code != 200):
1204+
error = "Error {} updating histogram's processed dataset".format(status_code)
1205+
self.parent.fem.flag_error(error)
1206+
1207+
command = "config/histogram"
1208+
formatted_string = ('{"pass_raw": %s}' % self.pass_raw).lower()
1209+
request = ApiAdapterRequest(formatted_string, content_type="application/json")
1210+
1211+
response = self.adapters["fp"].put(command, request)
1212+
status_code = response.status_code
1213+
if (status_code != 200):
1214+
error = "Error {} updating fp histogram's raw dataset".format(status_code)
1215+
self.parent.fem.flag_error(error)
1216+
12171217
# Update live histogram labelling according to calibration enabled (or not)
12181218
command = ""
12191219
payload = ('{"calibration_enable": %s}' % self.calibration_enable).lower()

0 commit comments

Comments
 (0)