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

Built-in plotting functionality for a range of parameters #2

Open
ashwinvis opened this issue Nov 13, 2017 · 14 comments
Open

Built-in plotting functionality for a range of parameters #2

ashwinvis opened this issue Nov 13, 2017 · 14 comments

Comments

@ashwinvis
Copy link
Owner

Can be integrated into the existing caeroc-app or as a separate app.

Related issue: AeroPython/scikit-aero#6

@ashwinvis
Copy link
Owner Author

Interesting plots:

  • Isentropic ratios (e.g. P/P0) vs mach number.
  • Theta beta mach number plot. See link to related issue above for examples.

@ashwinvis
Copy link
Owner Author

FYI, @j9ac9k

@j9ac9k
Copy link

j9ac9k commented Nov 13, 2017

Where in the GUI would you want the plot to be, or would it be in another window?

@ashwinvis
Copy link
Owner Author

ashwinvis commented Nov 13, 2017 via email

@j9ac9k
Copy link

j9ac9k commented Nov 15, 2017

Just forked the repo, for the minimum impact, I'm going to try and implement a standalone window.

@j9ac9k
Copy link

j9ac9k commented Nov 15, 2017

got the ugliest of ugly code to be somewhat functional, will be calling it a night, this is so ugly I decided to embrace it and leave the axes unlabeled (X is 'M' from 0.1 to 5, and y is p/p0

screen shot 2017-11-14 at 10 19 46 pm

Truth be told, I've never worked with a properly packaged python library that is PyPi compatible, so I'm going to need some help adhering to those standards. Anyway check out my fork to see the code, there really isn't much to it at all. For reference, working on this branch here: https://github.com/j9ac9k/caeroc/tree/with_plots

@ashwinvis
Copy link
Owner Author

Good job, definitely a step in the right direction 👍 . This is more than what I would have done in a day!

On the UI, since you have little more experience, I have a question, and probably you would have thought about it already. We need to be able set the range, and set the variables x and y. Maybe a popup QDialog box will be helpful. Or alternatively can it be done on PyQtGraph - can it can emit Qt signals?

Truth be told, I've never worked with a properly packaged python library that is PyPi compatible, so I'm going to need some help adhering to those standards.

PyPI does not complain so much, as long as we can build the package - it won't even complain if we don't specify the requirements explicitly.

But it is good practice to write good code on the go. On the bare minimum one-line docstrings, comments wherever things get too complicated, and PEP8 standards. I haven't practised these myself while creating caeroc because I was a novice 3 years back, when I started. But now I always stick to these principles.

@j9ac9k
Copy link

j9ac9k commented Nov 15, 2017

On the UI, since you have little more experience, I have a question, and probably you would have thought about it already. We need to be able set the range, and set the variables x and y. Maybe a popup QDialog box will be helpful. Or alternatively can it be done on PyQtGraph - can it can emit Qt signals?

So first thing, pyqtgraph can indeed emit signals for all sorts of stuff from view ranges changing to...well anything I've thought I needed a signal for, it had one (granted they weren't always documented, but it's a pure python package with readable code).

I'm not sure what the best UI layout would be for allowing a user to input ranges (was considering that). There are two forms of output you want to present, the table view, for a fixed input, and a plot for a ranged input (and perhaps you want to give the user ability to cap the y-range themselves).

PyPI does not complain so much, as long as we can build the package - it won't even complain if we don't specify the requirements explicitly.

But it is good practice to write good code on the go. On the bare minimum one-line docstrings, comments wherever things get too complicated, and PEP8 standards. I haven't practised these myself while creating caeroc because I was a novice 3 years back, when I started. But now I always stick to these principles.

Where I was going here is that I would make changes in the code, then was confused why they weren't taking effect (I'm sure there is a better way to do it than to python setup.py install after each change (what I was embarrassingly doing, but it was getting late...).

On another note, I generally find QtDesigner UIs hard to work with or to get the layout exactly as I want it, but I do like it from a prototyping/layout. I'll think a bit more about how the UI should change for taking fixed inputs and getting all parameters, vs. saying which parameters you want to see a relationship between, and their respective ranges.

I do think the external plot window is the way to go (as you can make it as big/small as you want).

@j9ac9k
Copy link

j9ac9k commented Nov 15, 2017

How would you feel about having a QTabWidget. One tab would have single value inputs as you currently have it (along with the result in table form), the other would have ranged inputs and bounded outputs for the plot results?

@ashwinvis
Copy link
Owner Author

On your question: you should use python setup.py develop. I did mention this in the readme. Maybe I should but it somewhere more visible. A separate file like CONTRIBUTING.rst.

QTabWidget sounds like a fine idea. I hope it wont require too much refactoring. And yes , an external window to display the plot is good enough.

QtDesigner is annoying to add changes, but easy to get started. I hear you.Compared to that pg is convenient. I don't know if there are any alternatives.

@j9ac9k
Copy link

j9ac9k commented Nov 15, 2017

On your question: you should use python setup.py develop. I did mention this in the readme. Maybe I should but it somewhere more visible. A separate file like CONTRIBUTING.rst.

It's visibility was fine, from the explanation, I wasn't sure that it was doing what I would want it to do (never having used setup.py).

QTabWidget sounds like a fine idea. I hope it wont require too much refactoring. And yes , an external window to display the plot is good enough.

Sounds good!

QtDesigner is annoying to add changes, but easy to get started. I hear you.Compared to that pg is convenient. I don't know if there are any alternatives.

Alternative is to do it by hand; which sounds like a pain, and sometimes feels like a pain, but it's not too bad provided you're going into a layout knowing what you want it to look like. Here is an example of a project I'm working on, the GUI was written w/o the use of qt designer.

This something I can likely help with; but it would likely be in conflict with #4 as the plotting would be limited to the Qt type GUIs ... I suppose if it's modular enough, it would still work.

screenshot from 2017-11-15 10-19-20

Since you're wanting to support both pyside and pyqt5, how would you feel about adding qtpy as a dependency? qtpy is an abstraction layer where effectively you do not have to worry about which qt backend you have, you import from qtpy, so the end user can have either pyside, pyside2 (not compatible w/ pyqtgraph yet), pyqt4 or pyqt5, and you don't have to change anything in your code base.

@ashwinvis
Copy link
Owner Author

ashwinvis commented Nov 15, 2017 via email

@j9ac9k
Copy link

j9ac9k commented Nov 15, 2017

I haven't actually used matplotlib.backends.qt_backend at all (I mean, I've specified the qt backend for matplotlib when generating plots, but I've never actually interacted with it)., does it do something similar with acting as an abstraction layer?

Qtpy would just allow you to remove the if pyqt elsle pyside type code you have, and it would give you pyqt4 compatibility.

@ashwinvis
Copy link
Owner Author

It is an abstraction layer as I understand. Maybe not as advanced as qtpy. I have seen qtpy before, and there are numerous similar packages. Check out the source code, you will understand. https://github.com/matplotlib/matplotlib/blob/master/lib/matplotlib/backends/qt_compat.py

If this doesnt work, we go for qtpy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants