parameters: (self, search_ws)
return_statement: return selected_peak
docstring: Finds a matching peak over the two banks.
  
          @param search_ws Workspace to search
          @return Peak centres for matching peak over both banks
docstring_summary: Finds a matching peak over the two banks.
docstring_tokens: Finds a matching peak over the two banks .
function: def _get_peak(self, search_ws):
          """
          Finds a matching peak over the two banks.
  
          @param search_ws Workspace to search
          @return Peak centres for matching peak over both banks
          """
  
          find_peak_args = dict()
          if self._peak_position is not None:
              find_peak_args['PeakPositions'] = [self._peak_position]
  
          # Find the peaks in each bank
          FindPeaks(InputWorkspace=search_ws,
                    PeaksList='__bank_1_peaks',
                    WorkspaceIndex=0,
                    PeakFunction=self._peak_function,
                    **find_peak_args)
  
          FindPeaks(InputWorkspace=search_ws,
                    PeaksList='__bank_2_peaks',
                    WorkspaceIndex=1,
                    PeakFunction=self._peak_function,
                    **find_peak_args)
  
          # Sort peaks by height, prefer to match tall peaks
          SortTableWorkspace(InputWorkspace='__bank_1_peaks',
                             OutputWorkspace='__bank_1_peaks',
                             Columns='centre',
                             Ascending=False)
  
          bank_1_ws = mtd['__bank_1_peaks']
          bank_2_ws = mtd['__bank_2_peaks']
  
          matching_peaks = list()
  
          # Find the centres of two peaks that are close to each other on both banks
          for peak_idx in range(0, bank_1_ws.rowCount()):
              bank_1_centre = bank_1_ws.cell('centre', peak_idx)
  
              for other_peak_idx in range(0, bank_2_ws.rowCount()):
                  bank_2_centre = bank_2_ws.cell('centre', other_peak_idx)
  
                  if abs(bank_1_centre - bank_2_centre) < self._peak_tolerance:
                      matching_peaks.append((bank_1_centre, bank_2_centre))
  
          # Remove temporary workspaces
          DeleteWorkspace('__bank_1_peaks')
          DeleteWorkspace('__bank_2_peaks')
  
          if len(matching_peaks) > 0:
              selected_peak = matching_peaks[0]
              logger.debug('Found matching peak: %s' % (str(selected_peak)))
          else:
              selected_peak = None
              logger.warning('No peak found')
  
          return selected_peak
function_tokens: def _get_peak ( self , search_ws ) : find_peak_args = dict ( ) if self . _peak_position is not None : find_peak_args [ 'PeakPositions' ] = [ self . _peak_position ] # Find the peaks in each bank FindPeaks ( InputWorkspace = search_ws , PeaksList = '__bank_1_peaks' , WorkspaceIndex = 0 , PeakFunction = self . _peak_function , * * find_peak_args ) FindPeaks ( InputWorkspace = search_ws , PeaksList = '__bank_2_peaks' , WorkspaceIndex = 1 , PeakFunction = self . _peak_function , * * find_peak_args ) # Sort peaks by height, prefer to match tall peaks SortTableWorkspace ( InputWorkspace = '__bank_1_peaks' , OutputWorkspace = '__bank_1_peaks' , Columns = 'centre' , Ascending = False ) bank_1_ws = mtd [ '__bank_1_peaks' ] bank_2_ws = mtd [ '__bank_2_peaks' ] matching_peaks = list ( ) # Find the centres of two peaks that are close to each other on both banks for peak_idx in range ( 0 , bank_1_ws . rowCount ( ) ) : bank_1_centre = bank_1_ws . cell ( 'centre' , peak_idx ) for other_peak_idx in range ( 0 , bank_2_ws . rowCount ( ) ) : bank_2_centre = bank_2_ws . cell ( 'centre' , other_peak_idx ) if abs ( bank_1_centre - bank_2_centre ) < self . _peak_tolerance : matching_peaks . append ( ( bank_1_centre , bank_2_centre ) ) # Remove temporary workspaces DeleteWorkspace ( '__bank_1_peaks' ) DeleteWorkspace ( '__bank_2_peaks' ) if len ( matching_peaks ) > 0 : selected_peak = matching_peaks [ 0 ] logger . debug ( 'Found matching peak: %s' % ( str ( selected_peak ) ) ) else : selected_peak = None logger . warning ( 'No peak found' ) return selected_peak