Ticket #6940 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Single Crystal Profile fit in Mantid

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

Description (last modified by Nick Draper) (diff)

Attached are the steps for doing the ID profile fitting. We discussed implementing the first 2 steps in Mantid to produce an "expname.profiles" file in the Mantid Workspace. Attached is an example of a profiles file (sapphire.profiles). It is the same as a peaks or integrate file, but with the counts for 100 steps through each profile.

All the Python scripts and config file examples can be found in /SNS/TOPAZ/shared/PythonPrograms.

To summarize, step 1 finds and indexes peaks, outputs UB matrices and outputs binary files with the events as a Qx,Qy,Qz vector.

Step 2 uses the UB matrices and the Qx,Qy,Qz events to create the unfitted profiles for each hkl peak.

Change History

comment:1 Changed 7 years ago by Vickie Lynch

  • Status changed from new to accepted

comment:2 Changed 7 years ago by Nick Draper

  • Milestone changed from Release 2.5 to Release 2.6

Moved to r2.6 at the end of r2.5

comment:3 Changed 7 years ago by Ruth Mikkelson

Refs #6940 Fixed logic error,Calculated more lattice Errors

SelectCellOfType and SelectCellWithForm will now calculate(incorrectly?) lattice parameter errors assuming least squares optimization(which may not be correct)

Changeset: 4f8d0f5aed74535b9d393d9bfa8c4dec0982e173

comment:4 Changed 7 years ago by Ruth Mikkelson

Refs #6940 Fixed logic error,Calculated more lattice Errors

SelectCellOfType and SelectCellWithForm will now calculate(incorrectly?) lattice parameter errors assuming least squares optimization(which may not be correct)

Changeset: 4f8d0f5aed74535b9d393d9bfa8c4dec0982e173

comment:5 Changed 7 years ago by Ruth Mikkelson

Refs #6940 Fixed logic error,Calculated more lattice Errors

SelectCellOfType and SelectCellWithForm will now calculate(incorrectly?) lattice parameter errors assuming least squares optimization(which may not be correct)

Changeset: 4f8d0f5aed74535b9d393d9bfa8c4dec0982e173

comment:6 Changed 7 years ago by Vickie Lynch

Refs #6940 output vectors instead of a file

Changeset: 8a64104a78f25cfc084d72d4996278cd807793c8

comment:7 Changed 7 years ago by Vickie Lynch

Merge branch 'feature/6940_profile_fit' into develop

comment:8 Changed 7 years ago by Vickie Lynch

Refs #6940 expose PeakInfo to python

Changeset: 7d6acc0a8e6b85f5bb4996b8ea129ca7a15fccb7

comment:9 Changed 7 years ago by Vickie Lynch

Refs #6940 changed too many

Changeset: 523917c9c6c559ac5b07abe73cec4aaee5a6f110

comment:10 Changed 7 years ago by Vickie Lynch

Refs #6940 merge conflict

Changeset: 58ff25f5cecfa4af54ab4350d1e08c7bcb863a1a

comment:11 Changed 7 years ago by Vickie Lynch

Refs #6940 cylinder integration added to IntegratePeaksMD

Changeset: 363907280ecd9ddfc58f6214d06f463ef5dec850

comment:12 Changed 7 years ago by Vickie Lynch

Refs #6940 fix background for cylinder integration

Changeset: ad0be0d72df96d0a10614376ca951a40bd2a09bd

comment:13 Changed 7 years ago by Vickie Lynch

Refs #6940 separate cylinder and sphere to help performance tests

Changeset: 3abd2f19797ee3d7b9f09b90494c5996be4fce97

comment:14 Changed 7 years ago by Vickie Lynch

Refs #6940 fix windows build

Changeset: 954f762219971a1127218cf5dbd81bf141237f92

comment:15 Changed 7 years ago by Vickie Lynch

Refs #6940 fix windows build

Changeset: a27e92768acdf4217913fabdf42c3c195fdaf816

comment:16 Changed 7 years ago by Vickie Lynch

Refs #6940 write profiles along cylinder

Changeset: bbd814e54f6d5ae20af2db273669cebf326e3f21

comment:17 Changed 7 years ago by Vickie Lynch

Refs #6940 sum events for profile

Changeset: e94ec2ac1188cebd4dffcac7cde975899bbb9afa

comment:18 Changed 7 years ago by Vickie Lynch

Refs #6940 try to remove osx warning

Changeset: f3e7d6c07980700f4d496b2c6e5d6a87be02a464

comment:19 Changed 7 years ago by Vickie Lynch

Refs #6940 better number of point for profile

Changeset: dd9d46e2c3e7f2acfdb49ce53d36319b77d21701

comment:20 Changed 7 years ago by Vickie Lynch

Refs #6940 add fitting options

Changeset: ee9732df8d66e6cebd29cbf082ce4e8b365c29cd

comment:21 Changed 7 years ago by Vickie Lynch

Refs #6940 only output Qvectors in memory if no file requested

Changeset: 13d9353f367f00edeacbefe3c613b7523d09d9f5

comment:22 Changed 7 years ago by Vickie Lynch

Refs #6940 write chisq; remove warning

Changeset: 637673b2b875ab8382be7d08bd3c69646f693580

comment:23 Changed 7 years ago by Vickie Lynch

Refs #6940 add FixResolution from ticket 7369

Changeset: bdbc797853af41c1d6e539dcfc7c31f230e5caf2

comment:24 Changed 7 years ago by Vickie Lynch

Refs #6940 add test for cylindrical integration

Changeset: 22c8d37a37e2bd581711a847626248b460615640

comment:25 Changed 7 years ago by Vickie Lynch

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

I will create another ticket to improve the fits with convolutions and save the fits for plotting, but I would like to get this into the nightly build for TOPAZ instrument scientists to test on July 8 at a meeting setup by Art Schultz. To test:

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.47099999999999997',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.10000000000000001',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws_cylinder',
Cylinder='1',CylinderLength='0.40000000000000002',PercentBackground='20',ProfileFunction='NoFit')

IntegratePeaksMD(InputWorkspace='TOPAZ_6674_MD',CoordinatesToUse='Q (sample frame)',PeakRadius='0.10000000000000001',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws_cylinder_gauss',
Cylinder='1',CylinderLength='0.40000000000000002',PercentBackground='20',ProfileFunction='Gaussian')

IntegratePeaksMD(InputWorkspace='TOPAZ_6674_MD',CoordinatesToUse='Q (sample frame)',PeakRadius='0.10000000000000001',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws_cylinder_b2b',
Cylinder='1',CylinderLength='0.40000000000000002',PercentBackground='20',ProfileFunction='ConvolutionBackToBackGaussian')

IntegratePeaksMD(InputWorkspace='TOPAZ_6674_MD',CoordinatesToUse='Q (sample frame)',PeakRadius='0.10000000000000001',PeaksWorkspace='peaks_ws',OutputWorkspace='peaks_ws_cylinder_exp',
Cylinder='1',CylinderLength='0.40000000000000002',PercentBackground='20',ProfileFunction='ConvolutionExpGaussian')

comment:26 Changed 7 years ago by Russell Taylor

  • Status changed from verify to reopened
  • Resolution fixed deleted

Newer gcc's are producing warnings in MD(Grid)Box relating to the fact that there is a read past the end of a vector if instantiated with nd=1. Less critically, there's also one about testing that an unsigned integer isn't negative. See here: http://download.mantidproject.org/jenkins/view/Develop%20Clean%20Builds%20and%20Tests/job/is_clean_ubuntu-12.04_develop/warnings19

These should be addressed before the ticket is merged. Hopefully you can use a development build for the meeting.

comment:27 Changed 7 years ago by Vickie Lynch

Refs #6940 fix warnings; add workspaces of each fit

Changeset: b497f31abf0e70382eb09ff425f2c8df7fdc36b0

comment:28 Changed 7 years ago by Vickie Lynch

Refs #6940 fix warnings

Changeset: 5b1a8c6734699dce3154a0785b7ec4ac64155990

comment:29 Changed 7 years ago by Vickie Lynch

Refs #6940 improve initial guess

Changeset: f1fe567edc6e38f6f72cfcaf2b5d900c4192fa25

comment:30 Changed 7 years ago by Vickie Lynch

Refs #6940 workspaces of fit and difference; labeled by hkl

Changeset: b5d8818fb16839e3f41494dad02f9d601545e536

comment:31 Changed 7 years ago by Vickie Lynch

Refs #6940 improve initial values for fits

Changeset: 5f3f52645465dc280b051772c1051c55ae9a30a6

comment:32 Changed 7 years ago by Vickie Lynch

Refs #6940 ConvolutionExpGaussian working

Changeset: 8bdc591dfe9e9164853000dae71fe378ff240c95

comment:33 Changed 7 years ago by Vickie Lynch

Refs #6940 comment failing test

Changeset: d0c190bab82504a556e882186fd210e479c24716

comment:34 Changed 7 years ago by Vickie Lynch

Refs #6940 comment more failing tests

Changeset: a6bd821fec2bb994da17f42dde3b077ccb2a795f

comment:35 Changed 7 years ago by Vickie Lynch

  • Status changed from reopened to accepted

comment:36 Changed 7 years ago by Vickie Lynch

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

Would like to get ticket tested while Art Shultz is at SNS this week. To test:

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')

for wi in xrange(mtd["ProfilesData"].getNumberHistograms()):
	graph_spec = plotSpectrum (("ProfilesData","ProfilesFit","ProfilesFitDiff"), wi)
	graph_spec.export("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')

for wi in xrange(mtd["ProfilesData"].getNumberHistograms()):
	graph_spec = plotSpectrum (("ProfilesData","ProfilesFit","ProfilesFitDiff"), wi)
	graph_spec.export("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_exp',
Cylinder='1',CylinderLength='0.4',PercentBackground='20',ProfileFunction='ConvolutionExpGaussian')

for wi in xrange(mtd["ProfilesData"].getNumberHistograms()):
	graph_spec = plotSpectrum (("ProfilesData","ProfilesFit","ProfilesFitDiff"), wi)
	graph_spec.export("ProfileExp_"+mtd["ProfilesData"].getAxis(1).label(wi)+".png")
	#Remove next 2 lines to keep plots in window
	graph_spec.confirmClose(False)
	graph_spec.close()

comment:37 Changed 7 years ago by Andrei Savici

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

comment:38 Changed 7 years ago by Andrei Savici

  • Status changed from verifying to closed

For some reason it puts the png files into the bin directory of Mantid. Not sure this will work for users on the beamline

comment:39 Changed 7 years ago by Nick Draper

  • Component changed from Mantid to Framework

comment:40 Changed 7 years ago by Nick Draper

  • Component changed from Framework to Diffraction
  • Description modified (diff)

comment:41 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 7786

Note: See TracTickets for help on using tickets.