Skip to content

Commit

Permalink
Fixed issue with q binning defined by user. Program used to crash whe…
Browse files Browse the repository at this point in the history
…n q_min defined by the user was bigger than the q_max calculated by the program. Now the program checks for those values and will assign a new q_min value if q_min is bigger than q_max. This refs #4303.
  • Loading branch information
JeanBilheux committed May 23, 2012
1 parent 3a064e3 commit 1b4cf83
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@ def PyExec(self):

# Load the data into its workspace
allow_multiple = True
print run_numbers

if len(run_numbers)>1 and allow_multiple:

Expand Down Expand Up @@ -841,6 +840,8 @@ def PyExec(self):
_Q = _const * math.sin(theta) / (tofm*1e-6)
_q_axis[t] = _Q*1e-10
q_max = max(_q_axis)
if (q_min >= q_max):
q_min = min(_q_axis)

if (backSubMethod == 1):
ws_integrated_data = ws_name + '_IntegratedDataWks'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def initialize_content(self):
self.connect(self._summary.angle_list, QtCore.SIGNAL("itemSelectionChanged()"), self._angle_changed)
self.connect(self._summary.remove_btn, QtCore.SIGNAL("clicked()"), self._remove_item)
self.connect(self._summary.fourth_column_switch, QtCore.SIGNAL("clicked(bool)"), self._fourth_column_clicked)
self.connect(self._summary.create_ascii_button, QtCore.SIGNAL("clicked()"), self._create_ascii_clicked)

# Catch edited controls
call_back = partial(self._edit_event, ctrl=self._summary.data_peak_from_pixel)
Expand Down Expand Up @@ -160,6 +161,12 @@ def initialize_content(self):
call_back = partial(self._edit_event, ctrl=self._summary.incident_medium_combobox)
self.connect(self._summary.incident_medium_combobox, QtCore.SIGNAL("editTextChanged(QString)"), call_back)

#4th column
call_back = partial(self._edit_event, ctrl=self._summary.dq0)
self.connect(self._summary.dq0, QtCore.SIGNAL("textChanged(QString)"), call_back)
call_back = partial(self._edit_event, ctrl=self._summary.dq_over_q)
self.connect(self._summary.dq_over_q, QtCore.SIGNAL("textChanged(QString)"), call_back)

#name of output file changed
call_back = partial(self._edit_event, ctrl=self._summary.cfg_scaling_factor_file_name)
self.connect(self._summary.cfg_scaling_factor_file_name_browse, QtCore.SIGNAL("clicked()"), call_back)
Expand Down Expand Up @@ -201,6 +208,15 @@ def _output_dir_browse(self):
if output_dir:
self._summary.outdir_edit.setText(output_dir)

def _create_ascii_clicked(self):
"""
Reached by the "Create ASCII" button
"""
print 'inside _create_ascii_clicked'




def browse_config_file_name(self):
'''
Define configuration file name
Expand Down Expand Up @@ -259,6 +275,8 @@ def _reset_warnings(self):
util.set_edited(self._summary.direct_pixel_edit, False)
util.set_edited(self._summary.cfg_scaling_factor_file_name, False)
util.set_edited(self._summary.incident_medium_combobox, False)
util.set_edited(self._summary.dq0, False)
util.set_edited(self._summary.dq_over_q, False)

def _det_angle_offset_chk_changed(self):
is_checked = self._summary.det_angle_offset_check.isChecked()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3808,7 +3808,7 @@ p, li { white-space: pre-wrap; }
</spacer>
</item>
<item>
<widget class="QPushButton" name="outdir_browse_button_3">
<widget class="QPushButton" name="create_ascii_button">
<property name="minimumSize">
<size>
<width>150</width>
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 'data_refl_simple.ui'
#
# Created: Tue May 22 08:02:53 2012
# Created: Wed May 23 05:52:12 2012
# by: PyQt4 UI code generator 4.7.2
#
# WARNING! All changes made in this file will be lost!
Expand Down Expand Up @@ -1284,11 +1284,11 @@ def setupUi(self, Frame):
self.horizontalLayout_29.addWidget(self.dq_over_q)
spacerItem18 = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_29.addItem(spacerItem18)
self.outdir_browse_button_3 = QtGui.QPushButton(self.groupBox_4)
self.outdir_browse_button_3.setMinimumSize(QtCore.QSize(150, 0))
self.outdir_browse_button_3.setMaximumSize(QtCore.QSize(150, 16777215))
self.outdir_browse_button_3.setObjectName("outdir_browse_button_3")
self.horizontalLayout_29.addWidget(self.outdir_browse_button_3)
self.create_ascii_button = QtGui.QPushButton(self.groupBox_4)
self.create_ascii_button.setMinimumSize(QtCore.QSize(150, 0))
self.create_ascii_button.setMaximumSize(QtCore.QSize(150, 16777215))
self.create_ascii_button.setObjectName("create_ascii_button")
self.horizontalLayout_29.addWidget(self.create_ascii_button)
self.verticalLayout_8.addLayout(self.horizontalLayout_29)
self.verticalLayout_4.addWidget(self.groupBox_4)
spacerItem19 = QtGui.QSpacerItem(20, 25, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Fixed)
Expand Down Expand Up @@ -1460,7 +1460,7 @@ def retranslateUi(self, Frame):
self.dq0_unit.setText(QtGui.QApplication.translate("Frame", " 1/Å", None, QtGui.QApplication.UnicodeUTF8))
self.dq_over_q_label.setText(QtGui.QApplication.translate("Frame", "dQ/Q", None, QtGui.QApplication.UnicodeUTF8))
self.dq_over_q.setText(QtGui.QApplication.translate("Frame", "0.045", None, QtGui.QApplication.UnicodeUTF8))
self.outdir_browse_button_3.setText(QtGui.QApplication.translate("Frame", "Create ASCII...", None, QtGui.QApplication.UnicodeUTF8))
self.create_ascii_button.setText(QtGui.QApplication.translate("Frame", "Create ASCII...", None, QtGui.QApplication.UnicodeUTF8))
self.auto_reduce_help_label.setText(QtGui.QApplication.translate("Frame", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
"p, li { white-space: pre-wrap; }\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,10 @@ def convertWorkspaceToQ(ws_data,
returns the new workspace handle
"""

print 'q_binning:'
print q_binning


mt1 = mtd[ws_data]
_tof_axis = mt1.readX(0)[:]
_fromYpixel = min([fromYpixel, toYpixel])
Expand Down

0 comments on commit 1b4cf83

Please sign in to comment.