parameters: (self)
docstring: Averages the bin widths at X.
docstring_summary: Averages the bin widths at X.
docstring_tokens: Averages the bin widths at X .
function: def PyExec(self):
          '''
          Averages the bin widths at X.
          '''
          inputWs = self.getProperty(self._PROP_INPUT_WS).value
          x = self.getProperty(self._PROP_X_VALUE).value
          roundingMode = self.getProperty(
              roundinghelper.PROP_NAME_ROUNDING_MODE).value
          n = inputWs.getNumberHistograms()
          widths = numpy.empty(n)
          for wsIndex in range(n):
              xs = inputWs.readX(wsIndex)
              lowerBound = xs[0]
              upperBound = xs[-1]
              if lowerBound > upperBound:
                  lowerBound, upperBound = upperBound, lowerBound
              if x <= lowerBound or x > upperBound:
                  raise RuntimeError(self._PROP_X_VALUE + ' = {0} out of range for workspace index {1}'.format(x, wsIndex))
              binIndex = inputWs.yIndexOfX(x, wsIndex)
              dx = xs[binIndex + 1] - xs[binIndex]
              widths[wsIndex] = dx
          binWidth = numpy.mean(widths)
          binWidth = roundinghelper.round(binWidth, roundingMode)
          self.setProperty(self._PROP_BIN_WIDTH, numpy.abs(binWidth))
function_tokens: def PyExec ( self ) : inputWs = self . getProperty ( self . _PROP_INPUT_WS ) . value x = self . getProperty ( self . _PROP_X_VALUE ) . value roundingMode = self . getProperty ( roundinghelper . PROP_NAME_ROUNDING_MODE ) . value n = inputWs . getNumberHistograms ( ) widths = numpy . empty ( n ) for wsIndex in range ( n ) : xs = inputWs . readX ( wsIndex ) lowerBound = xs [ 0 ] upperBound = xs [ - 1 ] if lowerBound > upperBound : lowerBound , upperBound = upperBound , lowerBound if x <= lowerBound or x > upperBound : raise RuntimeError ( self . _PROP_X_VALUE + ' = {0} out of range for workspace index {1}' . format ( x , wsIndex ) ) binIndex = inputWs . yIndexOfX ( x , wsIndex ) dx = xs [ binIndex + 1 ] - xs [ binIndex ] widths [ wsIndex ] = dx binWidth = numpy . mean ( widths ) binWidth = roundinghelper . round ( binWidth , roundingMode ) self . setProperty ( self . _PROP_BIN_WIDTH , numpy . abs ( binWidth ) )