Changes in / [ccdee50:e33fcd1] in sasview


Ignore:
File:
1 edited

Legend:

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

    r11a336f raea6bb7  
    329329            surface = None 
    330330 
     331        if self._low_extrapolate: 
     332            try: 
     333                qstar_low, qstar_low_err = inv.get_qstar_low() 
     334            except Exception as ex: 
     335                calculation_failed = True 
     336                msg += str(ex) 
     337        if self._high_extrapolate: 
     338            try: 
     339                qstar_high, qstar_high_err = inv.get_qstar_high() 
     340            except Exception as ex: 
     341                calculation_failed = True 
     342                msg += str(ex) 
     343 
    331344        if (calculation_failed): 
    332345            logging.warning('Calculation failed: {}'.format(msg)) 
    333346            return self.model 
    334         else: 
    335  
    336             if self._low_extrapolate: 
    337                 # for presentation in InvariantDetails 
    338                 qstar_low, qstar_low_err = inv.get_qstar_low() 
    339                 extrapolated_data = inv.get_extra_data_low(self._low_points) 
    340                 power_low = inv.get_extrapolation_power(range='low') 
    341  
    342                 # Plot the chart 
    343                 title = "Low-Q extrapolation" 
    344  
    345                 # Convert the data into plottable 
    346                 extrapolated_data = self._manager.createGuiData(extrapolated_data) 
    347  
    348                 extrapolated_data.name = title 
    349                 extrapolated_data.title = title 
    350                 extrapolated_data.symbol = "Line" 
    351                 extrapolated_data.has_errors = False 
    352  
    353                 # copy labels and units of axes for plotting 
    354                 extrapolated_data._xaxis = temp_data._xaxis 
    355                 extrapolated_data._xunit = temp_data._xunit 
    356                 extrapolated_data._yaxis = temp_data._yaxis 
    357                 extrapolated_data._yunit = temp_data._yunit 
    358  
    359                 # Add the plot to the model item 
    360                 # This needs to run in the main thread 
    361                 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, 
    362372                                       self._model_item, 
    363373                                       extrapolated_data, 
    364374                                       title) 
    365375 
    366             if self._high_extrapolate: 
    367                 # for presentation in InvariantDetails 
    368                 qmax_plot = Q_MAXIMUM_PLOT * max(temp_data.x) 
    369  
    370                 if qmax_plot > Q_MAXIMUM: 
    371                     qmax_plot = Q_MAXIMUM 
    372                 qstar_high, qstar_high_err = inv.get_qstar_high() 
    373                 power_high = inv.get_extrapolation_power(range='high') 
    374                 high_out_data = inv.get_extra_data_high(q_end=qmax_plot, npts=500) 
    375  
    376                 # Plot the chart 
    377                 title = "High-Q extrapolation" 
    378  
    379                 # Convert the data into plottable 
    380                 high_out_data = self._manager.createGuiData(high_out_data) 
    381                 high_out_data.name = title 
    382                 high_out_data.title = title 
    383                 high_out_data.symbol = "Line" 
    384                 high_out_data.has_errors = False 
    385  
    386                 # copy labels and units of axes for plotting 
    387                 high_out_data._xaxis = temp_data._xaxis 
    388                 high_out_data._xunit = temp_data._xunit 
    389                 high_out_data._yaxis = temp_data._yaxis 
    390                 high_out_data._yunit = temp_data._yunit 
    391  
    392                 # Add the plot to the model item 
    393                 # This needs to run in the main thread 
    394                 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, 
    395404                                       self._model_item, high_out_data, title) 
    396405 
    397             item = QtGui.QStandardItem(str(float('%.3g'% volume_fraction))) 
    398             self.model.setItem(WIDGETS.W_VOLUME_FRACTION, item) 
    399             item = QtGui.QStandardItem(str(float('%.3g'% volume_fraction_error))) 
    400             self.model.setItem(WIDGETS.W_VOLUME_FRACTION_ERR, item) 
    401             if surface: 
    402                 item = QtGui.QStandardItem(str(float('%.3g'% surface))) 
    403                 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE, item) 
    404                 item = QtGui.QStandardItem(str(float('%.3g'% surface_error))) 
    405                 self.model.setItem(WIDGETS.W_SPECIFIC_SURFACE_ERR, item) 
    406             item = QtGui.QStandardItem(str(float('%.3g'% qstar_total))) 
    407             self.model.setItem(WIDGETS.W_INVARIANT, item) 
    408             item = QtGui.QStandardItem(str(float('%.3g'% qstar_total_error))) 
    409             self.model.setItem(WIDGETS.W_INVARIANT_ERR, item) 
    410  
    411             item = QtGui.QStandardItem(str(float('%.3g'% qstar_low))) 
    412             self.model.setItem(WIDGETS.D_LOW_QSTAR, item) 
    413             item = QtGui.QStandardItem(str(float('%.3g'% qstar_low_err))) 
    414             self.model.setItem(WIDGETS.D_LOW_QSTAR_ERR, item) 
    415             item = QtGui.QStandardItem(str(float('%.3g'% qstar_high))) 
    416             self.model.setItem(WIDGETS.D_HIGH_QSTAR, item) 
    417             item = QtGui.QStandardItem(str(float('%.3g'% qstar_high_err))) 
    418             self.model.setItem(WIDGETS.D_HIGH_QSTAR_ERR, item) 
    419  
    420             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 
    421430 
    422431    def title(self): 
Note: See TracChangeset for help on using the changeset viewer.