Ticket #8804 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Create ConvertToMD helper algorithm which uses the limits of transformations to identify ConvertToMD ranges

Reported by: Alex Buts Owned by: Alex Buts
Priority: major Milestone: Release 3.2
Component: Framework Keywords:
Cc: Blocked By:
Blocking: #8026 Tester: Martyn Gigg

Description (last modified by Alex Buts) (diff)

Additional purpose is extracted from #7529

"ConvertToMD should use the Helper algorithm internally if the defaults are left blank, or not supplied"

Change History

comment:1 Changed 7 years ago by Alex Buts

  • Status changed from new to inprogress

refs #8804 started cherry-picking from #7529

Started new ConvertToMDHelper

which would use ConvertToMD core as the main part of the algorithm

Conflicts:

Code/Mantid/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h

Changeset: a384bafb942e4b0127b4d870d8bfd92a2004a83f

comment:2 Changed 7 years ago by Alex Buts

refs #8804 cherry-picking General framework for ConvertToMDHelper2

probably not yet working correctly

Conflicts:

Code/Mantid/Framework/MDAlgorithms/inc/MantidMDAlgorithms/ConvertToMD.h Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h

Changeset: b5aa7bab6ba82292158c7dcfdfdc8f2144cdf891

comment:3 Changed 7 years ago by Alex Buts

refs #8804 Get rid of test for ConvertToMDHelperParam

as the function has gone

cherry-picking

Conflicts:

Code/Mantid/Framework/MDAlgorithms/test/ConvertToMDComponentsTest.h

Changeset: 58632f1c862f16e8f052d6a9bd13b8280ceff299

comment:4 Changed 7 years ago by Alex Buts

refs #8804 Cherry-picking: All seems fixed

Conflicts:

Code/Mantid/Framework/MDAlgorithms/test/ConvertToQ3DdETest.h

Changeset: c1435ead63d6ad135965351ef57aadc705a2ba9c

comment:5 Changed 7 years ago by Alex Buts

refs #8804 fixing compiler warnings on Nix

Conflicts:

Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDHelper2.cpp

Changeset: be2bcf282470c891eb9749318a0578793db789dc

comment:6 Changed 7 years ago by Alex Buts

refs #8804 A bit more wiki description.

Conflicts:

Code/Mantid/Framework/MDAlgorithms/src/ConvertToMDHelper2.cpp

Changeset: c6d9d3ab2e805cb67bc305220c8057fa251e0df6

comment:7 Changed 7 years ago by Alex Buts

refs #8804 final bits of cherry-picking

Changeset: b2188e2df057194cc9d86dc618bca0b5b9b82fe7

comment:8 Changed 7 years ago by Alex Buts

refs #8804 finished separating ConvertToMDHelper2

Changeset: cf3f68efe1c950c8eb96354056f814105e4ff4af

comment:9 Changed 7 years ago by Nick Draper

  • Milestone changed from Release 3.1 to Backlog

Moved to backlog at the end of Release 3.1

comment:10 Changed 7 years ago by Alex Buts

refs #8804 Just some formatting

Changeset: b3413b1da55886cf1ffea87c87f5d79d53448047

comment:11 Changed 7 years ago by Alex Buts

refs #8804 temporary disabling tests for ConvertToMDHelper2

As the algorithm will be rebuild anyway.

Changeset: 872452eff6f330945da05527d724e8d4d1a8c045

comment:12 Changed 7 years ago by Alex Buts

refs #8804 Temporary disabling unix warnings

(changes to the algorithm are due anyway)

Changeset: 521b787e45ac1315a8c0f73f0e37a38681365f90

comment:13 Changed 7 years ago by Alex Buts

refs #8804 Disabling 3 more failing tests

Changeset: 62f2e6e0b90b6a754baf7e308d667cdd237998a9

comment:14 Changed 7 years ago by Alex Buts

refs #8804 method returns the range of the X-values from ISpectrum

Changeset: 968c7606a278f7ad627d79fb4d637321b7a7004b

comment:15 Changed 7 years ago by Alex Buts

refs #8804 checkpoint, nothing finished yet.

Changeset: 956e6368949cfc5f75218a7c5086ecb42b683556

comment:16 Changed 7 years ago by Alex Buts

refs #8804 Checkpointing before pulling in master

with changes necessary for this ticket.

Changeset: bf3ec2933133e65dfda7472410bbe55e1e4c43ab

comment:17 Changed 7 years ago by Martyn Gigg

I have a few comments about the new method in comment 14:

  • the ISpectrum implementation can be done without needing to access the size;
  • the documentation for the ISpectrum method should actually say what it does and what others could do:
  /** 
    * Return the min/max X values for this spectrum.
    * @returns A pair where the first is the minimum X value 
    *          and the second the maximum
    */
   std::pair<double,double> ISpectrum::getXDataRange() const
   {
     const auto & xdata = *refX;
     return std::pair<double,double>(xdata.front(),xdata.back());
   }
  • The TODO in the EventList header for the method should not be there, please just provide the correct implementation. It's just leaving confusion for the future if it is not done now as people will start using it with one implementation and then it's going to be switched.
Last edited 7 years ago by Martyn Gigg (previous) (diff)

comment:18 Changed 7 years ago by Alex Buts

refs #8804 Comments for ModQ transformation

noted while testing ticket #8810

Changeset: 81fca1460e927db59f841beed47d619c08c1942a

comment:19 Changed 7 years ago by Alex Buts

refs #8804 Added method which checks unit conversion range.

Changeset: 27ee41b1c24d4dc965259a33266a84d8f80b015d

comment:20 Changed 7 years ago by Alex Buts

refs #8804 one more place where m_Det has not been renamed

Changeset: ec94e8f9dd323573c9e18a52f51e0952c00bd6d3

comment:21 Changed 7 years ago by Alex Buts

refs #8804 Compiles and looks correct

But testing is needed.

Changeset: a32d56b6f4f61237d6c1306ea1539158f7ebfa26

comment:22 Changed 7 years ago by Alex Buts

refs #8804 Implemented Martyn's suggestions for ISpectum method

Though with reservations. Of course it looks better and more generic, but for vector I know that size is achieved in const time and accessing the elements through brackets is almost the fastest operation possible. Have no idea how back is implemented.

Other comments are work in progress -- have to discuss how actually this method is implemented for events.

Changeset: d3e8d0791ddb03fb66456c2da7a5deb882956b9e

comment:23 Changed 7 years ago by Martyn Gigg

I think we can assume that the implementers of the STL have an eye on efficiency and we can use the fruits of their labour to write cleaner code. It is most probably implemented as v[size()-1] but I don't think we need to care, I think there are many more places in our own implementations of things that will be bottlenecks.

I assume that the EventList method will be implemented before this is ticket is closed?

comment:24 Changed 7 years ago by Alex Buts

Will be implemented either before it is closed or I think of bringing another ticket -- depending on amount of work/testing this method needs. Special cases (e.g. empty Xdata or empty cow_ptr all need consideration.

comment:25 Changed 7 years ago by Alex Buts

refs #8804 Comments and formatting

Changeset: 4352755fb1f39fe8c0395f5bde335b0452619f9c

comment:26 Changed 7 years ago by Alex Buts

refs #8804 fixed last minor things and enabled unit tests.

Changeset: 2090a06575f7ce0a99d955a40380b993d77afa47

comment:27 Changed 7 years ago by Alex Buts

refs #8804 Unit tests and small bugfixes for UnitsConversionHelper

Changeset: 8936fb9827bc895a1660e0737f5c1d619751e155

comment:28 Changed 7 years ago by Alex Buts

refs #8804 Unix warnings

Changeset: 6ce6ac3e31b626406885fb075b5172e61781d88b

comment:29 Changed 7 years ago by Alex Buts

refs #8804 one more test for UnitsConversionHelper

Changeset: 4b27955f08eb2b122290e76a8b4e4af4d8a8a293

comment:30 Changed 7 years ago by Alex Buts

refs #8804 should fix Unix compilation error.

Changeset: 8ed2f650d4b524b9bd801003b07959ac808540d9

comment:31 Changed 7 years ago by Alex Buts

refs #8804 Minor change to convert to MD

to improve error message if one wants to add MD data to existing workspace using incorrect ConvertToMD transformation (current error message was really confusing in this situation)

Changeset: 1044cb40aadb0f39d617d42c91b4f3e88b9c6038

comment:32 Changed 7 years ago by Alex Buts

  • Status changed from inprogress to verify
  • Resolution set to fixed
  • Milestone changed from Backlog to Release 3.2

The main code for this ticket has been extracted from #7529 and the ticket both creates convertToMDHelper version 2 and integrates this helper into convertToMD, so this ticket duplicates #7529.

Algorithm relies on correct work of getXDataRange method which certainly correct for histogram workspaces but may be incorrect for event workspaces. The ticket #8870 is created to verify this.

Meanwhile, if tester works with event workspaces he should be sure that limits of the events at workspace XVector are synchronized with real limits of the events. It is correct for all workspaces I've tested but I can not be sure if it holds for any event workspace until #8870 is finished.

Valuable Information on testing this ticket can be extracted from #7529. I would add, that the testing script, used there and copied below does not work unchanged for Direct mode, as times of events, present in the testing workspace CNCS_7860_event indeed correspond to infinite energy transfer from the sample. ConvertToMDHelper V2 correctly estimate energy/momentum transfer in this situation as huge.

Crop workspace at e.g. t=50000 should be used to produce expected results, namely

CropWorkspace(InputWorkspace='CNCS_7860_event',OutputWorkspace='CNCS_7860_event_cr',XMin='50000')

==== Recommened testing script from #7529.

WS_Name='CNCS_7860_event'
Load(Filename=WS_Name,OutputWorkspace=WS_Name)
AddSampleLog(Workspace=WS_Name,LogName='Ei',LogText='3.',LogType='Number')
SetUB(Workspace=WS_Name,a='1.4165',b='1.4165',c='1.4165',u='1,0,0',v='0,1,0')   
AddSampleLog(Workspace=WS_Name,LogName='Psi',LogText=str(0.),LogType='Number Series')
SetGoniometer(Workspace=WS_Name,Axis0='Psi,0,1,0,1')
print ConvertToMDHelper(InputWorkspace=WS_Name, Version=1)
print ConvertToMDHelper(InputWorkspace=WS_Name, QDimensions='Q3D',QConversionScales='HKL',dEAnalysisMode='Direct',Version=2)

minValues = [-3, -3, -3, -1]
maxValues = [3, 3, 3, 3]

auto_limits = ConvertToMD(InputWorkspace=WS_Name,QDimensions='Q3D',QConversionScales='HKL',OverwriteExisting=0,dEAnalysisMode='Direct',SplitInto="20,20,1,1")
manual_limits = ConvertToMD(InputWorkspace=WS_Name,QDimensions='Q3D',QConversionScales='HKL',OverwriteExisting=0,dEAnalysisMode='Direct',SplitInto="20,20,1,1",MinValues=minValues,MaxValues=maxValues)

plotSlice(auto_limits)
plotSlice(manual_limits)

comment:33 Changed 7 years ago by Alex Buts

  • Description modified (diff)

comment:34 Changed 7 years ago by Alex Buts

refs #8804 Unix warning

Changeset: ee3dd4fd8e89d30cbe3af30d6786a70baf170162

comment:35 Changed 7 years ago by Alex Buts

refs #8804 Doxygen warning

Changeset: b520e8b8c8a50c6f3988df18be6256d4a5fe17e5

comment:36 Changed 7 years ago by Alex Buts

refs #8804 More Doxygen

Changeset: 3d7ce98e6153df05468f180aa1a8bde4e397f1fa

comment:37 Changed 7 years ago by Peter Parker

Alex, just a heads up. Russell's recent reset of Develop means this will need another git checkbuild before it can be tested.

comment:38 Changed 7 years ago by Peter Parker

  • Status changed from verify to reopened
  • Resolution fixed deleted

comment:39 Changed 7 years ago by Alex Buts

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

comment:40 Changed 7 years ago by Alex Buts

  • Blocking 8026 added

(In #8026) Convert to MD has been changed in #8804 so the block to avoid merge conflicts

comment:41 Changed 7 years ago by Alex Buts

refs #8804 fixed accumulated merge problems with master

Merge branch 'master' into feature/8804_ConverToMDHelperV2 Conflicts:

Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UnitsConversionHelper.h Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp

Changeset: 85850045292bfee86e1109506e64087e700e3b6f

comment:42 Changed 7 years ago by Alex Buts

refs #8804 Fixing errors after merge

Changeset: 65afba1e8c2a3a379dae629080672e111b1b255b

comment:43 Changed 7 years ago by Alex Buts

refs #8804 fixing conflicts with develop

Merge branch 'feature/8804_ConverToMDHelperV2' into develop

Conflicts:

.githooks/pre-commit Code/Mantid/Framework/MDEvents/inc/MantidMDEvents/UnitsConversionHelper.h Code/Mantid/Framework/MDEvents/src/MDTransfModQ.cpp Code/Mantid/Framework/MDEvents/src/UnitsConversionHelper.cpp

Changeset: a7985b8b6a3698a3332b9d12ee7cd7792aadd8fa

comment:44 Changed 7 years ago by Martyn Gigg

  • Status changed from verify to reopened
  • Resolution fixed deleted

Alex, you've somehow deleted the git pre-commit hook file, .githooks/pre-commit. This is the pristine copy of that file which is then copied into the appropriate place by cmake.

It needs to be restored before this can be tested/merged.

comment:45 Changed 7 years ago by Alex Buts

  • Status changed from reopened to inprogress

refs #8804 returning precommit hook accidentally deleted

during the merge. This will probably cause merge conflicts when merging to master (I will try to deal with them) but it should be easy to fix them - just choose any version of pre-commit

Changeset: 9207d4d623b12dd547f1ca4f7e812ab88ed3c20f

comment:46 Changed 7 years ago by Alex Buts

refs #8804 resolving conflicts around pre-commit hook

Merge branch 'feature/8804_ConverToMDHelperV2' into develop

Conflicts:

.githooks/pre-commit

Changeset: 220a659771fe2503196cfeae0a54a3c09849d132

comment:47 Changed 7 years ago by Alex Buts

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

comment:48 Changed 7 years ago by Martyn Gigg

Fix githooks/pre-commit mode.

It should be executable. Refs #8804

Changeset: 94b00fb969ac080e494a0b493ae458210f27dac3

comment:49 Changed 7 years ago by Martyn Gigg

  • Status changed from verify to reopened
  • Resolution fixed deleted

It looks like are compiler warnings in MDTransfModQ, can these be dealt with, please?

comment:50 Changed 7 years ago by Alex Buts

  • Status changed from reopened to inprogress

refs #8804 fixing compiler warning under unix

appeared after complex conflicts resolution

Changeset: 930a5b82ddf90a217f9bb87c7bbfd2932741e20d

comment:51 Changed 7 years ago by Alex Buts

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

comment:52 Changed 7 years ago by Martyn Gigg

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

comment:53 Changed 7 years ago by Alex Buts

  • Status changed from verifying to closed

Merge branch 'feature/8804_ConverToMDHelperV2' of https://github.com/mantidproject/mantid into feature/8804_ConverToMDHelperV2

Full changeset: 438677028f8d122d77bf1779235346b19310f9c0

comment:54 Changed 7 years ago by Martyn Gigg

Merge remote-tracking branch 'origin/feature/8804_ConverToMDHelperV2'

Full changeset: bf7ef195b0b67debf51dd8d1bb38e105fd81c1b8

comment:55 Changed 7 years ago by Martyn Gigg

I tried the script and got what was expected.

I also looked at the quantification/tobyfit scripts and taking out the limits there seems to produce something sensible for MERLIN data too so I think this looks okay.

comment:56 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 9648

Note: See TracTickets for help on using tickets.