예제 #1
0
파일: EnginX.py 프로젝트: gemmaguest/mantid
def _save_out(run_number, focus_directory, focus_general, output, enginx_file_name_format, bank_id):
    """
    save out the files required for the focus

    @param run_number :: the run number of the focused run
    @param focus_directory :: the user directory to save to
    @param focus_general :: the general folder to copy the saved out files to
    @param output :: the workspace to save
    @param enginx_file_name_format :: the naming scheme of the files
    @param bank_id :: the bank being saved

    """
    # work out where to save the files
    dat_name, genie_filename, gss_name, hdf5_name, nxs_name = _find_focus_file_location(bank_id, focus_directory,
                                                                                        enginx_file_name_format,
                                                                                        run_number)
    if not str(bank_id).isnumeric():
        bank_id = 0
    # save the files out to the user directory
    simple.SaveFocusedXYE(InputWorkspace=output, Filename=dat_name, SplitFiles=False,
                          StartAtBankNumber=bank_id)
    simple.SaveGSS(InputWorkspace=output, Filename=gss_name, SplitFiles=False, Bank=bank_id)
    simple.SaveOpenGenieAscii(InputWorkspace=output, Filename=genie_filename, OpenGenieFormat="ENGIN-X Format")
    simple.SaveNexus(InputWorkspace=output, Filename=nxs_name)
    simple.ExportSampleLogsToHDF5(InputWorkspace=output, Filename=hdf5_name, Blacklist="bankid")
    if not focus_general == focus_directory:
        if not os.path.exists(focus_general):
            os.makedirs(focus_general)
        # copy the files to the general directory
        copy2(dat_name, focus_general)
        copy2(gss_name, focus_general)
        copy2(genie_filename, focus_general)
        copy2(nxs_name, focus_general)
        copy2(hdf5_name, focus_general)
예제 #2
0
def _save_out(run_number, focus_directory, focus_general, output, join_string,
              bank_id):
    """
    save out the files required for the focus

    @param run_number :: the run number of the focused run
    @param focus_directory :: the user directory to save to
    @param focus_general :: the general folder to copy the saved out files to
    @param output :: the workspace to save
    @param join_string :: the nameing scheme of the files
    @param bank_id :: the bank being saved

    """
    # work out where to save the files
    filename = os.path.join(focus_directory,
                            join_string.format(run_number, bank_id))
    hdf5_name = os.path.join(focus_directory, run_number + ".hdf5")
    if not unicode(bank_id).isnumeric():
        bank_id = 0
    # save the files out to the user directory
    simple.SaveFocusedXYE(InputWorkspace=output,
                          Filename=filename + ".dat",
                          SplitFiles=False,
                          StartAtBankNumber=bank_id)
    simple.SaveGSS(InputWorkspace=output,
                   Filename=filename + ".gss",
                   SplitFiles=False,
                   Bank=bank_id)
    simple.SaveOpenGenieAscii(InputWorkspace=output,
                              Filename=filename + ".his",
                              OpenGenieFormat="ENGIN-X Format")
    simple.SaveNexus(InputWorkspace=output, Filename=filename + ".nxs")
    simple.ExportSampleLogsToHDF5(InputWorkspace=output,
                                  Filename=hdf5_name,
                                  Blacklist="bankid")
    if not focus_general == focus_directory:
        if not os.path.exists(focus_general):
            os.makedirs(focus_general)
        # copy the files to the general directory
        copy2(filename + ".dat", focus_general)
        copy2(filename + ".gss", focus_general)
        copy2(filename + ".his", focus_general)
        copy2(filename + ".nxs", focus_general)
        copy2(hdf5_name, focus_general)