Changeset 8abd96d in sasview


Ignore:
Timestamp:
Aug 11, 2016 6:22:16 AM (8 years ago)
Author:
lewis
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:
b2f21e0d
Parents:
09d6719
Message:

Fix error bar calculations

Fixing the error bar calculations also removes the need to scale the y
axis when changing to a Porod or Kratky plot, so commit f2f6af9 has
effectively been reverted.

Location:
src/sas/sasgui/plottools
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/sas/sasgui/plottools/PlotPanel.py

    r09d6719 r8abd96d  
    12231223        if prop["ylabel"]: 
    12241224            self.subplot.set_ylabel(r"$%s$"%prop["ylabel"]) 
    1225         if prop["xlim"] is not None: 
    1226             self.subplot.set_xlim(prop["xlim"]) 
    1227         if prop["ylim"] is not None: 
    1228             self.subplot.set_ylim(prop["ylim"]) 
    12291225        self.subplot.set_title(prop["title"]) 
    12301226 
     
    17671763        _yscale = 'linear' 
    17681764        for item in list: 
    1769             set_ylim = False # Whether to set ylim based on data points or error bars 
    17701765            item.setLabel(self.xLabel, self.yLabel) 
    17711766            # control axis labels from the panel itself 
     
    18271822                self.graph._yaxis_transformed("1/%s" % yname, "%s" % yunits) 
    18281823            if self.yLabel == "y*x^(2)": 
    1829                 set_ylim = True 
    18301824                item.transformY(transform.toYX2, transform.errToYX2) 
    18311825                xunits = convert_unit(4, self.xaxis_unit) 
     
    18331827                                              "%s%s" % (yunits, xunits)) 
    18341828            if self.yLabel == "y*x^(4)": 
    1835                 set_ylim = True 
    18361829                item.transformY(transform.toYX4, transform.errToYX4) 
    18371830                xunits = convert_unit(4, self.xaxis_unit) 
     
    18641857                self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname, xname), 
    18651858                                              "%s%s" % (yunits, xunits)) 
    1866             if self.viewModel == "Guinier lny vs x^(2)": 
    1867                 item.transformX(transform.toX2, transform.errToX2) 
    1868                 xunits = convert_unit(2, xunits) 
    1869                 self.graph._xaxis_transformed("%s^{2}" % xname, "%s" % xunits) 
    1870                 item.transformY(transform.toLogX, transform.errToLogX) 
    1871                 self.graph._yaxis_transformed("\ln\ \ %s" % yname, "%s" % yunits) 
    1872             if self.viewModel == "Porod y*x^(4) vs x^(4)": 
    1873                 item.transformX(transform.toX4, transform.errToX4) 
    1874                 xunits = convert_unit(4, self.xaxis_unit) 
    1875                 self.graph._xaxis_transformed("%s^{4}" % xname, "%s" % xunits) 
    1876                 item.transformY(transform.toYX4, transform.errToYX4) 
    1877                 self.graph._yaxis_transformed("%s \ \ %s^{4}" % (yname, xname), 
    1878                                               "%s%s" % (yunits, xunits)) 
    18791859            item.transformView() 
    1880             if set_ylim: 
    1881                 self.graph.ylim((min(item.view.y), max(item.view.y))) 
    1882             else: 
    1883                 self.graph.ylim(None) 
    18841860 
    18851861        # set new label and units 
  • src/sas/sasgui/plottools/plottables.py

    rf2f6af9 r8abd96d  
    157157        self.prop["xunit_base"] = units 
    158158 
    159     def xlim(self, xlim): 
    160         """ 
    161         Set the limits of the x axis to (min, max). 
    162         """ 
    163         self.prop["xlim"] = xlim 
    164  
    165159    def yaxis(self, name, units): 
    166160        """ 
     
    173167        self.prop["ylabel_base"] = name 
    174168        self.prop["yunit_base"] = units 
    175  
    176     def ylim(self, ylim): 
    177         """ 
    178         Set the limits of the y axis to (min, max). 
    179         """ 
    180         self.prop["ylim"] = ylim 
    181169 
    182170    def title(self, name): 
     
    278266        self.prop = {"xlabel": "", "xunit": None, 
    279267                     "ylabel": "", "yunit": None, 
    280                      "xlim": None, "ylim": None, 
    281268                     "title": ""} 
    282269        self.plottables = {} 
  • src/sas/sasgui/plottools/transform.py

    rd7bb526 r8abd96d  
    291291 
    292292 
    293 def errToYX2(x, y, dx=None, dy=None): 
     293def errToYX2(y, x, dy=None, dx=None): 
    294294    """ 
    295295    """ 
     
    325325 
    326326 
    327 def errToLogYX2(x, y, dx=None, dy=None): 
     327def errToLogYX2(y, x, dy=None, dx=None): 
    328328    """ 
    329329    calculate error of Log(yx**2) 
     
    375375 
    376376 
    377 def errToLogYX4(x, y=None, dx=None, dy=None): 
     377def errToLogYX4(y, x, dy=None, dx=None): 
    378378    """ 
    379379    error for ln(y*x^(4)) 
     
    396396 
    397397 
    398 def errToYX4(x, y=None, dx=None, dy=None): 
     398def errToYX4(y, x, dy=None, dx=None): 
    399399    """ 
    400400    error for (y*x^(4)) 
Note: See TracChangeset for help on using the changeset viewer.