Ticket #9389 (closed: fixed)
SpecularReflectionPositionCorrect algorithm
Reported by: | Owen Arnold | Owned by: | Owen Arnold |
---|---|---|---|
Priority: | major | Milestone: | Release 3.2 |
Component: | Framework | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | #9184, #9401 | Tester: |
Description
We can use the specular reflection condition to correct detector positions for both point detectors and multi detectors.
Some of this functionality is already done in ReflectometryReductionOne, but is more generally useful than just applied there. This algorithm can then be used in ReflectometryReductionOne. It should also be much much easier to test this functionality if it's provided as a separate algorithm.
Change History
comment:1 Changed 6 years ago by Owen Arnold
- Summary changed from ReflectometryCorrectDetectorPositions algorithm to SpecularReflectionPositionCorrect algorithm
comment:2 Changed 6 years ago by Owen Arnold
refs #9389. New algorithm created.
Basic destructive unit tests added.
Changeset: 508207651f6d83ab70a0ad879cf2b6fefd701f6b
comment:3 Changed 6 years ago by Owen Arnold
refs #9389. Vertical correction working for single detector.
Changeset: 48acf640ce99dedcccc5c62086dd61577f31e053
comment:4 Changed 6 years ago by Owen Arnold
refs #9389. Implement moveComponent and test.
Changeset: 35bd96436b166f683d6548c6a0a3f402e2d4cdca
comment:5 Changed 6 years ago by Owen Arnold
refs #9389. Offseting working for linear as well as point detectors.
Changeset: 90119d673881fbf87a71a4fb55f4589047a37b13
comment:7 Changed 6 years ago by Owen Arnold
- Status changed from assigned to inprogress
refs #9389. Better documentation and testing.
Changeset: 959b055e1b00681f6eb576b4d45effc1bdb8a864
comment:8 Changed 6 years ago by Owen Arnold
refs #9389. Make input workspaces on the fly.
It's actually only the detector positions that we care about in this algorithm. Data is not important. Therefore use LoadEmptyInstrument to indicate to future users and maintainers that this is the case. Should also be quicker than running Load.
Changeset: 05b8f74748e18530fdf3e8b0fe46df40dd1c21cd
comment:9 Changed 6 years ago by Owen Arnold
refs #9389. Fix warnings.
Changeset: 1f409d36caad8188c74cbf49c30492195adc3269
comment:10 Changed 6 years ago by Owen Arnold
refs #9389. Fix more warnings.
Changeset: 9c86927092722f7acbfe9a39910b32ba0e76b376
comment:11 Changed 6 years ago by Owen Arnold
refs #9389. Fix type conversion warnings.
Changeset: 52db76ce7571360fdc6a7ccec3c61b08531d988c
comment:12 Changed 6 years ago by Owen Arnold
refs #9389. Fix type dereferencing rules.
Changeset: a147487b4f0979a34789ce48001bce5bdcdd0442
comment:13 Changed 6 years ago by Owen Arnold
Tester: The following shows this working. The unit tests also provide extensive testing scenarios.
import os def sample_detector_vector(ws): inst = ws.getInstrument() refFrame = inst.getReferenceFrame() detector_pos= inst.getComponentByName('point-detector').getPos() sample_pos = inst.getComponentByName('some-surface-holder').getPos() sample_to_detector = detector_pos - sample_pos return sample_to_detector inst_dir = config.getInstrumentDirectory() file = os.path.join(inst_dir, 'POLREF_Definition.xml') ws = LoadEmptyInstrument(file) MoveInstrumentComponent(ws, 'point-detector', RelativePosition=False, X=1) MoveInstrumentComponent(ws, 'some-surface-holder', RelativePosition=False, X=0) print "Before Correction: ", sample_detector_vector(ws) ws = SpecularReflectionPositionCorrect(ws, 45, DetectorComponentName='point-detector', SampleComponentName='some-surface-holder') print "After Correction: (45 degree angle)", sample_detector_vector(ws)
comment:14 Changed 6 years ago by Owen Arnold
- Status changed from inprogress to verify
- Resolution set to fixed
comment:15 Changed 6 years ago by Owen Arnold
- Blocking 9401 added
(In #9401) This is actually blocked by #9389, because in order to fix this in a general way, we need to be able to determine an averaged vertical detector location as well as the sample location. The code to do this is already in SpecularReflectionCorrectPositions (9389).
- A first step to getting this done will be to extract out an algorithm base class called SpecularReflectionAlgorithm from SpecularReflectionCorrectPositions. This will provide two protected method and will otherwise virtual. Two methods are getDetectorComponent() and getSampleComponent()
- Next step is to use the base class to create a new algorithm called SpecularReflectionCorrectTheta, which will use this base class.
- Next step is to wire this algorithm into ReflectometryReductionOne to replace to existing correction logic.
comment:16 Changed 6 years ago by Peter Parker
Code looked fine to me. Unit tests are passing and seem to offer good coverage.
I had a play with the script, changing the magnitude and direction of the initial sample-detector vector, and those changes gave me different results. There was no change in result for vectors in the Y-direction, but if I've understood the code correctly this is expected (as they lie "across" the beam).
comment:17 Changed 6 years ago by Peter Parker
- Status changed from verify to closed
Merge remote-tracking branch 'origin/feature/9389_correct_positions_refl'
Full changeset: 47f57aec41e954f7b94d3f2ad73cea1c859d9b48
comment:18 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 10232