Ticket #7432 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Single Crystal Profile fit in Mantid corrections

Reported by: Vickie Lynch Owned by: Vickie Lynch
Priority: major Milestone: Release 2.6
Component: Framework Keywords:
Cc: Blocked By:
Blocking: Tester: Andrei Savici

Description

First data point is 0 which skews background. Profiles should be written in Art's format so they can be fitted with his code and fitting parameters for each peak should be saved in file. Fitting option with one exponential does not fit most peaks well. Gaussian Quadrature should be used for integration of profile with summing left as an option. Directory for output of png files should be specified.

Change History

comment:1 Changed 7 years ago by Vickie Lynch

Refs #7432 fix first point zero

Changeset: bc7c199c2c86e0653756e69e71026d982e1bbc4b

comment:2 Changed 7 years ago by Vickie Lynch

Refs #7432 find center of peak

Changeset: 0646b8c3581c75396176feb302457e6bc45e957b

comment:3 Changed 7 years ago by Vickie Lynch

  • Status changed from new to accepted

comment:4 Changed 7 years ago by Vickie Lynch

Refs #7432 profiles output files added

Changeset: 13f2ba999689e06e7c5914129f032cbaccde91cd

comment:5 Changed 7 years ago by Vickie Lynch

Refs #7432 write file of optimized fitting parameters

Changeset: 0e51e62fc3d7d666f65923f05267944e42cdd0b9

comment:6 Changed 7 years ago by Vickie Lynch

Refs #7432 fix Mac builds

Changeset: f5f1600a591a233870bed46d2d5541a3c803b704

comment:7 Changed 7 years ago by Vickie Lynch

Refs #7432 use function for evaluation

Changeset: 0585d1d6eff3e66b151c31228fb5c31bc8f90ae5

comment:8 Changed 7 years ago by Nick Draper

  • Status changed from accepted to assigned

comment:9 Changed 7 years ago by Vickie Lynch

Refs #7432 function for evaluation

Changeset: 67996985eda093010f404b05e80052069a9fc1a9

comment:10 Changed 7 years ago by Vickie Lynch

Refs #7432 use gsl integration instead of sum

Changeset: 6b4425273727dfdd58c968ec09dd363db32ebb5b

comment:11 Changed 7 years ago by Vickie Lynch

Refs #7432 add gsl header file

Changeset: aea50515297b5cfe82e035b467b0c72354137aa2

comment:12 Changed 7 years ago by Nick Draper

  • Status changed from assigned to new

comment:13 Changed 7 years ago by Vickie Lynch

  • Status changed from new to inprogress

Refs #7432 options for integration of profile

Changeset: 1346465cf62e6206c602b0f1512a7a6caf14290a

comment:14 Changed 7 years ago by Vickie Lynch

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

Here is script I used for testing. Puts all files in directories in your home area for checking. I removed ConvolutionExpGaussian option since it did not work well. Users would like plots put in directories without plotting in MantidPlot window but could not find a way to do this.

import os
Home = "/home/vel"
Load(Filename='TOPAZ_6674_event.nxs',OutputWorkspace='TOPAZ_6674_event',FilterByTofMin='2000',FilterByTofMax='16500',LoadMonitors='1',MonitorsAsEvents='1')
ConvertToDiffractionMDWorkspace(InputWorkspace='TOPAZ_6674_event',OutputWorkspace='TOPAZ_6674_MD',OutputDimensions='Q (sample frame)',SplitThreshold='50',MaxRecursionDepth='11')
FindPeaksMD(InputWorkspace='TOPAZ_6674_MD',PeakDistanceThreshold='0.471',MaxPeaks='100',OutputWorkspace='peaks_ws')
CentroidPeaksMD(InputWorkspace='TOPAZ_6674_MD',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws')
FindUBUsingFFT(PeaksWorkspace='peaks_ws',MinD='4',MaxD='12',Tolerance='0.12')
IndexPeaks(PeaksWorkspace='peaks_ws',Tolerance='0.12')
SelectCellOfType(PeaksWorkspace='peaks_ws',CellType='Rhombohedral',Centering='R')
IntegratePeaksMD(InputWorkspace='TOPAZ_6674_MD',CoordinatesToUse='Q (sample frame)',PeakRadius='0.1',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws_sphere')
IntegratePeaksMD(InputWorkspace='TOPAZ_6674_MD',CoordinatesToUse='Q (sample frame)',PeakRadius='0.1',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws_cylinder',
Cylinder='1',CylinderLength='0.4',PercentBackground='20',ProfileFunction='NoFit')

IntegratePeaksMD(InputWorkspace='TOPAZ_6674_MD',CoordinatesToUse='Q (sample frame)',PeakRadius='0.1',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws_cylinder_gauss',
Cylinder='1',CylinderLength='0.4',PercentBackground='20',ProfileFunction='Gaussian',ProfilesFile=Home+'/new.profiles')
os.system("mkdir ~/ProfileGauss")
for wi in xrange(mtd["ProfilesData"].getNumberHistograms()):
        graph_spec = plotSpectrum ("ProfilesData", wi, False, 1)
        l = graph_spec.activeLayer()
        l.insertCurve("ProfilesFit", wi)
        l.insertCurve("ProfilesFitDiff", wi)
        graph_spec.export(Home+"/ProfileGauss/ProfileGauss"+mtd["ProfilesData"].getAxis(1).label(wi)+".png")
        #Remove next 2 lines to keep plots in window
        graph_spec.confirmClose(False)
        graph_spec.close()

IntegratePeaksMD(InputWorkspace='TOPAZ_6674_MD',CoordinatesToUse='Q (sample frame)',PeakRadius='0.1',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws_cylinder_gauss_sum',
Cylinder='1',CylinderLength='0.4',PercentBackground='20',ProfileFunction='Gaussian',IntegrationOption="Sum")
os.system("mkdir ~/ProfileGauss_Sum")
for wi in xrange(mtd["ProfilesData"].getNumberHistograms()):
        graph_spec = plotSpectrum ("ProfilesData", wi, False, 1)
        l = graph_spec.activeLayer()
        l.insertCurve("ProfilesFit", wi)
        l.insertCurve("ProfilesFitDiff", wi)
        graph_spec.export(Home+"/ProfileGauss_Sum/ProfileGauss"+mtd["ProfilesData"].getAxis(1).label(wi)+".png")
        #Remove next 2 lines to keep plots in window
        graph_spec.confirmClose(False)
        graph_spec.close()

IntegratePeaksMD(InputWorkspace='TOPAZ_6674_MD',CoordinatesToUse='Q (sample frame)',PeakRadius='0.1',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws_cylinder_b2b',
Cylinder='1',CylinderLength='0.4',PercentBackground='20',ProfileFunction='ConvolutionBackToBackGaussian')
os.system("mkdir ~/ProfileB2B")
for wi in xrange(mtd["ProfilesData"].getNumberHistograms()):
        graph_spec = plotSpectrum ("ProfilesData", wi, False, 1)
        l = graph_spec.activeLayer()
        l.insertCurve("ProfilesFit", wi)
        l.insertCurve("ProfilesFitDiff", wi)
        graph_spec.export(Home+"/ProfileB2B/ProfileB2B"+mtd["ProfilesData"].getAxis(1).label(wi)+".png")
        #Remove next 2 lines to keep plots in window
        graph_spec.confirmClose(False)
        graph_spec.close()

IntegratePeaksMD(InputWorkspace='TOPAZ_6674_MD',CoordinatesToUse='Q (sample frame)',PeakRadius='0.1',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws_cylinder_b2b_sum',
Cylinder='1',CylinderLength='0.4',PercentBackground='20',ProfileFunction='ConvolutionBackToBackGaussian',IntegrationOption="Sum")
os.system("mkdir ~/ProfileB2B_Sum")
for wi in xrange(mtd["ProfilesData"].getNumberHistograms()):
        graph_spec = plotSpectrum ("ProfilesData", wi, False, 1)
        l = graph_spec.activeLayer()
        l.insertCurve("ProfilesFit", wi)
        l.insertCurve("ProfilesFitDiff", wi)
        graph_spec.export(Home+"/ProfileB2B_Sum/ProfileB2B"+mtd["ProfilesData"].getAxis(1).label(wi)+".png")
        #Remove next 2 lines to keep plots in window
        graph_spec.confirmClose(False)
        graph_spec.close()

Last edited 7 years ago by Vickie Lynch (previous) (diff)

comment:15 Changed 7 years ago by Andrei Savici

  • Status changed from verify to verifying
  • Tester set to Andrei Savici

comment:16 Changed 7 years ago by Andrei Savici

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/7432_profile_fit2'

comment:17 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8278

Note: See TracTickets for help on using tickets.