| 1 | raw_wksp = LoadRaw('C:/Mantid/trunk/Test/Data/HRP39191.raw','hrpd39191').workspace() |
|---|
| 2 | ConvertUnits(raw_wksp,raw_wksp, 'Wavelength') |
|---|
| 3 | samplePos = raw_wksp.getInstrument().getSample().getPos() |
|---|
| 4 | |
|---|
| 5 | slabWidthInCM = 1.8 |
|---|
| 6 | slabHeightInCM = 2.3 |
|---|
| 7 | slabThicknessInCM = 1.5 |
|---|
| 8 | |
|---|
| 9 | slabWidthInM = slabWidthInCM * 0.01 |
|---|
| 10 | slabHeightInM = slabHeightInCM * 0.01 |
|---|
| 11 | slabThicknessInM = slabThicknessInCM * 0.01 |
|---|
| 12 | |
|---|
| 13 | szX = (slabWidthInM/2) + samplePos.getX() |
|---|
| 14 | szY = (slabHeightInM/2) + samplePos.getY() |
|---|
| 15 | szZ = (slabThicknessInM/2) + samplePos.getZ() |
|---|
| 16 | |
|---|
| 17 | sampleXML = " <cuboid id=\"sample-shape\"> " + \ |
|---|
| 18 | "<left-front-bottom-point x=\"" + str(szX) + "\" y=\"" + str(-szY) + "\" z=\"" + str(-szZ) + "\" /> " + \ |
|---|
| 19 | "<left-front-top-point x=\"" +str(szX) + "\" y=\"" + str(szY) + "\" z=\"" + str(-szZ) + "\" /> " + \ |
|---|
| 20 | "<left-back-bottom-point x=\"" + str(szX) + "\" y=\"" + str(-szY) + "\" z=\"" + str(szZ) + "\" /> " + \ |
|---|
| 21 | "<right-front-bottom-point x=\"" + str(-szX) + "\" y=\"" + str(-szY) + "\" z=\"" + str(-szZ) + "\" /> " +\ |
|---|
| 22 | "</cuboid>" |
|---|
| 23 | |
|---|
| 24 | gaugeWidthInCM = 1.3 |
|---|
| 25 | gaugeHeightInCM = 2.1 |
|---|
| 26 | gaugeThicknessInCM = 1.2 |
|---|
| 27 | |
|---|
| 28 | gaugeWidthInM = gaugeWidthInCM * 0.01 |
|---|
| 29 | gaugeHeightInM = gaugeHeightInCM * 0.01 |
|---|
| 30 | gaugeThicknessInM = gaugeThicknessInCM * 0.01 |
|---|
| 31 | |
|---|
| 32 | gzX = (gaugeWidthInM/2) + samplePos.getX() |
|---|
| 33 | gzY = (gaugeHeightInM/2) + samplePos.getY() |
|---|
| 34 | gzZ = (gaugeThicknessInM/2) + samplePos.getZ() |
|---|
| 35 | |
|---|
| 36 | gaugeXML = " <cuboid id=\"gauge-shape\"> " + \ |
|---|
| 37 | "<left-front-bottom-point x=\"" + str(gzX) + "\" y=\"" + str(-gzY) + "\" z=\"" + str(-gzZ) + "\" /> " + \ |
|---|
| 38 | "<left-front-top-point x=\"" +str(gzX) + "\" y=\"" + str(gzY) + "\" z=\"" + str(-gzZ) + "\" /> " + \ |
|---|
| 39 | "<left-back-bottom-point x=\"" + str(gzX) + "\" y=\"" + str(-gzY) + "\" z=\"" + str(gzZ) + "\" /> " + \ |
|---|
| 40 | "<right-front-bottom-point x=\"" + str(-gzX) + "\" y=\"" + str(-gzY) + "\" z=\"" + str(-gzZ) + "\" /> " +\ |
|---|
| 41 | "</cuboid>" |
|---|
| 42 | |
|---|
| 43 | # Define the sample shape and gauge volume on the workspace |
|---|
| 44 | CreateSampleShape(raw_wksp, sampleXML) |
|---|
| 45 | DefineGaugeVolume(raw_wksp, gaugeXML) |
|---|
| 46 | |
|---|
| 47 | attenXsec = 6.52 |
|---|
| 48 | scatterXsec = 19.876 |
|---|
| 49 | numberDensity = 0.0093 |
|---|
| 50 | npoints = 100 |
|---|
| 51 | |
|---|
| 52 | AbsorptionCorrection(raw_wksp, 'anyshape_correction', attenXsec,scatterXsec,numberDensity,npoints) |
|---|
| 53 | |
|---|
| 54 | # Should equal CuboidGaugeVolumeAbsorption with same shape = FlatPlateAbsorption |
|---|
| 55 | CuboidGaugeVolumeAbsorption(raw_wksp, 'cuboidgauge_correction', attenXsec,scatterXsec,numberDensity,gaugeHeightInCM,gaugeWidthInCM,gaugeThicknessInCM,npoints) |
|---|
| 56 | |
|---|
| 57 | checker = CheckWorkspacesMatch('anyshape_correction', 'cuboidgauge_correction', Tolerance=0.001) |
|---|
| 58 | match = checker.getPropertyValue('Result') |
|---|
| 59 | print 'Checking AnyShape against CuboidGaugeVolume:',match |
|---|
| 60 | |
|---|
| 61 | FlatPlateAbsorption(raw_wksp, 'flatplate_correction', attenXsec,scatterXsec,numberDensity,slabHeightInCM,slabWidthInCM,slabThicknessInCM,npoints) |
|---|
| 62 | checker = CheckWorkspacesMatch('flatplate_correction', 'cuboidgauge_correction', Tolerance=0.001) |
|---|
| 63 | match = checker.getPropertyValue('Result') |
|---|
| 64 | print 'Checking FlatPlate against CuboidGaugeVolume:',match |
|---|
| 65 | |
|---|
| 66 | checker = CheckWorkspacesMatch('flatplate_correction', 'anyshape_correction', Tolerance=0.001) |
|---|
| 67 | match = checker.getPropertyValue('Result') |
|---|
| 68 | print 'Checking FlatPlate against AnyShape:',match |
|---|