parameters: (self)
docstring: Execute the algorithm.
docstring_summary: Execute the algorithm.
docstring_tokens: Execute the algorithm .
function: def PyExec(self):
          """Execute the algorithm."""
          self.log().purge()
          self.setup()
          to_group = []
          scaleFactor = self.getProperty(PropertyNames.SCALE_FACTOR).value
          progress = Progress(self, start=0.0, end=1.0, nreports=self._dimensionality)
          self.log().purge()
          self.log().accumulate('\nNumber of angles treated: {0}\n'.format(self._dimensionality))
          for angle_index in range(self._dimensionality):
              if len(self._db) == 1:
                  runDB = self.make_name(self._db[0])
              else:
                  runDB = self.make_name(self._db[angle_index])
              self.log().accumulate('Angle {0}:\n'.format(angle_index+1))
              self.log().accumulate('Direct Beam: {0}\n'.format(runDB))
              directBeamName = runDB + '_direct'
              directForegroundName = directBeamName + '_frg'
              # always process direct beam; even if it can be the same for different angles,
              # the foreground and background regions might be different
              self.process_direct_beam(directBeamName, directForegroundName, angle_index)
              if not self.is_polarized():
                  runRB = self.make_name(self._rb[angle_index])
                  self.log().accumulate('Reflected Beam: {0}\n'.format(runRB))
                  reflectedBeamName = runRB + '_reflected'
                  reflectedBeamInput = self.compose_run_string(self._rb[angle_index])
                  to_convert_to_q = self.process_reflected_beam(reflectedBeamInput, reflectedBeamName, directBeamName, angle_index)
              else:
                  foreground_names = []
                  run_inputs, run_names = self.compose_polarized_runs_list(angle_index)
                  for (run, name) in zip(run_inputs, run_names):
                      reflectedPolForegroundWSName = self.process_reflected_beam(run, name, directBeamName, angle_index)
                      foreground_names.append(reflectedPolForegroundWSName)
                  to_convert_to_q = self._outWS + '_pol_' + str(angle_index)
                  self.polarization_correction(','.join(foreground_names), to_convert_to_q)
                  for workspace in mtd[to_convert_to_q]:
                      self._autoCleanup.cleanupLater(workspace.getName())
  
              convertedToQName = self._outWS + '_' + str(angle_index)
              self.convert_to_momentum_transfer(to_convert_to_q, convertedToQName, directForegroundName, angle_index)
              if scaleFactor != 1:
                  Scale(InputWorkspace=convertedToQName, OutputWorkspace=convertedToQName, Factor=scaleFactor)
              to_group.append(convertedToQName)
              self._autoCleanup.protect(convertedToQName)
              progress.report()
  
          if len(to_group) > 1:
              try:
                  stitched = self._outWS + '_stitched'
                  use_manual = self.getProperty(PropertyNames.USE_MANUAL_SCALE_FACTORS).value
                  scale_factors = self.getProperty(PropertyNames.MANUAL_SCALE_FACTORS).value
                  Stitch1DMany(InputWorkspaces=to_group, OutputWorkspace=stitched, UseManualScaleFactors=use_manual,
                               ManualScaleFactors=scale_factors)
                  to_group.append(stitched)
              except RuntimeError as re:
                  self.log().warning('Unable to stitch automatically, consider stitching manually: ' + str(re))
  
          GroupWorkspaces(InputWorkspaces=to_group, OutputWorkspace=self._outWS)
          self.setProperty(Prop.OUTPUT_WS, self._outWS)
          self._autoCleanup.finalCleanup()
          self.log().flushNotice()
function_tokens: def PyExec ( self ) : self . log ( ) . purge ( ) self . setup ( ) to_group = [ ] scaleFactor = self . getProperty ( PropertyNames . SCALE_FACTOR ) . value progress = Progress ( self , start = 0.0 , end = 1.0 , nreports = self . _dimensionality ) self . log ( ) . purge ( ) self . log ( ) . accumulate ( '\nNumber of angles treated: {0}\n' . format ( self . _dimensionality ) ) for angle_index in range ( self . _dimensionality ) : if len ( self . _db ) == 1 : runDB = self . make_name ( self . _db [ 0 ] ) else : runDB = self . make_name ( self . _db [ angle_index ] ) self . log ( ) . accumulate ( 'Angle {0}:\n' . format ( angle_index + 1 ) ) self . log ( ) . accumulate ( 'Direct Beam: {0}\n' . format ( runDB ) ) directBeamName = runDB + '_direct' directForegroundName = directBeamName + '_frg' # always process direct beam; even if it can be the same for different angles, # the foreground and background regions might be different self . process_direct_beam ( directBeamName , directForegroundName , angle_index ) if not self . is_polarized ( ) : runRB = self . make_name ( self . _rb [ angle_index ] ) self . log ( ) . accumulate ( 'Reflected Beam: {0}\n' . format ( runRB ) ) reflectedBeamName = runRB + '_reflected' reflectedBeamInput = self . compose_run_string ( self . _rb [ angle_index ] ) to_convert_to_q = self . process_reflected_beam ( reflectedBeamInput , reflectedBeamName , directBeamName , angle_index ) else : foreground_names = [ ] run_inputs , run_names = self . compose_polarized_runs_list ( angle_index ) for ( run , name ) in zip ( run_inputs , run_names ) : reflectedPolForegroundWSName = self . process_reflected_beam ( run , name , directBeamName , angle_index ) foreground_names . append ( reflectedPolForegroundWSName ) to_convert_to_q = self . _outWS + '_pol_' + str ( angle_index ) self . polarization_correction ( ',' . join ( foreground_names ) , to_convert_to_q ) for workspace in mtd [ to_convert_to_q ] : self . _autoCleanup . cleanupLater ( workspace . getName ( ) ) convertedToQName = self . _outWS + '_' + str ( angle_index ) self . convert_to_momentum_transfer ( to_convert_to_q , convertedToQName , directForegroundName , angle_index ) if scaleFactor != 1 : Scale ( InputWorkspace = convertedToQName , OutputWorkspace = convertedToQName , Factor = scaleFactor ) to_group . append ( convertedToQName ) self . _autoCleanup . protect ( convertedToQName ) progress . report ( ) if len ( to_group ) > 1 : try : stitched = self . _outWS + '_stitched' use_manual = self . getProperty ( PropertyNames . USE_MANUAL_SCALE_FACTORS ) . value scale_factors = self . getProperty ( PropertyNames . MANUAL_SCALE_FACTORS ) . value Stitch1DMany ( InputWorkspaces = to_group , OutputWorkspace = stitched , UseManualScaleFactors = use_manual , ManualScaleFactors = scale_factors ) to_group . append ( stitched ) except RuntimeError as re : self . log ( ) . warning ( 'Unable to stitch automatically, consider stitching manually: ' + str ( re ) ) GroupWorkspaces ( InputWorkspaces = to_group , OutputWorkspace = self . _outWS ) self . setProperty ( Prop . OUTPUT_WS , self . _outWS ) self . _autoCleanup . finalCleanup ( ) self . log ( ) . flushNotice ( )