@@ -297,7 +297,7 @@ def calculate_average_occupancy(self):
297
297
return return_value
298
298
299
299
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."""
301
301
logging .debug ("Setting up Acquisition" )
302
302
fr_status = self .get_adapter_status ("fr" )
303
303
fp_status = self .get_adapter_status ("fp" )
@@ -513,7 +513,7 @@ def prepare_hdf_file(self):
513
513
self .hdf_retry = 0
514
514
self .in_progress = False
515
515
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 )
517
517
self .parent .software_state = "Error"
518
518
return
519
519
@@ -959,21 +959,21 @@ def _set_bin_end(self, bin_end):
959
959
if bin_end < 1 :
960
960
raise ParameterTreeError ("bin_end must be positive!" )
961
961
self .bin_end = bin_end
962
- self .update_histogram_dimensions ()
962
+ self .update_number_histograms ()
963
963
964
964
def _set_bin_start (self , bin_start ):
965
965
"""Update bin_start and datasets' histograms' dimensions."""
966
966
if bin_start < 0 :
967
967
raise ParameterTreeError ("bin_start must be positive!" )
968
968
self .bin_start = bin_start
969
- self .update_histogram_dimensions ()
969
+ self .update_number_histograms ()
970
970
971
971
def _set_bin_width (self , bin_width ):
972
972
"""Update bin_width and datasets' histograms' dimensions."""
973
973
if bin_width <= 0 :
974
974
raise ParameterTreeError ("bin_width must be positive!" )
975
975
self .bin_width = bin_width
976
- self .update_histogram_dimensions ()
976
+ self .update_number_histograms ()
977
977
978
978
def update_datasets_frame_dimensions (self ):
979
979
"""Update frames' datasets' dimensions."""
@@ -983,69 +983,24 @@ def update_datasets_frame_dimensions(self):
983
983
request = ApiAdapterRequest (str (payload ), content_type = "application/json" )
984
984
self .adapters ["fp" ].put (command , request )
985
985
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 ."""
988
988
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
1017
989
1018
990
def _set_max_frames_received (self , max_frames_received ):
1019
991
self .max_frames_received = max_frames_received
1020
992
1021
993
def _set_pass_processed (self , pass_processed = None ):
994
+ """Toggle passing processed dataset on/off."""
1022
995
if pass_processed is not None :
1023
996
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
1034
998
1035
999
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 ."""
1037
1001
if pass_raw is not None :
1038
1002
self .pass_raw = pass_raw
1039
1003
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 )
1049
1004
1050
1005
def _set_threshold_filename (self , threshold_filename ):
1051
1006
threshold_filename = self .data_config_path + threshold_filename
@@ -1102,7 +1057,7 @@ def _set_sensors_layout(self, layout):
1102
1057
1103
1058
self .update_rows_columns_pixels ()
1104
1059
self .update_datasets_frame_dimensions ()
1105
- self .update_histogram_dimensions ()
1060
+ self .update_number_histograms ()
1106
1061
1107
1062
def _get_compression_type (self ):
1108
1063
return self .compression_type
@@ -1152,6 +1107,7 @@ def commit_configuration(self):
1152
1107
# Enable live view for first node only
1153
1108
live_view_selected = True
1154
1109
logging .debug ("Sending configuration to %s FP(s)" % self .number_nodes )
1110
+
1155
1111
# Loop over node(s)
1156
1112
for index in range (self .number_nodes ):
1157
1113
self .gcf = GenerateConfigFiles (parameter_tree , self .number_histograms ,
@@ -1181,10 +1137,33 @@ def commit_configuration(self):
1181
1137
if (status_code != 200 ):
1182
1138
error = "Error {} loading plugins config in fp adapter" .format (status_code )
1183
1139
self .parent .fem .flag_error (error )
1140
+ pixel_spectra_params = self .gcf .generate_pixel_spectra_params ()
1184
1141
# Delete GCF object before next iteration
1185
1142
del self .gcf
1186
1143
self .gcf = None
1187
1144
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
+ payload = '{%s}' % (pixel_spectra_params )
1156
+ command = "config/hdf/dataset/" + "pixel_spectra"
1157
+ request = ApiAdapterRequest (str (payload ), content_type = "application/json" )
1158
+ self .adapters ["fp" ].put (command , request )
1159
+
1160
+ # summed_spectra dataset
1161
+ payload = '{"dims": [%s], "chunks": [1, %s]}' % \
1162
+ (self .number_histograms , self .number_histograms )
1163
+ command = "config/hdf/dataset/" + "summed_spectra"
1164
+ request = ApiAdapterRequest (str (payload ), content_type = "application/json" )
1165
+ self .adapters ["fp" ].put (command , request )
1166
+
1188
1167
# Allow FP time to process above PUT requests before configuring plugin settings
1189
1168
IOLoop .instance ().call_later (0.4 , self .submit_configuration )
1190
1169
@@ -1214,6 +1193,26 @@ def submit_configuration(self):
1214
1193
else :
1215
1194
self .plugin = "histogram"
1216
1195
1196
+ command = "config/histogram"
1197
+ formatted_string = ('{"pass_processed": %s}' % self .pass_processed ).lower ()
1198
+ request = ApiAdapterRequest (formatted_string , content_type = "application/json" )
1199
+
1200
+ response = self .adapters ["fp" ].put (command , request )
1201
+ status_code = response .status_code
1202
+ if (status_code != 200 ):
1203
+ error = "Error {} updating histogram's processed dataset" .format (status_code )
1204
+ self .parent .fem .flag_error (error )
1205
+
1206
+ command = "config/histogram"
1207
+ formatted_string = ('{"pass_raw": %s}' % self .pass_raw ).lower ()
1208
+ request = ApiAdapterRequest (formatted_string , content_type = "application/json" )
1209
+
1210
+ response = self .adapters ["fp" ].put (command , request )
1211
+ status_code = response .status_code
1212
+ if (status_code != 200 ):
1213
+ error = "Error {} updating fp histogram's raw dataset" .format (status_code )
1214
+ self .parent .fem .flag_error (error )
1215
+
1217
1216
# Update live histogram labelling according to calibration enabled (or not)
1218
1217
command = ""
1219
1218
payload = ('{"calibration_enable": %s}' % self .calibration_enable ).lower ()
0 commit comments