Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions src/dlstbx/mimas/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@
mimas.MimasISPyBParameter(key="ice_rings.filter", value="true"),
)

XIA2_DIALS_VMXM_SPOTFINDING_PARAMS: Tuple[mimas.MimasISPyBParameter, ...] = (
mimas.MimasISPyBParameter(key="spotfinder.filter.max_separation", value="8"),
mimas.MimasISPyBParameter(
key="spotfinder.threshold.dispersion.kernel_size", value="6,6"
),
mimas.MimasISPyBParameter(
key="spotfinder.threshold.dispersion.sigma_background", value="3"
),
mimas.MimasISPyBParameter(
key="spotfinder.threshold.dispersion.sigma_strong", value="1"
),
)


def xia2_dials_absorption_params(
scenario: mimas.MimasScenario,
Expand Down Expand Up @@ -298,6 +311,8 @@ def handle_rotation_end(
xia2_dials_beamline_extra_params = (
*XIA2_DIALS_COPPER_RINGS_PARAMS,
mimas.MimasISPyBParameter(key="failover", value="true"),
mimas.MimasISPyBParameter(key="remove_blanks", value="true"),
*XIA2_DIALS_VMXM_SPOTFINDING_PARAMS,
)

triggervars_pref: Tuple[mimas.MimasISPyBTriggerVariable, ...] = ()
Expand Down
20 changes: 17 additions & 3 deletions src/dlstbx/wrapper/xia2.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def construct_commandline(
Takes job parameter dictionary, returns array."""

command = ["xia2"]
spotfinding_params = []

for param, values in params["xia2"].items():
if param == "images":
Expand Down Expand Up @@ -56,9 +57,14 @@ def construct_commandline(
"unit_cell": "xia2.settings.unit_cell",
}
for param, value in params["ispyb_parameters"].items():
command.append(translation.get(param, param) + "=" + value)
if param.startswith("spotfinder"):
spotfinding_params.append(f"{param}={value}\n")
if "find_spots.phil_file=spots.phil" not in command:
command.append("find_spots.phil_file=spots.phil")
else:
command.append(translation.get(param, param) + "=" + value)

return command
return command, spotfinding_params

def send_results_to_ispyb(
self,
Expand Down Expand Up @@ -170,7 +176,7 @@ def run_xia2(self, working_directory: Path, params: dict):
)
return False

command = self.construct_commandline(
command, spotfinding_params = self.construct_commandline(
working_directory, params, "s3_urls" in self.recwrap.environment
)
self.log.info("command: %s", " ".join(command))
Expand Down Expand Up @@ -200,6 +206,14 @@ def run_xia2(self, working_directory: Path, params: dict):
subprocess_directory = working_directory / params["program_name"]
subprocess_directory.mkdir(parents=True, exist_ok=True)

# Write out spot finding parameters that are not directly accessible in xia2 to phil file

if spotfinding_params:
with open(subprocess_directory / "spots.phil", "w") as phil:
for phil_param in spotfinding_params:
phil.write(phil_param)
self.log.info(f"Created spots.phil in {subprocess_directory}")

if "dials.integrate.phil_file" in params["xia2"]:
dials_integrate_phil_file = subprocess_directory / params["xia2"].get(
"dials.integrate.phil_file"
Expand Down