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

Plotting to a new package? #980

Open
jowr opened this issue Feb 19, 2016 · 8 comments
Open

Plotting to a new package? #980

jowr opened this issue Feb 19, 2016 · 8 comments

Comments

@jowr
Copy link
Member

jowr commented Feb 19, 2016

The plotting routines seem to be quite fragile and they cause a lot of errors. Maybe it is time to remove the plotting from CoolProp and create a new package just for that. In theory, the plotting is not related to the equations of state and it might make sense to decouple the code. Opinions anyone?

@jowr jowr added this to the v5.2 milestone Feb 19, 2016
@jowr
Copy link
Member Author

jowr commented Feb 20, 2016

Just a little bit of background: I think I have some time very soon to work to a GUI for logp,h diagrams and maybe some other calculations. I am not sure whether Python is the right language, but I am open for comments. Does anyone have experience to share? The questions are: (a) Python vs C++ for the calculations and (b) QT vs wxWidgets for the interface. Hints regarding the correct graph drawing facilities are also very welcome. Is there a competitor to matplotlib? Maybe in the C++ world?

This was referenced Feb 20, 2016
@ibell
Copy link
Contributor

ibell commented Feb 20, 2016

I don't use the plotting functionality in CoolProp myself, so take my comments with a grain of salt. I write bespoke plotting code on an as-needed basis. Largely this is because I find the API to be a bit awkward, and the API doesn't seem very stable. My $0.02:

  • My sense is that it would be nice to keep the plotting in python land. I can imagine that this functionality could also be useful for other tools - REFPROP for instance.
  • Counter argument: I'm comfortable in C++ too. If you wrote a STL based API, a C++ plotter could be wrapped using SWIG into a python/C#, etc... plotting tool. Which could also be a nice way to go.
  • I had this discussion with another guy, and we couldn't figure out the right solution for something that will be supported 20 years from now. I would maybe lean towards C++ since it would be embeddable in a lot more target languages. C++ itself doesn't have any native nice plotting libraries.
  • Perhaps it would be good to send a message to the mailing list too, to see how many people use the plotting functionalities as they stand now.

@mayersre
Copy link

I do not use the CoolProp plotting functions because they mix the data calculation and the plotting, so here a grain of salt to my comments as well.

My choice would be Python3 and Qt for the GUI part.
Phoenix wx is quite new and you will not find many examples and experiance in the net.

Matplotlib is very good software, I do not know anything comparable in the (C++) world.

A library for the calculation of the plotdata would possibly be a good start, give a dataset and get data in return. Possibly save/retreive calculated data. Add saturation state for plotting or not in the wet area to calculated data. Calculation of points on the saturation lines and on Diagram edge values as begin or end of a line or line segment. This could take the performance advantages of C++. Purpose should be plotting, but not tied to a particular plot tool.
Then build a GUI for the plots based on this.

@jowr
Copy link
Member Author

jowr commented Feb 21, 2016

Thank you for the inputs. For now, QT and Python is also my favourite combination and I have been playing with that already:
qtpy3

I agree with @mayersre that the plotting code mixes calculations and drawing commmands, but I do think that this got better recently. There is CoolProp.Plots.Common, which has just a pinch of specific code tied to the drawing framework (only 2 calls to pyplot). The rest could be regarded as a unit-aware wrapper around the abstract state object. The idea was to provide an isoline object that takes advantage of the previous calculation to generate guesses to speed up the mixture calculations.

Well, I am still undecided whether it is worth removing a big chunk of code from the plotting routines to create a pure calculation class or sub-package. Please let me know if any of you has a good idea regarding the architecture of separated calculation and plotting library.

@mayersre
Copy link

Feel free to use whatever part of the tkinter GUI you want

@jowr
Copy link
Member Author

jowr commented Feb 22, 2016

Great, thanks for that. I am sure that you already found some good solutions for many problems and I really appreciate your offer. I will keep you posted.
And once, please let me know if you have ideas about how to make a good GUI and useful plotting facilities.

@ibell ibell modified the milestone: MinorRelease Oct 27, 2016
@jowr
Copy link
Member Author

jowr commented Mar 1, 2017

After a long break, development will continue at https://github.com/IPUdk/CoolPlot . It is going to be C++ and QT.
I am going to update some of the CoolProp code and add an isoline tracer to the C++ part and update the Python wrapper accordingly, see https://github.com/IPUdk/CoolPlot/issues/1

@ibell
Copy link
Contributor

ibell commented Mar 3, 2017 via email

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

3 participants