Changeset a98014ab in sasview
- Timestamp:
- Oct 3, 2018 5:00:21 AM (6 years ago)
- Branches:
- ESS_GUI, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
- Children:
- 34e5170
- Parents:
- 672c0e97
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r672c0e97 ra98014ab 999 999 return menu 1000 1000 1001 def canHaveMagnetism(self): 1002 """ 1003 Checks if the current model has magnetic scattering implemented 1004 """ 1005 current_model = self.cbModel.currentText() 1006 return self.is2D and current_model in self.MAGNETIC_MODELS 1007 1001 1008 def onSelectModel(self): 1002 1009 """ … … 1011 1018 if not model: 1012 1019 return 1013 self.chkMagnetism.setEnabled(self.is2D and model in self.MAGNETIC_MODELS) 1020 self.chkMagnetism.setEnabled(self.canHaveMagnetism()) 1021 self.tabFitting.setTabEnabled(TAB_MAGNETISM, self.chkMagnetism.isChecked() and self.canHaveMagnetism()) 1022 1014 1023 # Reset parameters to fit 1015 1024 self.resetParametersToFit() … … 1584 1593 if self.chkPolydispersity.isChecked(): 1585 1594 params_to_fit += self.poly_params_to_fit 1586 if self.chkMagnetism.isChecked() :1595 if self.chkMagnetism.isChecked() and self.canHaveMagnetism(): 1587 1596 params_to_fit += self.magnet_params_to_fit 1588 1597 if not params_to_fit: … … 2259 2268 if self.chkPolydispersity.isChecked() and self.poly_params_to_fit: 2260 2269 return True 2261 if self.chkMagnetism.isChecked() and self. magnet_params_to_fit:2270 if self.chkMagnetism.isChecked() and self.canHaveMagnetism() and self.magnet_params_to_fit: 2262 2271 return True 2263 2272 return False … … 2493 2502 model.setParam(key, value) 2494 2503 # add magnetic params if asked 2495 if self.chkMagnetism.isChecked() and self. _magnet_model.rowCount() > 0:2504 if self.chkMagnetism.isChecked() and self.canHaveMagnetism() and self._magnet_model.rowCount() > 0: 2496 2505 for key, value in self.magnet_params.items(): 2497 2506 model.setParam(key, value) … … 2966 2975 return 2967 2976 self._magnet_model.clear() 2968 [self.addCheckedMagneticListToModel(param, self._magnet_model) for param in \ 2969 self.model_parameters.call_parameters if param.type == 'magnetic'] 2977 # default initial value 2978 m0 = 0.5e-06 2979 for param in self.model_parameters.call_parameters: 2980 if param.type != 'magnetic': continue 2981 if "M0" in param.name: 2982 m0 += 0.5e-06 2983 value = m0 2984 else: 2985 value = param.default 2986 self.addCheckedMagneticListToModel(param, value) 2987 2970 2988 FittingUtilities.addHeadersToModel(self._magnet_model) 2971 2989 … … 2984 3002 return shell_names 2985 3003 2986 def addCheckedMagneticListToModel(self, param, model):3004 def addCheckedMagneticListToModel(self, param, value): 2987 3005 """ 2988 3006 Wrapper for model update with a subset of magnetic parameters … … 2999 3017 3000 3018 checked_list = [param.name, 3001 str( param.default),3019 str(value), 3002 3020 str(param.limits[0]), 3003 3021 str(param.limits[1]), 3004 3022 param.units] 3005 3023 3006 self.magnet_params[param.name] = param.default3007 3008 FittingUtilities.addCheckedListToModel( model, checked_list)3024 self.magnet_params[param.name] = value 3025 3026 FittingUtilities.addCheckedListToModel(self._magnet_model, checked_list) 3009 3027 3010 3028 def enableStructureFactorControl(self, structure_factor): … … 3517 3535 if self.chkPolydispersity.isChecked(): 3518 3536 self.iterateOverPolyModel(gatherPolyParams) 3519 if self.chkMagnetism.isChecked() and self.c hkMagnetism.isEnabled():3537 if self.chkMagnetism.isChecked() and self.canHaveMagnetism(): 3520 3538 self.iterateOverMagnetModel(gatherMagnetParams) 3521 3539
Note: See TracChangeset
for help on using the changeset viewer.