Ticket #9353 (closed: fixed)

Opened 6 years ago

Last modified 5 years ago

SavePlot1D

Reported by: Peter Peterson Owned by: Andrei Savici
Priority: major Milestone: Release 3.2
Component: Framework Keywords:
Cc: Blocked By:
Blocking: Tester: Michael Reuter

Description

A new algorithm to standardize some of the figure generation in auto-reduction. This should be a new workflow algorithm called SavePlot1D which takes in a MatrixWorkspace or WorkspaceGroup of MatrixWorkspace and makes line plots. For a single workspace it should do something similar to

from matplotlib import *
use("agg")
from matplotlib.pyplot import *
s = mtd[wkspname]
for i in xrange(s.getNumberHistorgrams()):
  plot(s.readX(i)[1:], s.readY(i))
xlabel('Q($\\AA^{-1}$)')
ylabel('Intensity')
legend()
show()
savefig(os.path.join(outputDir, wkspname+'.png'),bbox_inches='tight')

which should not register with mantid if matplotlib is not installed.

When given a WorkspaceGroup a stack of subplots should be made, with each one giving a plot of a single workspace.

Change History

comment:1 Changed 6 years ago by Peter Peterson

  • Status changed from new to assigned

comment:2 Changed 6 years ago by Andrei Savici

  • Status changed from assigned to inprogress

SavePlot1D. Refs #9353

Changeset: 36c860d4ceda5cae288b5fe14aee7b83aa0520c7

comment:3 Changed 6 years ago by Andrei Savici

Python export checkGroups. Refs #9353

Changeset: 495cb1a0f999a74db490261e8e1b3bf7b75d4402

comment:4 Changed 6 years ago by Andrei Savici

Fix ylabels and add warning. Refs #9353

Changeset: 30990c6d89e8bc383ac34a977e95ff7a602f7d2e

comment:5 Changed 6 years ago by Andrei Savici

SavePlot1D. Refs #9353

Changeset: d17c99a588d52f674fecab121c17547a2e65ddff

comment:6 Changed 6 years ago by Andrei Savici

Python export checkGroups. Refs #9353

Changeset: 3703afa1579df6ef24b70da5fd008f52b46b50ee

comment:7 Changed 6 years ago by Andrei Savici

Fix ylabels and add warning. Refs #9353

Changeset: db92bbc05c8045765fa527c05f2551da895bfe0e

comment:8 Changed 6 years ago by Andrei Savici

Import things for utf8. Refs #9353

Changeset: 6e09a8a6dc94626e1928c90b76a43fe2018be72a

comment:9 Changed 6 years ago by Andrei Savici

Conflict solving. Refs #9353

Merge branch 'feature/9353_SavePlot1D' of https://github.com/mantidproject/mantid into feature/9353_SavePlot1D

Conflicts:

Code/Mantid/Framework/PythonInterface/plugins/algorithms/WorkflowAlgorithms/SavePlot1D.py

Changeset: c0f05696d6d18b5983652b8e414458140a6ce2cd

comment:10 Changed 6 years ago by Andrei Savici

Doxygen documentation. Refs #9353

Changeset: 1017bd19ee4bbceb14368695551735dfc015c062

comment:11 Changed 6 years ago by Andrei Savici

Improvements, but some bugs left. Refs #9353

Changeset: e9c785b5cbd78d55b15fe2717cdd3fecd63be162

comment:12 Changed 6 years ago by Andrei Savici

Added progress. Refs #9353

Changeset: 15a400c29571676f9aef55ae4b39e5cab3493167

comment:13 Changed 6 years ago by Andrei Savici

Comment ot checkGroups methods in python. Refs #9353

Changeset: cf7343ffc827a5b68d777f705594abe3093a8114

comment:14 Changed 6 years ago by Peter Peterson

Currently doesn't put the angstrom symbol for things in d-spacing (like a powder diffraction pattern). Otherwise this is shaping up nicely.

comment:15 Changed 6 years ago by Andrei Savici

Change default behavior. Refs #9353

Changeset: 13c4bd4edcb06603468dd9e55752be2b5c79bc0a

comment:16 Changed 6 years ago by Martyn Gigg

Return base-class checkGroups if Python overload is not present.

Refs #9353

Changeset: c51bc88dac9fa4f4e80bf8056b2879388a987682

comment:17 Changed 6 years ago by Andrei Savici

Latex strings for units. Refs #9353

Changeset: 561792eb66f57cc1293b8b2eaf3226d1a5fcf323

comment:18 Changed 6 years ago by Andrei Savici

Using latex for units. Refs #9353

Changeset: d800ab251af4d264435483b827787b35665991a0

comment:19 Changed 6 years ago by Andrei Savici

Unit test. Refs #9353

Changeset: a20693ed66cc556d9445da9d5c7a5af2a2aea0eb

comment:20 Changed 6 years ago by Andrei Savici

More wiki info. refs #9353

Changeset: eb140e7a0ac4943fd125ba826774854658cf5c62

comment:21 Changed 6 years ago by Andrei Savici

Doxygen warning. Refs #9353

Changeset: 2f89b0d0d8bfb20e01556401ca8cfbecb644976a

comment:22 Changed 6 years ago by Andrei Savici

Requires matplotlib version>1.2.0. Refs #9353

Changeset: b1c5b7b22a9052505773cbe412cc19c5ecaf3f50

comment:23 Changed 6 years ago by Andrei Savici

Change import order. Refs #9353

The unit test fails otherwise with some very cryptic message if no matplotlib is present

Changeset: ec8d73226bcf2ee1df2a3a2ad2b4d308893f0849

comment:24 Changed 6 years ago by Andrei Savici

Testing:

  1. Single plot - create a workspace with several spectra. Preferably some units of momentum, momentum squared or tof, so you can see if the latex labels are working. If more than 1 and less or equal to 10, a legend should be present (sp-0, sp-1,...).
  2. Create a workspace group (works fine with two workspaces, I did not check with more). The resulting plot should have subplots for each workspace in the workspace group.
  3. Create a workspace with the Y axis with some units. For example, run DgsReduction on the CNCS file, then run SofQW, with Q axis binning "0,0.5,3". The legend will have |Q|=0, |Q|=0.5, ...

NOTE Must have matplotlib >1.2.0

The branch is feature/9353_SavePlot1D

comment:25 Changed 6 years ago by Andrei Savici

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

comment:26 Changed 6 years ago by Michael Reuter

  • Status changed from verify to verifying
  • Tester set to Michael Reuter

comment:27 Changed 6 years ago by Michael Reuter

  • Status changed from verifying to closed

Merge remote-tracking branch 'origin/feature/9353_SavePlot1D'

Full changeset: 81ed538a75936ec46725b9fa8429df3dbbdb0ea6

comment:28 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 10196

Note: See TracTickets for help on using tickets.