Skip to content

Commit

Permalink
Re #4373 Save as ascii in addition to XML
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet committed Dec 29, 2011
1 parent c342c5d commit cc7323a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -437,10 +437,15 @@ def _save_result(self):
"Data Files (*.xml)")
fname = str(QtCore.QFileInfo(fname_qstr).filePath())
if len(fname)>0:
if not fname.endswith('.xml'):
fname += ".xml"

self._stitcher.save_combined(fname)
if fname.endswith('.xml'):
self._stitcher.save_combined(fname, as_canSAS=True)
elif fname.endswith('.txt'):
self._stitcher.save_combined(fname, as_canSAS=False)
else:
fname_tmp = fname + ".xml"
self._stitcher.save_combined(fname_tmp, as_canSAS=True)
fname_tmp = fname + ".txt"
self._stitcher.save_combined(fname_tmp, as_canSAS=False)

def set_state(self, state):
"""
Expand Down
8 changes: 6 additions & 2 deletions Code/Mantid/scripts/LargeScaleStructures/data_stitching.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,14 +282,18 @@ def set_reference(self, id):
raise RuntimeError, "Stitcher: invalid reference ID"
self._reference = id

def save_combined(self, file_path=None):
def save_combined(self, file_path=None, as_canSAS=True):
"""
Save the resulting scaled I(Q) curves in one data file
@param file_path: file to save data in
"""
iq = self.get_scaled_data()
if file_path is not None:
SaveCanSAS1D(Filename=file_path, InputWorkspace=iq)
if as_canSAS:
SaveCanSAS1D(Filename=file_path, InputWorkspace=iq)
else:
SaveAscii(Filename=file_path, InputWorkspace=iq,
Separator="\t", CommentIndicator="# ", WriteXError=True)

def trim_zeros(self, x, y, e, dx):
zipped = zip(x,y,e,dx)
Expand Down

0 comments on commit cc7323a

Please sign in to comment.