Skip to content

Commit

Permalink
Add changes to other examples re #6752
Browse files Browse the repository at this point in the history
Work cannot be completed until ticket #6764 has been closed. Then the comments in the code from that ticket can be improved similarly.

Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Mar 28, 2013
1 parent 2da18ac commit 469b50b
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
# == Set parameters for calibration ==

path = r"C:/Temp/" # Path name of folder containing input and output files
filename = 'MAPS14919.raw' # Name of calibration run
filename = 'MAPS14919.raw' # Calibration run ( found in \\isis\inst$\NDXMAPS\Instrument\data\cycle_09_5 )
rangeLower = 2000 # Integrate counts in each spectra from rangeLower to rangeUpper
rangeUpper = 10000 #


# Set initial parameters for peak finding
ExpectedHeight = -1000.0 # Expected Height of Peaks (initial value of fit parameter)
ExpectedWidth = 8.0 # Expected width of centre peak (initial value of fit parameter)
ExpectedPositions = [4.0, 85.0, 128.0, 161.0, 252.0] # Expected positions of the edges and peak (initial values of fit parameters)
ExpectedHeight = -1000.0 # Expected Height of Gaussian Peaks (initial value of fit parameter)
ExpectedWidth = 8.0 # Expected width of Gaussian peaks in pixels (initial value of fit parameter)
ExpectedPositions = [4.0, 85.0, 128.0, 161.0, 252.0] # Expected positions of the edges and Gaussian peaks in pixels (initial values of fit parameters)

# Set what we want to calibrate (e.g whole intrument or one door )
CalibratedComponent = 'MAPS' # Calibrate all
Expand All @@ -48,8 +48,9 @@

# Get ideal tube
iTube = IdealTube()
# Set positions of where the shadows and ends should be.
# An intelligent guess is used here that is not correct for all tubes.
# The positions of the shadows and ends here are an intelligent guess.
# First array gives positions in Metres and second array gives type 1=Gaussian peak 2=edge.
# See http://www.mantidproject.org/IdealTube for details.
iTube.setPositionsAndForm([-0.50,-0.16,-0.00, 0.16, 0.50 ],[2,1,1,1,2])

# Get fitting parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
# Set initial parameters for peak finding
ExpectedHeight = -1000.0 # Expected Height of Gaussian Peaks (initial value of fit parameter)
ExpectedWidth = 8.0 # Expected width of Gaussian peaks in pixels (initial value of fit parameter)
ExpectedPositions = [4.0, 85.0, 128.0, 161.0, 252.0] # Expected positions of the edges and peak in pixels (initial values of fit parameters)
ExpectedPositions = [4.0, 85.0, 128.0, 161.0, 252.0] # Expected positions of the edges and Gaussian peaks in pixels (initial values of fit parameters)

# Set what we want to calibrate (e.g whole intrument or one door )
CalibratedComponent = 'B1_window' # Calibrate B1 window
Expand Down Expand Up @@ -69,6 +69,6 @@


# == Save workspace ==
SaveNexusProcessed( CalibInstWS, path+'TubeCalibDemoMapsResult.nxs',"Result of Running TCDemoMaps.py")
SaveNexusProcessed( CalibInstWS, path+'TubeCalibDemoMapsResult.nxs',"Result of Running TCDemoMaps_B1.py")
print "saved calibrated workspace (CalibInstWS) into Nexus file TubeCalibDemoMapsResult.nxs"

10 changes: 6 additions & 4 deletions Code/Mantid/scripts/Calibration/Examples/TubeCalibDemoMaps_D2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
# == Set parameters for calibration ==

path = r"C:/Temp/" # Path name of folder containing input and output files
filename = 'MAPS14919.raw' # Name of calibration run
filename = 'MAPS14919.raw' # Calibration run ( found in \\isis\inst$\NDXMAPS\Instrument\data\cycle_09_5 )
rangeLower = 2000 # Integrate counts in each spectra from rangeLower to rangeUpper
rangeUpper = 10000 #


# Set initial parameters for peak finding
ExpectedHeight = -1000.0 # Expected Height of Peaks (initial value of fit parameter)
ExpectedWidth = 8.0 # Expected width of centre peak (initial value of fit parameter)
ExpectedPositions = [4.0, 85.0, 128.0, 161.0, 252.0] # Expected positions of the edges and peak (initial values of fit parameters)
ExpectedHeight = -1000.0 # Expected Height of Gaussian Peaks (initial value of fit parameter)
ExpectedWidth = 8.0 # Expected width of Gaussian peaks in pixels (initial value of fit parameter)
ExpectedPositions = [4.0, 85.0, 128.0, 161.0, 252.0] # Expected positions of the edges and Gaussian peaks in pixels (initial values of fit parameters)

# Set what we want to calibrate (e.g whole intrument or one door )
CalibratedComponent = 'D2_window' # Calibrate D2 window
Expand All @@ -49,6 +49,8 @@
# Get ideal tube
iTube = IdealTube()
# The positions of the shadows and ends here are an intelligent guess.
# First array gives positions in Metres and second array gives type 1=Gaussian peak 2=edge.
# See http://www.mantidproject.org/IdealTube for details.
iTube.setPositionsAndForm([-0.65,-0.22,-0.00, 0.22, 0.65 ],[2,1,1,1,2])

# Get fitting parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# == Set parameters for calibration ==

path = r"C:/Temp/" # Path name of folder containing input and output files
filename = 'MER12024.raw' # Name of calibration run
filename = 'MER12024.raw' # Calibration run ( found in \\isis\inst$\NDXMERLIN\Instrument\data\cycle_11_5 )
rangeLower = 3000 # Integrate counts in each spectra from rangeLower to rangeUpper
rangeUpper = 20000 #

Expand All @@ -27,9 +27,9 @@
ActiveLength = 2.9 # Active length of tube in Metres

# Set initial parameters for peak finding
ExpectedHeight = 1000.0 # Expected Height of Peaks (initial value of fit parameter)
ExpectedHeight = 1000.0 # Expected Height of Gaussian Peak at centre (initial value of fit parameter)
ExpectedWidth = 32.0 # Expected width of centre peak (initial value of fit parameter)
ExpectedPositions = [35.0, 512.0, 989.0] # Expected positions of the edges and peak (initial values of fit parameters)
ExpectedPositions = [35.0, 512.0, 989.0] # Expected positions of the edges and centre peak in pixels (initial values of fit parameters)

# Set what we want to calibrate (e.g whole intrument or one door )
CalibratedComponent = 'MERLIN' # Calibrate whole instrument
Expand All @@ -56,6 +56,7 @@

# Get ideal tube
iTube = IdealTube()
# Call short cut method to construct ideal tube of the 3 point method format.
iTube.constructTubeFor3PointsMethod ( Left, Right, Centre, ActiveLength )

# Get fitting parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Get calibration raw file and integrate it
path = r"C:/Temp/" # Path name of folder containing input and output files
filename = 'WISH00017701.raw' # Name of calibration run
filename = 'WISH00017701.raw' # Calibration run ( found in \\isis\inst$\NDXWISH\Instrument\data\cycle_11_1 )
rawCalibInstWS = Load(path+filename) #'raw' in 'rawCalibInstWS' means unintegrated.
CalibInstWS = Integration( rawCalibInstWS, RangeLower=1, RangeUpper=20000 )
DeleteWorkspace(rawCalibInstWS)
Expand All @@ -29,11 +29,15 @@

# Give y-positions of slit points (gotten for converting first tube's slit point to Y)
iTube = IdealTube()
# set positions in Metres of Gaussian peaks (no edges).
iTube.setArray([-0.41,-0.31,-0.21,-0.11,-0.02, 0.09, 0.18, 0.28, 0.39 ])

# Set fitting parameters
eP = [65.0, 113.0, 161.0, 209.0, 257.0, 305.0, 353.0, 401.0, 449.0]
fitPar = TubeCalibFitParams( eP, 2000, 32 )
ExpectedHeight = 2000.0 # Expected Height of Gaussian Peaks (initial value of fit parameter)
ExpectedWidth = 32.0 # Expected width of Gaussian peaks in pixels (initial value of fit parameter)

fitPar = TubeCalibFitParams( eP, ExpectedHeight, ExpectedWidth )

print "Created objects needed for calibration."

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

# Get calibration raw file and integrate it
path = r"C:/Temp/" # Path name of folder containing input and output files
filename = 'WISH00017701.raw' # Name of calibration run
filename = 'WISH00017701.raw' # Calibration run ( found in \\isis\inst$\NDXWISH\Instrument\data\cycle_11_1 )
rawCalibInstWS = Load(path+filename) #'raw' in 'rawCalibInstWS' means unintegrated.
CalibInstWS = Integration( rawCalibInstWS, RangeLower=1, RangeUpper=20000 )
DeleteWorkspace(rawCalibInstWS)
Expand All @@ -29,13 +29,15 @@

# Set fitting parameters
eP = [65.0, 113.0, 161.0, 209.0, 257.0, 305.0, 353.0, 401.0, 449.0]
fitPar = TubeCalibFitParams( eP, 2000, 32 )
ExpectedHeight = 2000.0 # Expected Height of Gaussian Peaks (initial value of fit parameter)
ExpectedWidth = 32.0 # Expected width of Gaussian peaks in pixels (initial value of fit parameter)
fitPar = TubeCalibFitParams( eP, ExpectedHeight, ExpectedWidth )

print "Created objects needed for calibration."

# Use first tube as ideal tube
tube1 = TubeSpec(CalibInstWS)
tube1.setTubeSpecByString('WISH/panel03/tube001')
tube1.setTubeSpecByString('WISH/panel03/tube038')
iTube = IdealTube()
iTube.constructIdealTubeFromRealTube( CalibInstWS, tube1, fitPar)

Expand Down

0 comments on commit 469b50b

Please sign in to comment.