Ticket #8589 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Transmission Workflow Algorithm

Reported by: Owen Arnold Owned by: Owen Arnold
Priority: critical Milestone: Release 3.1
Component: Reflectometry Keywords:
Cc: Blocked By:
Blocking: #8616 Tester: Peter Parker

Description

There is a lack of flexibility in the current quick script (and also now #8371) that the users don't like. Essentially the generation and normalisation of transmission runs is hard-coded. The algorithms/scripts both make and use the Transmission runs. It would be better to separate out the building of the Transmission runs from their usage. This would also collapse the existing ReflectometryReductionOne algorithm down by quite a bit.

  • Create a new CreateTransmissionCorrection workflow algorithm. Fortunately, I knew that this work would be upon us so most of the Transmission Correction functionality is in a stand-alone method. Things like toLam may make a base algorithm.
  • Make ReflectometryReductionOne use CreateTransmissionCorrection
  • If the workspace 'FirstTransmissionRun' appears to be in units of wavelength. Assume that it has already been reduced and just use it as the denominator in the normalisation step. Otherwise if it's in TOF, run the TransmissionCorrection procedures. Otherwise, fall over and die (loudly).

Change History

comment:1 Changed 7 years ago by Owen Arnold

  • Status changed from new to inprogress

refs #8589. Template for new algorithm and tests.

Changeset: e2128e7236d3895d17933187fdb438e7b54dd3a2

comment:2 Changed 7 years ago by Owen Arnold

refs #8589. Create a base algorithm class.

Changeset: 8843ff2e46b881957c3513790828f336974364e4

comment:3 Changed 7 years ago by Owen Arnold

refs #8589. Move common toLam to base class.

Move and make adjustments to ensure that everything is still working and that tests still pass.

Changeset: fbb8721407a278f229c12e8b8ce7671a7a9f4bc8

comment:4 Changed 7 years ago by Owen Arnold

refs #8589. Move existing functions into base class.

Will still need to do some work around these yet.

Changeset: 5340581d1e4681256d642002280b95473e84bdd7

comment:5 Changed 7 years ago by Owen Arnold

refs #8589. Move transmission correction code into base class.

More work will need to be done here because we yet need to separate out the making from the utilisation parts in order for this to be useful to both Correction and Reduction algorithms which use it.

Changeset: bcc2ae5d4c86faa9f3bab71e240915a6bcbce1e6

comment:6 Changed 7 years ago by Owen Arnold

refs #8589. Separate make transmission method.

This method is used by current transmission run method, can also be used by Correction algorithm separately.

Changeset: 9833ce578e81d1a6f11ed7d1effd34b88cf772fe

comment:7 Changed 7 years ago by Owen Arnold

refs #8589. Check spectrum numbers of input trans workspaces.

Add unit tests to demonstrate happy-paths for the CreateTransmissionWorkspace alg.

Changeset: c0035476bdc925d568cc4a38a51ca779ca79782d

comment:8 Changed 7 years ago by Owen Arnold

refs #8589. Move trans corr to utilising algorithm class.

The bit that is actually applying the trans corr is not required in the base class.

Changeset: ae7bab4351315de14b3a03dffade074e6e625e0a

comment:9 Changed 7 years ago by Owen Arnold

refs #8589. Call make transmission via algorithm.

This is a better strategy particularly when nested histories become possible.

Changeset: 6f05e9ce12f01cc740fdfbc403f8af7a91a78ad2

comment:10 Changed 7 years ago by Owen Arnold

refs #8589. Make transmission runs not needed on base.

Make transmission runs can be private to the creation algorithm now that the workflow algorithm is calling the creational algorithm rather than using a shared method on the base class.

Changeset: e63d50f4cf3a9590d31fca12cd37ca51d4227bbb

comment:11 Changed 7 years ago by Owen Arnold

refs #8589. Use rather than make transmission workspaces.

Use rather than make a transmission workspace if the units are in wavelength.

Changeset: 772363c95337f00ef53729b5d829d304b4f445d0

comment:12 Changed 7 years ago by Owen Arnold

refs #8589. Remove unused test files.

Changeset: 19f56949194af1749d233e189fb49d4a69a59dee

comment:13 Changed 7 years ago by Owen Arnold

refs #8589. Improve documentation where possible.

Changeset: d05a1240d3c2bdbb71a533609d3990a18ffcb93c

comment:14 Changed 7 years ago by Owen Arnold

refs #8589. Bad property names.

Stitching is actually happening with workspaces in wavelength not in Q. Parameter names and documentation needs to reflect this.

Changeset: fe9ac6f1f913b5ce9c075658a205f0b6c95809c1

comment:15 Changed 7 years ago by Owen Arnold

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

Tester. The algorithms now achieve all of the above stated aims. The following script shows this. With one run of ReflectometryReductionOne, we allow it to process and utilise the raw transmission runs. For the second run of the algorithm, we run Create TransmissionWorkspace first, and then pass that result in as the FirstTransmissionRun. The plot shows that the results are identical.

from mantid.simpleapi import *
from isis_reflectometry import quick
reload(quick)

class ReflectometryQuick(object):
  
    def runTest(self):
        defaultInstKey = 'default.instrument'
        defaultInstrument = config[defaultInstKey]
        
        config[defaultInstKey] = 'INTER'
        LoadISISNexus(Filename='13463', OutputWorkspace='13463')
        LoadISISNexus(Filename='13464', OutputWorkspace='13464')
        LoadISISNexus(Filename='13460', OutputWorkspace='13460')
    
        transmissionRuns = '13463,13464'
        runNo = '13460'
        incidentAngle = 0.7
        quick.quick(runNo, trans=transmissionRuns) 

        config[defaultInstKey] = defaultInstrument
        
        # Existing behaviour all-in-one Reflectometry Reduction and Transmission correction.
        new_IvsQ1, new_IvsLam1, thetaOut1 = ReflectometryReductionOne(InputWorkspace='13460', WavelengthMin=1.0, WavelengthMax=17.0, WavelengthStep=0.05, MonitorBackgroundWavelengthMin=15.0, 
        MonitorBackgroundWavelengthMax=17.0, I0MonitorIndex=2, MonitorIntegrationWavelengthMin=4.0, MonitorIntegrationWavelengthMax=10.0, WorkspaceIndexList=[3,4], Params=[1.5, 0.02, 17], 
        StartOverlap=10.0, EndOverlap=12.0, FirstTransmissionRun='13463', SecondTransmissionRun='13464')
        

        # Separately compute the transmission run.
        transmission = CreateTransmissionWorkspace(WavelengthMin=1.0, WavelengthMax=17.0, WavelengthStep=0.05, MonitorBackgroundWavelengthMin=15.0, 
        MonitorBackgroundWavelengthMax=17.0, I0MonitorIndex=2, MonitorIntegrationWavelengthMin=4.0, MonitorIntegrationWavelengthMax=10.0, 
        WorkspaceIndexList=[3,4], Params=[1.5, 0.02, 17], StartOverlap=10.0, EndOverlap=12.0, FirstTransmissionRun='13463', SecondTransmissionRun='13464')
        

        # Pass the transmission run into ReflectometryReductionOne.
        new_IvsQ2, new_IvsLam2, thetaOut2 = ReflectometryReductionOne(InputWorkspace='13460', WavelengthMin=1.0, WavelengthMax=17.0, WavelengthStep=0.05, MonitorBackgroundWavelengthMin=15.0, 
        MonitorBackgroundWavelengthMax=17.0, I0MonitorIndex=2, MonitorIntegrationWavelengthMin=4.0, MonitorIntegrationWavelengthMax=10.0, WorkspaceIndexList=[3,4], 
        FirstTransmissionRun=transmission)
        
        plotSpectrum([new_IvsLam1, new_IvsLam2, '13460_IvsLam'], [0])
        plotSpectrum([new_IvsQ1, new_IvsQ2, '13460_IvsQ'], [0])
        
        
test = ReflectometryQuick()
test.runTest()

comment:16 Changed 7 years ago by Owen Arnold

  • Milestone changed from Backlog to Release 3.1

comment:17 Changed 7 years ago by Owen Arnold

  • Blocking 8616 added

comment:18 Changed 7 years ago by Peter Parker

  • Status changed from verify to verifying
  • Tester set to Peter Parker

comment:19 Changed 7 years ago by Peter Parker

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/8589_transmission_workflow'

Full changeset: 0c00f6ec424d77546b604829a284ec6a65bd2b05

comment:20 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9433

Note: See TracTickets for help on using tickets.