Ticket #3971 (closed: fixed)
REF_L instrument ends up just being called 'REF' inside Mantid
Reported by: | Russell Taylor | Owned by: | Karl Palmen |
---|---|---|---|
Priority: | major | Milestone: | Release 2.1 |
Component: | Mantid | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Peter Parker |
Description
Load a REF_L file and look at the instrument name - it just says 'REF'. Might be a problem once a REF_M definition comes along....
Change History
comment:1 Changed 9 years ago by Nick Draper
- Status changed from new to assigned
- Owner set to Anyone
comment:2 Changed 9 years ago by Nick Draper
- Milestone changed from Iteration 32 to Iteration 33
Moved to iteration 33 at iteration 32 code freeze
comment:3 Changed 9 years ago by Karl Palmen
I've observed that both REF_L and REF_M are called REF in the instrument tree in Mantid.
comment:5 Changed 9 years ago by Karl Palmen
This calling of the instrument REF in the instrument tree is not affected by changing the instrument name in the IDF file, even if the IDF is loaded directly through LoadEmptyInstrument. This can be seen with the REF_M_Definition.xml IDF file.
comment:6 Changed 9 years ago by Karl Palmen
A look at the code of LoadInstrument, which is used by LoadEmptyInstument, suggests that the instrument name is got from the IDF filename rather than any of its contents. It extracts the instrument name from the file name, by removing the directory part of the filename and then removing the '_Definition.xml' or '_Definition_update.xml' part by removing everything from the first '_' character. I.e. REF_L and REF_M loose the _L and _M because the '_' is a delimiter in the filename.
comment:7 Changed 9 years ago by Karl Palmen
Modifying the code that gets the instrument from filename to get REF_L or REF_M does not change the situation (still get REF in instrument tree).
comment:8 Changed 9 years ago by Karl Palmen
Improve extraction of instrument name from filename re #3971
Look for '_Def' rather than just '_'.
Signed-off-by: Karl Palmen <karl.palmen@…>
Changeset: 5e0bbb662e870bf377a415a91af6996027f12005
comment:9 Changed 9 years ago by Karl Palmen
Reverse instrument name search change re #3971
It appears that instrumentFile.find_first_of("_Def") searches for the first of any character in the argument string rather than the whole string as a substring. Search string changed back to "_".
Signed-off-by: Karl Palmen <karl.palmen@…>
Changeset: 65ffce74aeee09718e46ba2f8708e12f5aeb2adf
comment:10 Changed 9 years ago by Karl Palmen
Get instrument from file name by searching up to "_Def" re #3971
This time using the string.find("_Def") function, which does look for the argument string as a substring rather than any character in the argument string. Also modified a unit test to expect "REF_L" rather than "REF" .
Signed-off-by: Karl Palmen <karl.palmen@…>
Changeset: d360f72a31b8dad577b29bddaa851b756751715d
comment:12 Changed 9 years ago by Karl Palmen
- Status changed from accepted to verify
- Resolution set to fixed
comment:13 Changed 9 years ago by Karl Palmen
Improve extraction of instrument name from filename re #3971
Look for '_Def' rather than just '_'.
Signed-off-by: Karl Palmen <karl.palmen@…>
Changeset: 5e0bbb662e870bf377a415a91af6996027f12005
comment:14 Changed 9 years ago by Karl Palmen
Reverse instrument name search change re #3971
It appears that instrumentFile.find_first_of("_Def") searches for the first of any character in the argument string rather than the whole string as a substring. Search string changed back to "_".
Signed-off-by: Karl Palmen <karl.palmen@…>
Changeset: 65ffce74aeee09718e46ba2f8708e12f5aeb2adf
comment:15 Changed 9 years ago by Karl Palmen
Get instrument from file name by searching up to "_Def" re #3971
This time using the string.find("_Def") function, which does look for the argument string as a substring rather than any character in the argument string. Also modified a unit test to expect "REF_L" rather than "REF" .
Signed-off-by: Karl Palmen <karl.palmen@…>
Changeset: d360f72a31b8dad577b29bddaa851b756751715d
comment:16 Changed 8 years ago by Peter Parker
- Status changed from verify to verifying
- Tester set to Peter Parker
comment:17 Changed 8 years ago by Peter Parker
- Status changed from verifying to closed
Python script:
file = "C:/mantid/Test/AutoTestData/REF_L_32035.nxs" Load(Filename=file, OutputWorkspace=file) inst = mtd[REF_L].getInstrument() print inst.getName()
Output in Python Console:
REF_L
Functionality is covered by unit test.
comment:18 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 4818