Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove tth max options from Fit Grains Options #1583

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 8 additions & 43 deletions hexrd/ui/indexing/fit_grains_options_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from hexrd.ui.reflections_table import ReflectionsTable
from hexrd.ui.ui_loader import UiLoader
from hexrd.ui.utils import block_signals
from hexrd.ui.utils.dialog import add_help_url

from hexrd.ui.indexing.fit_grains_tolerances_model import (
FitGrainsToleranceModel)
Expand Down Expand Up @@ -41,6 +42,9 @@ def __init__(self, grains_table, ensure_seed_hkls_not_excluded=True,
flags = self.ui.windowFlags()
self.ui.setWindowFlags(flags | Qt.Tool)

url = 'hedm/fit_grains/#fit-grains-options'
add_help_url(self.ui.button_box, url)

self.update_materials()

kwargs = {
Expand Down Expand Up @@ -72,8 +76,6 @@ def __init__(self, grains_table, ensure_seed_hkls_not_excluded=True,
def setup_connections(self):
self.ui.accepted.connect(self.on_accepted)
self.ui.rejected.connect(self.rejected)
self.ui.tth_max_enable.toggled.connect(self.on_tth_max_toggled)
self.ui.tth_max_specify.toggled.connect(self.on_tth_specify_toggled)
self.ui.tolerances_view.selectionModel().selectionChanged.connect(
self.on_tolerances_select)
self.ui.add_row.clicked.connect(self.on_tolerances_add_row)
Expand Down Expand Up @@ -108,10 +110,6 @@ def all_widgets(self):
self.ui.refit_pixel_scale,
self.ui.tolerances_view,
self.ui.threshold,
self.ui.tth_max_enable,
self.ui.tth_max_instrument,
self.ui.tth_max_specify,
self.ui.tth_max_value,
]
return widgets

Expand Down Expand Up @@ -232,29 +230,17 @@ def tolerance_data_modified(self):

self.ui.grains_table_view.tolerances = tolerances

def on_tth_max_toggled(self, checked):
enabled = checked
self.ui.tth_max_instrument.setEnabled(enabled)
self.ui.tth_max_specify.setEnabled(enabled)
specify = self.ui.tth_max_specify.isChecked()
self.ui.tth_max_value.setEnabled(enabled and specify)

def on_tth_specify_toggled(self, checked):
self.ui.tth_max_value.setEnabled(checked)

def update_config(self):
# Set the new config options on the internal config
config = HexrdConfig().indexing_config['fit_grains']
config['npdiv'] = self.ui.npdiv.value()
config['refit'][0] = self.ui.refit_pixel_scale.value()
config['refit'][1] = self.ui.refit_ome_step_scale.value()
config['threshold'] = self.ui.threshold.value()
if not self.ui.tth_max_enable.isChecked():
config['tth_max'] = False
elif self.ui.tth_max_instrument.isChecked():
config['tth_max'] = True
else:
config['tth_max'] = self.ui.tth_max_value.value()

# The user sets the HKLs manually. Make sure this is set to False to
# reflect that.
config['tth_max'] = False

self.tolerances_model.copy_to_config(config)

Expand All @@ -271,27 +257,6 @@ def update_gui_from_config(self, config):
self.ui.refit_ome_step_scale.setValue(config.get('refit')[1])
self.ui.threshold.setValue(config.get('threshold'))

tth_max = config.get('tth_max')
if isinstance(tth_max, bool):
enabled = tth_max
instrument = tth_max
value = 0.0
else:
enabled = True
instrument = False
value = tth_max

self.ui.tth_max_enable.setChecked(enabled)

self.ui.tth_max_instrument.setEnabled(enabled)
self.ui.tth_max_instrument.setChecked(instrument)

self.ui.tth_max_specify.setEnabled(enabled)
self.ui.tth_max_specify.setChecked(not instrument)

self.ui.tth_max_value.setEnabled(enabled and (not instrument))
self.ui.tth_max_value.setValue(value)

tolerances = config.get('tolerance')
self.tolerances_model.update_from_config(tolerances)

Expand Down
4 changes: 4 additions & 0 deletions hexrd/ui/indexing/fit_grains_results_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
from hexrd.ui.navigation_toolbar import NavigationToolbar
from hexrd.ui.ui_loader import UiLoader
from hexrd.ui.utils import block_signals
from hexrd.ui.utils.dialog import add_help_url


COORDS_SLICE = slice(6, 9)
Expand Down Expand Up @@ -68,6 +69,9 @@ def __init__(self, data, material=None, parent=None,
loader = UiLoader()
self.ui = loader.load_file('fit_grains_results_dialog.ui', parent)

url = 'hedm/fit_grains/#fit-grains-results'
add_help_url(self.ui.button_box, url)

self.ui.splitter.setStretchFactor(0, 1)
self.ui.splitter.setStretchFactor(1, 10)
self.ui.export_workflow.setEnabled(allow_export_workflow)
Expand Down
4 changes: 4 additions & 0 deletions hexrd/ui/indexing/view_spots_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@
from hexrd.ui.navigation_toolbar import NavigationToolbar
from hexrd.ui.ui_loader import UiLoader
from hexrd.ui.utils import block_signals
from hexrd.ui.utils.dialog import add_help_url


class ViewSpotsDialog:
def __init__(self, spots, parent=None):
loader = UiLoader()
self.ui = loader.load_file('view_spots_dialog.ui', parent)

url = 'hedm/fit_grains/#visualize-spots'
add_help_url(self.ui.button_box, url)

self.setup_canvas()

self.spots = spots
Expand Down
Loading
Loading