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

Multiple plotting GUI #24338

Merged
merged 20 commits into from Jan 15, 2019
Merged

Multiple plotting GUI #24338

merged 20 commits into from Jan 15, 2019

Conversation

AnthonyLim23
Copy link
Contributor

@AnthonyLim23 AnthonyLim23 commented Dec 14, 2018

Description of work.
The multiple plotting in elemental analysis was not easily extendable or maintainable. This PR is the first stage of rewriting the functionality into an easier to maintain and extend form. I will add the test in a later PR

Report to: [user name]/[nobody].

To test:
In the Framework/Properties/Mantid.properties.template file you will have to add Muon/plotting_test.py to the list of interfaces and then build Mantid.

Open the interface
play with it.
The combobox at the bottom determines which plot(s) you change when editing the x and y ranges, errors etc.

Fixes #24036 and #24341 and #23558.


Reviewer

Please comment on the following (full description):

Code Review
  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there are changes in the release notes then do they describe the changes appropriately?
Functional Tests
  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

# SPDX - License - Identifier: GPL - 3.0 +
from __future__ import absolute_import, print_function

from MultiPlotting.multiPlotting_context import *
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a dislike of wildcard imports as it makes it more difficult to work out what comes from where. Could we change this to an explicit import?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will try to get the constants directly.

# & Institut Laue - Langevin
# SPDX - License - Identifier: GPL - 3.0 +

class AxisChangerPresenter(object):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this class strictly needed it seems to just simply forward everything to the view?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be useful if we ever decide to restrain acceptable inputs. We could then do the logic in here. However, yes it is unneeded for this case.


# use axis changer object later

class QuickEditModel(object ):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is what this model stores ever used? I found replacing it with a mock.MagicMock didn't seem to have an effect

from MultiPlotting.QuickEdit.quickEdit_model import QuickEditModel
from MultiPlotting.QuickEdit.quickEdit_presenter import QuickEditPresenter

class QuickEditWidget(object):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this class needed ? as it seems to mainly forward all of it's methods straight to methods on the presenter with the same names.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is something I have to clean up the code at import. It is a wrapper so we only have to import this if we want to use the widget. As opposed to importing the view, presenter and model.

self.layout().takeAt(5) # or more than 1 if you have more buttons
pm = QtGui.QPixmap()
ic = QtGui.QIcon(pm)
# self.add = self.addAction(ic, "Add line")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these are intentional as it is the coded we need to enable the remove line button in the toolbar. I just have not moved the code over yet.

def set_plot_y_range(self,subplotNames,range):
for subplotName in subplotNames:
self.plotObjects[subplotName].set_ylim(range)
#self._context.subplots[subplotName].ybounds =range
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray comment

def __init__(self, *args, **kwargs):
super(myToolbar, self).__init__(*args, **kwargs)
self.layout().takeAt(5) # or more than 1 if you have more buttons
pm = QtGui.QPixmap()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this and the line below do anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that should be commented out too

@@ -0,0 +1,38 @@
# Mantid Repository : https://github.com/mantidproject/mantid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this class used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove it

@@ -0,0 +1,23 @@
# Mantid Repository : https://github.com/mantidproject/mantid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this class used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dont think so, I will kill it

@@ -0,0 +1,36 @@
# Mantid Repository : https://github.com/mantidproject/mantid
#
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this class used anywhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove it

@AnthonyLim23
Copy link
Contributor Author

I have decided to add the tests to this branch so I have marked it as in progress.

@AnthonyLim23
Copy link
Contributor Author

unrelated failure

@mantid-builder
Copy link
Collaborator

@AnthonyLim23 have you had a chance to see why the build is failing?

Copy link
Contributor

@Matthew-Andrew Matthew-Andrew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good 👍 I have one minor comment in that when the tick button is pressed to bring up the customization window the drop down menu lists the plots by a name which includes the memory address. I think it would be clearer if this were just the plot title?

@AnthonyLim23
Copy link
Contributor Author

I have noticed that too. Since it is a matplotlib thing I am not sure how to fix it

@Matthew-Andrew
Copy link
Contributor

Ok as its a minor point and difficult to fix happy to leave for now.

@SimonHeybrock SimonHeybrock merged commit 4e2cc75 into master Jan 15, 2019
@SimonHeybrock SimonHeybrock deleted the 24036_refactorMuonPlotting branch January 15, 2019 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor muon plotting
4 participants