Ticket #7358 (closed: fixed)
Several SetSampleMaterialproperties should provided as output properties
Reported by: | Nick Draper | Owned by: | Nick Draper |
---|---|---|---|
Priority: | major | Milestone: | Release 2.6 |
Component: | Framework | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Owen Arnold |
Description
The scattering values that are either provided or calculated should be passed out as output properties for use in scripts and visibility in the history window.
Change History
comment:2 Changed 7 years ago by Nick Draper
re #7358 add output properties
Changeset: b0973d7c8cebf264b31c8402b9f5889a9e4ea447
comment:3 Changed 7 years ago by Nick Draper
- Status changed from accepted to verify
- Resolution set to fixed
To test
- run SetSampleMaterial using directly provided values (look at the wiki page for usage).
- use the history of the resulting workspace to check the output property values
- repeat using a chemical formula
comment:4 Changed 7 years ago by Peter Peterson
- Status changed from verify to verifying
- Tester set to Peter Peterson
comment:5 Changed 7 years ago by Peter Peterson
- Status changed from verifying to reopened
- Resolution fixed deleted
Generally I think the ticket itself is invalid. The information calculated by the algorithm is stored in the Workspace->Sample->Material in the provided workspace and accessible through that as fully decorated python objects (see #6827).
Some comments. You need to implement what you deem is the "correct" one.
- Rather than having duplicate output properties, set the calculated values in the existing ones with the same name (favorite option).
- Make the output properties as a group, using setPropertyGroup and a heading like "calculated values"
- Disable the output properties so people cannot enter anything in them.
comment:6 Changed 7 years ago by Nick Draper
- Status changed from reopened to accepted
The ticket is not invalid, the request came from spencer who had users that wanted to be able to see the resulting values in something other than the log window, and were not willing to use python. Setting the calculated values as output properties allows them to be visible in the history view of a workspace. This also follows the precedent of GetEI.
The part I had missed and many thanks for Pete for picking this up, was that I had not correctly marked the direction of the properties as outputs. this way they should not appear on dialogs or the python signature.
comment:7 Changed 7 years ago by Nick Draper
re #7358 correctly mark parameter direction
Changeset: ab0ebabde171a661bfe96da2dc24d81aed68f4d1
comment:8 Changed 7 years ago by Nick Draper
- Status changed from accepted to verify
- Resolution set to fixed
comment:9 Changed 7 years ago by Owen Arnold
- Status changed from verify to verifying
- Tester changed from Peter Peterson to Owen Arnold
comment:10 Changed 7 years ago by Owen Arnold
- Status changed from verifying to reopened
- Resolution fixed deleted
I've been testing this and had to reopen because the CoherentXSectionResult being returned doesn't look right. I had to create my own testing script for this ticket.
ws = Load(Filename='IRS26173') SetSampleMaterial(InputWorkspace=ws,AttenuationXSection=2.56,ScatteringXSection=11.62,SampleNumberDensity=0.0849106, ChemicalFormula="H4-N2-C3") sam = ws.sample() mat = sam.getMaterial() history = ws.getHistory() setSampleMaterialAlgorithm=history.lastAlgorithm() print mat.absorbXSection(), setSampleMaterialAlgorithm.getPropertyValue("AbsorptionXSectionResult") print mat.cohScatterXSection(), setSampleMaterialAlgorithm.getPropertyValue("CoherentXSectionResult") print mat.incohScatterXSection(), setSampleMaterialAlgorithm.getPropertyValue("IncoherentXSectionResult") print mat.totalScatterXSection(), setSampleMaterialAlgorithm.getPropertyValue("TotalXSectionResult")
In addition to the CoherentXSection not coming out right. There are the following issues that need to be addressed.
- There's also no unit test updates to cover the new functionality introduced here, so these new features have zero test coverage.
- The SetSampleMaterials wikipage example is wrong, because it is not possible to run the SetSampleMaterials algorithm (as per the example) without specifying a chemical formula.
comment:11 Changed 7 years ago by Nick Draper
refs #7358 Fix the test failures
Specifically, one of the ouput properies was not being set. Unit tests checks of the output properties have been added. The failure of the example was due to a change made by Pete in a previous ticket, but I've update the help text.
Changeset: 1065a8b50a5beb1619384b7f5e91c28e79afd4c9
comment:13 Changed 7 years ago by Nick Draper
- Status changed from accepted to verify
- Resolution set to fixed
comment:15 Changed 7 years ago by Owen Arnold
- Status changed from verifying to closed
Code changes look OK. Unit tests in place, and passing, and my previous failing python script (see above) is now outputting what I expect.
comment:16 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 8204