Ticket #4083 (closed: fixed)

Opened 9 years ago

Last modified 5 years ago

Expose BinaryOperationMD to python

Reported by: Janik Zikovsky Owned by: Janik Zikovsky
Priority: major Milestone: Release 2.0
Component: Mantid Keywords:
Cc: Blocked By: #4085
Blocking: Tester: Owen Arnold

Description

Continuation of #4036.

Change History

comment:1 Changed 9 years ago by Janik Zikovsky

  • Status changed from new to accepted

comment:2 Changed 9 years ago by Janik Zikovsky

  • Blocked By 4085 added

comment:3 Changed 9 years ago by Janik Zikovsky

Binary operations for MDHistoWorkspaces

Refs #4085, refs #4089, REfs #4083. Added tests for workspace groups in binary operations. The +-*/ operations are all overloaded and tested for matrix, group, and MD types.

Changeset: b61d875ec32d08b4b77b47c41730b53f97cff61d

comment:4 Changed 9 years ago by Janik Zikovsky

Sample script for testing:

CreateMDWorkspace(Dimensions='3',Extents='0,10,0,10,0,10',Names='x,y,z',Units='m,m,m',SplitInto='5',MaxRecursionDepth='20',OutputWorkspace='mdw')
FakeMDEventData("mdw",  PeakParams="1e6, 5,5,5, 2")
BinToMDHistoWorkspace("mdw", "A",  1, "x,0,10,30", "y,0,10,30", "z,0,10,30", IterateEvents="1", Parallel="0")

CreateMDWorkspace(Dimensions='3',Extents='0,10,0,10,0,10',Names='x,y,z',Units='m,m,m',SplitInto='5',MaxRecursionDepth='20',OutputWorkspace='mdw')
FakeMDEventData("mdw",  PeakParams="1e6, 3,3,3, 3")
BinToMDHistoWorkspace("mdw", "B",  1, "x,0,10,30", "y,0,10,30", "z,0,10,30", IterateEvents="1", Parallel="0")

A = mtd['A']
B = mtd['B']

C = A > 0
D = B > 0

C_or_D = C | D
C_and_D = C & D
C_xor_D = C ^ D

C_or_D2 = C
C_or_D2 |= D

C_and_D2 = C
C_and_D2 &= D

C_xor_D2 = C
C_xor_D2 ^= D

E = (C == D)

comment:5 Changed 9 years ago by Janik Zikovsky

Refs #4083 exposed boolean and comparison operations

for MDHistoWorkspaces to python. Tested in VanillaPythonTest.

È git commit -a -m Refs

Changeset: f05199fe2a5f68f52425e60bda6d6bcb30d1f7c1

comment:6 Changed 9 years ago by Janik Zikovsky

Refs #4083 exposed the not operation and allowed compound expressions

Changeset: 017d71fc336a01a2d11cd07f305cb12b42381fd1

comment:7 Changed 9 years ago by Janik Zikovsky

Refs #4083 apparently I have a newer unittest version

Changeset: 994ef46c43ead468275c64606739fd944661956b

comment:8 Changed 9 years ago by Janik Zikovsky

  • Status changed from accepted to verify
  • Resolution set to fixed

OK everything except the element-by-element == comparison is exposed to python.

Note for testers: the wiki page www.mantidproject.org/MDHistoWorkspace gives you the syntax of the operators.

comment:9 Changed 9 years ago by Janik Zikovsky

Binary operations for MDHistoWorkspaces

Refs #4085, refs #4089, REfs #4083. Added tests for workspace groups in binary operations. The +-*/ operations are all overloaded and tested for matrix, group, and MD types.

Changeset: b61d875ec32d08b4b77b47c41730b53f97cff61d

comment:10 Changed 9 years ago by Janik Zikovsky

Refs #4083 exposed boolean and comparison operations

for MDHistoWorkspaces to python. Tested in VanillaPythonTest.

È git commit -a -m Refs

Changeset: f05199fe2a5f68f52425e60bda6d6bcb30d1f7c1

comment:11 Changed 9 years ago by Janik Zikovsky

Refs #4083 exposed the not operation and allowed compound expressions

Changeset: 017d71fc336a01a2d11cd07f305cb12b42381fd1

comment:12 Changed 9 years ago by Janik Zikovsky

Refs #4083 apparently I have a newer unittest version

Changeset: 994ef46c43ead468275c64606739fd944661956b

comment:13 Changed 9 years ago by Alex Buts

refs #4083 Cosmetic changes

Changeset: af0d386b103c458f1c2e139ae9a56b6a6cdd07d8

comment:14 Changed 9 years ago by Owen Arnold

  • Status changed from verify to verifying
  • Tester set to Owen Arnold

comment:15 Changed 9 years ago by Owen Arnold

#updated test script for new python api

x=CreateMDWorkspace(Dimensions='3' ,Extents='0,10,0,10,0,10',Names='x,y,z',Units='m,m,m',SplitInto='5',MaxRecursionDepth='20')

FakeMDEventData(x, PeakParams="1e6, 5,5,5, 2")

A = BinToMDHistoWorkspace(x, True, "x,0,10,30", "y,0,10,30", "z,0,10,30", IterateEvents="1", Parallel="0")

y = CreateMDWorkspace(Dimensions='3',Extents='0,10,0,10,0,10', Names='x,y,z',Units='m,m,m',SplitInto='5',MaxRecursionDepth='20')

FakeMDEventData(y, PeakParams="1e6, 3,3,3, 3")

B = BinToMDHistoWorkspace(y, True, "x,0,10,30", "y,0,10,30", "z,0,10,30", IterateEvents="1", Parallel="0")

C = A > 0 D = B > 0

C_or_D = C | D C_and_D = C & D C_xor_D = C D

C_or_D2 = C C_or_D2 |= D

C_and_D2 = C C_and_D2 &= D

C_xor_D2 = C C_xor_D2 = D

E = (C == D) </source>

comment:16 Changed 9 years ago by Owen Arnold

  • Status changed from verifying to closed

This is definitely one of the most enjoyable tests I had to run. Really like the Venn diagram test scenarios that I could interact with using the slice viewer. Brilliant.

Oh, and yes, all the tests pass!

comment:17 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 4930

Note: See TracTickets for help on using tickets.