parameters: (merged_scan_workspace_name, integrated_peak_ws_name,
                                 peak_radius, peak_centre,
                                 merge_peaks=True,
                                 normalization='', mask_ws_name=None,
                                 scale_factor=1.)
return_statement: return True, pt_dict
docstring: Integrate the peak in a single scan with merged Pt.
      :param merged_scan_workspace_name: MDEventWorkspace with merged Pts.
      :param integrated_peak_ws_name: output PeaksWorkspace for integrated peak
      :param peak_radius:
      :param peak_centre:  a float radius or None for not using
      :param merge_peaks: If selected, merged all the Pts can return 1 integrated peak's value;
                          otherwise, integrate peak for each Pt.
      :param normalization: normalization set up (by time or ...)
      :param mask_ws_name: mask workspace name or None
      :param scale_factor: integrated peaks' scaling factor
      :return: dictionary of Pts.
docstring_summary: Integrate the peak in a single scan with merged Pt.
      :param merged_scan_workspace_name: MDEventWorkspace with merged Pts.
      :param integrated_peak_ws_name: output PeaksWorkspace for integrated peak
      :param peak_radius:
      :param peak_centre:  a float radius or None for not using
      :param merge_peaks: If selected, merged all the Pts can return 1 integrated peak's value;
                          otherwise, integrate peak for each Pt.
      :param normalization: normalization set up (by time or ...)
      :param mask_ws_name: mask workspace name or None
      :param scale_factor: integrated peaks' scaling factor
      :return: dictionary of Pts.
docstring_tokens: Integrate the peak in a single scan with merged Pt . : param merged_scan_workspace_name : MDEventWorkspace with merged Pts . : param integrated_peak_ws_name : output PeaksWorkspace for integrated peak : param peak_radius : : param peak_centre : a float radius or None for not using : param merge_peaks : If selected merged all the Pts can return 1 integrated peak s value ; otherwise integrate peak for each Pt . : param normalization : normalization set up ( by time or ... ) : param mask_ws_name : mask workspace name or None : param scale_factor : integrated peaks scaling factor : return : dictionary of Pts .
function: def integrate_single_scan_peak(merged_scan_workspace_name, integrated_peak_ws_name,
                                 peak_radius, peak_centre,
                                 merge_peaks=True,
                                 normalization='', mask_ws_name=None,
                                 scale_factor=1.):
      """ Integrate the peak in a single scan with merged Pt.
      :param merged_scan_workspace_name: MDEventWorkspace with merged Pts.
      :param integrated_peak_ws_name: output PeaksWorkspace for integrated peak
      :param peak_radius:
      :param peak_centre:  a float radius or None for not using
      :param merge_peaks: If selected, merged all the Pts can return 1 integrated peak's value;
                          otherwise, integrate peak for each Pt.
      :param normalization: normalization set up (by time or ...)
      :param mask_ws_name: mask workspace name or None
      :param scale_factor: integrated peaks' scaling factor
      :return: dictionary of Pts.
      """
      # check
      # assert isinstance(exp, int)
      # assert isinstance(scan, int)
      assert isinstance(peak_radius, float) or peak_radius is None, 'Peak radius {0} must be of type float but not ' \
                                                                    '{1}.'.format(peak_radius, type(peak_radius))
      assert len(peak_centre) == 3, 'Peak center {0} of type {1} must have 3 elements but not {2}.' \
                                    ''.format(peak_centre, type(peak_centre), len(peak_centre))
      assert isinstance(merge_peaks, bool), 'Flag to merge peak must be a boolean but not {0}.'.format(type(merge_peaks))
  
      try:
          peak_centre_str = '%f, %f, %f' % (peak_centre[0], peak_centre[1],
                                            peak_centre[2])
      except IndexError:
          raise RuntimeError('Peak center {0} must have 3 elements.'.format(peak_centre))
      except ValueError:
          raise RuntimeError('Peak center {0} must have floats.'.format(peak_centre))
  
      # normalization
      norm_by_mon = False
      norm_by_time = False
      if normalization == 'time':
          norm_by_time = True
      elif normalization == 'monitor':
          norm_by_mon = True
  
      # integrate peak of a scan
      print ('[DB....BAT] Peak integration scale factor: {0}'.format(scale_factor))
      mantidsimple.IntegratePeaksCWSD(InputWorkspace=merged_scan_workspace_name,
                                      OutputWorkspace=integrated_peak_ws_name,
                                      PeakRadius=peak_radius,
                                      PeakCentre=peak_centre_str,
                                      MergePeaks=merge_peaks,
                                      NormalizeByMonitor=norm_by_mon,
                                      NormalizeByTime=norm_by_time,
                                      MaskWorkspace=mask_ws_name,
                                      ScaleFactor=scale_factor)
  
      # process the output workspace
      pt_dict = dict()
      out_peak_ws = AnalysisDataService.retrieve(integrated_peak_ws_name)
      num_peaks = out_peak_ws.rowCount()
  
      for i_peak in range(num_peaks):
          peak_i = out_peak_ws.getPeak(i_peak)
          run_number_i = peak_i.getRunNumber() % 1000
          intensity_i = peak_i.getIntensity()
          pt_dict[run_number_i] = intensity_i
      # END-FOR
  
      # # store the data into peak info
      # if (exp, scan) not in self._myPeakInfoDict:
      #     raise RuntimeError('Exp %d Scan %d is not recorded in PeakInfo-Dict' % (exp, scan))
      # self._myPeakInfoDict[(exp, scan)].set_pt_intensity(pt_dict)
  
      return True, pt_dict
function_tokens: def integrate_single_scan_peak ( merged_scan_workspace_name , integrated_peak_ws_name , peak_radius , peak_centre , merge_peaks = True , normalization = '' , mask_ws_name = None , scale_factor = 1. ) : # check # assert isinstance(exp, int) # assert isinstance(scan, int) assert isinstance ( peak_radius , float ) or peak_radius is None , 'Peak radius {0} must be of type float but not ' '{1}.' . format ( peak_radius , type ( peak_radius ) ) assert len ( peak_centre ) == 3 , 'Peak center {0} of type {1} must have 3 elements but not {2}.' '' . format ( peak_centre , type ( peak_centre ) , len ( peak_centre ) ) assert isinstance ( merge_peaks , bool ) , 'Flag to merge peak must be a boolean but not {0}.' . format ( type ( merge_peaks ) ) try : peak_centre_str = '%f, %f, %f' % ( peak_centre [ 0 ] , peak_centre [ 1 ] , peak_centre [ 2 ] ) except IndexError : raise RuntimeError ( 'Peak center {0} must have 3 elements.' . format ( peak_centre ) ) except ValueError : raise RuntimeError ( 'Peak center {0} must have floats.' . format ( peak_centre ) ) # normalization norm_by_mon = False norm_by_time = False if normalization == 'time' : norm_by_time = True elif normalization == 'monitor' : norm_by_mon = True # integrate peak of a scan print ( '[DB....BAT] Peak integration scale factor: {0}' . format ( scale_factor ) ) mantidsimple . IntegratePeaksCWSD ( InputWorkspace = merged_scan_workspace_name , OutputWorkspace = integrated_peak_ws_name , PeakRadius = peak_radius , PeakCentre = peak_centre_str , MergePeaks = merge_peaks , NormalizeByMonitor = norm_by_mon , NormalizeByTime = norm_by_time , MaskWorkspace = mask_ws_name , ScaleFactor = scale_factor ) # process the output workspace pt_dict = dict ( ) out_peak_ws = AnalysisDataService . retrieve ( integrated_peak_ws_name ) num_peaks = out_peak_ws . rowCount ( ) for i_peak in range ( num_peaks ) : peak_i = out_peak_ws . getPeak ( i_peak ) run_number_i = peak_i . getRunNumber ( ) % 1000 intensity_i = peak_i . getIntensity ( ) pt_dict [ run_number_i ] = intensity_i # END-FOR # # store the data into peak info # if (exp, scan) not in self._myPeakInfoDict: #     raise RuntimeError('Exp %d Scan %d is not recorded in PeakInfo-Dict' % (exp, scan)) # self._myPeakInfoDict[(exp, scan)].set_pt_intensity(pt_dict) return True , pt_dict