Beispiel #1
0
def figure4b1_continuation():
    """Actual continuation analysis for 4B1. Contains commands to pyDSTool.

    Performs some formatting and continuation.
    Plotting commands are contained with continuation commands to keep pycont objects together

    :return: None
    """
    # Set parameters and convert to symbolic representation
    parameters = default_parameters(i_app=0 * uA_PER_CM2)
    striped_parameters = {k: strip_dimension(v) for k, v in parameters.items()}

    v, h, i_app = symbols("v h i_app")
    striped_parameters["i_app"] = i_app
    dydt = ode_2d([v, h], 0, striped_parameters, exp=exp)

    DSargs_1 = PyDSTool.args(name="bifn_1")
    DSargs_1.pars = {"i_app": 0}
    DSargs_1.varspecs = {
        "v": PyDSTool.convertPowers(str(dydt[0])),
        "h": PyDSTool.convertPowers(str(dydt[1])),
    }
    DSargs_1.ics = {"v": 0, "h": 0}

    ode_1 = PyDSTool.Generator.Vode_ODEsystem(DSargs_1)
    ode_1.set(pars={"i_app": 0})
    ode_1.set(ics={"v": -49, "h": 0.4})
    PyCont_1 = PyDSTool.ContClass(ode_1)

    PCargs_1 = PyDSTool.args(name="EQ1_1", type="EP-C")
    PCargs_1.freepars = ["i_app"]
    PCargs_1.MaxNumPoints = 500
    PCargs_1.MaxStepSize = 0.05
    PCargs_1.MinStepSize = 1e-5
    PCargs_1.StepSize = 1e-2
    PCargs_1.LocBifPoints = "all"
    PCargs_1.SaveEigen = True
    PyCont_1.newCurve(PCargs_1)
    PyCont_1["EQ1_1"].backward()
    PyCont_1["EQ1_1"].forward()
    PyCont_1["EQ1_1"].backward()

    PyCont_1["EQ1_1"].display(["i_app", "v"], stability=True, figure=1)

    PCargs_1.name = "LC1_1"
    PCargs_1.type = "LC-C"
    PCargs_1.initpoint = "EQ1_1:H1"
    PCargs_1.freepars = ["i_app"]
    PCargs_1.MaxNumPoints = 500
    PCargs_1.MaxStepSize = 0.1
    PCargs_1.LocBifPoints = "all"
    PCargs_1.SaveEigen = True
    PyCont_1.newCurve(PCargs_1)
    PyCont_1["LC1_1"].backward()
    PyCont_1["LC1_1"].display(("i_app", "v_min"), stability=True, figure=1)
    PyCont_1["LC1_1"].display(("i_app", "v_max"), stability=True, figure=1)

    PyCont_1.plot.toggleLabels(visible="off", bytype=["P", "RG", "LP"])
    PyCont_1.plot.togglePoints(visible="off", bytype=["P", "RG", "LP"])
    plt.gca().set_title("")
Beispiel #2
0
def __figure4b2_continuation__():
    parameters = default_parameters(i_app=-0.1)
    v, h, h_s, i_app = symbols('v h h_s i_app')
    parameters[0] = i_app
    dydt = ode_3d([v, h, h_s], 0, parameters, exp=exp)

    DSargs_2 = PyDSTool.args(name='bifn_2')
    DSargs_2.pars = {'i_app': 0}
    DSargs_2.varspecs = {
        'v': PyDSTool.convertPowers(str(dydt[0])),
        'h': PyDSTool.convertPowers(str(dydt[1])),
        'h_s': PyDSTool.convertPowers(str(dydt[2]))
    }
    DSargs_2.ics = {'v': 0, 'h': 0, 'h_s': 0}

    ode_2 = PyDSTool.Generator.Vode_ODEsystem(DSargs_2)
    ode_2.set(pars={'i_app': -0.1})
    ode_2.set(ics={'v': -67, "h": 0.77, "h_s": 1})
    PyCont_2 = PyDSTool.ContClass(ode_2)

    PCargs_2 = PyDSTool.args(name='EQ1_2', type='EP-C')
    PCargs_2.freepars = ['i_app']
    PCargs_2.MaxNumPoints = 300
    PCargs_2.MaxStepSize = 0.1
    PCargs_2.MinStepSize = 1e-5
    PCargs_2.StepSize = 1e-2
    PCargs_2.LocBifPoints = 'all'
    PCargs_2.SaveEigen = True
    PyCont_2.newCurve(PCargs_2)
    PyCont_2['EQ1_2'].backward()

    PyCont_2['EQ1_2'].display(['i_app', 'v'], stability=True, figure=1)

    PCargs_2.name = 'LC1_2'
    PCargs_2.type = 'LC-C'
    PCargs_2.initpoint = 'EQ1_2:H2'
    PCargs_2.freepars = ['i_app']
    PCargs_2.MaxNumPoints = 400
    PCargs_2.MaxStepSize = 0.1
    PCargs_2.StepSize = 1e-2
    PCargs_2.LocBifPoints = 'all'
    PCargs_2.SaveEigen = True
    PyCont_2.newCurve(PCargs_2)
    PyCont_2['LC1_2'].forward()
    PyCont_2['LC1_2'].display(('i_app', 'v_min'), stability=True, figure=1)
    PyCont_2['LC1_2'].display(('i_app', 'v_max'), stability=True, figure=1)

    PyCont_2.plot.toggleLabels(visible='off', bytype=['P', 'RG'])
    PyCont_2.plot.togglePoints(visible='off', bytype=['P', 'RG'])
    plt.gca().set_title('')
Beispiel #3
0
def __figure4b1_continuation__():
    parameters = default_parameters(i_app=0)
    v, h, i_app = symbols('v h i_app')
    parameters[0] = i_app
    dydt = ode_2d([v, h], 0, parameters, exp=exp)

    DSargs_1 = PyDSTool.args(name='bifn_1')
    DSargs_1.pars = {'i_app': 0}
    DSargs_1.varspecs = {
        'v': PyDSTool.convertPowers(str(dydt[0])),
        'h': PyDSTool.convertPowers(str(dydt[1]))
    }
    DSargs_1.ics = {'v': 0, 'h': 0}

    ode_1 = PyDSTool.Generator.Vode_ODEsystem(DSargs_1)
    ode_1.set(pars={'i_app': 0})
    ode_1.set(ics={'v': -49, "h": 0.4})
    PyCont_1 = PyDSTool.ContClass(ode_1)

    PCargs_1 = PyDSTool.args(name='EQ1_1', type='EP-C')
    PCargs_1.freepars = ['i_app']
    PCargs_1.MaxNumPoints = 500
    PCargs_1.MaxStepSize = 0.05
    PCargs_1.MinStepSize = 1e-5
    PCargs_1.StepSize = 1e-2
    PCargs_1.LocBifPoints = 'all'
    PCargs_1.SaveEigen = True
    PyCont_1.newCurve(PCargs_1)
    PyCont_1['EQ1_1'].backward()
    PyCont_1['EQ1_1'].forward()
    PyCont_1['EQ1_1'].backward()

    PyCont_1['EQ1_1'].display(['i_app', 'v'], stability=True, figure=1)

    PCargs_1.name = 'LC1_1'
    PCargs_1.type = 'LC-C'
    PCargs_1.initpoint = 'EQ1_1:H1'
    PCargs_1.freepars = ['i_app']
    PCargs_1.MaxNumPoints = 500
    PCargs_1.MaxStepSize = 0.1
    PCargs_1.LocBifPoints = 'all'
    PCargs_1.SaveEigen = True
    PyCont_1.newCurve(PCargs_1)
    PyCont_1['LC1_1'].backward()
    PyCont_1['LC1_1'].display(('i_app', 'v_min'), stability=True, figure=1)
    PyCont_1['LC1_1'].display(('i_app', 'v_max'), stability=True, figure=1)

    PyCont_1.plot.toggleLabels(visible='off', bytype=['P', 'RG'])
    PyCont_1.plot.togglePoints(visible='off', bytype=['P', 'RG'])
    plt.gca().set_title('')
Beispiel #4
0
def __figure3c_continuation__():
    parameters = default_parameters(i_app=0.16)
    v, h, h_s = symbols('v h h_s')
    dydt = hs_clamp([v, h, h_s], 0, parameters)

    DSargs_3 = PyDSTool.args(name='bifn_3')
    DSargs_3.pars = {'h_s': 0}
    DSargs_3.varspecs = {
        'v': PyDSTool.convertPowers(str(dydt[0])),
        'h': PyDSTool.convertPowers(str(dydt[1]))
    }
    DSargs_3.ics = {'v': 0, 'h': 0}

    ode_3 = PyDSTool.Generator.Vode_ODEsystem(DSargs_3)
    ode_3.set(pars={'h_s': 0})
    ode_3.set(ics={'v': -49, "h": 0.4})
    PyCont_3 = PyDSTool.ContClass(ode_3)

    PCargs_3 = PyDSTool.args(name='EQ1_3', type='EP-C')
    PCargs_3.freepars = ['h_s']
    PCargs_3.MaxNumPoints = 350
    PCargs_3.MaxStepSize = 0.1
    PCargs_3.MinStepSize = 1e-5
    PCargs_3.StepSize = 1e-2
    PCargs_3.LocBifPoints = 'all'
    PCargs_3.SaveEigen = True
    PyCont_3.newCurve(PCargs_3)
    PyCont_3['EQ1_3'].backward()

    PyCont_3['EQ1_3'].display(['h_s', 'v'], stability=True, figure=1)

    PCargs_3.name = 'LC1_3'
    PCargs_3.type = 'LC-C'
    PCargs_3.initpoint = 'EQ1_3:H2'
    PCargs_3.freepars = ['h_s']
    PCargs_3.MaxNumPoints = 500
    PCargs_3.MaxStepSize = 0.1
    PCargs_3.LocBifPoints = 'all'
    PCargs_3.SaveEigen = True
    PyCont_3.newCurve(PCargs_3)
    PyCont_3['LC1_3'].backward()
    PyCont_3['LC1_3'].display(('h_s', 'v_min'), stability=True, figure=1)
    PyCont_3['LC1_3'].display(('h_s', 'v_max'), stability=True, figure=1)

    PyCont_3.plot.toggleLabels(visible='off', bytype=['P', 'RG'])
    PyCont_3.plot.togglePoints(visible='off', bytype=['P', 'RG'])
    plt.gca().set_title('')
def figure3c_continuation():
    """Continuation analysis for 3C. Contains commands to pyDSTool.

    Performs some formatting and continuation
    Plotting commands are contained with continuation commands to keep pycont objects together

    :return: None
    """
    # Set parameters and convert to symbolic representation
    parameters = default_parameters(i_app=0.16 * uA_PER_CM2)
    striped_parameters = {k: strip_dimension(v) for k, v in parameters.items()}

    v, h, h_s = symbols("v h h_s")
    dydt = hs_clamp(
        [v, h, h_s], 0, striped_parameters
    )  # returns a symbolic expression since variables are symbolic

    DSargs_3 = PyDSTool.args(name="bifn_3")
    DSargs_3.pars = {"h_s": 0}
    DSargs_3.varspecs = {
        "v": PyDSTool.convertPowers(str(dydt[0])),
        "h": PyDSTool.convertPowers(str(dydt[1])),
    }  # convert **2 to ^2
    DSargs_3.ics = {"v": 0, "h": 0}

    ode_3 = PyDSTool.Generator.Vode_ODEsystem(DSargs_3)
    ode_3.set(pars={"h_s": 0})
    ode_3.set(ics={"v": -49, "h": 0.4})
    PyCont_3 = PyDSTool.ContClass(ode_3)

    PCargs_3 = PyDSTool.args(name="EQ1_3", type="EP-C")
    PCargs_3.freepars = ["h_s"]
    PCargs_3.MaxNumPoints = 350
    PCargs_3.MaxStepSize = 0.1
    PCargs_3.MinStepSize = 1e-5
    PCargs_3.StepSize = 1e-2
    PCargs_3.LocBifPoints = "all"
    PCargs_3.SaveEigen = True
    PyCont_3.newCurve(PCargs_3)
    PyCont_3["EQ1_3"].backward()

    PyCont_3["EQ1_3"].display(["h_s", "v"], stability=True, figure=1)

    PCargs_3.name = "LC1_3"
    PCargs_3.type = "LC-C"
    PCargs_3.initpoint = "EQ1_3:H2"
    PCargs_3.freepars = ["h_s"]
    PCargs_3.MaxNumPoints = 500
    PCargs_3.MaxStepSize = 0.1
    PCargs_3.LocBifPoints = "all"
    PCargs_3.SaveEigen = True
    PyCont_3.newCurve(PCargs_3)
    PyCont_3["LC1_3"].backward()
    PyCont_3["LC1_3"].display(("h_s", "v_min"), stability=True, figure=1)
    PyCont_3["LC1_3"].display(("h_s", "v_max"), stability=True, figure=1)

    PyCont_3.plot.toggleLabels(
        visible="off", bytype=["P", "RG", "LPC"]
    )  # remove unused labels
    PyCont_3.plot.togglePoints(
        visible="off", bytype=["P", "RG", "LPC"]
    )  # remove unused points

    # hopefully remove rightmost hopf point - this may not always be H1?
    PyCont_3.plot.toggleLabels(visible="off", byname="H1")

    plt.gca().set_title("")