Changeset 885857e in sasview for theoryview/perspectives
- Timestamp:
- Jan 11, 2010 12:39:38 PM (15 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 6939bd4
- Parents:
- f9a1279
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
theoryview/perspectives/theory/basepage.py
r0277d084 r885857e 508 508 509 509 self.state.model.name= self.model.name 510 511 #Remember fit engine_type for fit panel512 if self.engine_type == None:513 self.engine_type = "scipy"514 if self.manager !=None:515 self.manager._on_change_engine(engine=self.engine_type)516 517 self.state.engine_type = self.engine_type518 510 519 511 new_state = self.state.clone() … … 940 932 pass 941 933 #if is_modified: 942 943 934 # Here we should check whether the boundaries have been modified. 944 935 # If qmin and qmax have been modified, update qmin and qmax and … … 973 964 self.Refresh() 974 965 return is_modified 975 976 def _update_paramv_on_fit(self): 977 """ 978 make sure that update param values just before the fitting 979 """ 980 #flag for qmin qmax check values 981 flag =False 982 is_modified = False 983 ##So make sure that update param values on_Fit. 984 #self._undo.Enable(True) 985 if self.model !=None: 986 ##Check the values 987 self._check_value_enter( self.fittable_param ,is_modified) 988 self._check_value_enter( self.fixed_param ,is_modified) 989 self._check_value_enter( self.parameters ,is_modified) 990 991 # If qmin and qmax have been modified, update qmin and qmax and 992 # Here we should check whether the boundaries have been modified. 993 # If qmin and qmax have been modified, update qmin and qmax and 994 # set the is_modified flag to True 995 if self._validate_qrange(self.qmin, self.qmax): 996 tempmin = float(self.qmin.GetValue()) 997 if tempmin != self.qmin_x: 998 self.qmin_x = tempmin 999 tempmax = float(self.qmax.GetValue()) 1000 if tempmax != self.qmax_x: 1001 self.qmax_x = tempmax 1002 flag = True 1003 else: 1004 flag = False 1005 else: 1006 flag = False 1007 msg= "Cannot Fit :Must select a model!!! " 1008 wx.PostEvent(self.parent, StatusEvent(status = msg )) 1009 1010 return flag 966 1011 967 1012 968 def _is_modified(self, is_modified): … … 1585 1541 for item in list: 1586 1542 #skip angle parameters for 1D 1587 if self.data.__class__.__name__ !="Data2D":1543 if not self.enable2D: 1588 1544 if item in self.orientation_params: 1589 1545 continue 1590 1546 #try: 1591 1547 name = str(item[1]) 1592 1593 if string.find(name,".npts") ==-1 and string.find(name,".nsigmas")==-1: 1594 ## check model parameters range 1595 param_min= None 1596 param_max= None 1597 1598 ## check minimun value 1599 if item[5]!= None and item[5]!= "": 1600 if item[5].GetValue().lstrip().rstrip()!="": 1601 try: 1602 1603 param_min = float(item[5].GetValue()) 1604 if not self._validate_qrange(item[5],item[2]): 1605 if numpy.isfinite(param_min): 1606 item[2].SetValue(format_number(param_min)) 1607 1608 item[5].SetBackgroundColour(wx.WHITE) 1609 item[2].SetBackgroundColour(wx.WHITE) 1610 1611 except: 1612 msg = "Wrong Fit parameter range entered " 1613 wx.PostEvent(self.parent, StatusEvent(status = msg)) 1614 raise ValueError, msg 1615 is_modified = True 1616 ## check maximum value 1617 if item[6]!= None and item[6]!= "": 1618 if item[6].GetValue().lstrip().rstrip()!="": 1619 try: 1620 param_max = float(item[6].GetValue()) 1621 if not self._validate_qrange(item[2],item[6]): 1622 if numpy.isfinite(param_max): 1623 item[2].SetValue(format_number(param_max)) 1624 1625 item[6].SetBackgroundColour(wx.WHITE) 1626 item[2].SetBackgroundColour(wx.WHITE) 1627 except: 1628 msg = "Wrong Fit parameter range entered " 1629 wx.PostEvent(self.parent, StatusEvent(status = msg)) 1630 raise ValueError, msg 1631 is_modified = True 1632 1633 1634 if param_min != None and param_max !=None: 1635 if not self._validate_qrange(item[5], item[6]): 1636 msg= "Wrong Fit range entered for parameter " 1637 msg+= "name %s of model %s "%(name, self.model.name) 1638 wx.PostEvent(self.parent, StatusEvent(status = msg)) 1639 1640 if name in self.model.details.keys(): 1641 self.model.details[name][1:3]= param_min,param_max 1642 is_modified = True 1643 1644 else: 1645 self.model.details [name] = ["",param_min,param_max] 1646 is_modified = True 1548 1647 1549 try: 1648 1550 value= float(item[2].GetValue()) 1649 1650 1551 # If the value of the parameter has changed, 1651 1552 # +update the model and set the is_modified flag … … 1654 1555 is_modified = True 1655 1556 except: 1656 msg = "Wrong Fitparameter value entered "1557 msg = "Wrong parameter value entered " 1657 1558 wx.PostEvent(self.parent, StatusEvent(status = msg)) 1658 1559
Note: See TracChangeset
for help on using the changeset viewer.