@@ -215,30 +215,26 @@ def do_update_grid_square(
215215 )
216216 if grid_square_parameters .image :
217217 grid_square .gridSquareImage = grid_square_parameters .image
218- grid_square .pixelLocationX = (
219- int (grid_square_parameters .x_location / 7.8 )
220- if grid_square_parameters .x_location
221- else None
222- )
223- grid_square .pixelLocationY = (
224- int (grid_square_parameters .y_location / 7.8 )
225- if grid_square_parameters .y_location
226- else None
227- )
228- grid_square .height = (
229- int (grid_square_parameters .height / 7.8 )
230- if grid_square_parameters .height is not None
231- else None
232- )
233- grid_square .width = (
234- int (grid_square_parameters .width / 7.8 )
235- if grid_square_parameters .width is not None
236- else None
237- )
238- grid_square .angle = grid_square_parameters .angle
239- grid_square .stageLocationX = grid_square_parameters .x_stage_position
240- grid_square .stageLocationY = grid_square_parameters .y_stage_position
241- grid_square .pixelSize = grid_square_parameters .pixel_size
218+ if grid_square_parameters .x_location :
219+ grid_square .pixelLocationX = int (
220+ grid_square_parameters .x_location / 7.8
221+ )
222+ if grid_square_parameters .y_location :
223+ grid_square .pixelLocationY = int (
224+ grid_square_parameters .y_location / 7.8
225+ )
226+ if grid_square_parameters .height is not None :
227+ grid_square .height = int (grid_square_parameters .height / 7.8 )
228+ if grid_square_parameters .width is not None :
229+ grid_square .width = int (grid_square_parameters .width / 7.8 )
230+ if grid_square_parameters .angle :
231+ grid_square .angle = grid_square_parameters .angle
232+ if grid_square_parameters .x_stage_position :
233+ grid_square .stageLocationX = grid_square_parameters .x_stage_position
234+ if grid_square_parameters .y_stage_position :
235+ grid_square .stageLocationY = grid_square_parameters .y_stage_position
236+ if grid_square_parameters .pixel_size :
237+ grid_square .pixelSize = grid_square_parameters .pixel_size
242238 db .add (grid_square )
243239 db .commit ()
244240 return {"success" : True , "return_value" : grid_square .gridSquareId }
@@ -317,24 +313,22 @@ def do_update_foil_hole(
317313 foil_hole = (
318314 db .query (FoilHole ).filter (FoilHole .foilHoleId == foil_hole_id ).one ()
319315 )
320- foil_hole .foilHoleImage = foil_hole_parameters .image
321- foil_hole .pixelLocationX = (
322- int (foil_hole_parameters .x_location * scale_factor )
323- if foil_hole_parameters .x_location
324- else None
325- )
326- foil_hole .pixelLocationY = (
327- int (foil_hole_parameters .y_location * scale_factor )
328- if foil_hole_parameters .y_location
329- else None
330- )
331- foil_hole .diameter = (
332- foil_hole_parameters .diameter * scale_factor
333- if foil_hole_parameters .diameter is not None
334- else None
335- )
336- foil_hole .stageLocationX = foil_hole_parameters .x_stage_position
337- foil_hole .stageLocationY = foil_hole_parameters .y_stage_position
316+ if foil_hole_parameters .image :
317+ foil_hole .foilHoleImage = foil_hole_parameters .image
318+ if foil_hole_parameters .x_location :
319+ foil_hole .pixelLocationX = int (
320+ foil_hole_parameters .x_location * scale_factor
321+ )
322+ if foil_hole_parameters .y_location :
323+ foil_hole .pixelLocationY = int (
324+ foil_hole_parameters .y_location * scale_factor
325+ )
326+ if foil_hole_parameters .diameter is not None :
327+ foil_hole .diameter = foil_hole_parameters .diameter * scale_factor
328+ if foil_hole_parameters .x_stage_position :
329+ foil_hole .stageLocationX = foil_hole_parameters .x_stage_position
330+ if foil_hole_parameters .y_stage_position :
331+ foil_hole .stageLocationY = foil_hole_parameters .y_stage_position
338332 if (
339333 foil_hole_parameters .readout_area_x is not None
340334 and foil_hole_parameters .thumbnail_size_x is not None
0 commit comments