add exclude range to fit limits #237
@ -365,6 +365,9 @@ class Ui_BaseWindow(object):
|
||||
self.actionBinning.setObjectName("actionBinning")
|
||||
self.actionTNMH = QtWidgets.QAction(BaseWindow)
|
||||
self.actionTNMH.setObjectName("actionTNMH")
|
||||
self.actionExclude_region = QtWidgets.QAction(BaseWindow)
|
||||
self.actionExclude_region.setCheckable(True)
|
||||
self.actionExclude_region.setObjectName("actionExclude_region")
|
||||
self.menuSave.addAction(self.actionSave)
|
||||
self.menuSave.addAction(self.actionExportGraphic)
|
||||
self.menuSave.addAction(self.action_save_fit_parameter)
|
||||
@ -419,6 +422,7 @@ class Ui_BaseWindow(object):
|
||||
self.menuLimits.addAction(self.action_no_range)
|
||||
self.menuLimits.addAction(self.action_x_range)
|
||||
self.menuLimits.addAction(self.action_custom_range)
|
||||
self.menuLimits.addAction(self.actionExclude_region)
|
||||
self.menuFit.addAction(self.action_FitWidget)
|
||||
self.menuFit.addSeparator()
|
||||
self.menuFit.addAction(self.action_create_fit_function)
|
||||
@ -631,6 +635,7 @@ class Ui_BaseWindow(object):
|
||||
self.actionTNMH_model.setText(_translate("BaseWindow", "Tg , Hodge, TNMH,,,"))
|
||||
self.actionBinning.setText(_translate("BaseWindow", "Binning..."))
|
||||
self.actionTNMH.setText(_translate("BaseWindow", "TNMH..."))
|
||||
self.actionExclude_region.setText(_translate("BaseWindow", "Exclude region"))
|
||||
from ..data.datawidget.datawidget import DataWidget
|
||||
from ..data.integral_widget import IntegralWidget
|
||||
from ..data.point_select import PointSelectWidget
|
||||
|
@ -58,7 +58,8 @@ class FitToolbar(QtWidgets.QToolBar):
|
||||
|
||||
@QtCore.pyqtSlot(QtWidgets.QAction)
|
||||
def change_limit_type(self, action: QtWidgets.QAction):
|
||||
is_custom = (action.text() == 'Custom')
|
||||
is_custom = (action.text() in ['Custom', 'Exclude region'])
|
||||
print(is_custom)
|
||||
|
||||
for w in [self.label, self.label2, self.lineedit, self.lineedit2]:
|
||||
w.setEnabled(is_custom)
|
||||
@ -93,5 +94,6 @@ class FitToolbar(QtWidgets.QToolBar):
|
||||
return {
|
||||
'None': 'none',
|
||||
'Visible x range': 'x',
|
||||
'Custom': self.region.getRegion(),
|
||||
'Custom': ('in', self.region.getRegion()),
|
||||
'Exclude region': ('out', self.region.getRegion()),
|
||||
}[action_text]
|
||||
|
@ -888,7 +888,7 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
|
||||
self.fit_dialog.load(self.management.active_sets)
|
||||
for item in self.fit_dialog.preview_lines:
|
||||
self.current_graph_widget.add_external(item)
|
||||
if self.action_custom_range.isChecked():
|
||||
if self.action_custom_range.isChecked() or self.actionExclude_region.isChecked():
|
||||
self.current_graph_widget.add_external(self.fit_toolbar.region)
|
||||
|
||||
block_window = True
|
||||
@ -904,7 +904,7 @@ class NMRMainWindow(QtWidgets.QMainWindow, Ui_BaseWindow):
|
||||
if self.current_graph_widget is None:
|
||||
return
|
||||
|
||||
if action == self.action_custom_range and self.fit_dialog.isVisible():
|
||||
if action in [self.action_custom_range, self.actionExclude_region] and self.fit_dialog.isVisible():
|
||||
self.current_graph_widget.add_external(self.fit_toolbar.region)
|
||||
else:
|
||||
self.current_graph_widget.remove_external(self.fit_toolbar.region)
|
||||
|
@ -511,13 +511,16 @@ class UpperManagement(QtCore.QObject):
|
||||
|
||||
_x = data_i.x
|
||||
|
||||
# options for fit limits 'none', 'x', ('in', custom region), ('out', excluded region)
|
||||
if fit_limits == 'none':
|
||||
inside = slice(None)
|
||||
elif fit_limits == 'x':
|
||||
x_lim, _ = self.graphs[self.current_graph].ranges
|
||||
inside = np.where((_x >= x_lim[0]) & (_x <= x_lim[1]))
|
||||
elif fit_limits[0] == 'in':
|
||||
inside = np.where((_x >= fit_limits[1][0]) & (_x <= fit_limits[1][1]))
|
||||
else:
|
||||
inside = np.where((_x >= fit_limits[0]) & (_x <= fit_limits[1]))
|
||||
inside = np.where((_x < fit_limits[1][0]) | (_x > fit_limits[1][1]))
|
||||
|
||||
try:
|
||||
if isinstance(we, str):
|
||||
|
@ -247,6 +247,7 @@
|
||||
<addaction name="action_no_range"/>
|
||||
<addaction name="action_x_range"/>
|
||||
<addaction name="action_custom_range"/>
|
||||
<addaction name="actionExclude_region"/>
|
||||
</widget>
|
||||
<addaction name="action_FitWidget"/>
|
||||
<addaction name="separator"/>
|
||||
@ -1021,6 +1022,14 @@
|
||||
<string>TNMH...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionExclude_region">
|
||||
<property name="checkable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Exclude region</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
Loading…
Reference in New Issue
Block a user