Ticket #5635 (closed: fixed)

Opened 8 years ago

Last modified 5 years ago

Allow default loading of more than one Instrument Parameter File

Reported by: Owen Arnold Owned by: Karl Palmen
Priority: major Milestone: Release 2.4
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Nick Draper

Description (last modified by Anders Markvardsen) (diff)

Instrument Parameter Files shipped with Mantid, with the name InstrumentName_Parameters.xml, that live in the instrument directory are automatically loaded when mantid loads data for a specific instrument.

So e.g. if we have in the instrument folder:

HRPD_Instrument_1.xml HRPD_Instrument_2.xml HRPD_Instrument_3.xml HRPD_Parameters.xml

Then when any of the HRPD_Instrument_#.xml are loaded HRPD_Parameters.xml are then subsequenctly loaded.

Expand this so that if the instrument folder contains the files:

HRPD_Instrument_1.xml HRPD_Instrument_2.xml HRPD_Instrument_3.xml HRPD_Parameters.xml HRPD_Parameters_2.xml

then for this example HRPD_Parameters.xml is loaded after HRPD_Instrument_1.xml and HRPD_Instrument_3.xml are loaded and HRPD_Parameters_2.xml is loaded after HRPD_Instrument_2.xml.

Hence if a parameter file with a matching name exist than it takes precedence to the 'default' parameter file (which in the above example is HRPD_Parameters.xml)

Once implemented update IDF wiki accordingly

Change History

comment:1 Changed 8 years ago by Nick Draper

  • Milestone changed from Release 2.2 to Release 2.3

Moved at the end of release 2.2

comment:2 Changed 8 years ago by Anders Markvardsen

  • Status changed from new to assigned
  • Owner changed from Anders Markvardsen to Karl Palmen
  • Description modified (diff)

comment:3 Changed 8 years ago by Nick Draper

  • Milestone changed from Release 2.3 to Release 2.4

Moved to milestone 2.4

comment:4 Changed 8 years ago by Karl Palmen

A discussion of this at the 2012 Mantid Workshop suggested one parameter file might be sufficient.

comment:5 Changed 8 years ago by Anders Markvardsen

  • Summary changed from Allow default loading of more than one Instrument Parmeter File to Allow default loading of more than one Instrument Parameter File

comment:6 Changed 8 years ago by Anders Markvardsen

  • Description modified (diff)

Changed the ticket description according to suggestion at workshop

comment:7 Changed 8 years ago by Karl Palmen

I believe that 'Instrument' in the filenames in the description needs to be 'Definition', else the change requested would have no effect in practice.

comment:8 Changed 8 years ago by Karl Palmen

  • Status changed from assigned to accepted

comment:9 Changed 8 years ago by Karl Palmen

Implemented change to Parameter File Selection re #5635

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 6d454d295b769a7735b50e031617c27d268301be

comment:10 Changed 8 years ago by Karl Palmen

Unit Test for Loading Instrument with Parameter File re #5635

This one tests an IDF file not in the instrument folder with something extra added to its name uses the default parameter file in the instrument folder, because no parameter file has this extra part in its name.

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 2b00027847b4d5e7b32f854372b4172bfa77c72a

comment:11 Changed 8 years ago by Karl Palmen

Add further tests for Parameter File Selection re #5635 re #6281

Changeset: aa0d02c305752c02dbae97f629e2a1107321012c

comment:12 Changed 8 years ago by Karl Palmen

Add 2 more unit tests and remove duplicate code re #5635 re #6281

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: b3918a6583751723e83056373db828c06079b0de

comment:13 Changed 8 years ago by Karl Palmen

Added One More Test re #5635 re #6281

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 97a44fcf130819bb487dafe3448de21fc24626e3

comment:14 Changed 8 years ago by Karl Palmen

The original unit test did not check whether the parameter from the parameter file was successfully loaded, so would crash if the correct parameter file were not loaded. I modified this to make this check and if the parameter were not loaded it would give an informative message instead of attempting the other tests on the parameter.

This modification was included in all such tests.

comment:15 Changed 8 years ago by Karl Palmen

Added test IDF file re #5635 re #6281

Changeset: 150dcec1577da8f7906ce9a24d04368c568251c9

comment:16 Changed 8 years ago by Karl Palmen

I suggest this ticket be tested alongside #6281, because testing of the latter would entail a variation of testing this ticket.

Select an IDF file that uses a separate parameter file. Create a copy of that parameter file that has an effect you can observe when you load empty instrument with the IDF file (e.g. when you open the fit parameters window).

Create a copy of the IDF file with some extra characters after the "Definition" part of its name. Name the parameter file you created the same except for "Parameters" instead of definition. LoadEmptyInstrument with the new IDF file and check for the change that should occur with the new parameter file.

Create another copy of the IDF file with different characters after the "Definition" part and LoadEmpty instrument with it and check that the change does not occur and it is identical with the effect of LoadEmptyInstrument of the original IDF file.

Do this test with all the files in the instrument directory of your installation and again with all the files in some other folder.

comment:17 Changed 8 years ago by Karl Palmen

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

comment:18 Changed 8 years ago by Karl Palmen

Implemented change to Parameter File Selection re #5635

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 444c270c08d8748ab1b5037d0c4de3bca762a580

comment:19 Changed 8 years ago by Karl Palmen

Unit Test for Loading Instrument with Parameter File re #5635

This one tests an IDF file not in the instrument folder with something extra added to its name uses the default parameter file in the instrument folder, because no parameter file has this extra part in its name.

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 0e705dbd41f07bcef1ae32ab802065488b68ea36

comment:20 Changed 8 years ago by Karl Palmen

Add further tests for Parameter File Selection re #5635 re #6281

Changeset: 4e0adae4426c4dea7aa161cec351708ff2f4fe5d

comment:21 Changed 8 years ago by Karl Palmen

Add 2 more unit tests and remove duplicate code re #5635 re #6281

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 48b96e3b3ace374281326bc2d3c62640c9092743

comment:22 Changed 8 years ago by Karl Palmen

Added One More Test re #5635 re #6281

Signed-off-by: Karl Palmen <karl.palmen@…>

Changeset: 4467a586c0b7872d86f8efbfc6518f68d5d03069

comment:23 Changed 8 years ago by Karl Palmen

Added test IDF file re #5635 re #6281

Changeset: 3439c55d60b326eb22c79f6a64a23dacb4dc12cc

comment:24 Changed 8 years ago by Nick Draper

  • Status changed from verify to verifying
  • Tester set to Nick Draper

comment:25 Changed 8 years ago by Nick Draper

tested with altered files and

s=mtd["snap"]
print s
snap
i=s.getInstrument()
print i
<mantid.geometry._geometry.Instrument object at 0x0000000009675C18>
print i.getParameterNames()
set('centre-finder-step-size','default-incident-monitor-spectrum','default-transmission-monitor-spectrum','high-angle-detector-name','high-angle-detector-num-columns','high-angle-detector-num-rows','high-angle-detector-short-name','low-angle-detector-name','low-angle-detector-num-columns','low-angle-detector-num-rows','low-angle-detector-short-name')
print i.getStringParameter("low-angle-detector-name")
['outside directory  matching']

comment:26 Changed 8 years ago by Nick Draper

and

s=mtd["snap"]
i=s.getInstrument()
print i.getStringParameter("low-angle-detector-name")
['outside directory not matching']

comment:27 Changed 8 years ago by Nick Draper

  • Status changed from verifying to closed

and

s=mtd["snap"]
i=s.getInstrument()
print i.getStringParameter("low-angle-detector-name")
['rear-detector']

comment:28 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 6481

Note: See TracTickets for help on using tickets.