Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow user to rotate source to a different position after ReflectometryReduction has run #14942

Conversation

MattKing06
Copy link
Contributor

To Test:

Theta same after rotation
The second and third source position should be the same

from mantid.simpleapi import *
from numpy import sin, pi

dref = mtd['INTER00013463']

print dref.getInstrument().getSource().getPos()

IvsQ, IvsLam, thetaOut=ReflectometryReductionOneAuto(dref,AnalysisMode="MultiDetectorAnalysis",ProcessingInstructions="4", ThetaIn="0.5037",
    WavelengthMin=2.2,CorrectionAlgorithm='None',StrictSpectrumChecking=False,CorrectDetectorPositions=True)

print IvsLam.getInstrument().getSource().getPos()

IvsQ, IvsLam, thetaOut=ReflectometryReductionOneAuto(IvsLam,AnalysisMode="MultiDetectorAnalysis",ProcessingInstructions="4", ThetaIn="0.5037",
    WavelengthMin=2.2,CorrectionAlgorithm='None',StrictSpectrumChecking=False,CorrectDetectorPositions=True)
print IvsQ.getInstrument().getSource().getPos()

Theta smaller after rotation
The last source position should be less than the second (in Y,Z)

from mantid.simpleapi import *
from numpy import sin, pi

dref = mtd['INTER00013463']

print dref.getInstrument().getSource().getPos()

IvsQ, IvsLam, thetaOut=ReflectometryReductionOneAuto(dref,AnalysisMode="MultiDetectorAnalysis",ProcessingInstructions="4", ThetaIn="0.5037",
    WavelengthMin=2.2,CorrectionAlgorithm='None',StrictSpectrumChecking=False,CorrectDetectorPositions=True)

print IvsLam.getInstrument().getSource().getPos()

IvsQ, IvsLam, thetaOut=ReflectometryReductionOneAuto(IvsLam,AnalysisMode="MultiDetectorAnalysis",ProcessingInstructions="4", ThetaIn="0.2",
    WavelengthMin=2.2,CorrectionAlgorithm='None',StrictSpectrumChecking=False,CorrectDetectorPositions=True)
print IvsQ.getInstrument().getSource().getPos()

Theta larger after rotation
Second position of source should be smaller than the last position (in X,Y)

from mantid.simpleapi import *
from numpy import sin, pi

dref = mtd['INTER00013463']

print dref.getInstrument().getSource().getPos()

IvsQ, IvsLam, thetaOut=ReflectometryReductionOneAuto(dref,AnalysisMode="MultiDetectorAnalysis",ProcessingInstructions="4", ThetaIn="0.5037",
    WavelengthMin=2.2,CorrectionAlgorithm='None',StrictSpectrumChecking=False,CorrectDetectorPositions=True)

print IvsLam.getInstrument().getSource().getPos()

IvsQ, IvsLam, thetaOut=ReflectometryReductionOneAuto(IvsLam,AnalysisMode="MultiDetectorAnalysis",ProcessingInstructions="4", ThetaIn="8.2",
    WavelengthMin=2.2,CorrectionAlgorithm='None',StrictSpectrumChecking=False,CorrectDetectorPositions=True)
print IvsQ.getInstrument().getSource().getPos()

Release Notes: http://www.mantidproject.org/Release_Notes_3_6_Reflectometry#ReflectometryReductionOne

Fixes #14932

Currently it is working and the search table is populated
but this is just a scratch way of doing things, hopefully
with some review this can be made into a robust solution

Refs #14905
…ake_icat_searcher_run_parallel_to_ReflMainPresenter
…llow_user_to_rotate_source_after_reflReductionOne_has_run
@MattKing06 MattKing06 added the Reflectometry Issues and pull requests related to reflectometry label Jan 12, 2016
@MattKing06 MattKing06 added this to the Release 3.6 milestone Jan 12, 2016
@raquelalvarezbanos raquelalvarezbanos self-assigned this Jan 13, 2016
…llow_user_to_rotate_source_after_reflReductionOne_has_run
@raquelalvarezbanos
Copy link
Contributor

Merging all the cases in a single script:

from mantid.simpleapi import *
from numpy import sin, pi

Load(Filename=r'D:\SampleData-ISIS\INTER00013463.nxs', OutputWorkspace='INTER00013463')
dref = mtd['INTER00013463']

IvsQ, IvsLam, thetaOut=ReflectometryReductionOneAuto(dref,AnalysisMode="MultiDetectorAnalysis",ProcessingInstructions="4", ThetaIn="0.5037",
    WavelengthMin=2.2,CorrectionAlgorithm='None',StrictSpectrumChecking=False,CorrectDetectorPositions=True)
print "Source was rotated\t", IvsLam.getInstrument().getSource().getPos()

# Theta same after rotation    
IvsQ, IvsLam, thetaOut=ReflectometryReductionOneAuto(IvsLam,AnalysisMode="MultiDetectorAnalysis",ProcessingInstructions="4", ThetaIn="0.5037",
    WavelengthMin=2.2,CorrectionAlgorithm='None',StrictSpectrumChecking=False,CorrectDetectorPositions=True)
print "Same theta\t\t", IvsLam.getInstrument().getSource().getPos()

# Theta smaller after rotation
IvsQ, IvsLam, thetaOut=ReflectometryReductionOneAuto(IvsLam,AnalysisMode="MultiDetectorAnalysis",ProcessingInstructions="4", ThetaIn="0.2",
    WavelengthMin=2.2,CorrectionAlgorithm='None',StrictSpectrumChecking=False,CorrectDetectorPositions=True)
print "Smaller theta\t", IvsLam.getInstrument().getSource().getPos()

# Theta larger after rotation
IvsQ, IvsLam, thetaOut=ReflectometryReductionOneAuto(IvsLam,AnalysisMode="MultiDetectorAnalysis",ProcessingInstructions="4", ThetaIn="8.2",
    WavelengthMin=2.2,CorrectionAlgorithm='None',StrictSpectrumChecking=False,CorrectDetectorPositions=True)
print "Larger theta\t", IvsLam.getInstrument().getSource().getPos()

I run this script in debug mode and set a breakpoint at:

return rotationTheta;

to check the relative angles, which turned out to be 0.5037, 0, -0.3037 and 8.0, as expected.

@raquelalvarezbanos
Copy link
Contributor

To further test the changes I added the following couple of lines after each execution of ReflectometryReductionOneAuto():

print IvsQ.getXDimension().getMinimum() / ( 4 * pi * sin (thetaOut * pi / 180 ) / IvsLam.getXDimension().getMaximum())
print IvsQ.getXDimension().getMaximum() / (4 * pi * sin (thetaOut * pi / 180 ) / IvsLam.getXDimension().getMinimum())

The result in all the cases is close to 1, as expected.

@raquelalvarezbanos
Copy link
Contributor

@MattKing06 could you add a line to the release notes?

raquelalvarezbanos added a commit that referenced this pull request Jan 14, 2016
…te_source_after_reflReductionOne_has_run

Allow user to rotate source to a different position after ReflectometryReduction has run
@raquelalvarezbanos raquelalvarezbanos merged commit 34a24f9 into master Jan 14, 2016
@raquelalvarezbanos raquelalvarezbanos deleted the 14932_allow_user_to_rotate_source_after_reflReductionOne_has_run branch January 14, 2016 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reflectometry Issues and pull requests related to reflectometry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants