Changeset aea6bb7 in sasview


Ignore:
Timestamp:
Dec 7, 2018 5:21:41 AM (5 years ago)
Author:
wojciech
Branches:
ESS_GUI, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_opencl, ESS_GUI_sync_sascalc
Children:
1dc1d431, 44a698c
Parents:
740c381
Message:

Removing unnecessary else statemnent from Invariant code

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py

    r740c381 raea6bb7  
    345345            logging.warning('Calculation failed: {}'.format(msg)) 
    346346            return self.model 
    347         else: 
    348             if self._low_extrapolate: 
    349                 extrapolated_data = inv.get_extra_data_low(self._low_points) 
    350                 power_low = inv.get_extrapolation_power(range='low') 
    351  
    352                 # Plot the chart 
    353                 title = "Low-Q extrapolation" 
    354  
    355                 # Convert the data into plottable 
    356                 extrapolated_data = self._manager.createGuiData(extrapolated_data) 
    357  
    358                 extrapolated_data.name = title 
    359                 extrapolated_data.title = title 
    360                 extrapolated_data.symbol = "Line" 
    361                 extrapolated_data.has_errors = False 
    362  
    363                 # copy labels and units of axes for plotting 
    364                 extrapolated_data._xaxis = temp_data._xaxis 
    365                 extrapolated_data._xunit = temp_data._xunit 
    366                 extrapolated_data._yaxis = temp_data._yaxis 
    367                 extrapolated_data._yunit = temp_data._yunit 
    368  
    369                 # Add the plot to the model item 
    370                 # This needs to run in the main thread 
    371                 reactor.callFromThread(GuiUtils.updateModelItemWithPlot, 
     347 
     348        if self._low_extrapolate: 
     349            extrapolated_data = inv.get_extra_data_low(self._low_points) 
     350            power_low = inv.get_extrapolation_power(range='low') 
     351 
     352            # Plot the chart 
     353            title = "Low-Q extrapolation" 
     354 
     355            # Convert the data into plottable 
     356            extrapolated_data = self._manager.createGuiData(extrapolated_data) 
     357 
     358            extrapolated_data.name = title 
     359            extrapolated_data.title = title 
     360            extrapolated_data.symbol = "Line" 
     361            extrapolated_data.has_errors = False 
     362 
     363            # copy labels and units of axes for plotting 
     364            extrapolated_data._xaxis = temp_data._xaxis 
     365            extrapolated_data._xunit = temp_data._xunit 
     366            extrapolated_data._yaxis = temp_data._yaxis 
     367            extrapolated_data._yunit = temp_data._yunit 
     368 
     369            # Add the plot to the model item 
     370            # This needs to run in the main thread 
     371            reactor.callFromThread(GuiUtils.updateModelItemWithPlot, 
    372372                                       self._model_item, 
    373373                                       extrapolated_data, 
    374374                                       title) 
    375375 
    376             if self._high_extrapolate: 
    377                 # for presentation in InvariantDetails 
    378                 qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) 
    379  
    380                 if qmax_plot > Q_MAXIMUM: 
    381                     qmax_plot = Q_MAXIMUM 
    382                 power_high = inv.get_extrapolation_power(range='high') 
    383                 high_out_data = inv.get_extra_data_high(q_end=qmax_plot, npts=500) 
    384  
    385                 # Plot the chart 
    386                 title = "High-Q extrapolation" 
    387  
    388                 # Convert the data into plottable 
    389                 high_out_data = self._manager.createGuiData(high_out_data) 
    390                 high_out_data.name = title 
    391                 high_out_data.title = title 
    392                 high_out_data.symbol = "Line" 
    393                 high_out_data.has_errors = False 
    394  
    395                 # copy labels and units of axes for plotting 
    396                 high_out_data._xaxis = temp_data._xaxis 
    397                 high_out_data._xunit = temp_data._xunit 
    398                 high_out_data._yaxis = temp_data._yaxis 
    399                 high_out_data._yunit = temp_data._yunit 
    400  
    401                 # Add the plot to the model item 
    402                 # This needs to run in the main thread 
    403                 reactor.callFromThread(GuiUtils.updateModelItemWithPlot, 
     376        if self._high_extrapolate: 
     377            # for presentation in InvariantDetails 
     378            qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) 
     379 
     380            if qmax_plot > Q_MAXIMUM: 
     381                qmax_plot = Q_MAXIMUM 
     382            power_high = inv.get_extrapolation_power(range='high') 
     383            high_out_data = inv.get_extra_data_high(q_end=qmax_plot, npts=500) 
     384 
     385            # Plot the chart 
     386            title = "High-Q extrapolation" 
     387 
     388            # Convert the data into plottable 
     389            high_out_data = self._manager.createGuiData(high_out_data) 
     390            high_out_data.name = title 
     391            high_out_data.title = title 
     392            high_out_data.symbol = "Line" 
     393            high_out_data.has_errors = False 
     394 
     395            # copy labels and units of axes for plotting 
     396            high_out_data._xaxis = temp_data._xaxis 
     397            high_out_data._xunit = temp_data._xunit 
     398            high_out_data._yaxis = temp_data._yaxis 
     399            high_out_data._yunit = temp_data._yunit 
     400 
     401            # Add the plot to the model item 
     402            # This needs to run in the main thread 
     403            reactor.callFromThread(GuiUtils.updateModelItemWithPlot, 
    404404                                       self._model_item, high_out_data, title) 
    405405 
    406             item = QtGui.QStandardItem(str(float('%.3g'% volume_fraction))) 
    407             self.model.setItem(WIDGETS.W_VOLUME_FRACTION, item) 
    408             item = QtGui.QStandardItem(str(float('%.3g'% volume_fraction_error))) 
    409             self.model.setItem(WIDGETS.W_VOLUME_FRACTION_ERR, item) 
    410             if surface: 
    411                 item = QtGui.QStandardItem(str(float('%.3g'% surface))) 
    412                 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE, item) 
    413                 item = QtGui.QStandardItem(str(float('%.3g'% surface_error))) 
    414                 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE_ERR, item) 
    415             item = QtGui.QStandardItem(str(float('%.3g'% qstar_total))) 
    416             self.model.setItem(WIDGETS.W_INVARIANT, item) 
    417             item = QtGui.QStandardItem(str(float('%.3g'% qstar_total_error))) 
    418             self.model.setItem(WIDGETS.W_INVARIANT_ERR, item) 
    419  
    420             item = QtGui.QStandardItem(str(float('%.3g'% qstar_low))) 
    421             self.model.setItem(WIDGETS.D_LOW_QSTAR, item) 
    422             item = QtGui.QStandardItem(str(float('%.3g'% qstar_low_err))) 
    423             self.model.setItem(WIDGETS.D_LOW_QSTAR_ERR, item) 
    424             item = QtGui.QStandardItem(str(float('%.3g'% qstar_high))) 
    425             self.model.setItem(WIDGETS.D_HIGH_QSTAR, item) 
    426             item = QtGui.QStandardItem(str(float('%.3g'% qstar_high_err))) 
    427             self.model.setItem(WIDGETS.D_HIGH_QSTAR_ERR, item) 
    428  
    429             return self.model 
     406        item = QtGui.QStandardItem(str(float('%.3g'% volume_fraction))) 
     407        self.model.setItem(WIDGETS.W_VOLUME_FRACTION, item) 
     408        item = QtGui.QStandardItem(str(float('%.3g'% volume_fraction_error))) 
     409        self.model.setItem(WIDGETS.W_VOLUME_FRACTION_ERR, item) 
     410        if surface: 
     411            item = QtGui.QStandardItem(str(float('%.3g'% surface))) 
     412            self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE, item) 
     413            item = QtGui.QStandardItem(str(float('%.3g'% surface_error))) 
     414            self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE_ERR, item) 
     415        item = QtGui.QStandardItem(str(float('%.3g'% qstar_total))) 
     416        self.model.setItem(WIDGETS.W_INVARIANT, item) 
     417        item = QtGui.QStandardItem(str(float('%.3g'% qstar_total_error))) 
     418        self.model.setItem(WIDGETS.W_INVARIANT_ERR, item) 
     419 
     420        item = QtGui.QStandardItem(str(float('%.3g'% qstar_low))) 
     421        self.model.setItem(WIDGETS.D_LOW_QSTAR, item) 
     422        item = QtGui.QStandardItem(str(float('%.3g'% qstar_low_err))) 
     423        self.model.setItem(WIDGETS.D_LOW_QSTAR_ERR, item) 
     424        item = QtGui.QStandardItem(str(float('%.3g'% qstar_high))) 
     425        self.model.setItem(WIDGETS.D_HIGH_QSTAR, item) 
     426        item = QtGui.QStandardItem(str(float('%.3g'% qstar_high_err))) 
     427        self.model.setItem(WIDGETS.D_HIGH_QSTAR_ERR, item) 
     428 
     429        return self.model 
    430430 
    431431    def title(self): 
Note: See TracChangeset for help on using the changeset viewer.