Ticket #11043 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Introduce Pawley function

Reported by: Michael Wedel Owned by: Michael Wedel
Priority: major Milestone: Release 3.4
Component: Diffraction Keywords: POLDI
Cc: roman.tolchenov@…, martyn.gigg@… Blocked By: #11102
Blocking: #9992 Tester: Wenduo Zhou

Description

One mode of analysing POLDI data with the original analysis software is to perform a Pawley fit. In this approach, peak profiles are fitted to the data. Unlike in "unconstrained" peak fitting, the peak positions are not fitted individually, instead they are calculated from unit cell parameters.

While this functionality exists in other powder diffraction analysis software, it has to be implemented in Mantid in order to be able to use it for POLDI data. On the other hand, it should be made general enough so that it can be used in connection with other instruments as well.

In this ticket I would like to introduce an implementation example. A design document has been written already, but some points are still open for discussion.

Attachments

PawleyFcc3_6.nxs (124.2 KB) - added by Michael Wedel 6 years ago.
Peaks of FCC lattice with a = 3.6 in d-range [0.7...2.5]
PawleySi.nxs (126.8 KB) - added by Michael Wedel 6 years ago.
PawleyFunctionDiagram.pdf (2.0 KB) - added by Michael Wedel 6 years ago.

Change History

comment:1 Changed 6 years ago by Michael Wedel

comment:2 Changed 6 years ago by Michael Wedel

  • Milestone changed from Backlog to Release 3.4

comment:3 Changed 6 years ago by Michael Wedel

  • Blocked By 11102 added

comment:4 Changed 6 years ago by Michael Wedel

  • Blocking 9992 added

comment:5 Changed 6 years ago by Michael Wedel

  • Status changed from new to inprogress

Refs #11043. Added PawleyFunction skeleton

Changeset: 4e79d47ebe56ed0a47ac343518e2afbfcf3d5249

comment:6 Changed 6 years ago by Michael Wedel

Refs #11043. Renaming function, adding unit cell parameters

Changeset: 1428773c4a35503a3ba52efc17b857cb52c00071

comment:7 Changed 6 years ago by Michael Wedel

Refs #11043. Adding actual PawleyFunction

Changeset: 95581851a106ac9db694364434c9a78ead086c8c

comment:8 Changed 6 years ago by Michael Wedel

Refs #11043. Correcting parameter behavior, adding peaks.

Changeset: 492aff6d156bc1f4a38c8bffef85609c2996ad29

comment:9 Changed 6 years ago by Michael Wedel

Refs #11043. Implementing function

Changeset: 4ad731913a3c89af32bfbeca7b7215022b754231

comment:10 Changed 6 years ago by Michael Wedel

Refs #11043. PawleyFit-skeleton

Changeset: c7cc0cea5bbb0eefbfb35ac957e50a83eed77759

comment:11 Changed 6 years ago by Michael Wedel

Refs #11043. Extending peak handling in PawleyFunction

Changeset: 75d80b49011baa5d313258fc15010537c9ac01e7

comment:12 Changed 6 years ago by Michael Wedel

Refs #11043. First working version of PawleyFit

Changeset: 65a71b5abf27fe86e417b66bfe2ac8d495da9bfa

Changed 6 years ago by Michael Wedel

Peaks of FCC lattice with a = 3.6 in d-range [0.7...2.5]

comment:13 Changed 6 years ago by Michael Wedel

The algorithm can now be run with the following script:

Load(Filename='PawleyFcc3_6.nxs', OutputWorkspace='PawleyFcc3_6')
PawleyFit(InputWorkspace='PawleyFcc3_6', CrystalSystem='Cubic', InitialCell='3.58 3.58 3.58', MillerIndices='[1,1,1];[2,0,0];[2,2,0];[2,2,2];[3,1,1];[3,3,1];[4,0,0];[4,2,0];[4,2,2]', OutputWorkspace='output')

After this, output contains the input/calculated/difference curves.

comment:14 Changed 6 years ago by Michael Wedel

Refs #11043. Additional option.

Changeset: d4330d2487d522d11269d68a7327f9789bf4b5e9

comment:15 Changed 6 years ago by Michael Wedel

Refs #11043. Fixing parameter at right place, profile function name

Changeset: 0628fc061434e13c44cc811c391eb99f9854b60e

comment:16 Changed 6 years ago by Michael Wedel

Refs #11043. Add setWorkspace to FunctionParameterDecorator

The setWorkspace and setMatrixWorkspace methods were not implemented in FunctionParameterDecorator

Changeset: e8676f9b5480f969a1fa2cfffe2ffc3a1d82d453

comment:17 Changed 6 years ago by Michael Wedel

Refs #11043. Adapting PoldiPeakSearch to work with different units.

Changeset: 5db3ba1563a1ef036f674744fdf5e0199c9aaef0

comment:18 Changed 6 years ago by Michael Wedel

Refs #11043. Adding more unit tests.

Changeset: d02719ab0f55af1d4251ceff5deff23b7cf0abaf

comment:19 Changed 6 years ago by Michael Wedel

Refs #11043. Get reflections from table

Changeset: 7151e2cc576d2898816843813d7cb0545e3e2e65

comment:20 Changed 6 years ago by Michael Wedel

Refs #11043. Generating output tables

Changeset: 9452f4e3fa28be1f94d8236fb1bd8e51615c1c30

comment:21 Changed 6 years ago by Michael Wedel

Refs #11043. Adding unit tests for PawleyFunction

Changeset: c230d44e7edcc0229c1efd3b2c9e87b8b229b2ee

comment:22 Changed 6 years ago by Michael Wedel

Refs #11043. Documentation for PawleyFunction

Changeset: 581e3808f275a58e6036ffb8595ed470293f8fa3

comment:23 Changed 6 years ago by Michael Wedel

Refs #11043. PawleyFunction uses Unit

Changeset: f1f22ee4e5f1bf9f4bbc36092971d17c1cc2c6e5

comment:24 Changed 6 years ago by Michael Wedel

Refs #11043. PawleyFit uses Unit

Changeset: 77d662a993610c047ff4cf64542cf31a432ecbde

comment:25 Changed 6 years ago by Michael Wedel

Refs #11043. Fixing validation problem in PoldiIndexKnownCompound

This was a very annoying problem which was caused by too strict validation.

Changeset: 307851998d525ee5af922077773db6fcf5650558

comment:26 Changed 6 years ago by Michael Wedel

Refs #11043. Make unit transformation in PoldiPeakSearch more clear

Changeset: ca17e372098ba1fbdd86c7b9b8ab7e4fb259555f

comment:27 Changed 6 years ago by Michael Wedel

Refs #11043. Unit conversion in PawleyFunction more robust

Changeset: 42323ede4b9c5b54d20564fb0921d16e55532088

comment:28 Changed 6 years ago by Michael Wedel

Refs #11043. Fixing CodeConventions system test

Changeset: 8bae0e8486334d844ad137afabf1a52cd6b290fa

comment:29 Changed 6 years ago by Michael Wedel

Refs #11043. Making PawleyFit more flexible regarding table columns

Changeset: 840401c283320f44cdc5498e7c3e1fa6da782614

comment:30 Changed 6 years ago by Michael Wedel

Refs #11043. Adding background to PawleyFit

Changeset: 0d34aeab8084d732dfb1a7aac1256c21b4f0656e

comment:31 Changed 6 years ago by Michael Wedel

Refs #11043. Add tests for PawleyFit

Changeset: 2cde6a4b81b782678d839791b5683b6358bb6d2b

Changed 6 years ago by Michael Wedel

comment:32 Changed 6 years ago by Michael Wedel

Refs #11043. Checkpointing work

Changeset: f44b9989c650a2267cb7e1d66a35629056dc55bd

comment:33 Changed 6 years ago by Michael Wedel

Refs #11043. Adding data file for doc test

Changeset: 097a4b14e18a7e9a00e95f9bcebc25f80790de29

comment:34 Changed 6 years ago by Michael Wedel

Refs #11043. Complete docs and doc-test

Changeset: 9c952a5335c0c81ad7e4e765956bc3c3b621b1f3

comment:35 Changed 6 years ago by Michael Wedel

Refs #11043. Adding some logging

Changeset: 8d3907a29a0b3e152bf53ce109b3c0b02989e24d

comment:36 Changed 6 years ago by Michael Wedel

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

This is being verified as pull request #439.

comment:37 Changed 6 years ago by Michael Wedel

Refs #11043. Forgot to add export symbol

Changeset: fb68d0d8a851492e0f5f5fd91f43cfbc23dc3cae

comment:38 Changed 6 years ago by Michael Wedel

Refs #11043. Fix lattice parameter typo in doctest

I accidentally inserted an additional 2 into the decimals of the lattice parameter of Si.

Changeset: e0a263c7ab7c7fdd8b8f020ac5c6eaa8aa8552c5

comment:39 Changed 6 years ago by Michael Wedel

Jenkins retest this please

Changed 6 years ago by Michael Wedel

comment:40 Changed 6 years ago by Michael Wedel

Jenkins retest this please

comment:41 Changed 6 years ago by Michael Wedel

Testing information Code review. There is a [design document](https://github.com/mantidproject/documents/blob/9e0539b5d8c93614de17a7e252d078414a9db861/Design/Design-PawleyFunction.md) that explains the implementation a bit, especially the "Update" section.

In the unit tests for PawleyFunction and PawleyFit there are some basic examples for what the algorithm can do. In the documentation for PawleyFit there is a usage example. The algorithm should work on any MatrixWorkspace which contains a spectrum in terms of d-spacing or momentum transfer - if you know a good example from a powder diffraction beamline that would be something to try.

comment:42 Changed 6 years ago by Wenduo Zhou

  • Status changed from verify to verifying
  • Tester set to Wenduo Zhou

comment:43 Changed 6 years ago by Michael Wedel

  • Status changed from verifying to verify
  • Tester Wenduo Zhou deleted

comment:44 Changed 6 years ago by Wenduo Zhou

  • Status changed from verify to verifying
  • Tester set to Wenduo Zhou

comment:45 Changed 6 years ago by Michael Wedel

The Test SystemTests.ISISDirectInelastic.MERLINReduction failed, but it don't know how that could be caused by these changes. I tried running it locally, but I don't have 16 GB of free memory to run it. I will try again on the build server.

comment:46 Changed 6 years ago by Michael Wedel

Jenkins retest this please

comment:47 Changed 6 years ago by Michael Wedel

The same test failed again and it failed on other pull request builds as well, so it seems that this has nothing to do with the changes.

comment:48 Changed 6 years ago by Federico Montesino Pouzols

Jenkins, retest this please

comment:49 Changed 6 years ago by Wenduo Zhou

In testing script, you used a property named 'MillerIndicies' to input peaks of algorithm PawleyFit. But it does not exist in the final code. Did you removed it later?

comment:50 Changed 6 years ago by Michael Wedel

Yes, sorry for not updating the script, I forgot about that. It turned out that some reasonable guesses for peak height/fwhm were required, so the list of HKLs was not enough to provide in some cases. That's why I made the TableWorkspace mandatory and removed the MillerIndices property.

So in case one does not want to use the POLDI algorithms, a TableWorkspace would have to be obtained some other way, I guess it could be done through Python.

comment:51 Changed 6 years ago by Wenduo Zhou

The structure of the codes is clear. All tests are passed. Failed pull request is due to other irrelevant reason.

I tried to fit the attached silicon data and the result is very good.

The ticket is then closed.

comment:52 Changed 6 years ago by Michael Wedel

Refs #11043. Added reduced chi square to output

Added this to the algorithms documentation.

Changeset: 08d3845eaeeadde29389e917ec309812bbd00131

comment:53 Changed 6 years ago by Michael Wedel

I've thought about running PoldiPeakSearch inside the algorithm when only calculated peaks are supplied, but the algorithm also has some parameters and the default ones don't always work, so I think for now it's better to keep this out of the algorithm.

comment:54 Changed 6 years ago by Wenduo Zhou

Everything looks find. Ticket is thus closed.

comment:55 Changed 6 years ago by Wenduo Zhou

  • Status changed from verifying to closed

Merge pull request #439 from mantidproject/11043_introduce_pawley_function

Introduce Pawley function and algorithm for using it

Full changeset: 3a622047da3cc95a538cc5bbe869a845ab293c0f

comment:56 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 11881

Note: See TracTickets for help on using tickets.