Ticket #7229 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Muon: dead time from PlotAssymmetryByLog

Reported by: Anders Markvardsen Owned by: Arturs Bekasovs
Priority: critical Milestone: Release 3.0
Component: Muon Keywords:
Cc: Blocked By:
Blocking: Tester: Anders Markvardsen

Description (last modified by Anders Markvardsen) (diff)

Mark Telling writes:

Would it be possible to implement dead time corrections to muon data when running the Mantid > Muon > PlotAssymmetryByLog algorithm

In the dialogue box that is launched it would be great if we could have a tick box which allows the user to choose whether to apply the correction or not – for diagnostic purposes

Now that the muon instruments are running at much higher data rates, the option to correction for dead time is becoming imperative

Attachments

screenshot-1.png (120.9 KB) - added by Arturs Bekasovs 7 years ago.
Result of the PlotAsymmetryByLogValue for MUSR00015189 - MUSR00015199
calculate_asymmetry.py (891 bytes) - added by Arturs Bekasovs 7 years ago.
Script which calculates asymmetry for a range of workspaces
create_dead_time_table.py (287 bytes) - added by Arturs Bekasovs 7 years ago.
Script which creates dead time table with some random data
MUSR00015189.nxs (1.0 MB) - added by Arturs Bekasovs 7 years ago.
MUSR data file with replaced dead times

Change History

comment:1 Changed 7 years ago by Anders Markvardsen

From a further email conversation with Mark:

Yes, I think an option to launch PlotAssymmetryByLog from the Muon analysis interface would be a good thing - again with the option to apply deadtime corrections or not for diagnostic purposed

comment:2 Changed 7 years ago by Nick Draper

  • Milestone changed from Release 2.6 to Backlog

Moved to backlog at the code freeze for R2.6

comment:3 Changed 7 years ago by Anders Markvardsen

  • Priority changed from major to critical
  • Owner changed from Anders Markvardsen to Arturs Bekasovs
  • Description modified (diff)
  • Milestone changed from Backlog to Release 3.0

comment:4 Changed 7 years ago by Arturs Bekasovs

  • Component changed from MantidPlot to Muon

comment:5 Changed 7 years ago by Arturs Bekasovs

  • Status changed from new to inprogress

Added new properties to the algorithm.

Refs #7229

Changeset: 3f1e242a3c5d153b49bdb2c64a7df90298208000

comment:6 Changed 7 years ago by Arturs Bekasovs

Fixed indentation of the test code.

Refs #7229

Changeset: 4e1085be2438a288cffc04b69f22858b0cc652c1

comment:7 Changed 7 years ago by Arturs Bekasovs

Reduced the number of files loaded for tests.

It's was quite slow already, but I am going to add more tests.

Refs #7229

Changeset: 16c0d679085b965111f2febdcd1b46550cae5be1

comment:8 Changed 7 years ago by Arturs Bekasovs

Added tests for functionality to be implemented.

Obviously failing for now.

Refs #7229

Changeset: ce6ea4e2a8f268dfc7828be72fae7fbd6fa89ba2

comment:9 Changed 7 years ago by Arturs Bekasovs

Fixed the indentation of the ApplyDeadTimeCorr code.

Refs #7229

Changeset: 5950a637d17bee34b31e1ddff8033a14cb130817

comment:10 Changed 7 years ago by Arturs Bekasovs

Code clean-up regarding usage of a namespace.

Refs #7229

Changeset: b2ada415fdb816ef41a09859da01454c37bab315

comment:11 Changed 7 years ago by Arturs Bekasovs

Methods for applying dead time correction.

Refs #7229

Changeset: 01c59056db7111987c1cd8becf0c28395b269e09

comment:12 Changed 7 years ago by Arturs Bekasovs

New algorithm to group detectors using info from Muon Nexus.

Refs #7229

Changeset: 8a41efdb39d1322b19c7bf3e7a649061d79e5140

comment:13 Changed 7 years ago by Arturs Bekasovs

Make the algorithm retrieve workspaces from a group, not from ADS.

Otherwise I couldn't use child algorithm to modify workspace before it gets used.

Refs #7229

Changeset: dbc7caaf1063c77c59579dfe412e71275436d0b2

comment:14 Changed 7 years ago by Arturs Bekasovs

Use the new algorithm to apply auto-grouping.

It means I can apply dead time correction before grouping happens.

Refs #7229

Changeset: 72c9c1d127f49aa6b75327d507c1ce15948f95b2

comment:15 Changed 7 years ago by Arturs Bekasovs

Improve tests a bit.

Refs #7229

Changeset: 1f0d2ac733ebcee54b0814d5466358a6bef77bfb

comment:16 Changed 7 years ago by Arturs Bekasovs

Make grouping functions to return output workspaces.

Refs #7229

Changeset: e1e6635c638ae80b6ff546db79f4c030572e4a58

comment:17 Changed 7 years ago by Arturs Bekasovs

Code to apply dead time correction.

Is passing the tests.

Refs #7229

Changeset: 509fa76e21d1abc063a7354495a197fec389e366

comment:18 Changed 7 years ago by Arturs Bekasovs

Add an include for std::accumulate.

Refs #7229

Changeset: bd9d9e634e2afac7560f772f98d53d0c37883ac5

comment:19 Changed 7 years ago by Arturs Bekasovs

Added extensions to test files so they can be found.

Refs #7229

Changeset: 79cd8d6b16a2af4feb95ff827e22baf36b19c7f3

comment:20 Changed 7 years ago by Arturs Bekasovs

Tie all the properties to their widgets.

This make the whole thing less error-prone and gives me a list of all the property widgets.

Refs #7229

Changeset: 1df4cacb069ba2faeb4384b88e4290c5833c7ce1

comment:21 Changed 7 years ago by Arturs Bekasovs

Unified the code for handling Browse buttons.

Will be easier to add another one now.

Refs #7229

Changeset: 2c0eadf41060fbea94d137f80e8c326f67e316c6

comment:22 Changed 7 years ago by Arturs Bekasovs

Added DTC widgets to the UI.

Refs #7229

Changeset: f017052c6c69a163e41970ad2c49c572abd4ad66

comment:23 Changed 7 years ago by Arturs Bekasovs

Code for connecting DTC widgets to algorithm properties.

Refs #7229

Changeset: ea460e29dcf350681dffdeff9361224ee2d84790

comment:24 Changed 7 years ago by Arturs Bekasovs

Deal with the situation when ws doesn't contain any auto-grouping info.

Plus improve other error messages.

Refs #7229

Changeset: a58edd5ed87c5771fe87a10e6dcb18d4e86e67dd

comment:25 Changed 7 years ago by Arturs Bekasovs

Tester:

Changes touch the PlotAssymetryByLogValue used by Muon scientists, so that's the one you will be testing.

As you might see from the commits, I've had to change the way loaded workspaces are used and auto-grouping is applied within the algorithm. Hence first of all, please try to make sure that PlotAsymmetryByLogValue works in the same way as before in case Dead Time Correction is not applied.

  1. Read attached calculate_asymmetry.py through and make sure you understand and agree with the way it calculates a numerical asymmetry value for a range of workspaces.
  2. Load it to Mantid Python window and make sure applyDeadTimeCorr variable is set to False.
  3. Run the script. This should create a workspace "script_result".
  4. Now we will try to create the same results using the PlotAsymmetryByLogValue. Open it's dialog.
  5. Set the First run to AutoTestData/MUSR00015189.nxs, Last run to AutoTestData/MUSR00015199.nxs and Output workspace to e.g. result. By default, Log value should be set to run_number and Dead Time Correction Type to None, leave other fields untouched.
  6. Run the algorithm. Make sure no errors are thrown and it completes.
  7. Now compare the plots or the values of the result and script_result workspaces and make sure they are equal. In addition, compare that to the workspace on the screenshot attached, which is the result of running the algorithm in the last stable release, i.e. before the changes.

So knowing that it wasn't broken, we need to check that the Dead Time Correction is applied correctly.

  1. Run another script attached, create_dead_time_table.py. It should create a ws dead_times in the ADS with dead times for 64 detectors, all set to some random value.
  2. Now, go back to the calculate_asymmetry.py and set applyDeadTimeCorr to True. This will set it to apply Dead Time Correction using dead_times workspace. Run it.
  3. Using SaveNexus algorithm save dead_times workspace to some file.
  4. Run PlotAsymmetryByLogValue with Dead Time Correction Type set to FromSpecifiedFile, using the file where dead_times workspace was saved. Make sure it runs successfully.
  5. Make sure both script_result and result have changed and are equal again.

Now it is only left to check whether FromRunData DTC works.

  1. I've attached a MUSR data file, where dead_times stored in a file where changed to be the same as the ones in dead_times workspace. Download this data file.
  2. Set both First run and Last run to the file downloaded. Set Dead Time Correction Type to FromSpecifiedFile, set the file to the one you saved dead_times to. Run the algorithm saving the result to workspace result1.
  3. Now set Dead Time Correction Type to FromRunData and run the algorithm with Output workspace result2.
  4. Compare result1 and result2 and make sure they are the same.

Changed 7 years ago by Arturs Bekasovs

Result of the PlotAsymmetryByLogValue for MUSR00015189 - MUSR00015199

Changed 7 years ago by Arturs Bekasovs

Script which calculates asymmetry for a range of workspaces

Changed 7 years ago by Arturs Bekasovs

Script which creates dead time table with some random data

Changed 7 years ago by Arturs Bekasovs

MUSR data file with replaced dead times

comment:26 Changed 7 years ago by Arturs Bekasovs

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

comment:27 Changed 7 years ago by Anders Markvardsen

  • Status changed from verify to verifying
  • Tester set to Anders Markvardsen

comment:28 Changed 7 years ago by Anders Markvardsen

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/7229_muon_plotbylog_deadtime'

Full changeset: a77a209359342753ab06ea9bf66128fabae26383

comment:29 Changed 7 years ago by Anders Markvardsen

works as described

comment:30 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8075

Note: See TracTickets for help on using tickets.