Ticket #7492 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Include background in fitting data with ComptonScatteringCountRate

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: blocker Milestone: Release 3.0
Component: Framework Keywords:
Cc: Blocked By:
Blocking: Tester: Gesner Passos

Description


Change History

comment:1 Changed 7 years ago by Nick Draper

  • Milestone changed from Release 2.6 to Backlog

Moved to backlog at the code freeze for R2.6

comment:2 Changed 7 years ago by Martyn Gigg

  • Priority changed from major to critical
  • Milestone changed from Backlog to Release 3.0

comment:3 Changed 7 years ago by Martyn Gigg

  • Priority changed from critical to blocker

comment:4 Changed 7 years ago by Martyn Gigg

  • Status changed from new to inprogress

Refactor ComptonScattering to allow for a background.

The constraint matrices need to expand if a background is to be included. Refs #7492

Changeset: 5f80950633883e4e951883667f6ea7231796ee45

comment:5 Changed 7 years ago by Martyn Gigg

Allow ComptonScatteringCountRate to include a background.

Refs #7492

Changeset: e7dabe86db12c6a30b0e646b8dbe6f50419943ed

comment:6 Changed 7 years ago by Martyn Gigg

Alter ComptonProfile to require input data in seconds.

Avoids having to implement custom background functions that understand that the data must be in seconds. Refs #7492

Changeset: 0eb39f8df6063683d500e3c1e6dc252ecc5d3b04

comment:7 Changed 7 years ago by Martyn Gigg

Added AugmentedLagrangianOptimizer

Used for solving minimization problems subject to constraints. Refs #7492

Changeset: 5502ad26a54c56ee091cede74b970dea4fc54e39

comment:8 Changed 7 years ago by Martyn Gigg

Use AugmentedLagrangian optimizer in ComptonScatterCountRate

It is better at dealing with larger scale objective functions when the background is included. Refs #7492

Changeset: edf74d130ff6166b316236035a9e023b0e2f97ff

comment:9 Changed 7 years ago by Martyn Gigg

Add Vesuvio fit test for when Kfse is free parameter.

Refs #7492

Changeset: e1d45b8e34f789ea0be86338b89389a8ee4ac3a4

comment:10 Changed 7 years ago by Martyn Gigg

Update Vesuvio system tests due to optimizer changes.

Refs #7492

Changeset: 91427aeb88bfc25fd3017f73a7345e448d3d916f

comment:11 Changed 7 years ago by Martyn Gigg

Add Vesuvio Fitting test including a background.

Refs #7492

Changeset: d30019d6990d0272146d9369519a7a4c472f5fea

comment:12 Changed 7 years ago by Martyn Gigg

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

Branch: feature/7492_background_in_compton_scattering

Tester: The following script should run the fitting as the Vesuvio guys do. The systemtests/Data directory will need to be in the data search path.

function_str = \
        "composite=ComptonScatteringCountRate,NumDeriv=1,IntensityConstraints=\"Matrix(1|3)0|-1|3\";"\
        "name=GramCharlierComptonProfile,WorkspaceIndex=0,Mass=1.007940,HermiteCoeffs=1 0 1;"\
        "name=GaussianComptonProfile,WorkspaceIndex=0,Mass=27.000000;"\
        "name=GaussianComptonProfile,WorkspaceIndex=0,Mass=91.000000;name=Polynomial,n=1,A0=0,A1=0"
    # Run fit
    _do_fit(function_str, k_is_free=True)

def _do_fit(function_str, k_is_free):
    """
    Run the Vesuvio . If k_is_free is False then it is fixed to f0.Width*sqrt(2)/12
    
    """
    LoadVesuvio(Filename='14188-14190',OutputWorkspace='raw_ws',SpectrumList='135',Mode='SingleDifference',
                InstrumentParFile=r'IP0005.dat')
    CropWorkspace(InputWorkspace='raw_ws',OutputWorkspace='raw_ws',XMin=50,XMax=562)
    # Convert to seconds
    ScaleX(InputWorkspace='raw_ws',OutputWorkspace='raw_ws',Operation='Multiply',Factor=1e-06)
    
    if k_is_free:
        ties_str = "f1.Width=10.000000,f2.Width=25.000000"
    else:
        ties_str = "f1.Width=10.000000,f2.Width=25.000000,f0.FSECoeff=f0.Width*sqrt(2)/12"

    constraints_str = "2.000000 < f0.Width < 7.000000"
    
    Fit(InputWorkspace='raw_ws',Function=function_str,Ties=ties_str,Constraints=constraints_str,
        Output=WS_PREFIX, CreateOutput=True,OutputCompositeMembers=True,MaxIterations=5000,
        Minimizer="Levenberg-Marquardt,AbsError=1e-08,RelError=1e-08")
    # Convert to microseconds
    ScaleX(InputWorkspace=WS_PREFIX + '_Workspace',OutputWorkspace=WS_PREFIX + '_Workspace',Operation='Multiply',Factor=1e0

It should produce a reasonable fit with a table of parameters that includes f4.A0 & f4.A1 that relate to the background. Ultimate confirmation of the validity of the results has to lie with the Vesuvio guys but we need it in master to get that far.

comment:13 Changed 7 years ago by Martyn Gigg

Fix silly copy-and-paste error in VesuvioTest reference file

Refs #7492

Changeset: 21d391444e8de500a8dbaf7eaf1aa59eec4f47a9

comment:14 Changed 7 years ago by Martyn Gigg

Relax tolerance on windows/mac for vesuvio tests.

The results are still acceptable they just differ slightly (my guess is the GSL) from Linux where the reference file was created. Refs #7492

Changeset: ff671edd32f208431096c6571904362af4c245d5

comment:15 Changed 7 years ago by Martyn Gigg

Relax Mac tolerance. Refs #7492

Changeset: 69ffa416a305000821139628aed51e5792441707

comment:16 Changed 7 years ago by Gesner Passos

  • Status changed from verify to verifying
  • Tester set to Gesner Passos

comment:17 Changed 7 years ago by Gesner Passos

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/7492_background_in_compton_scattering'

Full changeset: 7e62579abce0e37800ffe211d15d066674ae23e6

comment:18 Changed 7 years ago by Gesner Passos

The results are sensible, and the implementation is well planed. Besides, the extension of the systemtests seems quite reasonable.

comment:19 Changed 7 years ago by Gesner Passos

Merge remote-tracking branch 'origin/feature/7492_background_in_compton_scattering'

Full changeset: 9604f8754c888624a383c1f1982499ebe73e9fcd

comment:20 Changed 7 years ago by Martyn Gigg

Relax Vesuvio fit tolerance for 32-bit Windows.

Refs #7492

Changeset: adce86757d1ae37dac071f84bdcca9aab5f4fc22

comment:21 Changed 7 years ago by Martyn Gigg

Fix VeusvioTest syntax

Refs #7492

Changeset: 544df9cf16cc5907dff93dc281e35c2d059bb6cd

comment:22 Changed 7 years ago by Martyn Gigg

Merge remote-tracking branch 'origin/feature/7492_background_in_compton_scattering'

Full changeset: e18f99097c78981dcb3aae61991d842d3d4f2367

comment:23 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8337

Note: See TracTickets for help on using tickets.