-
Notifications
You must be signed in to change notification settings - Fork 1
Vmxm spotfinding #343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Vmxm spotfinding #343
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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": | ||
|
|
@@ -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, | ||
|
|
@@ -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)) | ||
|
|
@@ -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}") | ||
|
|
||
|
Comment on lines
209
to
216
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To add to the comment I made on the earlier code block, if you created a list of spotfinder params, you could just do
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Run commands back to how they were before and now use spot finding parameters from earlier. |
||
| if "dials.integrate.phil_file" in params["xia2"]: | ||
| dials_integrate_phil_file = subprocess_directory / params["xia2"].get( | ||
| "dials.integrate.phil_file" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit nit-picky but I think this would be more readable as an if and statement rather than nested if statements
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On second thoughts, if you keep the nested if statement, you could create a list of the spotfinder commands and use that later on to create the phil file, rhater than looping through all of the parameters again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have kept nested if statement here and saved parameters to list.