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

Calling child algorithms with workspace groups doesn't populate output workspace property #38473

Open
rbauststfc opened this issue Dec 4, 2024 · 0 comments
Labels
Investigation A task to investigate options for future work ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS

Comments

@rbauststfc
Copy link
Contributor

If you run an algorithm on a workspace using the algorithm manager then it is not possible to retrieve the output from the "OutputWorkspace" property, it is instead put into the ADS:

input_ws = LoadNexus("INTER45455")
alg = AlgorithmManager.createUnmanaged("ReflectometryBackgroundSubtraction")
alg.initialize()
alg.setProperty("InputWorkspace", "input_ws")
alg.setProperty("ProcessingInstructions", "100-145")
alg.setProperty("OutputWorkspace", "result")
alg.execute()

output = alg.getProperty("OutputWorkspace").value
print(type(output)) # Gives None type and the workspace is instead stored in the ADS

However, if the above is run as a child algorithm, then you can retrieve the output directly from the "OutputWorkspace" property:

input_ws = LoadNexus("INTER45455")
alg = AlgorithmManager.createUnmanaged("ReflectometryBackgroundSubtraction")
alg.initialize()
alg.setChild(True)
alg.setAlwaysStoreInADS(False)
alg.setProperty("InputWorkspace", "input_ws")
alg.setProperty("ProcessingInstructions", "100-145")
alg.setProperty("OutputWorkspace", "result")
alg.execute()

output = alg.getProperty("OutputWorkspace").value
print(type(output)) # Gives a workspace

This makes it easy to retrieve outputs without having to interact with the ADS when calling algorithms from within other algorithms.

If an algorithm is run as a child against a workspace group, though, then the output always seems to be stored in the ADS and cannot be retrieved from the "OutputWorkspace" property:

input_ws_grp = LoadNexus("POLREF32130")
alg = AlgorithmManager.createUnmanaged("ReflectometryBackgroundSubtraction")
alg.initialize()
alg.setChild(True)
alg.setAlwaysStoreInADS(False)
alg.setProperty("InputWorkspace", "input_ws_grp")
alg.setProperty("ProcessingInstructions", "520-640")
alg.setProperty("OutputWorkspace", "result_grp")
alg.execute()

output = alg.getProperty("OutputWorkspace").value
print(type(output))  # Gives a None type and the workspace is instead stored in the ADS

If an algorithm is being run as a child then, regardless of whether it's been passed a single workspace or a workspace group, I think ideally it should return it's output via the "OutputWorkspace" property. Among other things, this would prevent unexpected behaviour when running algorithms as a child with a workspace group.

I've marked this as an investigation for now as I think we probably still need to determine if this is a bug or a conscious design decision (maybe due to technical obstacles?).

@rbauststfc rbauststfc added the Investigation A task to investigate options for future work label Dec 4, 2024
@rbauststfc rbauststfc added the ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Investigation A task to investigate options for future work ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS
Projects
Status: No status
Development

No branches or pull requests

1 participant