Ticket #6882 (closed: fixed)

Opened 7 years ago

Last modified 5 years ago

Export Label unit classe to Python

Reported by: Martyn Gigg Owned by: Martyn Gigg
Priority: major Milestone: Release 2.5
Component: Mantid Keywords:
Cc: Blocked By:
Blocking: Tester: Russell Taylor

Description (last modified by Martyn Gigg) (diff)

This will allow users to apply arbitrary labels to workspace axes.

Also change the return of Axis::setUnit(name) to return the newly created unit to avoid a call to get immediately after setting the unit.

Change History

comment:1 Changed 7 years ago by Martyn Gigg

  • Status changed from new to accepted

comment:2 Changed 7 years ago by Martyn Gigg

  • Description modified (diff)
  • Summary changed from Export UnitFactory and Unit classes to Python to Export concrete unit classes to Python

comment:3 Changed 7 years ago by Martyn Gigg

  • Description modified (diff)

comment:4 Changed 7 years ago by Martyn Gigg

  • Description modified (diff)
  • Summary changed from Export concrete unit classes to Python to Export Label unit classe to Python

comment:5 Changed 7 years ago by Martyn Gigg

Allow UnitFactory to create units from Python. Refs #6882

Changeset: f29d532613df6c436b96688db2a0b84d47068622

comment:6 Changed 7 years ago by Martyn Gigg

Export Label unit to Python. Refs #6882

This can then be used as an arbitrary label unit on axes.

Changeset: d09c81ebd20716a4b9b638d78f848597e85e4476

comment:7 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: 7230913a3248120f1832ed6c630013768804cc82

comment:8 Changed 7 years ago by Martyn Gigg

Allow UnitFactory to create units from Python. Refs #6882

Changeset: f29d532613df6c436b96688db2a0b84d47068622

comment:9 Changed 7 years ago by Martyn Gigg

Export Label unit to Python. Refs #6882

This can then be used as an arbitrary label unit on axes.

Changeset: d09c81ebd20716a4b9b638d78f848597e85e4476

comment:10 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: 7230913a3248120f1832ed6c630013768804cc82

comment:11 Changed 7 years ago by Martyn Gigg

Add a test for unit replacement on an Axis from Python. Refs #6882

Changeset: 15c111d380a7d2699eb3956e38d27dce437b6249

comment:12 Changed 7 years ago by Martyn Gigg

Fix export in old API for new signature. Refs #6882

Changeset: ce60b3ce4d0cda5ff7848a5245f3e9955a412bc3

comment:13 Changed 7 years ago by Martyn Gigg

Add a test for unit replacement on an Axis from Python. Refs #6882

Changeset: a9aaaf67b4a379d2744130638ca8b7485a42f512

comment:14 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: cad57599b7b1e0d3c2feeb677763a28fcf73cfd9

comment:15 Changed 7 years ago by Martyn Gigg

Add a test for unit replacement on an Axis from Python. Refs #6882

Changeset: 42be2dc13d525598ed04f695761c8489527791cc

comment:16 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: cad57599b7b1e0d3c2feeb677763a28fcf73cfd9

comment:17 Changed 7 years ago by Martyn Gigg

Add a test for unit replacement on an Axis from Python. Refs #6882

Changeset: 42be2dc13d525598ed04f695761c8489527791cc

comment:18 Changed 7 years ago by Martyn Gigg

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

Branch: feature/6882_export_unitfactory

Tester: Use the script below to create a workspace with a numeric vertical axis.

import numpy as np

datY=np.arange(100)
datX=np.arange(100)
datE=np.arange(100)
taxis=np.arange(10)
ns=10

CreateWorkspace(DataX=datX,DataY=datY,DataE=datE,NSpec=ns,
                             VerticalAxisUnit="Label", VerticalAxisValues=taxis,
                             OutputWorkspace="ws")

Open a colour fill plot of the workspace and observe that the axis labels are the default. Now run this script to change them.

ws = mtd['ws']
unitx = ws.getAxis(0).setUnit("Label")
unitx.setLabel("Time", "ns")

unity = ws.getAxis(1).setUnit("Label")
unity.setLabel("Temperature", "K")

and replot the colour fill plot.

comment:19 Changed 7 years ago by Russell Taylor

  • Status changed from verify to verifying
  • Tester set to Russell Taylor

comment:20 Changed 7 years ago by Martyn Gigg

Allow UnitFactory to create units from Python. Refs #6882

Changeset: f29d532613df6c436b96688db2a0b84d47068622

comment:21 Changed 7 years ago by Martyn Gigg

Export Label unit to Python. Refs #6882

This can then be used as an arbitrary label unit on axes.

Changeset: d09c81ebd20716a4b9b638d78f848597e85e4476

comment:22 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: cad57599b7b1e0d3c2feeb677763a28fcf73cfd9

comment:23 Changed 7 years ago by Martyn Gigg

Add a test for unit replacement on an Axis from Python. Refs #6882

Changeset: 42be2dc13d525598ed04f695761c8489527791cc

comment:24 Changed 7 years ago by Russell Taylor

  • Status changed from verifying to closed

Looks good. I was going to protest the lack of a unit test on the C++ side but then saw there aren't any for Axis (that's now ticket #6899).

comment:25 Changed 7 years ago by Martyn Gigg

Allow UnitFactory to create units from Python. Refs #6882

Changeset: f29d532613df6c436b96688db2a0b84d47068622

comment:26 Changed 7 years ago by Martyn Gigg

Export Label unit to Python. Refs #6882

This can then be used as an arbitrary label unit on axes.

Changeset: d09c81ebd20716a4b9b638d78f848597e85e4476

comment:27 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: 7230913a3248120f1832ed6c630013768804cc82

comment:28 Changed 7 years ago by Martyn Gigg

Fix export in old API for new signature. Refs #6882

Changeset: ce60b3ce4d0cda5ff7848a5245f3e9955a412bc3

comment:29 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: cad57599b7b1e0d3c2feeb677763a28fcf73cfd9

comment:30 Changed 7 years ago by Martyn Gigg

Add a test for unit replacement on an Axis from Python. Refs #6882

Changeset: 42be2dc13d525598ed04f695761c8489527791cc

comment:31 Changed 7 years ago by Martyn Gigg

Allow UnitFactory to create units from Python. Refs #6882

Changeset: f29d532613df6c436b96688db2a0b84d47068622

comment:32 Changed 7 years ago by Martyn Gigg

Export Label unit to Python. Refs #6882

This can then be used as an arbitrary label unit on axes.

Changeset: d09c81ebd20716a4b9b638d78f848597e85e4476

comment:33 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: cad57599b7b1e0d3c2feeb677763a28fcf73cfd9

comment:34 Changed 7 years ago by Martyn Gigg

Add a test for unit replacement on an Axis from Python. Refs #6882

Changeset: 42be2dc13d525598ed04f695761c8489527791cc

comment:35 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: 7230913a3248120f1832ed6c630013768804cc82

comment:36 Changed 7 years ago by Martyn Gigg

Fix export in old API for new signature. Refs #6882

Changeset: ce60b3ce4d0cda5ff7848a5245f3e9955a412bc3

comment:37 Changed 7 years ago by Martyn Gigg

Allow UnitFactory to create units from Python. Refs #6882

Changeset: f29d532613df6c436b96688db2a0b84d47068622

comment:38 Changed 7 years ago by Martyn Gigg

Export Label unit to Python. Refs #6882

This can then be used as an arbitrary label unit on axes.

Changeset: d09c81ebd20716a4b9b638d78f848597e85e4476

comment:39 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: 7230913a3248120f1832ed6c630013768804cc82

comment:40 Changed 7 years ago by Martyn Gigg

Fix export in old API for new signature. Refs #6882

Changeset: ce60b3ce4d0cda5ff7848a5245f3e9955a412bc3

comment:41 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: cad57599b7b1e0d3c2feeb677763a28fcf73cfd9

comment:42 Changed 7 years ago by Martyn Gigg

Add a test for unit replacement on an Axis from Python. Refs #6882

Changeset: 42be2dc13d525598ed04f695761c8489527791cc

comment:43 Changed 7 years ago by Martyn Gigg

Allow UnitFactory to create units from Python. Refs #6882

Changeset: f29d532613df6c436b96688db2a0b84d47068622

comment:44 Changed 7 years ago by Martyn Gigg

Export Label unit to Python. Refs #6882

This can then be used as an arbitrary label unit on axes.

Changeset: d09c81ebd20716a4b9b638d78f848597e85e4476

comment:45 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: cad57599b7b1e0d3c2feeb677763a28fcf73cfd9

comment:46 Changed 7 years ago by Martyn Gigg

Add a test for unit replacement on an Axis from Python. Refs #6882

Changeset: 42be2dc13d525598ed04f695761c8489527791cc

comment:47 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: 7230913a3248120f1832ed6c630013768804cc82

comment:48 Changed 7 years ago by Martyn Gigg

Fix export in old API for new signature. Refs #6882

Changeset: ce60b3ce4d0cda5ff7848a5245f3e9955a412bc3

comment:49 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: 7230913a3248120f1832ed6c630013768804cc82

comment:50 Changed 7 years ago by Martyn Gigg

Fix export in old API for new signature. Refs #6882

Changeset: ce60b3ce4d0cda5ff7848a5245f3e9955a412bc3

comment:51 Changed 7 years ago by Martyn Gigg

Allow UnitFactory to create units from Python. Refs #6882

Changeset: f29d532613df6c436b96688db2a0b84d47068622

comment:52 Changed 7 years ago by Martyn Gigg

Export Label unit to Python. Refs #6882

This can then be used as an arbitrary label unit on axes.

Changeset: d09c81ebd20716a4b9b638d78f848597e85e4476

comment:53 Changed 7 years ago by Martyn Gigg

Axis::setUnit(name) now returns new unit

This avoids having to retrieve the new unit immediately after setting it. Refs #6882

Changeset: cad57599b7b1e0d3c2feeb677763a28fcf73cfd9

comment:54 Changed 7 years ago by Martyn Gigg

Add a test for unit replacement on an Axis from Python. Refs #6882

Changeset: 42be2dc13d525598ed04f695761c8489527791cc

comment:55 Changed 7 years ago by Martyn Gigg

Merge branch 'feature/6882_export_unitfactory' into develop into 6856_ConvertToDiffractionMDWS_v2

comment:56 Changed 7 years ago by Martyn Gigg

Merge branch 'feature/6882_export_unitfactory' into develop into 6856_ConvertToDiffractionMDWS_v2

comment:57 Changed 7 years ago by Martyn Gigg

Merge branch 'feature/6882_export_unitfactory' into develop into 6856_ConvertToDiffractionMDWS_v2

comment:58 Changed 7 years ago by Martyn Gigg

Merge branch 'feature/6882_export_unitfactory' into develop into 6856_ConvertToDiffractionMDWS_v2

comment:59 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 7728

Note: See TracTickets for help on using tickets.