Ticket #5634 (closed: fixed)

Opened 8 years ago

Last modified 5 years ago

Product Exponential Quadratic 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: Jose Borreguero

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 (894 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 #5634. Template for new Product function.

Changeset: 83b754d91c04370fa02b79adb5823007ddea8ac3

comment:3 Changed 8 years ago by Owen Arnold

  • Blocked By 5636 added

comment:4 Changed 8 years ago by Owen Arnold

comment:5 Changed 8 years ago by Owen Arnold

refs #5634. Working with tests.

Changeset: e708079ff54f8ce3a35dea87151ec14387b67a9b

comment:6 Changed 8 years ago by Owen Arnold

refs #5633 #5634. Documentation.

Changeset: 3b1821e1920f87f9756d2accbf92cb8ba758c52f

comment:7 Changed 8 years ago by Owen Arnold

refs #5634. Fix GCC errors and warnings.

Changeset: 4c90aa9955ff44a4439992db3804f85357ca136f

comment:8 Changed 8 years ago by Owen Arnold

refs #5634. Fix GCC errors and warnings.

Changeset: db267153faf6adf20bfd6c6043de63f02b7c29be

comment:9 Changed 8 years ago by Owen Arnold

Tester: The following demonstrates this fit function working with the NormaliseByDetector alg, for which it was written. The demo.xml file is attached.

import math 

inWS = Load(Filename='POLREF00004699.nxs')
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/( (x*x + x + 1) * math.exp(-x/1)) # because we set A1 = 1 A0 = 1. A2=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.")

Changed 8 years ago by Owen Arnold

comment:10 Changed 8 years ago by Owen Arnold

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

comment:11 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:12 Changed 8 years ago by Jose Borreguero

  • Status changed from verify to verifying
  • Tester set to Jose Borreguero

comment:13 Changed 8 years ago by Jose Borreguero

  • Status changed from verifying to closed

comment:14 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 6480

Note: See TracTickets for help on using tickets.