Dear all,
I am attempting to continue an equilibrium curve (EP-C) and, after a first early continuation, I want to extend my curve.
My curve is in the ContClass object PC['EQ1'].
I originally launched:
PC['EQ1'].forward()
Then to extend it I relaunched the method (as described in the user manual), i.e.
PC['EQ1'].forward()
This second instance shows:
H point found
H point found
BP point found
However when I want to display the whole computed curve:
PC.display(['x','y'],figure='f1',stability=True)---------------------------------------------------------------------------KeyErrorTraceback(mostrecentcalllast)<ipython-input-83-175f93035ea0>in<module>()1#Createsubarrayofplots----> 2 PC.display(['yrel_1','ca_1'],figure='f1',stability=True)3#PC['LC1'].display(['yrel_1','ca_1_min'],stability=True)4#PC.plot.f1.toggleAll('off',bytype=['P', 'MX', 'RP'])/home/maurizio/Downloads/PyDSTool/PyCont/ContClass.pycindisplay(self,coords,curves,figure,axes,stability,domain,**plot_args)362363forcurveinplot_curves:--> 364 self.curves[curve].display(coords, figure=figure, axes=axes, stability=stability, domain=domain, init_display=False, **plot_args)365366defcomputeEigen(self):/home/maurizio/Downloads/PyDSTool/PyCont/Continuation.pycindisplay(self,coords,dirs,origin,figure,axes,stability,domain,init_display,points,**plot_args)689disp_args['label']='_nolegend_'690stabdict=partition([x.labels[label]['stab']\--> 691 for x in self.sol],['S','U','N'])692forstabtype,stablistinstabdict.items():693forcurveinstablist:KeyError:'EP'
I tried to extend on some other systems and the extension method seems to be fine and displayed correctly. Could it be due to BP point or some possible bug? Or I am doing something wrong here that I am missing?
Thanks for your help.
Maurizio
Last edit: Maurizio De Pitta' 2016-07-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think the problem is that the curve hit an "MX" point and this later as no Stability value assigned.
Just try to plot your curve without the "stability=True" parameters and it should work.
If you want to see the stability do (assuming that the error happened during a 'forward' and not 'backward' continuation):
curve.sol.remove(-1)
curve.display(...)
However, in any case, you will not be able to continue your curve farther.
This happens when there is an error during the correction phase. Unfortunately this error is not noticed to the user (cf Continuation.py l. 1152)
I guess we should file a bug for this issue if it does not already exist.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A follow up on this issue.
I am trying to figure out whether something is wrong with my equations or it is a bug. I believe that this KeyError: EP is of different nature than the plot bug above. I am basically computing the EP-C, but after some steps, the continuations halts producing the following error:
Why is this happening? Am I hitting an MX point? then why just not simply exit continuation and end in MX so that I can see the branch continued up to that point?
Last edit: Maurizio De Pitta' 2016-07-18
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Drew,
thanks for promptly replying. As for the code, I am afraid It is going to be problematic, as the PyDSTool script I am using use a RHS that is C coded which in turns is based on a lot of C code and libraries. If you think that the bug can be solved in this way, I can spend some (several) hours to wrap things up and hopefully provide you a standalone code, otherwise if you have any hint of where the bug could be I can try to see if I can fix it with your help.
M
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
A further follow up on this issue: A similar error occurs also as KeyError: LP when computing LP-C curves. I am not sure how to halt this annoying problem, but it seems that the continuer does not converge at some point, and somehow in the cascade of checks, something is missing. Indeed the full error message reads:
An update on KeyError: LP. On line 1366 of Continuation.py a comment by Drew (?) states explicitly that the we are going to hit a bug here in case a MX point is detected. So as a temporary workaround I added a condition check and run the for loop at line 1369 only if MX is not found, i.e.:
This now appears to work. Yet I am far from saying that this should be the fix. Of note is that somehow handlings of MX point in backward() and forward() methods of the Continuation class look quite dissimilar. Indeed when I hit an MX point, the forward() method ends just fine... Perhaps it could be an easy fix to recode them in a similar fashion?
I have not yet checked whether the above mentioned KeyError: EP could also be related to a buggy (or missing) MX handling. I am going to work back on the system in few days. Yet it mkight be the issue, as indeed the error was issued by the same code line... let's hope so...
Last edit: Maurizio De Pitta' 2016-08-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Maurizio,
Were you finally able to resolve this issue? I am having this problem as well. I added the line you mentioned on your last post. (if MX not in pt.labels.keys():)
But now I am getting the same KeyError: 'EP' in the line number 1436. I added the if check there too, but it gives the error 'NameError: global name 'MX' is not defined'
Do you have any idea ?
Drew/Rob you have any ideas on this ?
Ahmet
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Ahmet,
unfortunately not. The issue remained unsolved for me. Have you tried playing a bit with the initial point and the convergence/tolerance parameters? Also, recall that there is a bug in the BP point detection which currently substantially limits the fruibility of PyCont (see this post)
I have not played with the code for some months now, so I might be a bit rusty. But I recall that the "if condition" on MX needed to be added BOTH on backward AND forward modes.
M
Last edit: Maurizio De Pitta' 2017-06-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Maurizio,
Thanks for the answer. Yes I have tried many combinations of those. Sometimes it works, sometimes it doesnt.
I want to ask something else. I am trying to have some bifurcation diagrams. I am wondering if I can set the domain of the chosen free parameter when plotting. We do it by tdomain argument when calculating the trajectory. But I dont know how to do it with PyCont. To make it more clear say I have the free parameter taubkn and I want to have the taubkn-v graph. When I plot it, the x axis(taubkn) starts from 10 and goes to 50. But I want to see the 0-100 range for this parameter.
Do you know how can I do this?
Thanks,
Ahmet
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Ahmet,
do you mean checking the axis limits by using the PyCont visualization?
I don't usually use the display method, rather I just get my own data and postprocess them accordingly in plain python/matplotlib. Recall in fact, that you can dill (python module) your PyCont objects, saving them on hard disk and manipulate them later.
Nevertheless, display allows to specify figure and axes whereto plot your curves (see online help here). Hence, nothing prevents you from creating these latter before, pass them to the display method, and then tune your axis accordingly by ax.set_xlim(...) and/or ax.set_ylim(...).
I hope it could help.
Last edit: Maurizio De Pitta' 2017-06-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Maurizio,
I see, but actually what I was asking is this: when we are computing the trajectory we set the range of integration by DSargs.tdomain
Is there a similar thing for PyCont as well ? Can we set the range of continuation for a free parameter? Maybe pdomain does that?
And one more thing;
I am running my script, I get the special points H1, H2 ,H3. When I run it again without changing anything, this time I get H1, H2 only. This is happening to me all the time. I get different results running the same script consecutively. Do you know why this could be happening? This is being really problematic when running scripts that take long time.
Thanks a lot in advance,
Ahmet
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi Ahmet,
yes, pdomain is the answer, whereby you will ask to your continuer to stop also at points 'B'. There are some threads here that explain how to add pdomain. Read this one to figure out how to make it work exactly (in particular Drew's reply to my original post).
I know the problem you mention. It is because every time PyCont starts from a random guess of the tangent vector, and so the detection is somehow not fully reproducible, yet this procedure avoids ill-fated initial guesses, and ensures that you are going to continue your point regardless of the initial vector guess. Now, if you get different numbers of points, and H3 appears/disappears, I would tune more robustly your tolerances and detection criteria.
Cheers,
M
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi again Maurizio,
Sorry to bother you again. Since no one seems to reply to the newly created topics, I assume same thing will happen to me as well even if I open a topic to ask my question.
I have a simple question this time ;)
I have an equation in my system; Iapp=if(t<5)then(0.45)else(0)
I am wondering how can I implement this in PyDsTool? This equation basically tells: Iapp's value will be 0.45 for the first 5 seconds of the integration, after 5 seconds it will be 0. (this can be done in XPPAUT, you may know if you used it.)
Thanks,
Ahmet
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
import numpy as np
I_app = 0.45*np.heaviside(t-5.0)
Or look into the online documentation and see how to code auxfunc in
PyDSTool.
Unfortunately as you may have figured out, PyDSTool is no longer active and
it takes time for the developers to reply as they are both doing other
stuff. So for the future, use PyDSTool at your own risk: it is a fantastic
tool with great potential, but suffers from some serious bugs and the fact
that it has not been maintained (now for years) is contributing very fast
to its obsolescence.
Hi again Maurizio,
Sorry to bother you again. Since no one seems to reply to the newly
created topics, I assume same thing will happen to me as well even if I
open a topic to ask my question.
I have a simple question this time ;)
I have an equation in my system; Iapp=if(t<5)then(0.45)else(0)
I am wondering how can I implement this in PyDsTool? This equation
basically tells: Iapp's value will be 0.45 for the first 5 seconds of the
integration, after 5 seconds it will be 0. (this can be done in XPPAUT, you
may know if you used it.)
Dear all,
I am attempting to continue an equilibrium curve (EP-C) and, after a first early continuation, I want to extend my curve.
My curve is in the ContClass object
PC['EQ1']
.I originally launched:
Then to extend it I relaunched the method (as described in the user manual), i.e.
This second instance shows:
However when I want to display the whole computed curve:
I tried to extend on some other systems and the extension method seems to be fine and displayed correctly. Could it be due to BP point or some possible bug? Or I am doing something wrong here that I am missing?
Thanks for your help.
Maurizio
Last edit: Maurizio De Pitta' 2016-07-18
No this is not cause by the BP point.
I think the problem is that the curve hit an "MX" point and this later as no Stability value assigned.
Just try to plot your curve without the "stability=True" parameters and it should work.
If you want to see the stability do (assuming that the error happened during a 'forward' and not 'backward' continuation):
However, in any case, you will not be able to continue your curve farther.
This happens when there is an error during the correction phase. Unfortunately this error is not noticed to the user (cf Continuation.py l. 1152)
I guess we should file a bug for this issue if it does not already exist.
I'll put in the bug issue. :/ Lots of bugs lately, but I REALLY appreciate you all finding them.
Drew
A follow up on this issue.
I am trying to figure out whether something is wrong with my equations or it is a bug. I believe that this
KeyError: EP
is of different nature than the plot bug above. I am basically computing the EP-C, but after some steps, the continuations halts producing the following error:Why is this happening? Am I hitting an
MX
point? then why just not simply exit continuation and end inMX
so that I can see the branch continued up to that point?Last edit: Maurizio De Pitta' 2016-07-18
Hi Drew,
Hi Rob,
any feedback/idea on my last post?
Hi, Maurizio. I've seen this a few times - I think it's a bug. Any chance you could send me your script?
Drew
Hi Drew,
thanks for promptly replying. As for the code, I am afraid It is going to be problematic, as the PyDSTool script I am using use a RHS that is C coded which in turns is based on a lot of C code and libraries. If you think that the bug can be solved in this way, I can spend some (several) hours to wrap things up and hopefully provide you a standalone code, otherwise if you have any hint of where the bug could be I can try to see if I can fix it with your help.
M
A further follow up on this issue: A similar error occurs also as
KeyError: LP
when computingLP-C
curves. I am not sure how to halt this annoying problem, but it seems that the continuer does not converge at some point, and somehow in the cascade of checks, something is missing. Indeed the full error message reads:An update on
KeyError: LP
. On line 1366 ofContinuation.py
a comment by Drew (?) states explicitly that the we are going to hit a bug here in case aMX
point is detected. So as a temporary workaround I added a condition check and run thefor
loop at line 1369 only ifMX
is not found, i.e.:This now appears to work. Yet I am far from saying that this should be the fix. Of note is that somehow handlings of
MX
point inbackward()
andforward()
methods of theContinuation
class look quite dissimilar. Indeed when I hit anMX
point, theforward()
method ends just fine... Perhaps it could be an easy fix to recode them in a similar fashion?I have not yet checked whether the above mentioned
KeyError: EP
could also be related to a buggy (or missing)MX
handling. I am going to work back on the system in few days. Yet it mkight be the issue, as indeed the error was issued by the same code line... let's hope so...Last edit: Maurizio De Pitta' 2016-08-17
Hi Maurizio,
Were you finally able to resolve this issue? I am having this problem as well. I added the line you mentioned on your last post. (if
MX
not in pt.labels.keys():)But now I am getting the same KeyError: 'EP' in the line number 1436. I added the if check there too, but it gives the error 'NameError: global name 'MX' is not defined'
Do you have any idea ?
Drew/Rob you have any ideas on this ?
Ahmet
Hi Ahmet,
unfortunately not. The issue remained unsolved for me. Have you tried playing a bit with the initial point and the convergence/tolerance parameters? Also, recall that there is a bug in the BP point detection which currently substantially limits the fruibility of PyCont (see this post)
I have not played with the code for some months now, so I might be a bit rusty. But I recall that the "if condition" on MX needed to be added BOTH on backward AND forward modes.
M
Last edit: Maurizio De Pitta' 2017-06-15
Hi Maurizio,
Thanks for the answer. Yes I have tried many combinations of those. Sometimes it works, sometimes it doesnt.
I want to ask something else. I am trying to have some bifurcation diagrams. I am wondering if I can set the domain of the chosen free parameter when plotting. We do it by tdomain argument when calculating the trajectory. But I dont know how to do it with PyCont. To make it more clear say I have the free parameter
taubkn
and I want to have thetaubkn-v
graph. When I plot it, the x axis(taubkn) starts from 10 and goes to 50. But I want to see the 0-100 range for this parameter.Do you know how can I do this?
Thanks,
Ahmet
Hi Ahmet,
do you mean checking the axis limits by using the PyCont visualization?
I don't usually use the
display
method, rather I just get my own data and postprocess them accordingly in plain python/matplotlib. Recall in fact, that you candill
(python module) your PyCont objects, saving them on hard disk and manipulate them later.Nevertheless,
display
allows to specify figure and axes whereto plot your curves (see online help here). Hence, nothing prevents you from creating these latter before, pass them to thedisplay
method, and then tune your axis accordingly byax.set_xlim(...)
and/orax.set_ylim(...)
.I hope it could help.
Last edit: Maurizio De Pitta' 2017-06-16
Hi Maurizio,
I see, but actually what I was asking is this: when we are computing the trajectory we set the range of integration by DSargs.tdomain
Is there a similar thing for PyCont as well ? Can we set the range of continuation for a free parameter? Maybe pdomain does that?
And one more thing;
I am running my script, I get the special points H1, H2 ,H3. When I run it again without changing anything, this time I get H1, H2 only. This is happening to me all the time. I get different results running the same script consecutively. Do you know why this could be happening? This is being really problematic when running scripts that take long time.
Thanks a lot in advance,
Ahmet
Hi Ahmet,
yes,
pdomain
is the answer, whereby you will ask to your continuer to stop also at points'B'
. There are some threads here that explain how to addpdomain
. Read this one to figure out how to make it work exactly (in particular Drew's reply to my original post).I know the problem you mention. It is because every time PyCont starts from a random guess of the tangent vector, and so the detection is somehow not fully reproducible, yet this procedure avoids ill-fated initial guesses, and ensures that you are going to continue your point regardless of the initial vector guess. Now, if you get different numbers of points, and H3 appears/disappears, I would tune more robustly your tolerances and detection criteria.
Cheers,
M
Hi again Maurizio,
Sorry to bother you again. Since no one seems to reply to the newly created topics, I assume same thing will happen to me as well even if I open a topic to ask my question.
I have a simple question this time ;)
I have an equation in my system;
Iapp=if(t<5)then(0.45)else(0)
I am wondering how can I implement this in PyDsTool? This equation basically tells: Iapp's value will be 0.45 for the first 5 seconds of the integration, after 5 seconds it will be 0. (this can be done in XPPAUT, you may know if you used it.)
Thanks,
Ahmet
Hi Ahmet,
I assume you may try
import numpy as np
I_app = 0.45*np.heaviside(t-5.0)
Or look into the online documentation and see how to code auxfunc in
PyDSTool.
Unfortunately as you may have figured out, PyDSTool is no longer active and
it takes time for the developers to reply as they are both doing other
stuff. So for the future, use PyDSTool at your own risk: it is a fantastic
tool with great potential, but suffers from some serious bugs and the fact
that it has not been maintained (now for years) is contributing very fast
to its obsolescence.
Cheers,
M
Maurizio De Pitta'
https://sites.google.com/site/mauriziodepitta/home
On Mon, Jul 31, 2017 at 8:55 PM, Ahmet Kurt startimeahmet@users.sf.net
wrote: