@@ -1956,17 +1956,17 @@ def _flush_position_analysis(
19561956 movie_path : Path , dcg_id : int , session_id : int
19571957) -> Optional [int ]:
19581958 """Register a grid square and foil hole in the database"""
1959+ data_collection_group = murfey_db .exec (
1960+ select (db .DataCollectionGroup ).where (db .DataCollectionGroup .id == dcg_id )
1961+ ).one ()
1962+
19591963 # Work out the grid square and associated metadata file
19601964 grid_square = _grid_square_from_file (movie_path )
19611965 grid_square_metadata_file = _grid_square_metadata_file (movie_path , grid_square )
19621966 if grid_square_metadata_file :
19631967 gs = _grid_square_data (grid_square_metadata_file , grid_square )
19641968 else :
19651969 gs = GridSquare (id = grid_square )
1966-
1967- data_collection_group = murfey_db .exec (
1968- select (db .DataCollectionGroup ).where (db .DataCollectionGroup .id == dcg_id )
1969- ).one ()
19701970 if data_collection_group .atlas :
19711971 # If an atlas if present, work out where this grid square is on it
19721972 gs_pix_position = _get_grid_square_atlas_positions (
@@ -2000,6 +2000,7 @@ def _flush_position_analysis(
20002000 pixel_size = gs .pixel_size ,
20012001 image = gs .image ,
20022002 )
2003+ # Insert or update this grid square in the database
20032004 register_grid_square (session_id , gs .id , grid_square_parameters , murfey_db )
20042005
20052006 # Find the foil hole info and register it
@@ -2030,6 +2031,7 @@ def _flush_position_analysis(
20302031 tag = data_collection_group .tag ,
20312032 name = foil_hole ,
20322033 )
2034+ # Insert or update this foil hole in the database
20332035 register_foil_hole (session_id , gs .id , foil_hole_parameters , murfey_db )
20342036 return foil_hole
20352037
0 commit comments