Ticket #8646 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Refactor FitPeak for FindPeaks

Reported by: Wenduo Zhou Owned by: Wenduo Zhou
Priority: major Milestone: Release 3.1
Component: Framework Keywords:
Cc: petersonpf@…, taylorrj@… Blocked By:
Blocking: #7789 Tester: Vickie Lynch

Description

FindPeaks may call FitPeak N times if N peaks are to find. Calling through Algorithm might have a significant cost of computation time, as it is found that with new FindPeaks algorithm calling FitPeak (ticket #7789), system test CalibrateRectangularDetectorsTest is slowed down by 3 times.

Thus, one approach is to refactor FitPeak such that FindPeak can fit peak through a class object but not calling a Mantid Algorithm.

Attachments

test8646a.py (458 bytes) - added by Wenduo Zhou 7 years ago.
test8646b.py (861 bytes) - added by Wenduo Zhou 7 years ago.

Change History

comment:1 Changed 7 years ago by Wenduo Zhou

  • Status changed from new to inprogress

Checkpointing work. Refs #8646.

Changeset: 3986e29f7ae6186a3b3157c119a856427b86b704

comment:2 Changed 7 years ago by Wenduo Zhou

Checkpointing work. Refs #8646.

Changeset: 75140c3a4bcddf7c0abf6edbdd427028180c0672

comment:3 Changed 7 years ago by Wenduo Zhou

Checkpointing work. Refs #8646.

Changeset: 350d829ff7427751fb4ac4c0f11a998a9f8e7599

comment:4 Changed 7 years ago by Wenduo Zhou

Corrected build errors from refactoring. Refs #8646.

Changeset: c61600077bc2e7dd77edf15c2e99868add37e184

comment:5 Changed 7 years ago by Wenduo Zhou

Finished the implementation on new fit peak class. Refs #8646.

Changeset: ac67720cb5ab8204c1b44ad2e4ebddf7237e5160

comment:6 Changed 7 years ago by Wenduo Zhou

Cleaned the code and unit tests. Refs #8646.

Changeset: 8ff4af3a59d53fdaa3baa2ae746a550b1969dcb2

comment:7 Changed 7 years ago by Wenduo Zhou

Resolved conflict. Refs #8646.

Changeset: 854120e8debfc4330ae2571857677a184dfaf335

comment:8 Changed 7 years ago by Wenduo Zhou

How to verify

  1. Locate data file PG3_4866.gsa and PG3_2538_event.nxs in Mantid's system test's data;
  1. Load PG3_4866.gsa by LoadGSS. Pick up any peak to fit by FitPeak. For example you can find a peak centered close to 11190.. Give the algorithm a rough estimation on peak height (100.0) and peak width (20.0). Set the peak range between 11180=0.0 and 11300. Set the fit window between 11000 and 11400. And set 'FitBackgroundFirst' to true because the background is high relative to the peak.

You can also refer to test8646a.py attached.

  1. Load PG3_2538_event.nxs. Process the data referring to attached script test8646b.py. Select any spectrum and any peak to fit. For example, you can select peak near d=1.26 in spectrum 22000. Make a rough estimation on peak's parameters. As the background is low and flat you can use 'LinearBackground' and set 'FitBackgroundFirst' to false.

Changed 7 years ago by Wenduo Zhou

Changed 7 years ago by Wenduo Zhou

comment:9 Changed 7 years ago by Wenduo Zhou

Added more in wiki. Refs #8646.

Changeset: 158d08c494adb8ae318dadbbbf9629e28377ac71

comment:10 Changed 7 years ago by Wenduo Zhou

Fixed issues with fit error passing. Refs #8646.

Changeset: 20c0caddc7b9ac09ea36f5d60d6c69f962ed839a

comment:11 Changed 7 years ago by Wenduo Zhou

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

comment:12 Changed 7 years ago by Samuel Jackson

  • Status changed from verify to verifying
  • Tester set to Samuel Jackson

comment:13 Changed 7 years ago by Samuel Jackson

  • Status changed from verifying to reopened
  • Resolution fixed deleted

I'm getting a merge conflict in FitPeak when trying to test. Fix and I'll retest.

Auto-merging Code/Mantid/Framework/Algorithms/src/FitPeak.cpp
CONFLICT (content): Merge conflict in Code/Mantid/Framework/Algorithms/src/FitPeak.cpp
Auto-merging Code/Mantid/Framework/Algorithms/src/FindPeaks.cpp
Automatic merge failed; fix conflicts and then commit the result.

comment:14 follow-up: ↓ 15 Changed 7 years ago by Nick Draper

The title of this ticket is very similar to #7789 is it a duplicate?

comment:15 in reply to: ↑ 14 Changed 7 years ago by Wenduo Zhou

Replying to Nick Draper:

The title of this ticket is very similar to #7789 is it a duplicate?

These two tickets are different though somehow related. In ticket #7789, the section of codes in FindPeaks to fit a single peak will be replaced by calling algorithm FitPeak.

Some tests show that calling FitPeak as a sub algorithm is very costly. And it slowed down some algorithm, such as GetDetOffsetsMultiPeaks that calls FindPeaks thousands of times, significantly. So I created this ticket to implement a class to fit peak. And this class is used by FitPeak and will be used by FindPeaks in order to avoid the overhead to start sub algorithms.

comment:16 Changed 7 years ago by Wenduo Zhou

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

comment:17 Changed 7 years ago by Vickie Lynch

  • Status changed from verify to verifying
  • Tester changed from Samuel Jackson to Vickie Lynch

comment:18 Changed 7 years ago by Vickie Lynch

Refs #8646 fix merge conflict

Changeset: 5a18232cf2bedf44008edd94054587a72f17b16d

comment:19 Changed 7 years ago by Vickie Lynch

  • Status changed from verifying to closed

My gsa data did not have errors in file which caused chisq to be wrong, but this was not caused by these changes.

comment:20 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9490

Note: See TracTickets for help on using tickets.