@@ -186,13 +186,23 @@ def do_update_atlas(
186186 atlas_image : str ,
187187 pixel_size : float ,
188188 slot : int | None ,
189+ collection_mode : str | None = None ,
190+ color_flags : dict [str , str | int ] = {},
189191 ):
190192 try :
191193 with ISPyBSession () as db :
192194 atlas = db .query (Atlas ).filter (Atlas .atlasId == atlas_id ).one ()
193195 atlas .atlasImage = atlas_image or atlas .atlasImage
194196 atlas .pixelSize = pixel_size or atlas .pixelSize
195197 atlas .cassetteSlot = slot or atlas .cassetteSlot
198+ atlas .mode = collection_mode or atlas .mode
199+ # Optionally insert colour flags if present
200+ if color_flags :
201+ for (
202+ col_name ,
203+ value ,
204+ ) in color_flags .items ():
205+ setattr (atlas , col_name , value )
196206 db .add (atlas )
197207 db .commit ()
198208 return {"success" : True , "return_value" : atlas .atlasId }
@@ -209,6 +219,7 @@ def do_insert_grid_square(
209219 atlas_id : int ,
210220 grid_square_id : int ,
211221 grid_square_parameters : GridSquareParameters ,
222+ color_flags : dict [str , int ] = {},
212223 ):
213224 # most of this is for mypy
214225 if (
@@ -235,6 +246,10 @@ def do_insert_grid_square(
235246 stageLocationY = grid_square_parameters .y_stage_position ,
236247 pixelSize = grid_square_parameters .pixel_size ,
237248 )
249+ # Optionally insert colour flags
250+ if color_flags :
251+ for col_name , value in color_flags .items ():
252+ setattr (record , col_name , value )
238253 try :
239254 with ISPyBSession () as db :
240255 db .add (record )
@@ -250,7 +265,10 @@ def do_insert_grid_square(
250265 return {"success" : False , "return_value" : None }
251266
252267 def do_update_grid_square (
253- self , grid_square_id : int , grid_square_parameters : GridSquareParameters
268+ self ,
269+ grid_square_id : int ,
270+ grid_square_parameters : GridSquareParameters ,
271+ color_flags : dict [str , int ] = {},
254272 ):
255273 try :
256274 with ISPyBSession () as db :
@@ -290,6 +308,12 @@ def do_update_grid_square(
290308 grid_square .stageLocationY = grid_square_parameters .y_stage_position
291309 if grid_square_parameters .pixel_size :
292310 grid_square .pixelSize = grid_square_parameters .pixel_size
311+ if grid_square_parameters .collection_mode :
312+ grid_square .mode = grid_square_parameters .collection_mode
313+ # Optionally insert colour flags
314+ if color_flags :
315+ for col_name , value in color_flags .items ():
316+ setattr (grid_square , col_name , value )
293317 db .add (grid_square )
294318 db .commit ()
295319 return {"success" : True , "return_value" : grid_square .gridSquareId }
0 commit comments