Ticket #5633 (closed: fixed)

Opened 8 years ago

Last modified 5 years ago

Product Exponential Linear Fit Function

Reported by: Owen Arnold Owned by: Owen Arnold
Priority: major Milestone: Release 2.2
Component: Mantid Keywords:
Cc: Blocked By: #5636
Blocking: Tester: Michael Reuter

Description

Following #5626 we need functions specific to detector efficiency corrections. These need to be named functions with named parameters so that they can be configured in the IDF xml.

Attachments

demo.xml (735 bytes) - added by Owen Arnold 8 years ago.

Change History

comment:1 Changed 8 years ago by Owen Arnold

  • Status changed from new to accepted

comment:2 Changed 8 years ago by Owen Arnold

refs #5633. New parameter function produced

Changeset: 0b7a4be579ef2ea24d4d3c10255c2d25e9f43308

comment:3 Changed 8 years ago by Owen Arnold

refs #5633. Working and tested param function

Changeset: e6ab7071fe373fd11bf4a0259e740d5fe546ef52

comment:4 Changed 8 years ago by Owen Arnold

refs #5633. Fix GCC errors and warnings

Changeset: e7d689242d1638f92a6f96f1cb094794b201f52d

comment:5 Changed 8 years ago by Owen Arnold

refs #5633. Fix GCC errors

Changeset: dbb8db89633f7d88d226afcec9f5bf804c68234d

comment:6 Changed 8 years ago by Owen Arnold

refs #5633. Fix test precision issue on mac

Changeset: fe70e69e5718be81cb84cd630fca47b10f788258

comment:7 Changed 8 years ago by Owen Arnold

refs #5633. Characterise derivs using mocking

Changeset: 3d8e525bcb9637257e3efb8ce02ede1947193d98

comment:8 Changed 8 years ago by Owen Arnold

Create a wiki page to describe the algorithm @ http://www.mantidproject.org/ProductLinearExp

comment:9 Changed 8 years ago by Owen Arnold

  • Blocked By 5636 added

comment:10 Changed 8 years ago by Owen Arnold

refs #5633. Calculate Jacobian.

Changeset: 60d8b749ecebe1a1bd802b5ecdb398bfdc79fac0

comment:11 Changed 8 years ago by Owen Arnold

refs #5633 #5634. Documentation.

Changeset: 3b1821e1920f87f9756d2accbf92cb8ba758c52f

comment:12 Changed 8 years ago by Owen Arnold

Tester: The following python code (along with the attached demo.xml file) can be used to verify that this fit function is working, and is compatible with the NormaliseByDetector algorithm, for which it has been written. Running the following script should not cause any exception to be raised.

import math 

inWS = Load(Filename='POLREF00004699.nxs') # in AutoTest dir
inWS = ConvertSpectrumAxis(InputWorkspace=inWS,Target='signed_theta')
inWS = inWS[0]
inWS = ConvertUnits(InputWorkspace=inWS,Target='Wavelength',EMode='Indirect')

# Overwrite the
for i in range(0, inWS.getNumberHistograms()):
        Y = inWS.dataY(i)
        for j in range(0, len(Y)):
                Y[j] = 1

# Parameter file sets a global ProductLinearExp fit function for the whole instrument.
LoadParameterFile(Workspace=inWS,Filename=r'demo.xml')
normalised = NormaliseByDetector(InputWorkspace=inWS)

# It's enough just to use just the first histogram and compare the expected Y values with the Actual ones to determine if the ProductLinearExp fit function is being used.
for k in range(0, 1):
        Xout = normalised.dataX(i)
        Yout = normalised.dataY(i)
        Yin = inWS.dataY(i)
        for l in range(0, len(Xout)-1):
                x = (Xout[l]  + Xout[l + 1])  / 2
                yExpected= 1/math.exp(-x/1) # because we set A1 = 0, A0 = 1. Height=1 and Lifetime = 1 in the demo.xml file.
                yActual = Yout[l]
                if((math.fabs(yExpected) - math.fabs(yActual)) > 0.0001):
                        print math.fabs(yExpected) , math.fabs(yActual)
                        raise RuntimeError("Error, NormaliseByDetector is not using ProductLinearExp fit function properly.")
Last edited 8 years ago by Owen Arnold (previous) (diff)

Changed 8 years ago by Owen Arnold

comment:13 Changed 8 years ago by Owen Arnold

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

comment:14 Changed 8 years ago by Owen Arnold

refs #5633 #5634. Test via FunctionFactory

Quite a simple but important test, because these functions would not work via NormaliseByDetector unless they were factory registered. Also provides checking that they are types of IFunction, since the test downcasts the boost shared_ptr.

Changeset: 76e97bb7f0c883f83d6a97f19d0ac2b1f91ab3fe

comment:15 Changed 8 years ago by Michael Reuter

  • Status changed from verify to verifying
  • Tester set to Michael Reuter

comment:16 Changed 8 years ago by Michael Reuter

  • Status changed from verifying to closed

This seems to be working fine.

comment:17 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 6479

Note: See TracTickets for help on using tickets.