Ticket #9401 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Theta calculation bug

Reported by: Owen Arnold Owned by: Owen Arnold
Priority: blocker Milestone: Release 3.2
Component: Reflectometry Keywords: PatchCandidate
Cc: Blocked By: #9389
Blocking: #9184 Tester: Anders Markvardsen

Description

ReflectometryReductionOne and ReflectometryReductionOneAuto output incorrect theta values.

The following script shows this problem in action:

(q,l,th)=ReflectometryReductionOneAuto('INTER00022699',OutputWorkspace='vsQ1',OutputWorkspaceWavelength='vsLam1')
print "incorrect theta reported as ", th

ws = mtd['INTER00022699']
inst = ws.getInstrument()
det = inst.getComponentByName('point-detector').getPos()
sample = inst.getComponentByName('some-surface-holder').getPos()

detsample  = det - sample

refFrame = inst.getReferenceFrame()
upoffset = refFrame.vecPointingUp().scalar_prod(detsample)
beamoffset = refFrame.vecPointingAlongBeam().scalar_prod(detsample)

import math
print "correct theta is:", math.atan(upoffset/beamoffset)/2 * 180 / math.pi

Change History

comment:1 Changed 6 years ago by Owen Arnold

  • Keywords PatchCandidate added
  • Priority changed from major to blocker
  • Component changed from Framework to Reflectometry
  • Milestone changed from Backlog to Release 3.2

comment:2 Changed 6 years ago by Owen Arnold

  • Status changed from new to assigned

comment:3 Changed 6 years ago by Owen Arnold

  • Owner set to Owen Arnold

comment:4 Changed 6 years ago by Owen Arnold

  • Blocked By 9389 added

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:5 Changed 6 years ago by Owen Arnold

  • Status changed from assigned to inprogress

refs #9401. Create and Use base algorithm class

Changeset: 90f91bed9f6ae71c5460413e0de6015ac70b9e14

comment:6 Changed 6 years ago by Owen Arnold

refs #9401. Add new algorithm.

Create a testing base class and move properties over to algorithm base class.

Changeset: 794bd10310192e0e494435a1a177720aa7268708

comment:7 Changed 6 years ago by Owen Arnold

refs #9401. More shared tests.

Changeset: e835115b72826be03732327ec473750e122aa5f9

comment:8 Changed 6 years ago by Owen Arnold

refs #9401. Implement theta calculation.

Changeset: 1c2558f7d544cf310407d07c604dfaef19f1a742

comment:9 Changed 6 years ago by Owen Arnold

refs #9401. Documentation and logging.

Changeset: fb7976ce23be1507d2fde8b4085bb4c480ea8f28

comment:10 Changed 6 years ago by Owen Arnold

refs #9401. Rename algorithm to better reflect job.

Changeset: 1eb228c7d1e92e2680f4302807c755f10a692d6c

comment:11 Changed 6 years ago by Owen Arnold

refs #9401. Fixed in ReflectometryReductionOne.

Changeset: 57ac60c55017df965c0ed28442d1c67986789527

comment:12 Changed 6 years ago by Owen Arnold

  • Blocking 9184 added

comment:13 Changed 6 years ago by Owen Arnold

  • Status changed from inprogress to verify
  • Resolution set to fixed

Tester: This issue has now been fixed. I have reused the code in SpecularReflectionPositionCorrect via an algorithm base class to achieve this. Unit tests have been added and adapted to handle this error.

Rerun the original python script (ask me for INTER data set if required). To see this fixed.

comment:14 Changed 6 years ago by Anders Markvardsen

  • Status changed from verify to verifying
  • Tester set to Anders Markvardsen

comment:15 Changed 6 years ago by Anders Markvardsen

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/9401_correct_positions'

Full changeset: 48abd57ae32196550e2cb1aa06e28a38de801727

comment:16 Changed 6 years ago by Anders Markvardsen

Unit test added to handle error. Output from running script is:

incorrect theta reported as  0.709694197533
correct theta is: 0.709694197533

comment:17 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 10244

Note: See TracTickets for help on using tickets.