@@ -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