Changes in / [8e674ccf:60a4e71] in sasview
- Location:
- src/sas/qtgui
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r70f4458 rf3cc979 128 128 129 129 # Find param in volume_params 130 for p in parameters.form_volume_parameters: 130 poly_pars = parameters.form_volume_parameters 131 if is2D: 132 poly_pars += parameters.orientation_parameters 133 for p in poly_pars: 131 134 if p.name != param.name: 132 135 continue -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
rc71b20a rf3cc979 569 569 menu.exec_(self.lstParams.viewport().mapToGlobal(position)) 570 570 except AttributeError as ex: 571 logg ing.error("Error generating context menu: %s" % ex)571 logger.error("Error generating context menu: %s" % ex) 572 572 return 573 573 … … 1227 1227 if model_column in [delegate.poly_pd, delegate.poly_error, delegate.poly_min, delegate.poly_max]: 1228 1228 row = self.getRowFromName(parameter_name) 1229 param_item = self._model_model.item(row) 1229 param_item = self._model_model.item(row).child(0).child(0, model_column) 1230 if param_item is None: 1231 return 1230 1232 self._model_model.blockSignals(True) 1231 param_item. child(0).child(0, model_column).setText(item.text())1233 param_item.setText(item.text()) 1232 1234 self._model_model.blockSignals(False) 1233 1235 … … 1464 1466 self.communicate.statusBarUpdateSignal.emit(msg) 1465 1467 msg += results.mesg 1466 logg ing.error(msg)1468 logger.error(msg) 1467 1469 return 1468 1470 … … 1507 1509 if self.calc_fit._interrupting: 1508 1510 msg = "Fitting cancelled by user after: %s s." % GuiUtils.formatNumber(elapsed) 1509 logg ing.warning("\n"+msg+"\n")1511 logger.warning("\n"+msg+"\n") 1510 1512 else: 1511 1513 msg = "Fitting completed successfully in: %s s." % GuiUtils.formatNumber(elapsed) … … 2060 2062 kernel_module = generate.load_kernel_module(name) 2061 2063 except ModuleNotFoundError as ex: 2062 logg ing.error("Can't find the model "+ str(ex))2064 logger.error("Can't find the model "+ str(ex)) 2063 2065 return 2064 2066 … … 2528 2530 """ 2529 2531 # TODO: remimplement thread cancellation 2530 logg ing.error("".join(traceback.format_exception(etype, value, tb)))2532 logger.error("".join(traceback.format_exception(etype, value, tb))) 2531 2533 2532 2534 def setTableProperties(self, table): … … 2710 2712 2711 2713 if not datafile: 2712 logg ing.info("No weight data chosen.")2714 logger.info("No weight data chosen.") 2713 2715 raise IOError 2714 2716 … … 2809 2811 2810 2812 func = QtWidgets.QComboBox() 2811 # Available range of shells displayed in the combobox2812 func.addItems([str(i) for i in range(param_length+1)])2813 2814 # Respond to index change2815 func.currentIndexChanged.connect(self.modifyShellsInList)2816 2813 2817 2814 # cell 2: combobox 2818 2815 item2 = QtGui.QStandardItem() 2819 self._model_model.appendRow([item1, item2]) 2816 2817 # cell 3: min value 2818 item3 = QtGui.QStandardItem() 2819 2820 # cell 4: max value 2821 item4 = QtGui.QStandardItem() 2822 2823 self._model_model.appendRow([item1, item2, item3, item4]) 2820 2824 2821 2825 # Beautify the row: span columns 2-4 … … 2826 2830 self._n_shells_row = shell_row - 1 2827 2831 2828 # Set the index to the state-kept value 2829 func.setCurrentIndex(self.current_shell_displayed 2830 if self.current_shell_displayed < func.count() else 0) 2831 2832 def modifyShellsInList(self, index): 2832 # Get the default number of shells for the model 2833 kernel_pars = self.kernel_module._model_info.parameters.kernel_parameters 2834 shell_par = None 2835 for par in kernel_pars: 2836 if par.name == param_name: 2837 shell_par = par 2838 break 2839 if not shell_par: 2840 logger.error("Could not find %s in kernel parameters.", param_name) 2841 default_shell_count = shell_par.default 2842 shell_min = 0 2843 shell_max = 0 2844 try: 2845 shell_min = int(shell_par.limits[0]) 2846 shell_max = int(shell_par.limits[1]) 2847 except IndexError as ex: 2848 # no info about limits 2849 pass 2850 item3.setText(str(shell_min)) 2851 item4.setText(str(shell_max)) 2852 2853 # Respond to index change 2854 func.currentTextChanged.connect(self.modifyShellsInList) 2855 2856 # Available range of shells displayed in the combobox 2857 func.addItems([str(i) for i in range(shell_min, shell_max+1)]) 2858 2859 # Add default number of shells to the model 2860 func.setCurrentText(str(default_shell_count)) 2861 2862 def modifyShellsInList(self, text): 2833 2863 """ 2834 2864 Add/remove additional multishell parameters … … 2837 2867 first_row = self._n_shells_row + 1 2838 2868 remove_rows = self._num_shell_params 2869 try: 2870 index = int(text) 2871 except ValueError: 2872 # bad text on the control! 2873 index = 0 2874 logger.error("Multiplicity incorrect! Setting to 0") 2839 2875 2840 2876 if remove_rows > 1: … … 2851 2887 self.current_shell_displayed = index 2852 2888 2853 # Change 'n' in the parameter model, thereby updating the underlying model 2889 # Param values for existing shells were reset to default; force all changes into kernel module 2890 for row in new_rows: 2891 par = row[0].text() 2892 val = GuiUtils.toDouble(row[1].text()) 2893 self.kernel_module.setParam(par, val) 2894 2895 # Change 'n' in the parameter model; also causes recalculation 2854 2896 self._model_model.item(self._n_shells_row, 1).setText(str(index)) 2855 2897 -
src/sas/qtgui/Perspectives/Fitting/UnitTesting/FittingWidgetTest.py
r3fbd77b rf712bf30 613 613 614 614 # Check that the number of rows increased 615 # (note that n == 1 by default in core_multi_shell so this increases index by 2) 615 616 more_rows = self.widget._model_model.rowCount() - last_row 616 self.assertEqual(more_rows, 6) # 6new rows: 2 params per index617 618 # Backto 0617 self.assertEqual(more_rows, 4) # 4 new rows: 2 params per index 618 619 # Set to 0 619 620 self.widget.lstParams.indexWidget(func_index).setCurrentIndex(0) 620 self.assertEqual(self.widget._model_model.rowCount(), last_row )621 self.assertEqual(self.widget._model_model.rowCount(), last_row - 2) # 2 fewer rows than default 621 622 622 623 def testPlotTheory(self): -
src/sas/qtgui/Plotting/PlotterBase.py
rd9150d8 r343d7fd 10 10 11 11 import matplotlib.pyplot as plt 12 from matplotlib import rcParams 12 13 13 14 DEFAULT_CMAP = pylab.cm.jet … … 29 30 self.manager = manager 30 31 self.quickplot = quickplot 32 33 # Set auto layout so x/y axis captions don't get cut off 34 rcParams.update({'figure.autolayout': True}) 31 35 32 36 #plt.style.use('ggplot')
Note: See TracChangeset
for help on using the changeset viewer.