SumSpectra of grouped workspace

Dear All,
SumSpectra allows summing spectra in one workspace but how can I sum spectra grouped in a workspace. I have several workspaces, each contain one histogram (2454 bins), and wish to sum them up, how can I do that.
Many thanks.

There isn’t a single algorithm to do that, but it should be possible with a short bit of python looping over the group members and using Plus to add them together.

I’ll try it out and post an answer in a minute.

This should do it, just replace wsGroup with your group workspace.

#clone the first workspace as the result
wsResult = CloneWorkspace(wsGroup[0])
#loop over the rest if the members of the group
for i in range(1,wsGroup.getNumberOfEntries()):
    wsResult += wsGroup[i]

If you need it I can convert this into a python algorithm pretty easily.

Here’s the code I used to create a wsGroup to test it with

#create a group workspace
wsPrefix = "member"
wsList = []
for i in range (10):
    wsName = wsPrefix + str(i)
    wsList.append(wsName)
    CreateSampleWorkspace(OutputWorkspace=wsName)
    
wsGroup = GroupWorkspaces(wsList)

Regards,
Nick