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

Matrix Algebra error #3062

Closed
NickDraper opened this issue Jan 11, 2011 · 1 comment
Closed

Matrix Algebra error #3062

NickDraper opened this issue Jan 11, 2011 · 1 comment
Assignees
Labels
High Priority An issue or pull request that if not addressed is severe enough to postponse a release.
Milestone

Comments

@NickDraper
Copy link
Contributor

This script now fails to run on the latest stable 64 bit Mantid (also 32 bit windows).
It breaks on the

Io= m2*(Ipp*Iaa - Ipa*Iap)/(Ipp + Iaa - Ipa - Iap)

Line with following error.
The sizes of the two workspaces are not compatible for algorithm Multiply
Logic Error in execution of algorithm Multiply
The sizes of the two workspaces are not compatible for algorithm Multiply
Unfortunately the multiplication works if you subsequently use the qti interface so presumably there is a bug in the link between python and Mantid
Rob

LoadRaw(Filename="OFFSPEC00005730.raw",OutputWorkspace="ws",Cache="Always",LoadLogFiles="0")
for i in range(5732,5746,2):
        LoadRaw(Filename="OFFSPEC0000"+str(i)+".raw",OutputWorkspace="wtemp",Cache="Always",LoadLogFiles="0")
        Plus("ws","wtemp","ws")
for i in range(5713,5729,2):
        LoadRaw(Filename="OFFSPEC0000"+str(i)+".raw",OutputWorkspace="wtemp",Cache="Always",LoadLogFiles="0")
        Plus("ws","wtemp","ws")

ConvertUnits("ws","ws","Wavelength",AlignBins="1")
Rebin("ws","ws","0.5,0.2,14.5")
CloneWorkspace("ws","wsdet")
CloneWorkspace("ws","wsmon2")
CropWorkspace("wsmon2","wsmon2t",StartWorkspaceIndex="1",EndWorkspaceIndex="1")
mantid.deleteWorkspace("wsmon2")
RenameWorkspace("wsmon2t","wsmon2")
CropWorkspace("wsdet","wsdett",StartWorkspaceIndex="3",EndWorkspaceIndex="3")
mantid.deleteWorkspace("wsdet")
RenameWorkspace("wsdett","wsdet")

Divide("wsdet","wsmon2","rs")
Ispp=mtd["rs_1"]
Ispa=mtd["rs_2"]
Isap=mtd["rs_3"]
Isaa=mtd["rs_4"]
LoadRaw(Filename="OFFSPEC00005731.raw",OutputWorkspace="w",Cache="Always",LoadLogFiles="0")
for i in range(5733,5746,2):
        LoadRaw(Filename="OFFSPEC0000"+str(i)+".raw",OutputWorkspace="wtemp",Cache="Always",LoadLogFiles="0")
        Plus("w","wtemp","w")
for i in range(5714,5729,2):
        LoadRaw(Filename="OFFSPEC0000"+str(i)+".raw",OutputWorkspace="wtemp",Cache="Always",LoadLogFiles="0")
        Plus("w","wtemp","w")

ConvertUnits("w","w","Wavelength",AlignBins="1")
Rebin("w","w","0.5,0.2,14.5")
CloneWorkspace("w","wdet")
CloneWorkspace("w","wmon2")
CropWorkspace("wmon2","wmon2t",StartWorkspaceIndex="1",EndWorkspaceIndex="1")
mantid.deleteWorkspace("wmon2")
RenameWorkspace("wmon2t","wmon2")
CropWorkspace("wdet","wdett",StartWorkspaceIndex="3",EndWorkspaceIndex="3")
mantid.deleteWorkspace("wdet")
RenameWorkspace("wdett","wdet")

Divide("wdet","wmon2","r")
Ipp=mtd["r_1"]
Ipa=mtd["r_2"]
Iap=mtd["r_3"]
Iaa=mtd["r_4"]
rho = (Iaa - Iap)/(Ipp - Ipa)
alpha = (Iaa - Ipa)/(Ipp - Iap)
ppap = (Ipp - Ipa)*(Ipp - Iap)/(Ipp*Iaa - Ipa*Iap)
paaa = rho*alpha*ppap
CreateSingleValuedWorkspace("m2","2.0","0.0")
m2=mtd["m2"]
Io= m2*(Ipp*Iaa - Ipa*Iap)/(Ipp + Iaa - Ipa - Iap)
Pp=(Ispp+Isaa - Ispa-Isap)*(alpha*(Ispp - Isap) - Isaa+Ispa)/((rho*alpha*Ispp+Isaa + rho*Ispa + alpha*Isap)*(rho*  (Ispp - Ispa) - Isaa+Isap))
Ap=(Ispp+Isaa - Ispa-Isap)*(rho*(Ispp - Ispa) - Isaa+Isap)/((rho*alpha*Ispp+Isaa + rho*Ispa + alpha*Isap)*(alpha*  (Ispp - Isap) - Isaa+Ispa)) 
Rs=(alpha*(Ispp - Isap) - Isaa+Ispa)*(rho*(Ispp - Ispa) - Isaa+Isap)/((rho*alpha*Ispp+Isaa + rho*Ispa + alpha*Isap) *(Ispp+Isaa - Ispa - Isap) )
ReplaceSpecialValues(rho,"rho","0.0","0.0","0.0","0.0")
ReplaceSpecialValues(alpha,"alpha","0.0","0.0","0.0","0.0")
ReplaceSpecialValues(Io,"Io","0.0","0.0","0.0","0.0")
ReplaceSpecialValues(Pp,"Pp","0.0","0.0","0.0","0.0")
ReplaceSpecialValues(Ap,"Ap","0.0","0.0","0.0","0.0")
ReplaceSpecialValues(Rs,"Rs","0.0","0.0","0.0","0.0")
Sqrt("Pp")
Sqrt("Ap")
Sqrt("Rs")
ReplaceSpecialValues(Pp,"Pp","0.0","0.0","0.0","0.0")
ReplaceSpecialValues(Ap,"Ap","0.0","0.0","0.0","0.0")
ReplaceSpecialValues(Rs,"Rs","0.0","0.0","0.0","0.0")
p1=plotSpectrum(["rho","alpha","Pp","Ap"],0,0)
l=p1.activeLayer()
l.setAxisScale(Layer.Left,0.5,1.2)
p1=plotSpectrum(["Pp","Ap"],0,1)
l=p1.activeLayer()
l.setAxisScale(Layer.Left,0.5,1.2)
p1=plotSpectrum(["rho","alpha"],0,1)
l=p1.activeLayer()
l.setAxisScale(Layer.Left,0.5,1.2)
@NickDraper
Copy link
Contributor Author

This issue was originally trac ticket 2215

@NickDraper NickDraper added High Priority An issue or pull request that if not addressed is severe enough to postponse a release. Mantid labels Jun 3, 2015
@NickDraper NickDraper added this to the Iteration 27 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.
Projects
None yet
Development

No branches or pull requests

2 participants