Changeset edd166b in sasview for sansview/perspectives/fitting
- Timestamp:
- Nov 20, 2009 12:48:21 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:
- b4ad125
- Parents:
- d23528ee
- Location:
- sansview/perspectives/fitting
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/basepage.py
r35c9d31 redd166b 6 6 import copy 7 7 import math 8 import string 8 9 from sans.guiframe.utils import format_number,check_float 9 10 from sans.guicomm.events import StatusEvent … … 496 497 if hasattr(self, "disp_box"): 497 498 self.state.disp_box = copy.deepcopy(self.disp_box.GetSelection()) 498 499 self.state.model = self.model.clone() 499 500 500 self.state.model.name= self.model.name 501 501 #if not hasattr(self.model, "_persistency_dict"): … … 504 504 505 505 #Remember fit engine_type for fit panel 506 if self.engine_type == None and self.manager !=None: 507 self.engine_type = self.manager._return_engine_type() 508 509 self.state.engine_type = self.engine_type 506 if self.engine_type == None: 507 self.engine_type = "scipy" 508 if self.manager !=None: 509 self.manager._on_change_engine(engine=self.engine_type) 510 #self.engine_type = self.manager._return_engine_type() 511 512 self.state.engine_type = self.engine_type 510 513 511 514 new_state = self.state.clone() … … 720 723 self._save_plotting_range() 721 724 722 #self.state.orientation_params =[]723 #self.state.orientation_params_disp =[]724 #self.state.parameters =[]725 #self.state.fittable_param =[]726 #self.state.fixed_param =[]727 728 729 725 ## save checkbutton state and txtcrtl values 730 726 self._copy_parameters_state(self.orientation_params, … … 755 751 self.enable2D= state.enable2D 756 752 self.engine_type = state.engine_type 757 758 #??? 753 759 754 self.disp_cb_dict = state.disp_cb_dict 760 755 self.disp_list = state.disp_list … … 768 763 self._set_model_sizer_selection( self.model ) 769 764 self.set_model_param_sizer(self.model) 770 765 771 766 ## reset value of combox box 772 767 self.structurebox.SetSelection(state.structurecombobox ) … … 783 778 if hasattr(self, "cb1"): 784 779 self.cb1.SetValue(state.cb1) 785 780 786 781 ## reset state of checkbox,textcrtl and regular parameters value 787 782 … … 794 789 self.enable_disp.SetValue(state.enable_disp) 795 790 self.disable_disp.SetValue(state.disable_disp) 796 791 797 792 if hasattr(self, "disp_box"): 798 793 … … 836 831 self.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 837 832 self.state.disp_cb_dict = copy.deepcopy(state.disp_cb_dict) 838 833 839 834 ##plotting range restore 840 835 self._reset_plotting_range(state) 836 841 837 ## smearing info restore 842 838 if hasattr(self,"enable_smearer"): … … 844 840 self.enable_smearer.SetValue(state.enable_smearer) 845 841 self.disable_smearer.SetValue(state.disable_smearer) 846 self.onSmear(event=None) 847 self.tcChi.SetLabel(str( state.tcChi)) 842 self.onSmear(event=None) 848 843 849 844 ## reset state of checkbox,textcrtl and dispersity parameters value 850 845 self._reset_parameters_state(self.fittable_param,state.fittable_param) 851 846 self._reset_parameters_state(self.fixed_param,state.fixed_param) 852 847 853 848 ## draw the model with previous parameters value 854 849 self._onparamEnter_helper() 855 850 856 851 ## reset context menu items 857 852 self._reset_context_menu() … … 860 855 self.state = state.clone() 861 856 self._draw_model() 862 863 def _clear_Err_on_Fit(self): 864 """ 865 hide the error text control shown 866 after fitting 867 """ 868 """ 869 if hasattr(self,"text2_3"): 870 self.text2_3.Hide() 871 872 if len(self.parameters)>0: 873 for item in self.parameters: 874 ## hide statictext +/- 875 if item[3]!=None and item[3].IsShown(): 876 item[3].Hide() 877 ## hide textcrtl for error after fit 878 if item[4]!=None and item[4].IsShown(): 879 item[4].Clear() 880 item[4].Hide() 881 if len(self.fittable_param)>0: 882 for item in self.fittable_param: 883 ## hide statictext +/- 884 if item[3]!=None and item[3].IsShown(): 885 item[3].Hide() 886 ## hide textcrtl for error after fit 887 if item[4]!=None and item[4].IsShown(): 888 item[4].Clear() 889 item[4].Hide() 890 ##Is this layout necessary? Had a problem w/MAC:Not anymore. 891 self.Layout() 892 """ 893 return 857 894 858 def _selectDlg(self): 895 859 """ … … 963 927 #self._undo.Enable(True) 964 928 if self.model !=None: 965 966 967 # Flag to register when a parameter has changed. 929 # Flag to register when a parameter has changed. 968 930 is_modified = False 969 is_modified =self._check_value_enter( self.fittable_param ,is_modified) 970 is_modified =self._check_value_enter( self.fixed_param ,is_modified) 971 is_modified =self._check_value_enter( self.parameters ,is_modified) 972 973 if is_modified: 974 #self.sizer3.Layout() 975 self.Layout() 976 self.Refresh() 977 else: 978 self.Layout() 931 try: 932 is_modified =self._check_value_enter( self.fittable_param ,is_modified) 933 is_modified =self._check_value_enter( self.fixed_param ,is_modified) 934 is_modified =self._check_value_enter( self.parameters ,is_modified) 935 except: 936 pass 937 #if is_modified: 979 938 980 939 # Here we should check whether the boundaries have been modified. … … 1006 965 self.state_change= True 1007 966 self._draw_model() 1008 967 self.Layout() 968 self.Refresh() 969 1009 970 def _update_paramv_on_fit(self): 1010 971 """ … … 1021 982 self._check_value_enter( self.fittable_param ,is_modified) 1022 983 self._check_value_enter( self.fixed_param ,is_modified) 1023 self._check_value_enter( self.parameters ,is_modified) 984 self._check_value_enter( self.parameters ,is_modified) 1024 985 1025 986 # If qmin and qmax have been modified, update qmin and qmax and … … 1036 997 if float(self.npts.GetValue()) != self.num_points: 1037 998 self.num_points = float(self.npts.GetValue()) 1038 1039 999 else: 1040 1000 msg= "Cannot Fit :Must select a model!!! " … … 1501 1461 tcrtl= event.GetEventObject() 1502 1462 1463 #Clear msg if previously shown. 1464 msg= "" 1465 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1466 1503 1467 ## save current state 1504 1468 self.save_current_state() … … 1511 1475 1512 1476 self._onparamEnter_helper() 1513 1477 1514 1478 else: 1515 1479 msg= "Cannot Plot :Must enter a number!!! " … … 1527 1491 if len(list)==0: 1528 1492 return is_modified 1493 1529 1494 for item in list: 1530 try: 1531 name = str(item[1]) 1532 if hasattr(self,"text2_3") and self.text2_3.IsShown(): 1533 if hasattr(self,"item[4]")and self.item[4] == None: 1534 self.text2_3.Hide() 1535 1495 #skip angle parameters for 1D 1496 if self.data.__class__.__name__ !="Data2D": 1497 if item in self.orientation_params: 1498 continue 1499 #try: 1500 name = str(item[1]) 1501 1502 if string.find(name,".npts") ==-1 and string.find(name,".nsigmas")==-1: 1536 1503 ## check model parameters range 1537 1504 param_min= None 1538 1505 param_max= None 1506 1539 1507 ## check minimun value 1540 if item[5]!= None :1508 if item[5]!= None and item[5]!= "": 1541 1509 if item[5].GetValue().lstrip().rstrip()!="": 1542 param_min = float(item[5].GetValue()) 1510 try: 1511 param_min = float(item[5].GetValue()) 1512 except: 1513 msg = "Wrong Fit parameter range entered " 1514 wx.PostEvent(self.parent.parent, StatusEvent(status = msg)) 1515 raise ValueError, msg 1543 1516 is_modified = True 1544 1517 ## check maximum value 1545 if item[6]!= None :1518 if item[6]!= None and item[5]!= "": 1546 1519 if item[6].GetValue().lstrip().rstrip()!="": 1547 param_max = float(item[6].GetValue()) 1520 try: 1521 param_max = float(item[6].GetValue()) 1522 except: 1523 msg = "Wrong Fit parameter range entered " 1524 wx.PostEvent(self.parent.parent, StatusEvent(status = msg)) 1525 raise ValueError, msg 1548 1526 is_modified = True 1549 1527 from sans.guiframe.utils import check_value 1528 1550 1529 if param_min != None and param_max !=None: 1551 1530 if not check_value(item[5], item[6]): 1552 1531 msg= "Wrong Fit range entered for parameter " 1553 1532 msg+= "name %s of model %s "%(name, self.model.name) 1554 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1533 wx.PostEvent(self.parent.parent, StatusEvent(status = msg)) 1534 1555 1535 if name in self.model.details.keys(): 1556 self.model.details[name][1:]= param_min,param_max 1557 1558 value= float(item[2].GetValue()) 1559 1560 # If the value of the parameter has changed, 1561 # +update the model and set the is_modified flag 1562 if value != self.model.getParam(name): 1563 self.model.setParam(name,value) 1564 is_modified = True 1565 1566 except: 1567 msg= "Model Drawing Error:wrong value entered : %s"% sys.exc_value 1568 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 1569 return 1536 if param_min != self.model.details[name][1] or param_max != self.model.details[name][2]: 1537 self.model.details[name][1:3]= param_min,param_max 1538 is_modified = True 1539 1540 else: 1541 self.model.details [name] = ["",param_min,param_max] 1542 is_modified = True 1543 1544 value= float(item[2].GetValue()) 1545 1546 # If the value of the parameter has changed, 1547 # +update the model and set the is_modified flag 1548 if value != self.model.getParam(name): 1549 self.model.setParam(name,value) 1550 is_modified = True 1551 1570 1552 return is_modified 1571 1553 … … 1617 1599 self.sizer5.Layout() 1618 1600 self.Layout() 1619 #self.Refresh()1601 self.Refresh() 1620 1602 1621 1603 … … 1648 1630 if item in self.param_toFit: 1649 1631 self.param_toFit.remove(item) 1632 1650 1633 for item in self.orientation_params_disp: 1651 1634 if item in self.param_toFit: -
sansview/perspectives/fitting/fitpage.py
rc13b8cc redd166b 44 44 ## default fitengine type 45 45 self.engine_type = None 46 46 47 47 ## draw sizer 48 48 self._fill_datainfo_sizer() … … 57 57 self.enable_smearer.Disable() 58 58 self.disable_smearer.Disable() 59 59 self.disp_cb_dict = {} 60 60 ## to update the panel according to the fit engine type selected 61 61 self.Bind(EVT_FITTER_TYPE,self._on_engine_change) … … 78 78 """ 79 79 self.engine_type = event.type 80 81 80 if len(self.parameters)==0: 81 self.Layout() 82 82 return 83 83 if event.type =="park": … … 138 138 item[6].Show(True) 139 139 self.Layout() 140 self.SetScrollbars(20,20,25,65)141 140 142 141 … … 336 335 for item in self.model.dispersion.keys(): 337 336 if not item in self.model.orientation_params: 338 #if not self.disp_cb_dict.has_key(item):339 #self.disp_cb_dict[item]= None337 if not self.disp_cb_dict.has_key(item): 338 self.disp_cb_dict[item]= None 340 339 name1=item+".width" 341 340 name2=item+".npts" … … 429 428 for item in self.model.dispersion.keys(): 430 429 if item in self.model.orientation_params: 431 430 if not self.disp_cb_dict.has_key(item): 431 self.disp_cb_dict[item]= None 432 432 name1=item+".width" 433 433 name2=item+".npts" … … 497 497 if self.engine_type=="park" and self.data.__class__.__name__ =="Data2D": 498 498 ctl3.Show(True) 499 ctl3.Enable(True)500 499 ctl4.Show(True) 501 ctl4.Enable(True)502 500 503 501 … … 545 543 self.orientation_params_disp.append([None,name3, Tct2 546 544 ,None,None, None, None,None]) 545 """ 547 546 #Display units text on panel 548 547 for item in self.model.dispersion.keys(): 549 548 name = item +".width" 550 549 """ 551 550 self.state.disp_cb_dict = copy.deepcopy(self.disp_cb_dict) 552 551 … … 592 591 593 592 #Clear errors if exist from previous fitting 594 self._clear_Err_on_Fit()593 #self._clear_Err_on_Fit() 595 594 596 595 # Remove or do not allow fitting on the Q=0 point, especially when y(q=0)=None at x[0]. … … 677 676 """ 678 677 tcrtl= event.GetEventObject() 678 #Clear msg if previously shown. 679 msg= "" 680 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 679 681 680 682 if check_float(tcrtl): 681 683 self._onparamEnter_helper() 682 683 684 temp_smearer = None 684 685 if self.enable_smearer.GetValue(): … … 693 694 wx.PostEvent(self.parent, event) 694 695 self.state_change= False 696 695 697 else: 696 698 msg= "Cannot Plot :Must enter a number!!! " … … 703 705 Check validity of value enter in the parameters range field 704 706 """ 705 is_modified = True707 706 708 tcrtl= event.GetEventObject() 709 #Clear msg if previously shown. 710 msg= "" 711 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 712 # Flag to register when a parameter has changed. 713 is_modified = False 707 714 if tcrtl.GetValue().lstrip().rstrip()!="": 708 715 try: 709 716 value = float(tcrtl.GetValue()) 710 717 tcrtl.SetBackgroundColour(wx.WHITE) 711 tcrtl.Refresh() 718 self._check_value_enter(self.fittable_param ,is_modified) 719 self._check_value_enter(self.parameters ,is_modified) 720 712 721 except: 713 722 tcrtl.SetBackgroundColour("pink") 714 tcrtl.Refresh() 715 return 723 msg= "Model Error:wrong value entered : %s"% sys.exc_value 724 wx.PostEvent(self.parent.parent, StatusEvent(status = msg )) 725 return 716 726 else: 717 727 tcrtl.SetBackgroundColour(wx.WHITE) 718 self.save_current_state()719 is_modified = False720 728 721 if is_modified: 722 self._onparamEnter_helper() 723 ## new state posted 724 if self.state_change: 725 #self._undo.Enable(True) 726 self.save_current_state() 727 event = PageInfoEvent(page = self) 728 wx.PostEvent(self.parent, event) 729 self.state_change= False 729 #self._undo.Enable(True) 730 self.save_current_state() 731 event = PageInfoEvent(page = self) 732 wx.PostEvent(self.parent, event) 733 self.state_change= False 730 734 self.Layout() 731 735 self.Refresh() 732 736 737 738 def _clear_Err_on_Fit(self): 739 """ 740 hide the error text control shown 741 after fitting 742 """ 743 744 if hasattr(self,"text2_3"): 745 self.text2_3.Hide() 746 747 if len(self.parameters)>0: 748 for item in self.parameters: 749 #Skip t ifhe angle parameters if 1D data 750 if self.data.__class__.__name__ !="Data2D": 751 if item in self.orientation_params: 752 continue 753 if item in self.param_toFit: 754 continue 755 ## hide statictext +/- 756 if item[3]!=None and item[3].IsShown(): 757 item[3].Hide() 758 ## hide textcrtl for error after fit 759 if item[4]!=None and item[4].IsShown(): 760 item[4].Hide() 761 762 if len(self.fittable_param)>0: 763 for item in self.fittable_param: 764 #Skip t ifhe angle parameters if 1D data 765 if self.data.__class__.__name__ !="Data2D": 766 if item in self.orientation_params: 767 continue 768 if item in self.param_toFit: 769 continue 770 ## hide statictext +/- 771 if item[3]!=None and item[3].IsShown(): 772 item[3].Hide() 773 ## hide textcrtl for error after fit 774 if item[4]!=None and item[4].IsShown(): 775 item[4].Hide() 776 777 return 733 778 734 779 … … 742 787 self.state.data= data 743 788 self._fill_datainfo_sizer() 744 self.SetScrollbars(20,20,25,65) 745 self.Layout() 789 790 #self.SetScrollbars(20,20,25,65) 791 #self.Layout() 746 792 747 793 def reset_page(self, state,first=False): … … 749 795 reset the state 750 796 """ 751 752 797 self.reset_page_helper(state) 753 798 import sans.guiframe.gui_manager 754 799 evt = ModelEventbox(model=state.model) 755 wx.PostEvent(self.event_owner, evt) 756 757 self.manager._on_change_engine(engine=self.engine_type) 758 759 #self.state = self 800 wx.PostEvent(self.event_owner, evt) 801 802 if self.engine_type != None: 803 self.manager._on_change_engine(engine=self.engine_type) 804 #self.tcChi.SetLabel(str(format_number(self.tcChi.GetLabel()))) 805 # reset param_toFit 806 self.select_param(event = None) 807 #Save state_fit 760 808 self.save_current_state_fit() 761 #self.set_model_param_sizer(model=state.model)762 809 self.Layout() 763 810 self.Refresh() 764 811 765 812 def get_range(self): 766 813 """ … … 796 843 797 844 """ 798 if out == None: 799 return 845 if out == None or not numpy.isfinite(chisqr): 846 raise ValueError,"Fit error occured..." 847 848 is_modified = False 849 has_error = False 850 self._clear_Err_on_Fit() 800 851 #format chi2 801 852 chi2 = format_number(chisqr) 802 803 853 self.tcChi.SetLabel(chi2) 804 854 805 is_modified = False 806 has_error = False 807 855 #Hide error title 856 if self.text2_3.IsShown(): 857 self.text2_3.Hide() 858 808 859 try: 809 860 n = self.disp_box.GetCurrentSelection() … … 817 868 pass 818 869 #set the panel when fit result are float not list 870 819 871 if out.__class__== numpy.float64: 820 872 self.param_toFit[0][2].SetValue(format_number(out)) 821 self.param_toFit[0][2].Refresh()822 873 823 874 if self.param_toFit[0][4].IsShown: … … 846 897 has_error = True 847 898 else: 848 849 if self.text2_3.IsShown(): 850 self.text2_3.Hide() 899 851 900 i = 0 852 901 #Set the panel when fit result are list 853 for item in self.param_toFit: 854 ## reset error value to initial state 855 if item[3].IsShown(): 856 item[3].Hide() 857 if item[4].IsShown(): 858 item[4].Hide() 859 860 if len(out)<=len(self.param_toFit) and i < len(out): 861 item[2].SetValue(format_number(self.model.getParam(item[1]))) 862 item[2].Refresh() 863 for ind in range(len(out)): 864 865 if item[1] == p_name[ind]: 866 break 867 868 869 if(cov !=None) and len(cov)<=len(self.param_toFit) and i < len(cov): 870 try: 871 name= dispersity.__name__ 872 if name == "GaussianDispersion": 873 if hasattr(self,"text_disp_1" ): 874 if self.text_disp_1!=None: 875 self.text_disp_1.Show(True) 876 except: 877 pass 878 if cov[ind]==None or not numpy.isfinite(cov[ind]): 879 880 if item[3].IsShown: 881 item[3].Hide() 882 if item[4].IsShown: 883 item[4].Hide() 884 885 else: 886 item[3].Show(True) 887 item[3].Refresh() 888 item[4].Show(True) 889 item[4].SetValue(format_number(cov[ind])) 890 item[4].Refresh() 891 has_error = True 892 i += 1 902 for item in self.param_toFit: 903 if len(item)>5 and item != None: 904 ## reset error value to initial state 905 if item[3].IsShown(): 906 item[3].Hide() 907 if item[4].IsShown(): 908 item[4].Hide() 909 910 if len(out)<=len(self.param_toFit):# and i < len(out): 911 val_out = format_number(self.model.getParam(item[1])) 912 if item[2] != val_out: 913 item[2].SetValue(val_out) 914 915 for ind in range(len(out)): 916 917 if item[1] == p_name[ind]: 918 break 919 920 if(cov !=None) and len(cov)<=len(self.param_toFit): 921 922 try: 923 name= dispersity.__name__ 924 if name == "GaussianDispersion": 925 if hasattr(self,"text_disp_1" ): 926 if self.text_disp_1!=None: 927 self.text_disp_1.Show(True) 928 except: 929 pass 930 931 if cov[ind]!=None and numpy.isfinite(cov[ind]): 932 val_err = format_number(cov[ind]) 933 item[3].Show(True) 934 item[4].Show(True) 935 if val_err != item[4].GetValue(): 936 item[4].SetValue(format_number(cov[ind])) 937 has_error = True 938 i += 1 893 939 #Show error title when any errors displayed 894 940 if has_error: 895 941 if not self.text2_3.IsShown(): 896 self.text2_3.Show(True) 897 ## save current state 898 self.save_current_state() 899 900 self.text2_3.Layout() 901 self.sizer3.Layout() 902 self.Layout() 903 self.Refresh() 942 self.text2_3.Show(True) 943 try: 944 ## save current state 945 self.save_current_state() 946 self.Layout() 947 self.Refresh() 948 except: 949 raise 950 self.btFit.SetFocus() 951 904 952 905 953 def onSmear(self, event): … … 943 991 if output ==None: 944 992 output= "-" 993 945 994 self.tcChi.SetLabel(str(format_number(output))) 946 995 947 996 self.sizer5.Layout() 948 #self.sizer5.Refresh()949 self.state.tcChi = output997 self.sizer5.Refresh() 998 self.state.tcChi =self.tcChi 950 999 951 1000 except: … … 1094 1143 self.param_toFit=[] 1095 1144 for item in self.parameters: 1145 #Skip t ifhe angle parameters if 1D data 1146 if self.data.__class__.__name__ !="Data2D": 1147 if item in self.orientation_params: 1148 continue 1096 1149 #Select parameters to fit for list of primary parameters 1097 1150 if item[0].GetValue(): … … 1102 1155 if item in self.param_toFit: 1103 1156 self.param_toFit.remove(item) 1157 1104 1158 #Select parameters to fit for list of fittable parameters with dispersion 1105 1159 for item in self.fittable_param: 1160 #Skip t ifhe angle parameters if 1D data 1161 if self.data.__class__.__name__ !="Data2D": 1162 if item in self.orientation_params: 1163 continue 1106 1164 if item[0].GetValue(): 1107 1165 if not (item in self.param_toFit): … … 1110 1168 #remove parameters from the fitting list 1111 1169 if item in self.param_toFit: 1112 self.param_toFit.remove(item) 1170 self.param_toFit.remove(item) 1171 1172 #Calculate num. of angle parameters 1173 if self.data.__class__.__name__ =="Data2D": 1174 len_orient_para = 0 1175 else: 1176 len_orient_para = len(self.orientation_params) #assume even len 1177 #Total num. of angle parameters 1178 if len(self.fittable_param) > 0: 1179 len_orient_para *= 2 1113 1180 #Set the value of checkbox that selected every checkbox or not 1114 if len(self.parameters)+len(self.fittable_param) ==len(self.param_toFit):1181 if len(self.parameters)+len(self.fittable_param)-len_orient_para ==len(self.param_toFit): 1115 1182 self.cb1.SetValue(True) 1116 1183 else: … … 1247 1314 1248 1315 ctl4.Hide() 1249 1316 1250 1317 if self.engine_type=="park": 1251 1318 ctl3.Show(True) … … 1339 1406 sizer.Add(ctl3, (iy,ix),(1,1), wx.EXPAND|wx.ADJUST_MINSIZE, 0) 1340 1407 ctl3.Hide() 1341 if self.data.__class__.__name__ =="Data2D":1342 ctl3.Show(True)1408 #if self.data.__class__.__name__ =="Data2D": 1409 # ctl3.Show(True) 1343 1410 1344 else:1345 ctl3.Hide()1411 #else: 1412 # ctl3.Hide() 1346 1413 1347 1414 ix += 1 … … 1353 1420 1354 1421 ctl4.Hide() 1355 if self.data.__class__.__name__ =="Data2D": 1356 ctl4.Show(True) 1357 1358 else: 1359 ctl4.Hide() 1360 1361 if self.engine_type !="park" or self.data.__class__.__name__ !="Data2D": 1362 ctl3.Hide() 1363 ctl4.Hide() 1364 else: 1422 1423 if self.engine_type =="park" and self.data.__class__.__name__ =="Data2D": 1365 1424 ctl3.Show(True) 1366 1425 ctl4.Show(True) -
sansview/perspectives/fitting/fitting.py
r464fce54 redd166b 636 636 msg= title +" error: %s" % sys.exc_value 637 637 wx.PostEvent(self.parent, StatusEvent(status= msg, type="stop")) 638 638 return 639 639 640 640 def _onSelect(self,event): … … 769 769 model.setParam(name,result.pvec) 770 770 else: 771 model.setParam(name,result.pvec[i]) 771 if result.pvec[i] != None and numpy.isfinite(result.pvec[i]): 772 model.setParam(name,result.pvec[i]) 772 773 i += 1 773 774 ## Reset values of the current page to fit result … … 812 813 813 814 for page, value in self.page_finder.iteritems(): 815 """ 814 816 if format_number(result.fitness) == page.get_chi2(): 815 817 #ToDo: Compare parameter inputs with outputs too. … … 817 819 msg +=" but chi2 has not been improved..." 818 820 wx.PostEvent(self.parent, StatusEvent(status="%s " % msg)) 819 break 821 break 822 """ 820 823 if value.get_scheduled()==1: 821 824 model = value.get_model() … … 832 835 if p.name == p_name: 833 836 small_out.append(p.value ) 834 model.setParam(param_name,p.value) 837 if p.value != None and numpy.isfinite(p.value): 838 model.setParam(param_name,p.value) 835 839 small_param_name.append(param_name) 836 840 small_cov.append(p.stderr) … … 1243 1247 @param model: the model to plot 1244 1248 """ 1245 1246 1249 x= numpy.linspace(start= qmin, 1247 1250 stop= qmax,
Note: See TracChangeset
for help on using the changeset viewer.