Skip to content

Commit

Permalink
Re #5042 Add range for scaling to specular ridge
Browse files Browse the repository at this point in the history
  • Loading branch information
mdoucet committed Mar 30, 2012
1 parent 935fae2 commit ba5e543
Show file tree
Hide file tree
Showing 4 changed files with 74 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ def initialize_content(self):
Initialize the content of the frame
"""
# Apply and save buttons
self.connect(self._content.pick_unity_range_btn, QtCore.SIGNAL("clicked()"), self._pick_specular_ridge)
self.connect(self._content.auto_scale_btn, QtCore.SIGNAL("clicked()"), self._apply)
self.connect(self._content.save_btn, QtCore.SIGNAL("clicked()"), self._save_result)
self._content.max_q_unity_edit.setText("0.01")
Expand Down Expand Up @@ -215,11 +216,30 @@ def _apply(self):
except:
mtd.sendLogMessage("Could not scale data")

def _pick_specular_ridge(self):
from LargeScaleStructures import data_stitching
refID = 0
if len(self._workspace_list)==0:
return

for i in range(len(self._workspace_list)):
item = self._workspace_list[i]
if item.is_selected():
refID = i

def call_back(xmin, xmax):
self._content.min_q_unity_edit.setText("%-g" % xmin)
self._content.max_q_unity_edit.setText("%-g" % xmax)

if mtd.workspaceExists(self._workspace_list[refID].name):
data_stitching.RangeSelector.connect([self._workspace_list[refID].name], call_back)

def _scale_data_sets(self):
"""
Perform auto-scaling
"""
scale_to_unity = self._content.scale_to_one_chk.isChecked()
min_q_unity = float(self._content.min_q_unity_edit.text())
max_q_unity = float(self._content.max_q_unity_edit.text())

s = Stitcher()
Expand All @@ -242,7 +262,7 @@ def _scale_data_sets(self):
refID = i

if scale_to_unity:
scale = data.scale_to_unity(xmin, min(xmax,max_q_unity))
scale = data.scale_to_unity(max(xmin,min_q_unity), min(xmax,max_q_unity))
data.set_scale(scale)
item.set_scale(scale)

Expand Down
1 change: 1 addition & 0 deletions Code/Mantid/scripts/Interface/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#os.system("pyuic4 -o ui/reflectometer/ui_data_refl.py ui/reflectometer/data_refl.ui")
os.system("pyuic4 -o ui/reflectometer/ui_data_refl_simple.py ui/reflectometer/data_refl_simple.ui")
os.system("pyuic4 -o ui/reflectometer/ui_refm_reduction.py ui/reflectometer/refm_reduction.ui")
os.system("pyuic4 -o ui/reflectometer/ui_refl_stitching.py ui/reflectometer/refl_stitching.ui")
#os.system("pyuic4 -o ui/reflectometer/ui_merging_reflm.py ui/reflectometer/merging_refl.ui")
#os.system("pyuic4 -o ui/reflectometer/ui_merging_reflm.py ui/reflectometer/merging_refm.ui")
#os.system("pyuic4 -o ui/reflectometer/ui_norm_refl.py ui/reflectometer/norm_refl.ui")
Expand Down
36 changes: 33 additions & 3 deletions Code/Mantid/scripts/Interface/ui/reflectometer/refl_stitching.ui
Original file line number Diff line number Diff line change
Expand Up @@ -283,12 +283,12 @@ skip</string>
<item>
<widget class="QLabel" name="max_q_unity_label">
<property name="text">
<string>Max Q where R=1:</string>
<string>Spectular ridge from</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="max_q_unity_edit">
<widget class="QLineEdit" name="min_q_unity_edit">
<property name="minimumSize">
<size>
<width>80</width>
Expand All @@ -306,7 +306,37 @@ skip</string>
<item>
<widget class="QLabel" name="label_6">
<property name="text">
<string>1/Å</string>
<string>1/Å to </string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="max_q_unity_edit">
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>80</width>
<height>16777215</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>1/Å </string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pick_unity_range_btn">
<property name="text">
<string>Pick range</string>
</property>
</widget>
</item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Form implementation generated from reading ui file 'ui/reflectometer/refl_stitching.ui'
#
# Created: Tue Mar 6 08:47:40 2012
# Created: Thu Mar 29 16:55:29 2012
# by: PyQt4 UI code generator 4.7.4
#
# WARNING! All changes made in this file will be lost!
Expand Down Expand Up @@ -119,14 +119,25 @@ def setupUi(self, Frame):
self.max_q_unity_label = QtGui.QLabel(self.scrollAreaWidgetContents)
self.max_q_unity_label.setObjectName("max_q_unity_label")
self.horizontalLayout_2.addWidget(self.max_q_unity_label)
self.min_q_unity_edit = QtGui.QLineEdit(self.scrollAreaWidgetContents)
self.min_q_unity_edit.setMinimumSize(QtCore.QSize(80, 0))
self.min_q_unity_edit.setMaximumSize(QtCore.QSize(80, 16777215))
self.min_q_unity_edit.setObjectName("min_q_unity_edit")
self.horizontalLayout_2.addWidget(self.min_q_unity_edit)
self.label_6 = QtGui.QLabel(self.scrollAreaWidgetContents)
self.label_6.setObjectName("label_6")
self.horizontalLayout_2.addWidget(self.label_6)
self.max_q_unity_edit = QtGui.QLineEdit(self.scrollAreaWidgetContents)
self.max_q_unity_edit.setMinimumSize(QtCore.QSize(80, 0))
self.max_q_unity_edit.setMaximumSize(QtCore.QSize(80, 16777215))
self.max_q_unity_edit.setObjectName("max_q_unity_edit")
self.horizontalLayout_2.addWidget(self.max_q_unity_edit)
self.label_6 = QtGui.QLabel(self.scrollAreaWidgetContents)
self.label_6.setObjectName("label_6")
self.horizontalLayout_2.addWidget(self.label_6)
self.label_7 = QtGui.QLabel(self.scrollAreaWidgetContents)
self.label_7.setObjectName("label_7")
self.horizontalLayout_2.addWidget(self.label_7)
self.pick_unity_range_btn = QtGui.QPushButton(self.scrollAreaWidgetContents)
self.pick_unity_range_btn.setObjectName("pick_unity_range_btn")
self.horizontalLayout_2.addWidget(self.pick_unity_range_btn)
spacerItem4 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem4)
self.auto_scale_btn = QtGui.QPushButton(self.scrollAreaWidgetContents)
Expand Down Expand Up @@ -171,8 +182,10 @@ def retranslateUi(self, Frame):
"points to\n"
"skip", None, QtGui.QApplication.UnicodeUTF8))
self.scale_to_one_chk.setText(QtGui.QApplication.translate("Frame", "Scale to unity", None, QtGui.QApplication.UnicodeUTF8))
self.max_q_unity_label.setText(QtGui.QApplication.translate("Frame", "Max Q where R=1:", None, QtGui.QApplication.UnicodeUTF8))
self.label_6.setText(QtGui.QApplication.translate("Frame", "1/Å", None, QtGui.QApplication.UnicodeUTF8))
self.max_q_unity_label.setText(QtGui.QApplication.translate("Frame", "Spectular ridge from", None, QtGui.QApplication.UnicodeUTF8))
self.label_6.setText(QtGui.QApplication.translate("Frame", "1/Å to ", None, QtGui.QApplication.UnicodeUTF8))
self.label_7.setText(QtGui.QApplication.translate("Frame", "1/Å ", None, QtGui.QApplication.UnicodeUTF8))
self.pick_unity_range_btn.setText(QtGui.QApplication.translate("Frame", "Pick range", None, QtGui.QApplication.UnicodeUTF8))
self.auto_scale_btn.setText(QtGui.QApplication.translate("Frame", "Auto scale", None, QtGui.QApplication.UnicodeUTF8))
self.save_btn.setText(QtGui.QApplication.translate("Frame", "Save", None, QtGui.QApplication.UnicodeUTF8))

0 comments on commit ba5e543

Please sign in to comment.