Menu

'display' method for ContClass

Help
2016-03-28
2016-04-18
  • Kirill Aleshin

    Kirill Aleshin - 2016-03-28

    Hi, I have installed latest PyDSTool and encountered strange behavior from method 'display' from ContClass - it refuses to show plot windows, for instance in any example, delivered with the PyDSTool. There is no error messages in console and script executes successfully. As for other plots from pyplot - let me say in Tutorial_Calcium.py - figure 1 and 2 are shown properly. Does anybody have any clue how to dial with this problem?

    PyDSTool was installed on Ubuntu, Python 2.7.6, latest matplotlib and other dependencies from apt-get. Render for matplotlib is set to 'Qt4Agg'.

    Thanks in advance ( :

     
  • Rob Clewley

    Rob Clewley - 2016-03-30

    Have you tried adjusting the matplotlib backend, adding a call to matplotlib's show command, or verifying that you have interactive set to true.

     
  • Kirill Aleshin

    Kirill Aleshin - 2016-04-18

    Thank you very much, Rob, the problem was solved by appending line "matplotlib.pyplot.ion()" to the code.

     
  • Amardeep Mishra

    Amardeep Mishra - 2017-01-24

    Hi Rob!
    First of all I would like to thank you for doing such a commendable job. This is a great alternative to auto and matcont! Actually the reason why I am writing this message is that I have the same issue. That is,the PC['EQ1'].display() wont draw the bifurcation plots for calcium channel model. I tried the solution suggested by Kirill i.e adding plt.ion() at the beginning of calcium model script. However Now I get just plain grey graphs with nothing in it! And once the code run completes it automatically collapses i.e closes.
    I would like to point out that I use ubuntu 16.04 .The first two figures are being drawn correctly,however 3rd and the 4th one is plain grey window without anything in it and as soon as code run gets over--they collapse!
    I am also attaching the screen shot of what I am getting after appending the calcium model code with plt.ion(). PFA!

     

    Last edit: Amardeep Mishra 2017-01-24
  • Amardeep Mishra

    Amardeep Mishra - 2017-01-24

    I tried to give a time delay of 10 seconds at the end of the calcium code and it drew the 3rd figure but the 4th figure is still grey! I guess it is not drawing the last graph. I copied the line-- PC['EQ1'].display( , , figure=5) at the end just before the time.sleep(10) -- this resulted in the 4th figure getting drawn. But as soon as those 10 seconds elapsed,all the graphs collapsed. I am attaching the figure.PFA

     

    Last edit: Amardeep Mishra 2017-01-24
  • Greg

    Greg - 2017-01-24

    Hi Armadeep,

    I would look into it, although in the newest PyDSTool install I can not find the (very old) examples anymore, so if you could attach your script here I can see if I can do sth (also on Ubuntu 16.04).

    Greg

     
  • Amardeep Mishra

    Amardeep Mishra - 2017-01-25

    Hi greg!
    Here is the calcium model script that I modified yesterday. It now shows figure 3 and 4 but as soon as the code run gets over,all the graphs collapse simultaneously. PFA the script.

     
  • Amardeep Mishra

    Amardeep Mishra - 2017-01-25

    I ran into another problem,and that is,while running PyCont_Lorenz.py I am getting the following graph. It isnt getting drawn completely.PFA.As you can see in the graph below u2 variable graph is truncated...:(

     

    Last edit: Amardeep Mishra 2017-01-25
  • Greg

    Greg - 2017-01-25

    Hi Armadeep,

    so I run the calcium script, and all graphs are drawn nicely for me. Figure 4 and 5 are the actual bifurcation diagrams and they take at least a few seconds to compute.

    When I run the script directly from the linux terminal, the graphs also all collapse at the end. I usually run it from within the ipython interpreter, which I strongly recommend to use to easily get persistent plots AND a free interpreter.

    When not running from an active python interpreter, remove the plt.ion() and the plt.show() in the middle of the script (this makes you see only 1,2 and 3), but put an plt.show() at the end!

    Hope that helps,
    Greg

    PS: As the other plots work for you, I don't think it is a matplotlib backend issue, but you could check with matplotlib.get_backend() what you have,'TkAgg' works best in most cases.

     
  • Amardeep Mishra

    Amardeep Mishra - 2017-01-26

    Hi dear Greg!
    Thanks for answering it! I modified the code and made it work yesterday after a lot of trial and error of course...:p . here is the modified code. Actually the thing is ,I run my scripts directly from terminal,I dont use ipython or any other console,I think that might have been the reason why they were collapsing earlier! Anyways,here is the code.PFA
    Now my problem is,when I run lorenz code(pycont_lorenz),it shows a truncated graph.I now use ipython as you suggested-- %run ./PyCont_Lorenz.py
    I tried to run the same code directly from my terminal,however the result was same truncated graph. Actually greg,I am planning to intruduce this library to my friends as an alternative to auto and matcont(I might have to give a demo in a couple of days!). Also is it possible to do EXTENDED BIFURCATION ANALYSIS with PyDSTool? if yes,then kindly let me know!
    or
    Is there a way to implement constraints in the parameter?Or have one parameter vary as function of another?these are some of the things which our lab has been doing using matcont till now.It will be great to have your views!
    Thanks once again greg!

     

    Last edit: Amardeep Mishra 2017-01-26
  • Greg

    Greg - 2017-01-26

    Hi Armadeep,

    you are welcome :) Well for the truncated plot, I can not do much, as I am still missing the 'lor.dat' to run the 2nd script. I guess the problems resides in line 75 ('X = array(PyCont...') where the plots are merged on one canvas for some reason. You can either try to comment out this step and plot them separately, or you play around with the posions set in the line underneath.
    You could also try to extract the computed data from the PyCont object and plot it yourself. Unfortunately this is quite convoluted but setting e.g. p = PyCont['LC1'], you can explore this object easily in ipython (e.g. typing 'p.' no enter but double tabulator). There you see for example arrays in p.curves and p.sol, the latter being the solutions of the continuation.
    The easiest would maybe still be to rewrite the PyCont.display(...) calls, also look at the Calcium scipt how it is done there.

     
    • Amardeep Mishra

      Amardeep Mishra - 2017-01-26

      Hi greg!
      And about extended bifurcation analysis? is this feature available in pydstool?If so then can you kindly point me to example codes so that I can have a look?Are you folks planning to introduce it? What are your views? I am planning to use your library in my research --of course I will be quoting it!

       
  • Greg

    Greg - 2017-01-26

    Hi,

    what exactly do you mean by 'extended bifurcation analysis' ?

     
    • Amardeep Mishra

      Amardeep Mishra - 2017-02-02

      Hi greg!
      Sorry for late replies as I was out of station! EBA refers to a kind of bifurcation wherein there are constraints on parameters and normally there are more than one parameter that can vary.For instance in my field(Aerospace),there are 4 controls that are used to control 8 state variables. Normal bifurcation would be when we vary one control parameter(keeping other fixed) and see how a particular state variable behaves(how does stability or other things are affected).However in EBA we vary one control parameter with some constraints.
      here is a paper by my professor that uses this-
      http://arc.aiaa.org/doi/pdf/10.2514/2.4839

       
    • Amardeep Mishra

      Amardeep Mishra - 2017-02-02

      Also I wanted to ask,how will the syntax change if lets say our auxilary function has more than one independent variable.For instance in calcium channel model-
      DSargs.fnspecs = {'minf': (['v'], '0.5 * (1 + tanh( (v-v1)/v2 ))') }
      There is only one variable 'v',but in my case there are more than one variables in aux function.So what will be the syntax?Kindly help me!

       

Log in to post a comment.