Ticket #6047 (closed: fixed)
MERLIN Component GetFullName not working
Reported by: | Gesner Passos | Owned by: | Karl Palmen |
---|---|---|---|
Priority: | major | Milestone: | Release 2.4 |
Component: | Mantid | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Martyn Gigg |
Description
Related to #5659. All GetFullName detectors reply an empty string.
This can be showed in this way:
ws = Load('merlinfile') for j in range(69640): # the number of workpaces ids name = ws.getDetector(i).getFullName() if name != "": print name
You will fill up with no answer.
Change History
comment:3 Changed 8 years ago by Karl Palmen
Problem observed when running the script (same as previous but for run number):
ws = Load('MER11840') numBlankNames = 0 for j in range(69640): # the number of workpaces ids name = ws.getDetector(j).getFullName() if name != "": print name else: numBlankNames += 1 print numBlankNames,"blank names"
69632 blank names counted.
comment:4 Changed 8 years ago by Karl Palmen
The same situation applies to getName as for getFullname as is shown by running
ws = Load('MER11840') numBlankNames = 0 for j in range(69640): # the number of workpaces ids name = ws.getDetector(j).getName() if name != "": print name else: numBlankNames += 1 print numBlankNames,"blank names"
comment:6 Changed 8 years ago by Karl Palmen
The reason why it is failing for run 11840 of MERLIN is because this run gives four detectors to each workspace index, which is the j in the scripts. This can be shown by running the following script
ws = Load('MER11840') for j in range(1000): # the number of workpaces ids IDs = ws.getDetector(j).getDetectorIDs() print IDs
comment:7 Changed 8 years ago by Karl Palmen
The underlying cause is that ws.getDetector( workspace index ) returns a Detector if there is just one detector for this workspace index (and corresponding spectrum), but it returns a DetectorGroup if there are several detectors for this workspace index.
Both Detectors and DetectorGroup implement getName and getFullName, but for DetectorGroup they both return "".
std::string getName() const{return "";} std::string getFullName() const{return "";}
in DetectorGroup.h .
Perhaps, they should return a list of names.
comment:8 Changed 8 years ago by Karl Palmen
Other issues. When I was running the script that listed the multiple detector IDs for a workspace with just one detector per workspace index. It failed indicating that the Detector (rather than DetectorGroup) did not have a getDetectorIDs() attribute. This can make writing scripts like this that call the getDetector attribute of workspace difficult.
comment:9 Changed 8 years ago by Karl Palmen
DetectorGroup getName and getFullName return list re #6047
Each element of the list is followed by a semi-colon.
Signed-off-by: Karl Palmen <karl.palmen@…>
Changeset: c4ee2a5941e72645e6ebbcf2cc21493ff2c31964
comment:10 Changed 8 years ago by Karl Palmen
To test I suggest running the following script, but with the argument of Load modified to create some other workspace for which there are several detectors to some spectra. See that the names are listed with semicolons separating them.
Run also for a workspace where there is just one detector per spectrum to verify that still works.
Repeat but with getFullName changed to getName.
In each case, the count of blank names at the end should be 0 (provided each spectrum has at least one detector).
ws = Load('MER11840') numBlankNames = 0 for j in range(ws.getNumberHistograms()): # the number of workpaces ids name = ws.getDetector(j).getFullName() if name != "": print name else: numBlankNames += 1 print numBlankNames,"blank names"
comment:11 Changed 8 years ago by Karl Palmen
- Status changed from accepted to verify
- Resolution set to fixed
comment:12 Changed 8 years ago by Karl Palmen
DetectorGroup getName and getFullName return list re #6047
Each element of the list is followed by a semi-colon.
Signed-off-by: Karl Palmen <karl.palmen@…>
Changeset: 41875d97137ebcceab608f854e848b294b49680a
comment:13 Changed 8 years ago by Martyn Gigg
- Status changed from verify to verifying
- Tester set to Martyn Gigg
comment:14 Changed 8 years ago by Martyn Gigg
- Status changed from verifying to closed
This looks fine. I've opened a ticket to expose the getNameSeparator method to python: #6455
comment:15 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 6893
The script
works for me and counts no blank names.