mantidproject / mantid

Main repository for Mantid code
https://www.mantidproject.org
GNU General Public License v3.0
211 stars 124 forks source link

SaveAscii issue #12495

Closed OwenArnold closed 9 years ago

OwenArnold commented 9 years ago

This is a bug report issued to us during the beta test period, that I think we ought to fix from Nina.

Hi,

I  have some trouble with the SaveAscii algorithm, basically I cannot switch off the SpectrumID in my saved file. We have workspaces with multiple spectra but I am only writing out one spectrum at a time. Setting WriteSpectrumID = False used to suppress the spectrumID to be written to the file in this case but it does not anymore.  The problem is that our data fitting programs fall over this single number line and refuse to work with the data until we strip it externally. As we have tens to hundreds of files this is quite a nuisance even with the stripping script we are using to clean up the saved data. Could you please look into this?

The code I am using is, spectrum is an integer: 
SaveAscii(inputwksp, filename, SpectrumList = [spectrum], WriteSpectrumID = False, CommentIndicator = "#", Separator = "Tab", ColumnHeader = False)

In the following function:
def saveslices(inputwksp, dir = None):
    if dir:
        userdirectory = dir
    else:
        userdirectory = "U:/vanWell/April_2015/savetest/"
    spectrum = 0
    print spectrum
    while True:
        try:
            filename = userdirectory + inputwksp + "_" + str(spectrum) + ".dat"
            SaveAscii(inputwksp, filename, SpectrumList = [spectrum], WriteSpectrumID = False, CommentIndicator = "#", Separator = "Tab", ColumnHeader = False)
            spectrum += 1
            print spectrum
        except: 
            print "Break out of loop: " + str(spectrum)
            break

Where spectrum is an integer. This used to work, but hasn’t for the last few releases.

Thanks,

Nina

I think the fix would be as simple as removing these two lines https://github.com/mantidproject/mantid/blob/master/Code/Mantid/Framework/DataHandling/src/SaveAscii2.cpp#L120:L121 but lets see what Mathieu has to say about this first.

OwenArnold commented 9 years ago

This issue was originally trac ticket 11657