Changeset 75daa79 in sasview
- Timestamp:
- Aug 1, 2011 3:55:38 PM (13 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:
- 4225aed
- Parents:
- 0fd2f27
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sansview/perspectives/fitting/fitpage.py
r3f36675 r75daa79 1627 1627 return self.enable2D 1628 1628 1629 def compute_data_range(self, data): 1630 """ 1631 compute the minimum and the maximum range of the data 1632 return the npts contains in data 1633 :param data: 1634 """ 1635 qmin, qmax, npts = None, None, None 1636 if data is not None: 1637 if not hasattr(data,"data"): 1638 qmin = min(data.x) 1639 # Maximum value of data 1640 qmax = max(data.x) 1641 npts = len(data.x) 1642 else: 1643 qmin = 0 1644 x = max(math.fabs(data.xmin), math.fabs(data.xmax)) 1645 y = max(math.fabs(data.ymin), math.fabs(data.ymax)) 1646 ## Maximum value of data 1647 qmax = math.sqrt(x*x + y*y) 1648 npts = len(data.data) 1649 return qmin, qmax, npts 1650 1651 1629 1652 def set_data(self, data): 1630 1653 """ … … 1670 1693 self.structurebox.Enable() 1671 1694 data_name = self.data.name 1695 data_min, data_max, npts = self.compute_data_range(self.data) 1672 1696 #set maximum range for x in linear scale 1673 1697 if not hasattr(self.data,"data"): #Display only for 1D data fit 1674 # Minimum value of data1675 data_min = min(self.data.x)1676 # Maximum value of data1677 data_max = max(self.data.x)1678 #number of total data points1679 self.Npts_total.SetValue(str(len(self.data.x)))1680 #default:number of data points selected to fit1681 self.Npts_fit.SetValue(str(len(self.data.x)))1682 1698 self.btEditMask.Disable() 1683 1699 self.EditMask_title.Disable() 1684 1700 else: 1685 1701 1686 ## Minimum value of data1687 data_min = 01688 x = max(math.fabs(self.data.xmin), math.fabs(self.data.xmax))1689 y = max(math.fabs(self.data.ymin), math.fabs(self.data.ymax))1690 ## Maximum value of data1691 data_max = math.sqrt(x*x + y*y)1692 #number of total data points1693 self.Npts_total.SetValue(str(len(self.data.data)))1694 #default:number of data points selected to fit1695 self.Npts_fit.SetValue(str(len(self.data.data)))1696 1702 self.btEditMask.Enable() 1697 1703 self.EditMask_title.Enable() 1704 self.Npts_total.SetValue(str(npts)) 1705 #default:number of data points selected to fit 1706 self.Npts_fit.SetValue(str(npts)) 1698 1707 self.Npts_total.SetEditable(False) 1699 1708 self.Npts_total.SetBackgroundColour(\ … … 1707 1716 #self.minimum_q.SetValue(str(data_min)) 1708 1717 #self.maximum_q.SetValue(str(data_max)) 1718 if data_min is None: 1719 data_min = "" 1720 if data_max is None: 1721 data_max = "" 1709 1722 self.qmin.SetValue(str(data_min)) 1710 1723 self.qmax.SetValue(str(data_max))
Note: See TracChangeset
for help on using the changeset viewer.