parameters: (filename)
docstring: There are among the B2 window tubes, some tubes that are showing only 2 strips.
  
      Those tubes must be calibrated separated, as the known positions are not valid.
  
      This example calibrate them, using only 4 known values: 2 edges and 2 peaks.
  
      Run this example, and them see the worksapce in the calibrated instrument and you will see
      how it worked.
  
      The picture shows the output, look that only a section of the B2 Window was calibrated.
  
      .. image:: /images/calibrateB2Window.png
docstring_summary: There are among the B2 window tubes, some tubes that are showing only 2 strips.
docstring_tokens: There are among the B2 window tubes some tubes that are showing only 2 strips .
function: def calibrateB2Window(filename):
      """
      There are among the B2 window tubes, some tubes that are showing only 2 strips.
  
      Those tubes must be calibrated separated, as the known positions are not valid.
  
      This example calibrate them, using only 4 known values: 2 edges and 2 peaks.
  
      Run this example, and them see the worksapce in the calibrated instrument and you will see
      how it worked.
  
      The picture shows the output, look that only a section of the B2 Window was calibrated.
  
      .. image:: /images/calibrateB2Window.png
  
      """
      from tube_calib_fit_params import TubeCalibFitParams
      # b2 with 2 peaks range
      b2_range = list(range(196, 212)) + list(range(222, 233))
  
      CalibInstWS = loadingStep(filename)
      # == Set parameters for calibration ==
      # Set what we want to calibrate (e.g whole instrument or one door )
      CalibratedComponent = 'MAPS'  # Calibrate all
      # define the known positions and function factor (edge, peak, peak, peak, edge)
      knownPos, funcFactor = [-0.50, -0.16, 0.16, 0.50], [2, 1, 1, 2]
  
      # the expected positions in pixels for the special points
      expectedPositions = [4.0, 85.0, 161.0, 252.0]
      fitPar = TubeCalibFitParams(expectedPositions)
      fitPar.setAutomatic(True)
  
      # == Get the calibration and put results into calibration table ==
      calibrationTable, peakTable = tube.calibrate(CalibInstWS, CalibratedComponent, knownPos, funcFactor,
                                                   fitPar=fitPar, outputPeak=True, plotTube=[b2_range[0], b2_range[-1]],
                                                   rangeList=b2_range)
  
      mantid.ApplyCalibration(Workspace=CalibInstWS, CalibrationTable=calibrationTable)
function_tokens: def calibrateB2Window ( filename ) : from tube_calib_fit_params import TubeCalibFitParams # b2 with 2 peaks range b2_range = list ( range ( 196 , 212 ) ) + list ( range ( 222 , 233 ) ) CalibInstWS = loadingStep ( filename ) # == Set parameters for calibration == # Set what we want to calibrate (e.g whole instrument or one door ) CalibratedComponent = 'MAPS' # Calibrate all # define the known positions and function factor (edge, peak, peak, peak, edge) knownPos , funcFactor = [ - 0.50 , - 0.16 , 0.16 , 0.50 ] , [ 2 , 1 , 1 , 2 ] # the expected positions in pixels for the special points expectedPositions = [ 4.0 , 85.0 , 161.0 , 252.0 ] fitPar = TubeCalibFitParams ( expectedPositions ) fitPar . setAutomatic ( True ) # == Get the calibration and put results into calibration table == calibrationTable , peakTable = tube . calibrate ( CalibInstWS , CalibratedComponent , knownPos , funcFactor , fitPar = fitPar , outputPeak = True , plotTube = [ b2_range [ 0 ] , b2_range [ - 1 ] ] , rangeList = b2_range ) mantid . ApplyCalibration ( Workspace = CalibInstWS , CalibrationTable = calibrationTable )