def as_mantid_script(cls, data, output_path='/tmp'): """ Return the Mantid script associated with the current parameters @param data: dictionary of reduction properties @param output_path: output path to use in the script """ script_file_path = os.path.join(scripts_location,'reduce.py') data.update({'output_path' : output_path}) script = build_script(script_file_path, cls, data) logger.debug("\n-------------------------\n"+script+"\n-------------------------\n") return script
def as_xml(cls, data): """ Create XML from the current data. @param data: dictionary of reduction properties """ data['timestamp'] = time.ctime(); xml_file_path = os.path.join(scripts_location,'reduce.xml') xml = build_script(xml_file_path, cls, data) if is_xml_valid(xml): logger.debug("\n-------------------------\n"+xml+"\n-------------------------\n") return xml else: logger.error("XML is not valid!") return None
def as_xml(cls, data): """ Create XML from the current data. @param data: dictionary of reduction properties """ data['timestamp'] = time.ctime(); dark_corr = data['dark_current_run'] and str(len(data['dark_current_run'])>0) data['dark_corr'] = dark_corr if data['beam_radius'] is None: data['beam_radius']=cls.base_fields['beam_radius'].initial xml_file_path = os.path.join(scripts_location,'reduce.xml') xml = build_script(xml_file_path, cls, data) if is_xml_valid(xml): logger.debug("\n-------------------------\n"+xml+"\n-------------------------\n") return xml else: logger.error("XML is not valid!") return None