@@ -95,7 +95,8 @@ def register_search_map_in_database(
9595 search_map .width = search_map_params .width or search_map .width
9696 if _transport_object :
9797 _transport_object .do_update_search_map (search_map .id , search_map_params )
98- except Exception :
98+ except Exception as e :
99+ logger .info (f"Registering new search map due to { e } " , exc_info = True )
99100 if _transport_object :
100101 sm_ispyb_response = _transport_object .do_insert_search_map (
101102 dcg .atlas_id , search_map_params
@@ -140,16 +141,13 @@ def register_search_map_in_database(
140141 height = search_map_params .height ,
141142 width = search_map_params .width ,
142143 )
143- murfey_db .add (search_map )
144- murfey_db .commit ()
145144
146145 murfey_session = murfey_db .exec (
147146 select (MurfeySession ).where (MurfeySession .id == session_id )
148147 ).one ()
149148 machine_config = get_machine_config (instrument_name = murfey_session .instrument_name )[
150149 murfey_session .instrument_name
151150 ]
152-
153151 if all (
154152 [
155153 search_map .reference_matrix_m11 ,
@@ -209,15 +207,22 @@ def register_search_map_in_database(
209207 search_map_params .width_on_atlas = int (
210208 search_map .width * search_map .pixel_size / dcg .atlas_pixel_size
211209 )
212- search_map_params .x_location = corrected_vector [0 ] / dcg .atlas_pixel_size + 2003
213- search_map_params .y_location = corrected_vector [1 ] / dcg .atlas_pixel_size + 2003
210+ search_map_params .x_location = float (
211+ corrected_vector [0 ] / dcg .atlas_pixel_size + 2003
212+ )
213+ search_map_params .y_location = float (
214+ corrected_vector [1 ] / dcg .atlas_pixel_size + 2003
215+ )
214216 search_map .x_location = search_map_params .x_location
215217 search_map .y_location = search_map_params .y_location
216218 if _transport_object :
217219 _transport_object .do_update_search_map (search_map .id , search_map_params )
218220 else :
219221 logger .info (
220- f"Unable to register search map { sanitise (search_map_name )} position yet"
222+ f"Unable to register search map { sanitise (search_map_name )} position yet: "
223+ f"stage { search_map_params .x_stage_position } , "
224+ f"width { search_map_params .width } , "
225+ f"atlas pixel size { dcg .atlas_pixel_size } "
221226 )
222227 murfey_db .add (search_map )
223228 murfey_db .commit ()
@@ -327,16 +332,16 @@ def register_batch_position_in_database(
327332 search_map .height / 2 ,
328333 ]
329334 tilt_series .x_location = (
330- centre_batch_pixel [0 ]
331- - BatchPositionParameters .x_beamshift / search_map .pixel_size
335+ centre_batch_pixel [0 ] - batch_parameters .x_beamshift / search_map .pixel_size
332336 )
333337 tilt_series .y_location = (
334- centre_batch_pixel [1 ]
335- - BatchPositionParameters .y_beamshift / search_map .pixel_size
338+ centre_batch_pixel [1 ] - batch_parameters .y_beamshift / search_map .pixel_size
336339 )
337340 else :
338341 logger .warning (
339- f"No search map information available to register position of { sanitise (batch_name )} "
342+ f"Incomplete search map for position of { sanitise (batch_name )} : "
343+ f"stage { search_map .x_stage_position } , "
344+ f"width { search_map .width } , "
340345 )
341346 murfey_db .add (tilt_series )
342347 murfey_db .commit ()
0 commit comments