Changeset ca4f40d in sasview
- Timestamp:
- Jan 19, 2019 9:57:07 PM (6 years ago)
- Branches:
- master, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249
- Children:
- 1342f6a
- Parents:
- 722c425
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/perspectives/fitting/fitpage.py
r722c425 rca4f40d 18 18 19 19 from sas.sascalc.fit.qsmearing import smear_selection 20 from sas.sascalc.dataloader.data_info import Data1D, Data2D 20 21 21 22 from sas.sasgui.guiframe.events import StatusEvent, NewPlotEvent, \ … … 187 188 :return: True or False 188 189 """ 189 if self.data.__class__.__name__ == "Data2D" or \ 190 self.enable2D: 190 if isinstance(self.data, Data2D) or self.enable2D: 191 191 return True 192 192 return False … … 202 202 203 203 # Check if data is 2D 204 if self.data.__class__.__name__ == "Data2D" or \ 205 self.enable2D: 204 if isinstance(self.data, Data2D) or self.enable2D: 206 205 is_2d_data = True 207 206 … … 518 517 519 518 # check if it is 2D data 520 if self.data.__class__.__name__ == "Data2D"or self.enable2D:519 if isinstance(self.data, Data2D) or self.enable2D: 521 520 is_2d_data = True 522 521 … … 821 820 self.sizer4_4.Add(cb, (iy, ix), (1, 1), 822 821 wx.LEFT | wx.EXPAND | wx.ADJUST_MINSIZE, 5) 823 if self.data.__class__.__name__ == "Data2D" or \ 824 self.enable2D: 822 if isinstance(self.data, Data2D) or self.enable2D: 825 823 cb.Show(True) 826 824 elif cb.IsShown(): … … 834 832 ctl1.SetToolTipString(poly_tip) 835 833 ctl1.SetValue(str(format_number(value, True))) 836 if self.data.__class__.__name__ == "Data2D" or \ 837 self.enable2D: 834 if isinstance(self.data, Data2D) or self.enable2D: 838 835 if first_orient: 839 836 values.SetLabel('PD[ratio], Sig[deg]') … … 869 866 870 867 ctl2.Hide() 871 if self.data.__class__.__name__ == "Data2D" or \ 872 self.enable2D: 868 if isinstance(self.data, Data2D) or self.enable2D: 873 869 if self.is_mac: 874 870 text2.Show(True) … … 895 891 ctl4.Hide() 896 892 897 if self.data.__class__.__name__ == "Data2D" or \ 898 self.enable2D: 893 if isinstance(self.data, Data2D) or self.enable2D: 899 894 ctl3.Show(True) 900 895 ctl4.Show(True) … … 908 903 909 904 Tctl.SetValue(str(format_number(value))) 910 if self.data.__class__.__name__ == "Data2D" or \ 911 self.enable2D: 905 if isinstance(self.data, Data2D) or self.enable2D: 912 906 Tctl.Show(True) 913 907 else: … … 928 922 929 923 Tct2.SetValue(str(format_number(value))) 930 if self.data.__class__.__name__ == "Data2D" or \ 931 self.enable2D: 924 if isinstance(self.data, Data2D) or self.enable2D: 932 925 Tct2.Show(True) 933 926 else: … … 956 949 text2, ctl2, ctl3, ctl4, disp_box]) 957 950 958 if self.data.__class__.__name__ == "Data2D" or \ 959 self.enable2D: 951 if isinstance(self.data, Data2D) or self.enable2D: 960 952 disp_box.Show(True) 961 953 else: … … 1342 1334 flag1 = self.update_pinhole_smear() 1343 1335 flag = flag or flag1 1344 elif self.data.__class__.__name__ != "Data2D" and \ 1345 not self.enable2D: 1336 elif not isinstance(self.data, Data2D) and not self.enable2D: 1346 1337 enable_smearer = not self.disable_smearer.GetValue() 1347 1338 self._manager.set_smearer(smearer=temp_smearer, … … 1416 1407 if event is not None: 1417 1408 event.Skip() 1418 if self.data.__class__.__name__ == "Data2D":1409 if isinstance(self.data, Data2D): 1419 1410 return 1420 1411 is_click = event.LeftDown() … … 1434 1425 if event is not None: 1435 1426 event.Skip() 1436 if self.data.__class__.__name__ == "Data2D":1427 if isinstance(self.data, Data2D): 1437 1428 return 1438 1429 act_ctrl = event.GetEventObject() … … 1450 1441 """ 1451 1442 event.Skip() 1452 if self.data.__class__.__name__ == "Data2D":1443 if isinstance(self.data, Data2D): 1453 1444 return 1454 1445 ctrl = event.GetEventObject() … … 1511 1502 # Check if # of points for theory model are valid(>0). 1512 1503 # check for 2d 1513 if self.data.__class__.__name__ == "Data2D" or \ 1514 self.enable2D: 1504 if isinstance(self.data, Data2D) or self.enable2D: 1515 1505 # set mask 1516 1506 radius = np.sqrt(self.data.qx_data * self.data.qx_data + … … 1564 1554 if item[0].IsShown(): 1565 1555 # Skip the angle parameters if 1D data 1566 if self.data.__class__.__name__ != "Data2D" and \ 1567 not self.enable2D: 1556 if not isinstance(self.data, Data2D) and not self.enable2D: 1568 1557 if item in self.orientation_params: 1569 1558 continue … … 1583 1572 if item[0].IsShown(): 1584 1573 # Skip the angle parameters if 1D data 1585 if self.data.__class__.__name__ != "Data2D" and \ 1586 not self.enable2D: 1574 if not isinstance(self.data, Data2D) and not self.enable2D: 1587 1575 if item in self.orientation_params: 1588 1576 continue … … 1634 1622 #Otherwise no smearing can be applied using smear from data (a Gaussian 1635 1623 #width of zero will cause a divide by zero error) 1636 if self.data.__class__.__name__ == "Data2D":1624 if isinstance(self.data, Data2D): 1637 1625 if data.dqx_data is not None and data.dqy_data is not None \ 1638 1626 and data.dqx_data.all()and data.dqy_data.all(): … … 1654 1642 #Otherwise no smearing can be applied using smear from data (a Gaussian 1655 1643 #width of zero will cause a divide by zero error) 1656 elif self.data.__class__.__name__ == "Data1D":1644 elif isinstance(self.data, Data1D): 1657 1645 #is it valid 1D pinhole resolution data? 1658 1646 if data.dx is not None and np.all(data.dx): … … 1975 1963 di_flag = False 1976 1964 dq_flag = False 1977 if self.data.__class__.__name__ == "Data2D" or \ 1978 self.enable2D: 1965 if isinstance(self.data, Data2D) or self.enable2D: 1979 1966 self.slit_smearer.Disable() 1980 1967 self.pinhole_smearer.Enable(True) … … 2061 2048 # update model plot with new data information 2062 2049 if flag: 2063 if self.data.__class__.__name__ == "Data2D":2050 if isinstance(self.data, Data2D): 2064 2051 self.enable2D = True 2065 2052 self.model_view.SetLabel("2D Mode") … … 2128 2115 npts2fit = 0 2129 2116 qmin, qmax = self.get_range() 2130 if self.data.__class__.__name__ == "Data2D" or \ 2131 self.enable2D: 2117 if isinstance(self.data, Data2D) or self.enable2D: 2132 2118 radius = np.sqrt(self.data.qx_data * self.data.qx_data + 2133 2119 self.data.qy_data * self.data.qy_data) … … 2519 2505 of the values entered for slit smear 2520 2506 """ 2521 if self.data.__class__.__name__ == "Data2D"or self.enable2D:2507 if isinstance(self.data, Data2D) or self.enable2D: 2522 2508 return 2523 2509 # make sure once more if it is smearer … … 2715 2701 for item in self.parameters: 2716 2702 # Skip t ifhe angle parameters if 1D data 2717 if self.data.__class__.__name__ != "Data2D" and\ 2718 not self.enable2D: 2703 if not isinstance(self.data, Data2D) and not self.enable2D: 2719 2704 if item in self.orientation_params: 2720 2705 continue … … 2732 2717 for item in self.fittable_param: 2733 2718 # Skip t ifhe angle parameters if 1D data 2734 if self.data.__class__.__name__ != "Data2D" and\ 2735 not self.enable2D: 2719 if not isinstance(self.data, Data2D) and not self.enable2D: 2736 2720 if item in self.orientation_params: 2737 2721 continue … … 2745 2729 2746 2730 # Calculate num. of angle parameters 2747 if self.data.__class__.__name__ == "Data2D" or \ 2748 self.enable2D: 2731 if isinstance(self.data, Data2D) or self.enable2D: 2749 2732 len_orient_para = 0 2750 2733 else: … … 3039 3022 if not self._has_magnetic: 3040 3023 mag_on_button.Show(False) 3041 elif not self.data.__class__.__name__ == "Data2D":3024 elif not isinstance(self.data, Data2D): 3042 3025 mag_on_button.Show(False) 3043 3026 else: … … 3055 3038 mag_angle_help_button.Show(False) 3056 3039 3057 if not self.data.__class__.__name__ == "Data2D" and \ 3058 not self.enable2D: 3040 if not isinstance(self.data, Data2D) and not self.enable2D: 3059 3041 orient_angle.Hide() 3060 3042 else: … … 3080 3062 cb.SetToolTipString("Check mark to fit") 3081 3063 wx.EVT_CHECKBOX(self, cb.GetId(), self.select_param) 3082 if self.data.__class__.__name__ == "Data2D" or \ 3083 self.enable2D: 3064 if isinstance(self.data, Data2D) or self.enable2D: 3084 3065 cb.Show(True) 3085 3066 else: … … 3096 3077 "Hit 'Enter' after typing to update the plot.") 3097 3078 ctl1.SetValue(format_number(value, True)) 3098 if self.data.__class__.__name__ == "Data2D" or \ 3099 self.enable2D: 3079 if isinstance(self.data, Data2D) or self.enable2D: 3100 3080 ctl1.Show(True) 3101 3081 else: … … 3137 3117 ctl4.Hide() 3138 3118 3139 if self.data.__class__.__name__ == "Data2D" or \ 3140 self.enable2D: 3119 if isinstance(self.data, Data2D) or self.enable2D: 3141 3120 if self.is_mac: 3142 3121 text2.Show(True) … … 3154 3133 units = wx.StaticText(self, -1, "", 3155 3134 style=wx.ALIGN_LEFT) 3156 if self.data.__class__.__name__ == "Data2D" or \ 3157 self.enable2D: 3135 if isinstance(self.data, Data2D) or self.enable2D: 3158 3136 units.Show(True) 3159 3137 else: … … 3234 3212 """ 3235 3213 # more disables for 2D 3236 if self.data.__class__.__name__ == "Data2D" or \ 3237 self.enable2D: 3214 if isinstance(self.data, Data2D) or self.enable2D: 3238 3215 self.slit_smearer.Disable() 3239 3216 self.default_mask = copy.deepcopy(self.data.mask) … … 3241 3218 self.pinhole_smearer.Enable(True) 3242 3219 3243 elif self.data.__class__.__name__ == "Data1D":3220 elif isinstance(self.data, Data1D): 3244 3221 if self.model is not None: 3245 3222 self.slit_smearer.Enable(True)
Note: See TracChangeset
for help on using the changeset viewer.