Ticket #7772 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Make LoadDetectorGroupingFile work with .map files

Reported by: Arturs Bekasovs Owned by: Arturs Bekasovs
Priority: minor Milestone: Release 3.0
Component: Muon Keywords:
Cc: Blocked By:
Blocking: #7765 Tester: Roman Tolchenov

Description

Currently it's done in GroupDetectors2, which shouldn't probably care about dealing with files.

Attachments

grouping.map (89 bytes) - added by Arturs Bekasovs 7 years ago.
Sample grouping Map file

Change History

comment:1 Changed 7 years ago by Arturs Bekasovs

  • Status changed from new to inprogress
  • Blocking 7765 added

comment:2 Changed 7 years ago by Arturs Bekasovs

From GroupDetectors2 documentation:

The file must have the following format (extra space and comments starting with # are allowed) :

"unused number1"             
"unused number2"
"number_of_input_spectra1"
"input spec1" "input spec2" "input spec3" "input spec4"
"input spec5 input spec6"
**    
"unused number2" 
"number_of_input_spectra2"
"input spec1" "input spec2" "input spec3" "input spec4"

Each phrase in "" is replaced by a single integer. The section of the file that follows ** is repeated once for each group.

Some programs require that "unused number1" is the number of groups specified in the file but Mantid ignores that number and all groups contained in the file are read regardless. "unused number2" is in other implementations the group's spectrum number but in this algorithm it is is ignored and can be any integer (not necessarily the same integer)

An example of an input file follows:

2
1  
12  
1 2 3 4 5
6 7 8 9 10
11 12
2  
10
65 66 67 68 69 
70 71 72 73 74  

comment:3 Changed 7 years ago by Arturs Bekasovs

Added a new exception type for errors happened during file parsing.

Refs #7772

Changeset: 43de19fabd73a2d2c0c25f735468b51851a23296

comment:4 Changed 7 years ago by Arturs Bekasovs

Added a publicly available function to parse a numeric range.

This is quite a useful one, as I've seen at least 3 different implementations of that. Rigorous tests for it were added as well.

Refs #7772

Changeset: 3894f4aa48a78190997072670f1d41ab45b3fce2

comment:5 Changed 7 years ago by Arturs Bekasovs

Added a class to parse Map grouping files and used it in the algorithm.

Refs #7772

Changeset: 427056773b090b429e4618749dc7c5adcc29eea0

comment:6 Changed 7 years ago by Arturs Bekasovs

Added tests for Map files.

Refs #7772

Changeset: 8c98af86f39b3963f5a49eea80991edf1b340bc2

comment:7 Changed 7 years ago by Arturs Bekasovs

Make FilePropertyWidget use default extension.

Before these changes it was using default extension for save dialogs only. The point here is that code for save and load dialogs is doing almost the same thing and should probably be moved to a single method. Additionally, for some reason load dialogs are using ".ext (*.ext)" approach, while save dialogs are displaying "*.ext" straight away. Somebody should probably take a look at that as a maintenance.

Refs #7772

Changeset: dde8e9f33ad284a41c871697c69e417ab2dc5885

comment:8 Changed 7 years ago by Arturs Bekasovs

Fix build errors due to using initialization lists.

Refs #7772

Changeset: 3030d1c6adff434c76c551fff8c124375ead5411

comment:9 Changed 7 years ago by Arturs Bekasovs

Tester:

  1. Save an attached grouping.map file somewhere on your drive.
  2. Run MantidPlot.
  3. Run LoadDetectorsGroupingFile algorithm.
  4. Click the Browse for the InputFile. Notice that .map extension was added to the extension list, but make sure that .xml is selected by default.
  5. Change the extension to .map and select the grouping.map file.
  6. Run the algorithm with some OutputWorkspace name. Make sure it completes silently and the workspace is created.
  7. Open the data view for all the spectra of created workspace.
  8. Check that spectra with indices (0-9) have a single Y value of 1.0, spectra (10-19) - value of 2.0, and (20-29) - value of 3.0.
  9. Read the description of the .map format in the comment above, and try to experiment by changing the contents of grouping.map and checking that the algorithm parses it correctly. Try to introduce errors, e.g. insufficiently many spectra specified for a group, incorrect integer, reversed range, garbage on the line etc, and make sure that informative error messages are returned.
  10. Now try to load a AutoTestData/MUSRGrouping.xml file and make sure it parses it correctly as well. Correct values for a resulting workspace: spectra indices (0-31) - value of 2.0, and (32-63) - value of 1.0. This is just to make sure that the old code is not affected.

Last edited 7 years ago by Arturs Bekasovs (previous) (diff)

Changed 7 years ago by Arturs Bekasovs

Sample grouping Map file

comment:10 Changed 7 years ago by Arturs Bekasovs

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

comment:11 Changed 7 years ago by Roman Tolchenov

  • Status changed from verify to verifying
  • Tester set to Roman Tolchenov

comment:12 Changed 7 years ago by Roman Tolchenov

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/7772_load_map_grouping_file'

comment:13 Changed 7 years ago by Nick Draper

  • Component changed from Framework to Muon

comment:14 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 8617

Note: See TracTickets for help on using tickets.