Skip to content

Commit

Permalink
displaying the march dollase result fitting parameters. this refs #67
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanBilheux committed Sep 17, 2021
1 parent b4ed3c6 commit b0e4aae
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,8 @@ def march_dollase_advanced_mode_clicked(self):
o_march.fill_history_table_with_fitting_information()

def march_dollase_item_to_plot_changed(self):
pass
o_march = MarchDollase(parent=self)
o_march.fitting_item_to_plot_changed()

def tab_algorithm_changed(self, tab_index):
logging.info(f"Tab algorithm changed to tab index {tab_index}")
Expand Down
18 changes: 18 additions & 0 deletions notebooks/__code/bragg_edge/peak_fitting_evaluation/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,24 @@ def x_axis_data(self, x_axis_selected='index'):
xaxis = xaxis_index[left_xaxis_index: right_xaxis_index]
return xaxis

def march_dollase_result_fitting_item_selected(self):
if self.parent.ui.march_d_spacing.isChecked():
return 'd_spacing'
elif self.parent.ui.march_sigma.isChecked():
return 'sigma'
elif self.parent.ui.march_alpha.isChecked():
return 'alpha'
elif self.parent.ui.march_a1.isChecked():
return 'a1'
elif self.parent.ui.march_a2.isChecked():
return 'a2'
elif self.parent.ui.march_a5.isChecked():
return 'a5'
elif self.parent.ui.march_a6.isChecked():
return 'a6'
else:
raise NotImplementedError("fitting option parameter not implemented!")

@staticmethod
def units(name='index'):
if name == 'index':
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from __code.table_handler import TableHandler
from __code.bragg_edge.bragg_edge_peak_fitting_gui_utility import GuiUtility
from __code.bragg_edge.get import Get
from __code.bragg_edge.peak_fitting_evaluation.get import Get as GetPeakFitting
from __code.utilities import find_nearest_index
from __code.file_handler import make_ascii_file

Expand Down Expand Up @@ -437,3 +438,19 @@ def export_data_of_selected_rows(self):

message = "{} has been created!".format(output_file_name)
self.parent.ui.statusbar.showMessage(message, 10000) # 10s

def fitting_item_to_plot_changed(self):
o_get = GetPeakFitting(parent=self.parent)
item_to_plot = o_get.march_dollase_result_fitting_item_selected()

fitting_input_dictionary = self.parent.fitting_input_dictionary
march_data = fitting_input_dictionary['rois']

array_to_plot = []
for _roi in march_data.keys():
_value = march_data[_roi]['fitting']['march_dollase'][item_to_plot]
array_to_plot.append(_value)

self.parent.march_dollase_plot.axes.cla()
self.parent.march_dollase_plot.axes.plot(array_to_plot, '*')
self.parent.march_dollase_plot.draw()
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@ def record_result_into_dict(entry_dict, result_object, name_of_parameter, parame

o_march = MarchDollase(parent=self.parent)
o_march.fill_result_table_with_fitting_information()
o_march.fitting_item_to_plot_changed()


class ResultValueError(object):
Expand Down
22 changes: 19 additions & 3 deletions notebooks/ui/ui_bragg_edge_peak_fitting.ui
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,22 @@
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="fit_that_selection_button">
<property name="sizePolicy">
Expand All @@ -376,13 +392,13 @@
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
<height>50</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>16777215</height>
<height>50</height>
</size>
</property>
<property name="text">
Expand Down Expand Up @@ -1577,7 +1593,7 @@
<item>
<widget class="QTabWidget" name="tabWidget_5">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab_11">
<attribute name="title">
Expand Down

0 comments on commit b0e4aae

Please sign in to comment.