Skip to content

Commit

Permalink
Refs #11289. Implemented raw detector tab.
Browse files Browse the repository at this point in the history
  • Loading branch information
wdzhou committed Mar 13, 2015
1 parent 3a54017 commit 8b33900
Show file tree
Hide file tree
Showing 3 changed files with 438 additions and 60 deletions.
37 changes: 27 additions & 10 deletions Code/Mantid/scripts/HFIRPowderReduction/HfirPDReductionGUI.py
@@ -1,3 +1,9 @@
################################################################################
#
# Main class for HFIR powder reduction GUI
#
################################################################################

#pylint: disable=invalid-name
import numpy
import sys
Expand All @@ -6,8 +12,6 @@

from Ui_MainWindow import Ui_MainWindow #import line for the UI python class
from PyQt4 import QtCore, QtGui
#from PyQt4.QtCore import *
#from PyQt4.QtGui import *
try:
_fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
Expand All @@ -16,15 +20,21 @@ def _fromUtf8(s):

from matplotlib.pyplot import setp

# FIXME - Remove after debugging
NOMANTID = True

try:
import mantid.simpleapi as api
import mantid.kernel
from mantid.simpleapi import AnalysisDataService
from mantid.kernel import ConfigService
IMPORT_MANTID = True
except ImportError as e:
print "Unable to import Mantid: %s." % (str(e))
IMPORT_MANTID = False
if NOMANTID is False:
print "Unable to import Mantid: %s." % (str(e))
raise e
else:
print "NO MANTID IS USED FOR DEBUGGING PURPOSE."


#----- default configuration ---------------
Expand Down Expand Up @@ -114,16 +124,17 @@ def _initSetup(self):
""" Initial setup
"""
# FIXME - This part will be implemented soon as default configuration is made
# Mantid configuration
self._instrument = str(self.ui.comboBox_instrument.currentText())
#if IMPORT_MANTID is True:
# config = ConfigService.Instance()
# self._instrument = config["default.instrument"]
#else:
# self._instrument = DEFAULT_INSTRUMENT

# UI widgets setup
self.ui.comboBox_outputFormat.addItems(['Fullprof', 'GSAS', 'Fullprof+GSAS'])

# Mantid configuration
if IMPORT_MANTID is True:
config = ConfigService.Instance()
self._instrument = config["default.instrument"]
else:
self._instrument = DEFAULT_INSTRUMENT

# Set up data source
self._serverAddress = DEFAULT_SERVER
Expand Down Expand Up @@ -316,6 +327,12 @@ def _reduceSpicePDData(self, datafilename, unit, xmin, xmax, binsize):
self._prevoutws = self._outws
self._outws = None

# Rebin
if xmin is None or xmax is None:
binpar = "%.7f" % (binsize)
else:
binpar = "%.7f, %.7f, %.7f" % (xmin, binsize, xmax)

# base workspace name
basewsname = os.path.basename(datafilename).split(".")[0]

Expand Down

0 comments on commit 8b33900

Please sign in to comment.