parameters: (self, ws)
docstring: Calculates the beam center's x,y coordinates, and the beam flux
              @param ws : the input [empty beam] workspace
docstring_summary: Calculates the beam center's x,y coordinates, and the beam flux
docstring_tokens: Calculates the beam center s x y coordinates and the beam flux
function: def _process_beam(self, ws):
          """
              Calculates the beam center's x,y coordinates, and the beam flux
              @param ws : the input [empty beam] workspace
          """
          centers = ws + '_centers'
          method = self.getPropertyValue('BeamFinderMethod')
          radius = self.getProperty('BeamRadius').value
          FindCenterOfMassPosition(InputWorkspace=ws, DirectBeam=(method == 'DirectBeam'), BeamRadius=radius, Output=centers)
          beam_x = mtd[centers].cell(0,1)
          beam_y = mtd[centers].cell(1,1)
          AddSampleLog(Workspace=ws, LogName='BeamCenterX', LogText=str(beam_x), LogType='Number')
          AddSampleLog(Workspace=ws, LogName='BeamCenterY', LogText=str(beam_y), LogType='Number')
          DeleteWorkspace(centers)
          if self._mode != 'TOF':
              MoveInstrumentComponent(Workspace=ws, X=-beam_x, Y=-beam_y, ComponentName='detector')
              self._fit_beam_width(input_ws=ws)
          run = mtd[ws].getRun()
          att_coeff = 1.
          if run.hasProperty('attenuator.attenuation_coefficient'):
              att_coeff = run.getLogData('attenuator.attenuation_coefficient').value
              self.log().information('Found attenuator coefficient/value: {0}'.format(att_coeff))
          elif run.hasProperty('attenuator.attenuation_value'):
              att_value = run.getLogData('attenuator.attenuation_value').value
              if float(att_value) < 10. and self._instrument == 'D33':
                  instrument = mtd[ws].getInstrument()
                  param = 'att'+str(int(att_value))
                  if instrument.hasParameter(param):
                      att_coeff = instrument.getNumberParameter(param)[0]
                  else:
                      raise RuntimeError('Unable to find the attenuation coefficient for D33 attenuator #'+str(int(att_value)))
              else:
                  att_coeff = float(att_value)
              self.log().information('Found attenuator coefficient/value: {0}'.format(att_coeff))
          if run.hasProperty('attenuator2.attenuation_value'):
              # D22 can have the second, chopper attenuator
              # In principle, either of the 2 attenuators can be in or out
              # In practice, only one (standard or chopper) is in at a time
              # If one is out, its attenuation_value is set to 1, so it's safe to take the product
              att2_value = run.getLogData('attenuator2.attenuation_value').value
              self.log().information('Found attenuator 2 value: {0}'.format(att2_value))
              att_coeff *= float(att2_value)
          self.log().information('Attenuation coefficient used is: {0}'.format(att_coeff))
          flux_out = self.getPropertyValue('FluxOutputWorkspace')
          if flux_out:
              flux = ws + '_flux'
              CalculateFlux(InputWorkspace=ws, OutputWorkspace=flux, BeamRadius=radius)
              Scale(InputWorkspace=flux, Factor=att_coeff, OutputWorkspace=flux)
              nspec = mtd[ws].getNumberHistograms()
              x = mtd[flux].readX(0)
              y = mtd[flux].readY(0)
              e = mtd[flux].readE(0)
              CreateWorkspace(DataX=x, DataY=np.tile(y, nspec), DataE=np.tile(e, nspec), NSpec=nspec,
                              ParentWorkspace=flux, UnitX='Wavelength', OutputWorkspace=flux)
              mtd[flux].getRun().addProperty('ProcessedAs', 'Beam', True)
              RenameWorkspace(InputWorkspace=flux, OutputWorkspace=flux_out)
              self.setProperty('FluxOutputWorkspace', mtd[flux_out])
function_tokens: def _process_beam ( self , ws ) : centers = ws + '_centers' method = self . getPropertyValue ( 'BeamFinderMethod' ) radius = self . getProperty ( 'BeamRadius' ) . value FindCenterOfMassPosition ( InputWorkspace = ws , DirectBeam = ( method == 'DirectBeam' ) , BeamRadius = radius , Output = centers ) beam_x = mtd [ centers ] . cell ( 0 , 1 ) beam_y = mtd [ centers ] . cell ( 1 , 1 ) AddSampleLog ( Workspace = ws , LogName = 'BeamCenterX' , LogText = str ( beam_x ) , LogType = 'Number' ) AddSampleLog ( Workspace = ws , LogName = 'BeamCenterY' , LogText = str ( beam_y ) , LogType = 'Number' ) DeleteWorkspace ( centers ) if self . _mode != 'TOF' : MoveInstrumentComponent ( Workspace = ws , X = - beam_x , Y = - beam_y , ComponentName = 'detector' ) self . _fit_beam_width ( input_ws = ws ) run = mtd [ ws ] . getRun ( ) att_coeff = 1. if run . hasProperty ( 'attenuator.attenuation_coefficient' ) : att_coeff = run . getLogData ( 'attenuator.attenuation_coefficient' ) . value self . log ( ) . information ( 'Found attenuator coefficient/value: {0}' . format ( att_coeff ) ) elif run . hasProperty ( 'attenuator.attenuation_value' ) : att_value = run . getLogData ( 'attenuator.attenuation_value' ) . value if float ( att_value ) < 10. and self . _instrument == 'D33' : instrument = mtd [ ws ] . getInstrument ( ) param = 'att' + str ( int ( att_value ) ) if instrument . hasParameter ( param ) : att_coeff = instrument . getNumberParameter ( param ) [ 0 ] else : raise RuntimeError ( 'Unable to find the attenuation coefficient for D33 attenuator #' + str ( int ( att_value ) ) ) else : att_coeff = float ( att_value ) self . log ( ) . information ( 'Found attenuator coefficient/value: {0}' . format ( att_coeff ) ) if run . hasProperty ( 'attenuator2.attenuation_value' ) : # D22 can have the second, chopper attenuator # In principle, either of the 2 attenuators can be in or out # In practice, only one (standard or chopper) is in at a time # If one is out, its attenuation_value is set to 1, so it's safe to take the product att2_value = run . getLogData ( 'attenuator2.attenuation_value' ) . value self . log ( ) . information ( 'Found attenuator 2 value: {0}' . format ( att2_value ) ) att_coeff *= float ( att2_value ) self . log ( ) . information ( 'Attenuation coefficient used is: {0}' . format ( att_coeff ) ) flux_out = self . getPropertyValue ( 'FluxOutputWorkspace' ) if flux_out : flux = ws + '_flux' CalculateFlux ( InputWorkspace = ws , OutputWorkspace = flux , BeamRadius = radius ) Scale ( InputWorkspace = flux , Factor = att_coeff , OutputWorkspace = flux ) nspec = mtd [ ws ] . getNumberHistograms ( ) x = mtd [ flux ] . readX ( 0 ) y = mtd [ flux ] . readY ( 0 ) e = mtd [ flux ] . readE ( 0 ) CreateWorkspace ( DataX = x , DataY = np . tile ( y , nspec ) , DataE = np . tile ( e , nspec ) , NSpec = nspec , ParentWorkspace = flux , UnitX = 'Wavelength' , OutputWorkspace = flux ) mtd [ flux ] . getRun ( ) . addProperty ( 'ProcessedAs' , 'Beam' , True ) RenameWorkspace ( InputWorkspace = flux , OutputWorkspace = flux_out ) self . setProperty ( 'FluxOutputWorkspace' , mtd [ flux_out ] )