Skip to content

Commit 7c9994c

Browse files
Vmxm spotfinding (#343)
Include custom spot finding parameters for VMXm's dials autoprocessing, which will generate spots.phil in the xia2-dials working directory.
1 parent f0aa602 commit 7c9994c

2 files changed

Lines changed: 32 additions & 3 deletions

File tree

src/dlstbx/mimas/core.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@
4444
mimas.MimasISPyBParameter(key="ice_rings.filter", value="true"),
4545
)
4646

47+
XIA2_DIALS_VMXM_SPOTFINDING_PARAMS: Tuple[mimas.MimasISPyBParameter, ...] = (
48+
mimas.MimasISPyBParameter(key="spotfinder.filter.max_separation", value="8"),
49+
mimas.MimasISPyBParameter(
50+
key="spotfinder.threshold.dispersion.kernel_size", value="6,6"
51+
),
52+
mimas.MimasISPyBParameter(
53+
key="spotfinder.threshold.dispersion.sigma_background", value="3"
54+
),
55+
mimas.MimasISPyBParameter(
56+
key="spotfinder.threshold.dispersion.sigma_strong", value="1"
57+
),
58+
)
59+
4760

4861
def xia2_dials_absorption_params(
4962
scenario: mimas.MimasScenario,
@@ -298,6 +311,8 @@ def handle_rotation_end(
298311
xia2_dials_beamline_extra_params = (
299312
*XIA2_DIALS_COPPER_RINGS_PARAMS,
300313
mimas.MimasISPyBParameter(key="failover", value="true"),
314+
mimas.MimasISPyBParameter(key="remove_blanks", value="true"),
315+
*XIA2_DIALS_VMXM_SPOTFINDING_PARAMS,
301316
)
302317

303318
triggervars_pref: Tuple[mimas.MimasISPyBTriggerVariable, ...] = ()

src/dlstbx/wrapper/xia2.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ def construct_commandline(
2929
Takes job parameter dictionary, returns array."""
3030

3131
command = ["xia2"]
32+
spotfinding_params = []
3233

3334
for param, values in params["xia2"].items():
3435
if param == "images":
@@ -56,9 +57,14 @@ def construct_commandline(
5657
"unit_cell": "xia2.settings.unit_cell",
5758
}
5859
for param, value in params["ispyb_parameters"].items():
59-
command.append(translation.get(param, param) + "=" + value)
60+
if param.startswith("spotfinder"):
61+
spotfinding_params.append(f"{param}={value}\n")
62+
if "find_spots.phil_file=spots.phil" not in command:
63+
command.append("find_spots.phil_file=spots.phil")
64+
else:
65+
command.append(translation.get(param, param) + "=" + value)
6066

61-
return command
67+
return command, spotfinding_params
6268

6369
def send_results_to_ispyb(
6470
self,
@@ -170,7 +176,7 @@ def run_xia2(self, working_directory: Path, params: dict):
170176
)
171177
return False
172178

173-
command = self.construct_commandline(
179+
command, spotfinding_params = self.construct_commandline(
174180
working_directory, params, "s3_urls" in self.recwrap.environment
175181
)
176182
self.log.info("command: %s", " ".join(command))
@@ -200,6 +206,14 @@ def run_xia2(self, working_directory: Path, params: dict):
200206
subprocess_directory = working_directory / params["program_name"]
201207
subprocess_directory.mkdir(parents=True, exist_ok=True)
202208

209+
# Write out spot finding parameters that are not directly accessible in xia2 to phil file
210+
211+
if spotfinding_params:
212+
with open(subprocess_directory / "spots.phil", "w") as phil:
213+
for phil_param in spotfinding_params:
214+
phil.write(phil_param)
215+
self.log.info(f"Created spots.phil in {subprocess_directory}")
216+
203217
if "dials.integrate.phil_file" in params["xia2"]:
204218
dials_integrate_phil_file = subprocess_directory / params["xia2"].get(
205219
"dials.integrate.phil_file"

0 commit comments

Comments
 (0)