Skip to content

Commit f3fdabc

Browse files
pbloweypjnaughton
andauthored
Add xia2.overload to udc strategy pipeline (#359)
Co-authored-by: Paul Naughton <paul.naughton@diamond.ac.uk>
1 parent fd774ef commit f3fdabc

2 files changed

Lines changed: 6 additions & 49 deletions

File tree

src/dlstbx/services/strategy.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,9 +193,12 @@ def generate_strategy(
193193
)
194194
beamline_config = parse_config_file(beamline_config_file)
195195

196+
scaled_transmission = parameters.get("scaled_transmission", 1.0)
197+
196198
transmission_limits = (
197199
get_beamline_param(beamline_config, ("gda.mx.udc.minTransmission",), 0.0),
198-
get_beamline_param(beamline_config, ("gda.mx.udc.maxTransmission",), 1.0),
200+
min(get_beamline_param(beamline_config, ("gda.mx.udc.maxTransmission",), 1.0),
201+
scaled_transmission)
199202
)
200203
exposure_time_limits = (
201204
get_beamline_param(

src/dlstbx/wrapper/xia2_overload.py

Lines changed: 2 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -13,52 +13,6 @@
1313
class Xia2OverloadWrapper(Wrapper):
1414
_logger_name = "dlstbx.wrap.xia2_overload"
1515

16-
def send_to_ispyb(self, transmission):
17-
ispyb_command_list = []
18-
19-
d = {
20-
"program": "xia2.overload",
21-
"ispyb_command": "insert_screening_output",
22-
"screening_id": "$ispyb_screening_id",
23-
"store_result": "ispyb_screening_output_id",
24-
}
25-
ispyb_command_list.append(d)
26-
27-
d = {
28-
"ispyb_command": "insert_screening_strategy",
29-
"transmission": transmission,
30-
"screening_output_id": "$ispyb_screening_output_id",
31-
"store_result": "ispyb_screening_strategy_id",
32-
}
33-
ispyb_command_list.append(d)
34-
35-
d = {
36-
"ispyb_command": "insert_screening_strategy_wedge",
37-
"screening_strategy_id": "$ispyb_screening_strategy_id",
38-
"store_result": "ispyb_screening_strategy_wedge_id",
39-
}
40-
ispyb_command_list.append(d)
41-
42-
d = {
43-
"ispyb_command": "insert_screening_strategy_sub_wedge",
44-
"transmission": transmission,
45-
"screening_strategy_wedge_id": "$ispyb_screening_strategy_wedge_id",
46-
"store_result": "ispyb_screening_strategy_sub_wedge_id",
47-
}
48-
ispyb_command_list.append(d)
49-
50-
d = {
51-
"ispyb_command": "update_processing_status",
52-
"program_id": "$ispyb_autoprocprogram_id",
53-
"message": "Processing successful",
54-
"status": "success",
55-
}
56-
ispyb_command_list.append(d)
57-
58-
self.recwrap.send_to("ispyb", {"ispyb_command_list": ispyb_command_list})
59-
self.log.info("Sent %d commands to ISPyB", len(ispyb_command_list))
60-
self.log.debug("Sending %s", json.dumps(ispyb_command_list, indent=2))
61-
6216
def run(self):
6317
assert hasattr(self, "recwrap"), "No recipewrapper object found"
6418

@@ -121,9 +75,9 @@ def run(self):
12175
saturation = (max_count / overload_limit) * average_to_peak
12276
scale_factor = target_countrate_pct / saturation
12377

124-
scaled_transmission = transmission * scale_factor
125-
self.send_to_ispyb(min(100, scaled_transmission))
78+
scaled_transmission = min(1, ( transmission * scale_factor ) / 100)
12679

80+
self.recwrap.send_to("strategy", {"parameters": {"scaled_transmission": scaled_transmission}})
12781
self.log.info("Done.")
12882
return True
12983

0 commit comments

Comments
 (0)