diff --git a/scripts/Diffraction/isis_powder/polaris.py b/scripts/Diffraction/isis_powder/polaris.py index 523ae5863d8d489cd0889038b1b80b90d0e03836..a13fa7a835e5c781c6154ecb5725bf131cee58a3 100644 --- a/scripts/Diffraction/isis_powder/polaris.py +++ b/scripts/Diffraction/isis_powder/polaris.py @@ -58,11 +58,20 @@ class Polaris(AbstractInst): @staticmethod def _generate_input_file_name(run_number): + polaris_old_name = "POL" + polaris_new_name = "POLARIS" + first_run_new_name = 96912 + if isinstance(run_number, list): - updated_list = ["POL" + str(val) for val in run_number] + # Lists use recursion to deal with individual entries + updated_list = [] + for run in run_number: + updated_list.append(Polaris._generate_input_file_name(run_number=run)) return updated_list else: - return "POL" + str(run_number) + # Select between old and new prefix + prefix = polaris_new_name if int(run_number) >= first_run_new_name else polaris_old_name + return prefix + str(run_number) def _generate_output_file_name(self, run_number_string): return self._generate_input_file_name(run_number=run_number_string) @@ -85,7 +94,8 @@ class Polaris(AbstractInst): return output def _apply_absorb_corrections(self, run_details, van_ws, gen_absorb=False): - return polaris_algs.calculate_absorb_corrections(ws_to_correct=van_ws) + return polaris_algs.calculate_absorb_corrections(ws_to_correct=van_ws, + multiple_scattering=self._inst_settings.multiple_scattering) def _output_focused_ws(self, processed_spectra, run_details, output_mode=None): d_spacing_group, tof_group = polaris_algs.split_into_tof_d_spacing_groups(run_details=run_details, diff --git a/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py b/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py index b753da8cd0391980112f74d45e36ca2359c94a6a..08e8259fe11917a541b13cc31cd45c25a5692c96 100644 --- a/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py +++ b/scripts/Diffraction/isis_powder/polaris_routines/polaris_algs.py @@ -7,7 +7,7 @@ from isis_powder.routines.RunDetails import RunDetails from isis_powder.polaris_routines import polaris_advanced_config -def calculate_absorb_corrections(ws_to_correct): +def calculate_absorb_corrections(ws_to_correct, multiple_scattering): mantid.MaskDetectors(ws_to_correct, SpectraList=list(range(0, 55))) absorb_dict = polaris_advanced_config.absorption_correction_params @@ -18,7 +18,8 @@ def calculate_absorb_corrections(ws_to_correct): mantid.SetSample(InputWorkspace=ws_to_correct, Geometry=geometry_json, Material=material_json) ws_to_correct = mantid.ConvertUnits(InputWorkspace=ws_to_correct, OutputWorkspace=ws_to_correct, Target="TOF") - ws_to_correct = mantid.MayersSampleCorrection(InputWorkspace=ws_to_correct, OutputWorkspace=ws_to_correct) + ws_to_correct = mantid.MayersSampleCorrection(InputWorkspace=ws_to_correct, OutputWorkspace=ws_to_correct, + MultipleScattering=multiple_scattering) ws_to_correct = mantid.ConvertUnits(InputWorkspace=ws_to_correct, OutputWorkspace=ws_to_correct, Target="dSpacing") return ws_to_correct diff --git a/scripts/Diffraction/isis_powder/polaris_routines/polaris_output.py b/scripts/Diffraction/isis_powder/polaris_routines/polaris_output.py index 955286eece086fc0513b7f679fea33c3c99353c9..80dcf7d61151d84bccef68edce65f1430a9aebb9 100644 --- a/scripts/Diffraction/isis_powder/polaris_routines/polaris_output.py +++ b/scripts/Diffraction/isis_powder/polaris_routines/polaris_output.py @@ -8,16 +8,22 @@ def save_polaris_focused_data(d_spacing_group, tof_group, output_paths, run_numb mantid.SaveGSS(InputWorkspace=tof_group, Filename=output_paths["gss_filename"], SplitFiles=False, Append=False) mantid.SaveNexusProcessed(InputWorkspace=tof_group, Filename=output_paths["nxs_filename"], Append=False) - _save_xye(ws_group=d_spacing_group, ws_units="d_spacing", run_number=run_number, - output_folder=output_paths["output_folder"]) + dat_folder_name = "dat_files" + dat_file_destination = os.path.join(output_paths["output_folder"], dat_folder_name) + if not os.path.exists(dat_file_destination): + os.makedirs(dat_file_destination) + + _save_xye(ws_group=d_spacing_group, ws_units="d", run_number=run_number, + output_folder=dat_file_destination) _save_xye(ws_group=tof_group, ws_units="TOF", run_number=run_number, - output_folder=output_paths["output_folder"]) + output_folder=dat_file_destination) def _save_xye(ws_group, ws_units, run_number, output_folder): bank_index = 1 + prefix_filename = "POL" + str(run_number) for ws in ws_group: - outfile_name = str(run_number) + "-b_" + str(bank_index) + "-" + ws_units + ".dat" + outfile_name = prefix_filename + "-b_" + str(bank_index) + "-" + ws_units + ".dat" bank_index += 1 full_file_path = os.path.join(output_folder, outfile_name)