Ticket #10904 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

Write PeakShape

Reported by: Owen Arnold Owned by: Owen Arnold
Priority: critical Milestone: Release 3.4
Component: Diffraction Keywords:
Cc: Blocked By: #10878
Blocking: #10905 Tester: Martyn Gigg

Description

These algorithms should be writing out peak shape information:

IntegrateMD IntegrateEllipsoids IntegratePeaksHybrid

Drawing of these types in the PeaksViewer will require a redesign of parts of the peaks viewer and is the subject of a later ticket.

Change History

comment:1 Changed 6 years ago by Owen Arnold

changes in 10878 will allow this to happen.

comment:2 Changed 6 years ago by Owen Arnold

  • Blocking 10905 added

comment:3 Changed 6 years ago by Owen Arnold

  • Status changed from new to assigned

comment:4 Changed 6 years ago by Owen Arnold

  • Status changed from assigned to inprogress

refs #10904. IntegratePeaksMD algorithms done.

IntegratePeaksMD v1 and v2 write out integrated peak info in the form of PeakShape

PeakShapeSpherical adapted to write out background outer radius and background inner radius as well as the peak radius. Factories also updated for this, unit tests added to and updated for this.

I got a little worried that someone may change the integer values agaist the enum entries of SpecialCoordinateSystem. So I put in place a unit test to sanity check those.

Changeset: 4427109cf115e1a82aa734433567825260d8c5d2

comment:5 Changed 6 years ago by Owen Arnold

refs #10904. Ellipsoid shape.

Changeset: 2387ce56192b68b8e817acc2f7867c9bc706e9bf

comment:6 Changed 6 years ago by Owen Arnold

refs #10904. Factory for elliptical peak shapes

Changeset: 78da6586affaaeb716be0bf5a600a8faa90aaead

comment:7 Changed 6 years ago by Owen Arnold

refs #10904. Hook new factory into loader.

Changeset: 8d327c5fb2c546e06cdb04f9f45b3666f20a999a

comment:8 Changed 6 years ago by Owen Arnold

refs #10904. Write from IntegrateEllipsoids.

Changeset: 3d558b329cc794b4b193e860851f62f88234b6e8

comment:9 Changed 6 years ago by Owen Arnold

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

This is being verified as pull request #179.

comment:10 Changed 6 years ago by Owen Arnold

refs #10904. Mv PeakShape an fix warnings.

Changeset: 0dd26e09dce1a86ae91341ae120499db6bd7b61c

comment:11 Changed 6 years ago by Owen Arnold

refs #10904. Fix remaining warning.

Changeset: 43d4e257400c3dd46d1e2f081a192d06158d7593

comment:12 Changed 6 years ago by Owen Arnold

refs #10904. Expose PeakShape to python.

Changeset: bf2702633f1a18ab35ab234fd0378f52aa2767f8

comment:13 Changed 6 years ago by Owen Arnold

refs #10904 SpecialCoords API->Kernel

Since we have put PeakShape in Geometry, SpecialCoordinateSystem must be moved to the Kernel package out of API.

Changeset: 561214347d175ee881aadba4e8796c51f8c359e5

comment:14 Changed 6 years ago by Owen Arnold

refs #10904. Python tests for PeakShape.

Also fix GCC and Windows warnings

Changeset: 8996ec68fc0f83d080026fbe978c8519d819b551

comment:15 Changed 6 years ago by Owen Arnold

refs #10904. Resolve conflict with master.

Changeset: f910af2cda11091a56dd9cd69fd3621e9c4bcb9a

comment:16 Changed 6 years ago by Owen Arnold

Tester:

What's been done as part of this ticket has been well covered by unit tests. In addition, there are some new things that can be done in python (see below)

Setup steps

# Basic parameters  for  Triphylite Crystal
#Name of the workspaces to create
ws_name = "TOPAZ_3132"
filename = ws_name +"_event.nxs"
ws = LoadEventNexus(Filename=filename,FilterByTofMin=3000, FilterByTofMax=16000)

# -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
# Part 1. Basic Reduction

# Spherical Absorption and Lorentz Corrections
ws = AnvredCorrection(InputWorkspace=ws, LinearScatteringCoef=0.451, LinearAbsorptionCoef=0.993, Radius=0.14)

# Convert to Q space
LabQ = ConvertToDiffractionMDWorkspace(InputWorkspace=ws, LorentzCorrection='0',
        OutputDimensions='Q (lab frame)', SplitInto=2, SplitThreshold=150)

# Find peaks
PeaksLattice = FindPeaksMD(InputWorkspace=LabQ,MaxPeaks=100)

# 3d integration to centroid peaks
PeaksLattice = CentroidPeaksMD(InputWorkspace=LabQ,
    PeakRadius=0.12, PeaksWorkspace=PeaksLattice)

# Find the UB matrix using the peaks and known lattice parameters
FindUBUsingLatticeParameters(PeaksWorkspace=PeaksLattice, a=10.3522, b=6.0768, c=4.7276,
                alpha=90, beta=90, gamma=90, NumInitial=20, Tolerance=0.12)

# And index to HKL
IndexPeaks(PeaksWorkspace=PeaksLattice, Tolerance=0.12)

Then run

PeaksLatticeFFT = IntegratePeaksMD(InputWorkspace=LabQ, PeakRadius=0.12,
    BackgroundOuterRadius=0.18,BackgroundInnerRadius=0.15,
    PeaksWorkspace=PeaksLatticeFFT)

# The new bit:
shape = PeaksLatticeFFT.getPeak(0).getPeakShape()
print shape.toJSON()

And you should get this:

{
   "algorithm_name" : "IntegratePeaksMD",
   "algorithm_version" : 2,
   "background_inner_radius" : 0.150,
   "background_outer_radius" : 0.180,
   "frame" : 1,
   "radius" : 0.120,
   "shape" : "spherical"
}

Then run

PeaksLatticeFFT = IntegrateEllipsoids(InputWorkspace=ws, PeaksWorkspace=PeaksLatticeFFT) 
    
# The new bit
shape = PeaksLatticeFFT.getPeak(0).getPeakShape()
print shape.toJSON()

And you should get this:

{
   "algorithm_name" : "IntegrateEllipsoids",
   "algorithm_version" : -1,
   "background_inner_radius0" : 0.1569320366997004,
   "background_inner_radius1" : 0.1904709902029069,
   "background_inner_radius2" : 0.2009385702055810,
   "background_outer_radius0" : 0.1977219764573250,
   "background_outer_radius1" : 0.2399784099709861,
   "background_outer_radius2" : 0.2531667343589144,
   "direction0" : "-0.397112 0.592816 0.700622",
   "direction1" : "-0.674626 -0.706126 0.215095",
   "direction2" : "-0.622239 0.387241 -0.68034",
   "frame" : 1,
   "radius0" : 0.1569320366997004,
   "radius1" : 0.1904709902029069,
   "radius2" : 0.2009385702055810,
   "shape" : "ellipsoid"
}

comment:17 Changed 6 years ago by Martyn Gigg

  • Status changed from verify to verifying
  • Tester set to Martyn Gigg

comment:18 Changed 6 years ago by Owen Arnold

refs #10904. Fix windows build.

Changeset: a22ac8e3d0f6fead27e7209c2dc4f6232d24c62f

comment:19 Changed 6 years ago by Owen Arnold

Jenkins retest this please

comment:20 Changed 6 years ago by Owen Arnold

Jenkins retest this please

comment:21 Changed 6 years ago by Owen Arnold

refs #10904. Fix bad include.

Changeset: 53d30cb05751da73fef600a749f5a88086e31c2d

comment:22 Changed 6 years ago by Martyn Gigg

Jenkins, retest this please

comment:23 Changed 6 years ago by Martyn Gigg

The builds have got themselves into some odd state with this pull request. I suggest closing it without merging and opening a fresh one.

comment:24 Changed 6 years ago by Owen Arnold

  • Status changed from verifying to verify

This is being verified as pull request #196.

comment:25 Changed 6 years ago by Owen Arnold

refs #10904. Scope resolution for enum

Changeset: df4c56ab348ef6b5abd194d30c0ef4f2347327a9

comment:26 Changed 6 years ago by Martyn Gigg

  • Status changed from verify to verifying

comment:27 Changed 6 years ago by Martyn Gigg

The script from the ticket works as expected and so do all of the methods on the new PeakShape class. I can see that most of the changes are due to the move of the SpecialCoordinateSystem.

comment:28 Changed 6 years ago by Martyn Gigg

  • Status changed from verifying to closed

Merge pull request #196 from mantidproject/feature/10904_apply_peak_shape

Full changeset: 35142efce2f65370653d5b5d210ba1a6dedd7147

comment:29 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 11743

Note: See TracTickets for help on using tickets.