def save_calibration(ceria_run, van_run, calibration_directory, calibration_general, name, bank_names, zeros, difcs, difas): """ save the calibration data @param ceria_run :: the run number of the ceria @param van_run :: the run number of the vanadium @param calibration_directory :: the user specific calibration directory to save to @param calibration_general :: the general calibration directory to save to @param name :: the name of the banks being saved @param bank_names :: the list of banks to save @param difas :: the list of difa values to save @param difcs :: the list of difc values to save @param zeros :: the list of tzero values to save """ gsas_iparm_fname = os.path.join(calibration_directory, "ENGINX_" + van_run + "_" + ceria_run + "_" + name + ".prm") # work out what template to use if name == "all_banks": template_file = None elif name == "bank_South": template_file = "template_ENGINX_241391_236516_South_bank.prm" else: template_file = "template_ENGINX_241391_236516_North_bank.prm" # write out the param file to the users directory Utils.write_ENGINX_GSAS_iparam_file(output_file=gsas_iparm_fname, bank_names=bank_names, difa=difas, difc=difcs, tzero=zeros, ceria_run=ceria_run, vanadium_run=van_run, template_file=template_file) if not calibration_general == calibration_directory: # copy the param file to the general directory if not os.path.exists(calibration_general): os.makedirs(calibration_general) copy2(gsas_iparm_fname, calibration_general)
def save_calibration(ceria_run, van_run, calibration_directory, calibration_general, name, bank_names, zeros, difcs): """ save the calibration data @param ceria_run :: the run number of the ceria @param van_run :: the run number of the vanadium @param calibration_directory :: the user specific calibration directory to save to @param calibration_general :: the general calibration directory to save to @param name :: the name of the banks being saved @param bank_names :: the list of banks to save @param difcs :: the list of difc values to save @param zeros :: the list of tzero values to save """ gsas_iparm_fname = os.path.join(calibration_directory, "ENGINX_" + van_run + "_" + ceria_run + "_" + name + ".prm") # work out what template to use if name == "all_banks": template_file = None elif name == "bank_South": template_file = "template_ENGINX_241391_236516_South_bank.prm" else: template_file = "template_ENGINX_241391_236516_North_bank.prm" # write out the param file to the users directory Utils.write_ENGINX_GSAS_iparam_file(output_file=gsas_iparm_fname, bank_names=bank_names, difc=difcs, tzero=zeros, ceria_run=ceria_run, vanadium_run=van_run, template_file=template_file) if not calibration_general == calibration_directory: # copy the param file to the general directory if not os.path.exists(calibration_general): os.makedirs(calibration_general) copy2(gsas_iparm_fname, calibration_general)
def generate_prm_output_file(difa_list, difc_list, tzero_list, bank_name, kwargs_to_pass): file_path = calibration_dir + EnggUtils.generate_output_file_name( ceria_path, instrument, bank=bank_name) EnggUtils.write_ENGINX_GSAS_iparam_file(file_path, difa_list, difc_list, tzero_list, bk2bk_params, **kwargs_to_pass) set_setting(output_settings.INTERFACES_SETTINGS_GROUP, output_settings.ENGINEERING_PREFIX, "last_calibration_path", file_path)
def save_calibration(ceria_run, calibration_directory, calibration_general, name, bank_names, zeros, difcs, difas, bk2bk_params): """ save the calibration data @param ceria_run :: the run number of the ceria @param calibration_directory :: the user specific calibration directory to save to @param calibration_general :: the general calibration directory to save to @param name :: the name of the banks being saved @param bank_names :: the list of banks to save @param difas :: the list of difa values to save @param difcs :: the list of difc values to save @param zeros :: the list of tzero values to save """ file_save_prefix = os.path.join(calibration_directory, "ENGINX_" + ceria_run + "_") gsas_iparm_fname = file_save_prefix + name + ".prm" pdcals_to_save = dict() # fname: workspace # work out what template to use, and which PDCalibration files to save if name == "all_banks": template_file = None pdcals_to_save[file_save_prefix + "bank_North.nxs"] = 'engg_calibration_bank_1' pdcals_to_save[file_save_prefix + "bank_South.nxs"] = 'engg_calibration_bank_2' elif name == "bank_2": template_file = "template_ENGINX_241391_South_bank.prm" pdcals_to_save[file_save_prefix + "bank_South.nxs"] = 'engg_calibration_bank_2' elif name == "bank_1": template_file = "template_ENGINX_241391_North_bank.prm" pdcals_to_save[file_save_prefix + "bank_North.nxs"] = 'engg_calibration_bank_1' else: # cropped uses North bank template template_file = "template_ENGINX_241391_North_bank.prm" pdcals_to_save[file_save_prefix + "cropped.nxs"] = 'engg_calibration_cropped' # write out the param file to the users directory Utils.write_ENGINX_GSAS_iparam_file(output_file=gsas_iparm_fname, bank_names=bank_names, difa=difas, difc=difcs, tzero=zeros, ceria_run=ceria_run, template_file=template_file, bk2bk_params=bk2bk_params) for fname, ws in pdcals_to_save.items(): simple.SaveNexus(InputWorkspace=ws, Filename=fname) if not calibration_general == calibration_directory: # copy the param file to the general directory if not os.path.exists(calibration_general): os.makedirs(calibration_general) copy2(gsas_iparm_fname, calibration_general) for fname in pdcals_to_save.keys(): copy2(fname, calibration_general)