Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SANS2D IDF and Parameter Name #10204

Closed
PeterParker opened this issue Apr 23, 2014 · 1 comment
Closed

Fix SANS2D IDF and Parameter Name #10204

PeterParker opened this issue Apr 23, 2014 · 1 comment
Assignees
Labels
High Priority An issue or pull request that if not addressed is severe enough to postponse a release. SANS Issues and pull requests related to SANS
Milestone

Comments

@PeterParker
Copy link
Contributor

['''EDITED''']

For the complete avoidance of doubt, here is a script with which one can test a) which SANS2D Instrument Definition and Parameter files are being used when loading old and new runs, and b) which Parameter files are being loaded when manually loading SANS2D IDFs:

#!div style="font-size: 80%"
  ```#!python
import os

# Set to your instrument directory.
inst_dir = r"C:\Users\stv04463\Development\Mantid\Source\WIP\Code\Mantid\instrument"

OLD_SANS_RUN = "SANS2D00022300.nxs"
NEW_SANS_RUN = "SANS2D00023519.nxs"

IDF_SINCE_9333 = "SANS2D_Tubes_Definition.xml"
PROPOSED_IDF_IN_9361 = "SANS2D_Definition_Tubes.xml"

OLD_IDF = "SANS2D_Definition.xml"
NEW_IDF = IDF_SINCE_9333

def new_idf_was_loaded(inst):
    # A component that existed in the old SANS2D IDF.
    OLD_COMP = "SANS2D/rear-detector/rear-detector(x=184)"
    # A component that exists in the new SANS2D IDF.
    NEW_COMP = "SANS2D/rear-detector/left32"

    if inst.getComponentByName(OLD_COMP) != None and inst.getComponentByName(NEW_COMP) == None:
        return False
    if inst.getComponentByName(OLD_COMP) == None and inst.getComponentByName(NEW_COMP) != None:
        return True

def new_param_file_was_loaded(inst):
    # The name of a parameter which should be different in the old and new versions of the param files.
    COL_PARAM = "low-angle-detector-num-columns"

    if len(inst.getNumberParameter(COL_PARAM)) == 0:
        return False
    if 192 == inst.getNumberParameter(COL_PARAM)[0]:
        return False
    if 512 == inst.getNumberParameter(COL_PARAM)[0]:
        return True

# a) Load an old and a new run, and see if correct IDFs / param files are being pulled in.
ws = Load(Filename=OLD_SANS_RUN)
inst = ws.getInstrument()
assert not new_idf_was_loaded(inst)
assert not new_param_file_was_loaded(inst)
ws = Load(Filename=NEW_SANS_RUN)
inst = ws.getInstrument()
assert new_idf_was_loaded(inst) # Fails since http://trac.mantidproject.org/mantid/ticket/9333.
assert new_param_file_was_loaded(inst) # Fails since http://trac.mantidproject.org/mantid/ticket/9333.

# b) Load the old and new IDFs manually and see if the correct param files are being pulled in.
inst_ws = LoadEmptyInstrument(Filename=os.path.join(inst_dir, OLD_IDF))
inst = inst_ws.getInstrument()
assert not new_idf_was_loaded(inst)
assert not new_param_file_was_loaded(inst)
inst_ws = LoadEmptyInstrument(Filename=os.path.join(inst_dir, NEW_IDF))
inst = inst_ws.getInstrument()
assert new_idf_was_loaded(inst) # Fails since http://trac.mantidproject.org/mantid/ticket/9333.
assert new_param_file_was_loaded(inst) # Fails since http://trac.mantidproject.org/mantid/ticket/9333.


Since http://trac.mantidproject.org/mantid/ticket/9333 the names of the SANS2D IDF and param file have been:

SANS2D_Tubes_Parameters.xml
SANS2D_Tubes_Definition.xml


which makes the script above fail (see comments in script).

Changing to:

SANS2D_Parameters_Tubes.xml
SANS2D_Definition_Tubes.xml


will mean that the script works fine, but that the system tests fail.  (This is because the reduction incorrectly pulls in the latest IDF for the instrument rather the the IDF that corresponds to the data being reduced.)  This will need to be addressed in this ticket.


@PeterParker
Copy link
Contributor Author

This issue was originally trac ticket 9361

@PeterParker PeterParker added High Priority An issue or pull request that if not addressed is severe enough to postponse a release. SANS Issues and pull requests related to SANS labels Jun 3, 2015
@PeterParker PeterParker self-assigned this Jun 3, 2015
@PeterParker PeterParker added this to the Release 3.2 milestone Jun 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
High Priority An issue or pull request that if not addressed is severe enough to postponse a release. SANS Issues and pull requests related to SANS
Projects
None yet
Development

No branches or pull requests

1 participant