Ticket #6856 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Rewire ConvertToDiffractionMDWorkspace

Reported by: Nick Draper Owned by: Alex Buts
Priority: major Milestone: Release 2.6
Component: Framework Keywords:
Cc: campbellsi@… Blocked By: #6855
Blocking: Tester: Peter Peterson

Description

Create a new version of this algorithm (version 2), where it runs ConvertToMD underneath, passing over arguments as necessary.

This is a prelude to deprecation.

Change History

comment:1 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:2 Changed 7 years ago by Nick Draper

  • Status changed from new to assigned
  • Owner set to Alex Buts

comment:3 Changed 7 years ago by Alex Buts

  • Status changed from assigned to accepted

comment:4 Changed 7 years ago by Alex Buts

refs #6856 Copied ConvertToDiffractionMDWorkspace.cpp

into MD algorithms

Changeset: 7d40f473314ba31940afa80f278acd1867ad8b1a

comment:5 Changed 7 years ago by Alex Buts

refs #6856 Cloned initial algorithm into version 2

and verified that everything (unit tests) works fine, so we have two identical versions of the same algorithm with only the version number different

Changeset: 036d14be4a6779699f937e6dc6db5d887d8a9b7d

comment:6 Changed 7 years ago by Alex Buts

refs #6856 Compiles but does not work

Changeset: 01a0702e3fae2a2ad58cd47f3d3c384a3176af12

comment:7 Changed 7 years ago by Alex Buts

refs #6856 All works except single event per bin

Changeset: 598886f1432633be0984386b8451d74390fcd930

comment:8 Changed 7 years ago by Alex Buts

refs #6856 Disable missing properties on interface and some comments

Changeset: 24b049578cb648bf09d1d29276f1882100c1cfda

comment:9 Changed 7 years ago by Alex Buts

refs #6856 merge conflicts with the develop

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' into develop

Conflicts:

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

Changeset: 202de9cc4982fd9988ac1a5953cc8a5f21d53fb6

comment:10 Changed 7 years ago by Alex Buts

refs #6856 minor comments

Changeset: 8730c54c8b9520a2cf2f1e21a3e9f26c30061f38

comment:11 Changed 7 years ago by Alex Buts

refs #6856 minor warning ans suspicions for merge error

Changeset: 3082a780c15a47d04a38ad77517b92eaacc0b6a3

comment:12 Changed 7 years ago by Alex Buts

refs #6856 Resolving merge conflicts

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' into develop

Conflicts:

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

Changeset: cb7dade8a127cc7c7dae6ab848340d734cac7abf

comment:13 Changed 7 years ago by Alex Buts

refs #6856 Minor commits, and digging for merge conflict source

Changeset: 3138b1a078b93e5abfd062b271bc980bdfc9ce59

comment:14 Changed 7 years ago by Alex Buts

refs #6856 Resolving merge conflict

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' of https://github.com/mantidproject/mantid into develop

Conflicts:

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

Changeset: ebf4e84a00a098811e3870d525f65f8623cda58c

comment:15 Changed 7 years ago by Alex Buts

It is possible to have merge conflict with master (at least there are concurrent changes on develop) in ConvertToMD.cpp file

The correct (working with develop) function looks like attached below, though I have no idea where half of the changes came from. I think the tester, if faced with conflicts, should replace the copyMetaData function with the function provided below and hope for the best.

void ConvertToMD::copyMetaData(API::IMDEventWorkspace_sptr mdEventWS, MDEvents::MDWSDescription &targWSDescr) const
{
 // Copy ExperimentInfo (instrument, run, sample) to the output WS
  API::ExperimentInfo_sptr ei(m_InWS2D->cloneExperimentInfo());

  ei->mutableRun().addProperty("RUBW_MATRIX",targWSDescr.m_Wtransf.getVector(),true);
  ei->mutableRun().addProperty("W_MATRIX",targWSDescr.getPropertyValueAsType<std::vector<double> >("W_MATRIX"),true);

  // run index as the number of experiment into megred within this run. It is possible to interpret it differently 
  // and should never expect it to start with 0 (for first experiment info)
  uint16_t runIndex = mdEventWS->addExperimentInfo(ei);

  const MantidVec & binBoundaries = m_InWS2D->readX(0);

  // Replacement for SpectraDetectorMap::createIDGroupsMap using the ISpectrum objects instead
  auto mapping = boost::make_shared<det2group_map>();
  for ( size_t i = 0; i < m_InWS2D->getNumberHistograms(); ++i )
  {
    const auto& dets = m_InWS2D->getSpectrum(i)->getDetectorIDs();
    if(!dets.empty())
    {
      std::vector<detid_t> id_vector;
      std::copy(dets.begin(), dets.end(), std::back_inserter(id_vector));
      mapping->insert(std::make_pair(id_vector.front(), id_vector));
    }
  }

  uint16_t nexpts = mdEventWS->getNumExperimentInfo();
  for(uint16_t i = 0; i < nexpts; ++i)
  {
    ExperimentInfo_sptr expt = mdEventWS->getExperimentInfo(i);
    expt->mutableRun().storeHistogramBinBoundaries(binBoundaries);
    expt->cacheDetectorGroupings(*mapping);
  }

 // add rinindex to the target workspace description for further usage as the identifier for the events, which come from this run. 
    targWSDescr.addProperty("RUN_INDEX",runIndex,true);  
}

comment:16 Changed 7 years ago by Alex Buts

refs #6856 Enabling last disabled unit test

Changeset: 1f38c46c6fa711d7f97a7c5bb46f5222efc02c3e

comment:17 Changed 7 years ago by Alex Buts

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' of https://github.com/mantidproject/mantid into develop

comment:18 Changed 7 years ago by Alex Buts

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' of https://github.com/mantidproject/mantid into develop

comment:19 Changed 7 years ago by Alex Buts

refs #6856 doxygen errors

Changeset: 137d5965b49eb0ec64fc98b81ea38885cec1ed0e

comment:20 Changed 7 years ago by Alex Buts

refs #6856 more comments

Changeset: b985bc9893c6ac0a8549daf72fd6a8724415c473

comment:21 Changed 7 years ago by Alex Buts

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

To tester:

There are currently two version of ConvertToDiffractionMDWorkspace algorithm where the old one is V1 and the new one wraps ConvertToDiffractionMDWorkspace interface around convertToMD algorithm. The same unit tests with minor modifications for calling proper version pass for both versions.

Tester should try some real life example converting into MD using old and new version of the algorithm and check that results are similar (not exactly the same as different round-off and different summation may lead to slight variations)

new ConvertToDiffractionMDWorkspace always works with ClearInputWorkspace=false; OneEventPerBin=true options and generates MDEventWorkspace rather then MELeanEventWorkspace

Last edited 7 years ago by Alex Buts (previous) (diff)

comment:22 Changed 7 years ago by Alex Buts

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' of https://github.com/mantidproject/mantid into develop

comment:23 Changed 7 years ago by Alex Buts

refs #6856 Temporary modifying the system tests to run prev algorithm

Changeset: 35fc6a79ac51ca7e9ed51ec8d7574337b11414d1

comment:24 Changed 7 years ago by Alex Buts

  • Status changed from verify to reopened
  • Resolution fixed deleted

system tests need fixing

comment:25 Changed 7 years ago by Alex Buts

refs #6856 One more place to change the alg version

Changeset: 6d687b5e86bdbc5f8c70aede18d51906fac12413

comment:26 Changed 7 years ago by Alex Buts

refs #6856 reverting change to API2 erroneously merged with this ticket

Changeset: 9e24ad70eab301298eaf037a29582453c44161db

comment:27 Changed 7 years ago by Alex Buts

refs #6856 still reverting API2

Changeset: 52ab230c798eb9f22ffd9f5dd9a73f78d463cdee

comment:28 Changed 7 years ago by Alex Buts

refs #6856 fixing conflicts

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' into develop

Conflicts:

SystemTests/AnalysisTests/MDWorkspaceTests.py

Changeset: 2fbe864dba804810e724e63dc4f26d356f7e224f

comment:29 Changed 7 years ago by Alex Buts

refs #6856 Trying to identify the error in Diffraction_Workflow_Test

Changeset: bb2ff26ac52fd2b431c33e6778c65d8963debcd9

comment:30 Changed 7 years ago by Alex Buts

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' into develop

comment:31 Changed 7 years ago by Alex Buts

refs #6856 still undoing wrong merge with new API ticket

Changeset: f9ec762bd0688415411acac0978436767bd497a7

comment:32 Changed 7 years ago by Alex Buts

refs #6856 attempting to solve 3-sided conflict

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' into develop

Conflicts:

SystemTests/AnalysisTests/Diffraction_Workflow_Test.py

Changeset: fd2ef3d4fc001c9c4c6386aa354300816afbb368

comment:33 Changed 7 years ago by Alex Buts

refs #6856 Temporary reverting to V1 of algorithm

Changeset: 364be2684257df6c4b34166825c21e828974fce9

comment:34 Changed 7 years ago by Alex Buts

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' into develop

comment:35 Changed 7 years ago by Alex Buts

refs #6856 fixing ConvertToDiffractionMDWorkspace interface

Changeset: e0734911de5ec96b0f5ee30b3effe1a17a1a8df9

comment:36 Changed 7 years ago by Alex Buts

refs #6856 Copied ConvertToDiffractionMDWorkspace.cpp

into MD algorithms

Changeset: 4e34acb0274e5ac16885bdab63adc037610c88cd

comment:37 Changed 7 years ago by Alex Buts

refs #6856 Cloned initial algorithm into version 2

and verified that everything (unit tests) works fine, so we have two identical versions of the same algorithm with only the version number different

Changeset: 19319ba1983fd56dd852d6735d9bfe0c5acab6de

comment:38 Changed 7 years ago by Alex Buts

refs #6856 Compiles but does not work

Changeset: b8f384b4af4a30b0f00dfc8257a846a40d52cc61

comment:39 Changed 7 years ago by Alex Buts

refs #6856 All works except single event per bin

Changeset: 6354c9415bd9e2ad51543d5dd871572fe16a829f

comment:40 Changed 7 years ago by Alex Buts

refs #6856 Disable missing properties on interface and some comments

Changeset: 87f2599720dc175338fa5e68f2400f6635f0c959

comment:41 Changed 7 years ago by Alex Buts

refs #6856 minor comments

Changeset: fdbddee266861389a8f4abbd520e0193785f2609

comment:42 Changed 7 years ago by Alex Buts

refs #6856 minor warning ans suspicions for merge error

Changeset: f8159475f393afad75209630b749f63c99803232

comment:43 Changed 7 years ago by Alex Buts

refs #6856 Minor commits, and digging for merge conflict source

Changeset: 8406d5318de061cf020eeece29f5571de6c3eb4c

comment:44 Changed 7 years ago by Alex Buts

refs #6856 Enabling last disabled unit test

Changeset: d48de8ec0de992b704af8c7059a45f95be40feb1

comment:45 Changed 7 years ago by Alex Buts

refs #6856 doxygen errors

Changeset: 0838a1beaa32975516c1140d1ca201fb25fb9240

comment:46 Changed 7 years ago by Alex Buts

refs #6856 more comments

Changeset: 27045d93fae3476313d2661ab9c4fb187c0d238d

comment:47 Changed 7 years ago by Alex Buts

refs #6856 Temporary modifying the system tests to run prev algorithm

Changeset: 300cdca4955d15b13140aedc837d8ab48e6f5cf4

comment:48 Changed 7 years ago by Alex Buts

refs #6856 One more place to change the alg version

Changeset: 79625bd87b53101f511e28912c02306009d3565d

comment:49 Changed 7 years ago by Alex Buts

refs #6856 reverting change to API2 erroneously merged with this ticket

Changeset: ef84da15e9b01296320fae714374962e4a4af28f

comment:50 Changed 7 years ago by Alex Buts

refs #6856 still reverting API2

Changeset: f5c1df44bb8d9966863adc3fcdbe323efb67e69f

comment:51 Changed 7 years ago by Alex Buts

refs #6856 Trying to identify the error in Diffraction_Workflow_Test

Changeset: cdb1820e3910ed6e15f071d258a6fe80f2009dea

comment:52 Changed 7 years ago by Alex Buts

refs #6856 still undoing wrong merge with new API ticket

Changeset: 683e20377c3ac3d82ca1415b750de344ec50a955

comment:53 Changed 7 years ago by Alex Buts

refs #6856 Temporary reverting to V1 of algorithm

Changeset: d8bc21ac304c07714c8b190cd063fd3ff720d581

comment:54 Changed 7 years ago by Alex Buts

refs #6856 fixing ConvertToDiffractionMDWorkspace interface

Changeset: c2719637eaed37160745d2126ad5d073c225042c

comment:55 Changed 7 years ago by Alex Buts

refs #6856 small merging error fixed

Changeset: e258d6ace3bbd30e4ac3de73d3a375d5900013b7

comment:56 Changed 7 years ago by Alex Buts

refs #6856 fixing merging conflicts with changes to API-2

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' into develop

Conflicts:

SystemTests/AnalysisTests/Diffraction_Workflow_Test.py SystemTests/AnalysisTests/MDWorkspaceTests.py SystemTests/AnalysisTests/WishDiffuseScattering.py

Changeset: a980763a449c1c4f4b64bcc5e72f0392a8076f54

comment:57 Changed 7 years ago by Alex Buts

refs #6856 Merge conflicts

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' into develop

Conflicts:

SystemTests/AnalysisTests/Diffraction_Workflow_Test.py

Changeset: 26a78fe16fa7dabad6b6cfed107ca84c3f3fb325

comment:58 Changed 7 years ago by Alex Buts

refs #6856 Merge conflicts

Merge branch 'feature/6856_ConvertToDiffractionMDWS_v2' into develop

Conflicts:

Code/Mantid/Framework/MDAlgorithms/src/ConvertToMD.cpp Code/Mantid/Framework/PythonInterface/plugins/algorithms/SNSPowderReduction.py

Changeset: 355e0a01eee737d2ba67b40477fbdd918a23a9d1

comment:59 Changed 7 years ago by Alex Buts

To Tester: new comments

Two versions of ConvertToDiffractionMDWorkspace algorithm where build where the old one is V1 and the new one wraps ConvertToDiffractionMDWorkspace interface around convertToMD algorithm. The same unit tests with minor modifications for calling proper version pass for both versions.

The changes are in branches feature/6856_ConvertToDiffractionMDWS_v2 and these branch exist both in Mantid and in SystemTests. Both have to be merged to correspondent master for system tests to pass.

Some system tests do not pass for the new version of algorithm, so there is ticket #7189 to check what is going on.

There were already tickets stating that ConvertToMD and ConvertToDiffractionMDWorispace produce similar results. This ticket is just to create a ConvertToDiffractionMDWorkspace wrapper for ConvertToMD.

Tester should try to run ConvertToDiffractionMDWorkspace interface and look at it bearing in mind that new ConvertToDiffractionMDWorkspace always works with ClearInputWorkspace=false; OneEventPerBin=true options and generates MDEventWorkspace rather then MELeanEventWorkspace.

The tester may look for further cases where the algorithms produce different results but remember about #7189.

I have rebased branches to master so there should be no conflicts (at least there were no conflicts at the start of the week)

Last edited 7 years ago by Alex Buts (previous) (diff)

comment:60 Changed 7 years ago by Alex Buts

  • Status changed from reopened to accepted

comment:61 Changed 7 years ago by Alex Buts

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

comment:62 Changed 7 years ago by Alex Buts

refs #6856 temporary reverting SXDAnalysis to work with V1 of the

ConvertToDiffractionMDWorkspace as the new one is substantially slower.

Changeset: 6811c9e6768a15185f872c30cd37ffffc521cdec

comment:63 Changed 7 years ago by Peter Peterson

  • Status changed from verify to verifying
  • Tester set to Peter Peterson

comment:64 Changed 7 years ago by Peter Peterson

Merge remote branch 'origin/feature/6856_ConvertToDiffractionMDWS_v2'

Conflicts:

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

Re #6856.

Changeset: e3f1dada77bd1f50bed74cf16f58dd0addb88bb7

comment:65 Changed 7 years ago by Peter Peterson

  • Status changed from verifying to closed

comment:66 Changed 7 years ago by Nick Draper

  • Component changed from Mantid to Framework

comment:67 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 7702

Note: See TracTickets for help on using tickets.