Ticket #8593 (closed: fixed)
Vesuvio workflow needs to support DetectorGroups
Reported by: | Martyn Gigg | Owned by: | Martyn Gigg |
---|---|---|---|
Priority: | critical | Milestone: | Release 3.1 |
Component: | Direct Inelastic | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Arturs Bekasovs |
Description (last modified by Martyn Gigg) (diff)
This is required so all of the spectra can be summed on loading and the the fitting applied to the summed workspace and averaged detector geometry.
When complete the following script should run successfully:
raw_ws = LoadVesuvio(Filename='14188-14195',OutputWorkspace='raw_ws',SpectrumList='135-142',Mode='SingleDifference', InstrumentParFile=r'IP0004_10.par') raw_ws = SumSpectra(raw_ws) CropWorkspace(InputWorkspace='raw_ws',OutputWorkspace='raw_ws',XMin=50,XMax=562) # Convert to seconds ScaleX(InputWorkspace='raw_ws',OutputWorkspace='raw_ws',Operation='Multiply',Factor=1e-06) function_str = \ "composite=ComptonScatteringCountRate,NumDeriv=1,IntensityConstraints=\"Matrix(1|3)0|-1|3\";"\ "name=GramCharlierComptonProfile,WorkspaceIndex=0,Mass=1.007940,HermiteCoeffs=1 0 1;"\ "name=GaussianComptonProfile,WorkspaceIndex=0,Mass=27.000000;"\ "name=GaussianComptonProfile,WorkspaceIndex=0,Mass=91.000000" ties_str = "f1.Width=10.000000,f2.Width=25.000000" constraints_str = "2.000000 < f0.Width < 7.000000" Fit(InputWorkspace='raw_ws',Function=function_str,Ties=ties_str,Constraints=constraints_str, Output='fit', CreateOutput=True,OutputCompositeMembers=True,MaxIterations=5000, Minimizer="Levenberg-Marquardt,AbsError=1e-08,RelError=1e-08") # Convert to microseconds ScaleX(InputWorkspace='fit_Workspace',OutputWorkspace='fit_Workspace',Operation='Multiply',Factor=1e06) ScaleX(InputWorkspace='raw_ws',OutputWorkspace='raw_ws',Operation='Multiply',Factor=1e06) # Usually constructed from Fit output parameters in user scripts mass1_str = "name=GramCharlierComptonProfile,WorkspaceIndex=0,Mass=1.007900,HermiteCoeffs=1 0 0,Width=4.226288,FSECoeff=0.498073,C_0=57.941101" mass2_str = "name=GaussianComptonProfile,WorkspaceIndex=0,Mass=27.000000,Width=13.000000,Intensity=1.626268" mass3_str = "name=GaussianComptonProfile,WorkspaceIndex=0,Mass=91.200000,Width=26.000000,Intensity=2.977515" function_str = "%s;%s;%s" %(mass1_str,mass2_str,mass3_str) background,corrected = CalculateGammaBackground(InputWorkspace='raw_ws', ComptonFunction=function_str,WorkspaceIndexList=0)
The script currently complains about not being able to find a t0 parameter during Fit.
Change History
comment:1 Changed 7 years ago by Martyn Gigg
- Description modified (diff)
- Summary changed from ComptonScatteringCountRate & CalculateGammaBackground to support DetectorGroups to Vesuvio workflow needs to support DetectorGroups
comment:2 Changed 7 years ago by Martyn Gigg
- Status changed from new to inprogress
Add support for DetectorGroups to Compton functions
The parameters are averaged across the DetectorGroup when one is found Refs #8593
Changeset: 1745c657d83ec637c970a11eb7b3df107e4455d8
comment:3 Changed 7 years ago by Martyn Gigg
Add SumSpectra option to LoadVesuvio
The final output is just a single spectrum when this option is used. Refs #8593
Changeset: e8d6a77377b3612769885660793cb8b7fb44abc8
comment:4 Changed 7 years ago by Martyn Gigg
Add a test for LoadVesuvio SumSpectra option.
Refs #8593
Changeset: ff68b3dfcdd1077d8a248b03ac4623fa66cca1e2
comment:5 Changed 7 years ago by Martyn Gigg
- Status changed from inprogress to verify
- Resolution set to fixed
- Description modified (diff)
Branch: feature/8593_compton_scattering_detector_groups in both code & systemtests repositories
Tester: The data is on the ISIS archive & the IP file is attached to #8378.
Run the script above and it should run to completion without error. You can plot the raw_ws,background,corrected workspaces to see that the background has been taken off the raw_ws.
Now run this slightly altered script, sum is on algorithm, and it should give the same values:
raw_ws = LoadVesuvio(Filename='14188-14195',OutputWorkspace='raw_ws',SpectrumList='135-142',Mode='SingleDifference', InstrumentParFile=r'IP0004_10.par',SumSpectra=True) CropWorkspace(InputWorkspace='raw_ws',OutputWorkspace='raw_ws',XMin=50,XMax=562) # Convert to seconds ScaleX(InputWorkspace='raw_ws',OutputWorkspace='raw_ws',Operation='Multiply',Factor=1e-06) function_str = \ "composite=ComptonScatteringCountRate,NumDeriv=1,IntensityConstraints=\"Matrix(1|3)0|-1|3\";"\ "name=GramCharlierComptonProfile,WorkspaceIndex=0,Mass=1.007940,HermiteCoeffs=1 0 1;"\ "name=GaussianComptonProfile,WorkspaceIndex=0,Mass=27.000000;"\ "name=GaussianComptonProfile,WorkspaceIndex=0,Mass=91.000000" ties_str = "f1.Width=10.000000,f2.Width=25.000000" constraints_str = "2.000000 < f0.Width < 7.000000" Fit(InputWorkspace='raw_ws',Function=function_str,Ties=ties_str,Constraints=constraints_str, Output='fit', CreateOutput=True,OutputCompositeMembers=True,MaxIterations=5000, Minimizer="Levenberg-Marquardt,AbsError=1e-08,RelError=1e-08") # Convert to microseconds ScaleX(InputWorkspace='fit_Workspace',OutputWorkspace='fit_Workspace',Operation='Multiply',Factor=1e06) ScaleX(InputWorkspace='raw_ws',OutputWorkspace='raw_ws',Operation='Multiply',Factor=1e06) # Usually constructed from Fit output parameters in user scripts mass1_str = "name=GramCharlierComptonProfile,WorkspaceIndex=0,Mass=1.007900,HermiteCoeffs=1 0 0,Width=4.226288,FSECoeff=0.498073,C_0=57.941101" mass2_str = "name=GaussianComptonProfile,WorkspaceIndex=0,Mass=27.000000,Width=13.000000,Intensity=1.626268" mass3_str = "name=GaussianComptonProfile,WorkspaceIndex=0,Mass=91.200000,Width=26.000000,Intensity=2.977515" function_str = "%s;%s;%s" %(mass1_str,mass2_str,mass3_str) background,corrected = CalculateGammaBackground(InputWorkspace='raw_ws', ComptonFunction=function_str,WorkspaceIndexList=0)
comment:6 Changed 7 years ago by Arturs Bekasovs
- Status changed from verify to verifying
- Tester set to Arturs Bekasovs
comment:7 Changed 7 years ago by Arturs Bekasovs
Both scripts provided do work now. Corrected ws does seem to be raw_ws with subtracted background. Updated system test is passing on my machine.
comment:8 Changed 7 years ago by Arturs Bekasovs
- Status changed from verifying to closed
Merge remote-tracking branch 'origin/feature/8593_compton_scattering_detector_groups'
Full changeset: 14eff3e66ef3e175059e797767d0e8b279fc6708
comment:9 Changed 7 years ago by Arturs Bekasovs
Merge remote-tracking branch 'origin/feature/8593_compton_scattering_detector_groups'
Full changeset: 19b3681d8043a21f8821489da8cd8be09ae7da68
comment:10 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 9437