parameters: (workspace: WorkspaceTypes, bank_name: str, shadow_height: float = 1000, shadow_width: float = 4,
               fit_domain: float = 7, minimum_intensity: float = 1000,
               calibration_table: str = 'CalibTable',
               peak_pixel_positions_table: str = 'PeakTable',
               peak_vertical_positions_table: str = 'PeakYTable',
               parameters_table_group: str = 'ParametersTable')
docstring: r"""
      Find the position of the wire shadow on each tube in the bank, in units of pixel positions
  
      :param workspace: input Workspace2D containing total neutron counts per pixel
      :param bank_name: a string of the form 'bankI' where 'I' is a bank number
      :param shadow_height: initial guess for the decrease in neutron counts caused by the calibrating wire
      :param shadow_width: initial guess for the number of pixels shadowed by the calibrating wire
      :param fit_domain: number of pixels over which a calibrating wire may have any significant influence
      :param minimum_intensity: mininum number of neutron counts per pixel to warrant a significant fit
      session. This number is compared against the neutron counts per pixel, averaged over all pixels in the bank
      :param calibration_table: output TableWorkspace containing one column for detector ID and one column
      for its calibrated XYZ coordinates, in meters
      :param peak_pixel_positions_table: output table containing the positions of the wire shadows for each tube, in
      units of pixel coordinates
      :param peak_vertical_positions_table: output table containing the positions of the wire shadows for each tube
          along the vertical (Y) axis. This positions are the result if evaluating the peak pixel positions with
          the quadratic function that translates pixel positions to vertical positions (see
          parameters_table_group)
      :param parameters_table_group: name of the WorkspaceGroup containing individual TableWorkspace tables. Each
          table holds values and errors for the optimized coefficients of the polynomial that fits the peak positions (in
          pixel coordinates) to the known wire positions (along the Y-coordinate). The last entry in the table
          holds the goodness-of-fit, chi-square value. The name of each individual TableWorkspace is the string
          `parameters_table_group` plus the suffix `_I`, where `I` is the tube index in the bank, startin at zero.
          If set to `None`, no group workspace is generated.
  
      :raises AssertionError: the input workspace is of incorrect type or cannot be found
      :raises AssertionError: the input `shadow_height` is a non-positive value
      :raises AssertionError: the `bank_name` if not of the form 'bankI'
      :raises AssertionError: insufficient neutron counts per pixel
  
      :return: workspace handles to the calibration and peak table
docstring_summary: r"""
      Find the position of the wire shadow on each tube in the bank, in units of pixel positions
docstring_tokens: r Find the position of the wire shadow on each tube in the bank in units of pixel positions
function: def fit_bank(workspace: WorkspaceTypes, bank_name: str, shadow_height: float = 1000, shadow_width: float = 4,
               fit_domain: float = 7, minimum_intensity: float = 1000,
               calibration_table: str = 'CalibTable',
               peak_pixel_positions_table: str = 'PeakTable',
               peak_vertical_positions_table: str = 'PeakYTable',
               parameters_table_group: str = 'ParametersTable') -> None:
      r"""
      Find the position of the wire shadow on each tube in the bank, in units of pixel positions
  
      :param workspace: input Workspace2D containing total neutron counts per pixel
      :param bank_name: a string of the form 'bankI' where 'I' is a bank number
      :param shadow_height: initial guess for the decrease in neutron counts caused by the calibrating wire
      :param shadow_width: initial guess for the number of pixels shadowed by the calibrating wire
      :param fit_domain: number of pixels over which a calibrating wire may have any significant influence
      :param minimum_intensity: mininum number of neutron counts per pixel to warrant a significant fit
      session. This number is compared against the neutron counts per pixel, averaged over all pixels in the bank
      :param calibration_table: output TableWorkspace containing one column for detector ID and one column
      for its calibrated XYZ coordinates, in meters
      :param peak_pixel_positions_table: output table containing the positions of the wire shadows for each tube, in
      units of pixel coordinates
      :param peak_vertical_positions_table: output table containing the positions of the wire shadows for each tube
          along the vertical (Y) axis. This positions are the result if evaluating the peak pixel positions with
          the quadratic function that translates pixel positions to vertical positions (see
          parameters_table_group)
      :param parameters_table_group: name of the WorkspaceGroup containing individual TableWorkspace tables. Each
          table holds values and errors for the optimized coefficients of the polynomial that fits the peak positions (in
          pixel coordinates) to the known wire positions (along the Y-coordinate). The last entry in the table
          holds the goodness-of-fit, chi-square value. The name of each individual TableWorkspace is the string
          `parameters_table_group` plus the suffix `_I`, where `I` is the tube index in the bank, startin at zero.
          If set to `None`, no group workspace is generated.
  
      :raises AssertionError: the input workspace is of incorrect type or cannot be found
      :raises AssertionError: the input `shadow_height` is a non-positive value
      :raises AssertionError: the `bank_name` if not of the form 'bankI'
      :raises AssertionError: insufficient neutron counts per pixel
  
      :return: workspace handles to the calibration and peak table
      """
      message = f'Cannot process workspace {workspace}. Pass the name of an existing workspace or a workspace handle'
      assert isinstance(workspace, (str, Workspace2D)), message
      workspace_name = str(workspace)
      assert AnalysisDataService.doesExist(workspace_name), f'Input workspace {workspace_name} does not exists'
      assert shadow_height > 0, 'shadow height must be positive'
      peak_height, peak_width = -shadow_height, shadow_width
      assert re.match(r'^bank\d+$', bank_name), 'The bank name must be of the form "bankI" where "I" in an integer'
      message = f'Insufficient counts per pixel in workspace {workspace_name} for a confident calibration'
      assert sufficient_intensity(workspace, bank_name, minimum_intensity=minimum_intensity), message
      # Fit only the inner 14 dips because the extrema wires are too close to the tube tips.
      # The dead zone in the tube tips interferes with the shadow cast by the extrema  wires
      # preventing a good fitting
      wire_positions_pixels = wire_positions(units='pixels')[1: -1]
      wire_count = len(wire_positions_pixels)
      peaks_form = [1] * wire_count  # signals we'll be fitting dips (peaks with negative heights)
  
      fit_par = TubeCalibFitParams(wire_positions_pixels, height=peak_height, width=peak_width, margin=fit_domain)
      fit_par.setAutomatic(True)
  
      tube.calibrate(workspace_name, bank_name, wire_positions(units='meters')[1: -1],
                     peaks_form, fitPar=fit_par, outputPeak=True, parameters_table_group=parameters_table_group)
      if calibration_table != 'CalibTable':
          RenameWorkspace(InputWorkspace='CalibTable', OutputWorkspace=calibration_table)
      trim_calibration_table(calibration_table)  # discard X and Z coordinates
      if peak_pixel_positions_table != 'PeakTable':
          RenameWorkspace(InputWorkspace='PeakTable', OutputWorkspace=peak_pixel_positions_table)
      calculate_peak_y_table(peak_pixel_positions_table, parameters_table_group,
                             output_workspace=peak_vertical_positions_table)
function_tokens: def fit_bank ( workspace : WorkspaceTypes , bank_name : str , shadow_height : float = 1000 , shadow_width : float = 4 , fit_domain : float = 7 , minimum_intensity : float = 1000 , calibration_table : str = 'CalibTable' , peak_pixel_positions_table : str = 'PeakTable' , peak_vertical_positions_table : str = 'PeakYTable' , parameters_table_group : str = 'ParametersTable' ) -> None : message = f'Cannot process workspace {workspace}. Pass the name of an existing workspace or a workspace handle' assert isinstance ( workspace , ( str , Workspace2D ) ) , message workspace_name = str ( workspace ) assert AnalysisDataService . doesExist ( workspace_name ) , f'Input workspace {workspace_name} does not exists' assert shadow_height > 0 , 'shadow height must be positive' peak_height , peak_width = - shadow_height , shadow_width assert re . match ( r'^bank\d+$' , bank_name ) , 'The bank name must be of the form "bankI" where "I" in an integer' message = f'Insufficient counts per pixel in workspace {workspace_name} for a confident calibration' assert sufficient_intensity ( workspace , bank_name , minimum_intensity = minimum_intensity ) , message # Fit only the inner 14 dips because the extrema wires are too close to the tube tips. # The dead zone in the tube tips interferes with the shadow cast by the extrema  wires # preventing a good fitting wire_positions_pixels = wire_positions ( units = 'pixels' ) [ 1 : - 1 ] wire_count = len ( wire_positions_pixels ) peaks_form = [ 1 ] * wire_count # signals we'll be fitting dips (peaks with negative heights) fit_par = TubeCalibFitParams ( wire_positions_pixels , height = peak_height , width = peak_width , margin = fit_domain ) fit_par . setAutomatic ( True ) tube . calibrate ( workspace_name , bank_name , wire_positions ( units = 'meters' ) [ 1 : - 1 ] , peaks_form , fitPar = fit_par , outputPeak = True , parameters_table_group = parameters_table_group ) if calibration_table != 'CalibTable' : RenameWorkspace ( InputWorkspace = 'CalibTable' , OutputWorkspace = calibration_table ) trim_calibration_table ( calibration_table ) # discard X and Z coordinates if peak_pixel_positions_table != 'PeakTable' : RenameWorkspace ( InputWorkspace = 'PeakTable' , OutputWorkspace = peak_pixel_positions_table ) calculate_peak_y_table ( peak_pixel_positions_table , parameters_table_group , output_workspace = peak_vertical_positions_table )