@@ -2431,25 +2431,41 @@ def init_from_task_data(self, sample_model, params):
2431
2431
)
2432
2432
2433
2433
# Set parameters from diffraction plan
2434
- diffraction_plan = sample_model .diffraction_plan
2435
- if diffraction_plan :
2434
+ plan = sample_model .diffraction_plan
2435
+ if plan :
2436
2436
# It is not clear if diffraction_plan is a dict or an object,
2437
2437
# and if so which kind
2438
- if hasattr (diffraction_plan , "radiationSensitivity" ):
2439
- radiation_sensitivity = diffraction_plan .radiationSensitivity
2440
- else :
2441
- radiation_sensitivity = diffraction_plan .get ("radiationSensitivity" )
2442
-
2443
- if radiation_sensitivity :
2444
- self .relative_rad_sensitivity = radiation_sensitivity
2445
-
2446
- if hasattr (diffraction_plan , "aimedResolution" ):
2447
- resolution = diffraction_plan .aimedResolution
2448
- else :
2449
- resolution = diffraction_plan .get ("aimedResolution" )
2450
-
2451
- if resolution :
2452
- self .aimed_resolution = resolution
2438
+ # NB if 'val' is ever not None but zero we still want to skip it
2439
+ tag = "radiationSensitivity"
2440
+ val = getattr (plan , tag , plan .get (tag ))
2441
+ if val :
2442
+ self .relative_rad_sensitivity = val
2443
+ tag = "aimedResolution"
2444
+ val = getattr (plan , tag , plan .get (tag ))
2445
+ if val :
2446
+ self .aimed_resolution = val
2447
+ if self .automation_mode :
2448
+ tag = "exposureTime"
2449
+ val = getattr (plan , tag , plan .get (tag ))
2450
+ if val :
2451
+ self .auto_acq_parameters [- 1 ]["exposure_time" ] = val
2452
+ tag = "oscillationRange"
2453
+ val = getattr (plan , tag , plan .get (tag ))
2454
+ if val :
2455
+ self .auto_acq_parameters [- 1 ]["image_width" ] = val
2456
+ tag = "energy"
2457
+ val = getattr (plan , tag , plan .get (tag ))
2458
+ if val :
2459
+ if self .wftype == "diffractcal" :
2460
+ energy_tag = "Main"
2461
+ else :
2462
+ energy_tag = "Characterisation"
2463
+ self .wavelengths = (
2464
+ GphlMessages .PhasingWavelength (
2465
+ wavelength = HWR .beamline .energy .calculate_wavelength (val ),
2466
+ role = energy_tag ,
2467
+ ),
2468
+ )
2453
2469
2454
2470
# Parameters for start of workflow
2455
2471
def get_path_template (self ):
0 commit comments