示例#1
0
        def plot_alpha_beta_curves(cls, ax1, ax2, alphabeta_chl, state, color="blue"):
            chl = alphabeta_chl




            inf_v =  np.array(alphabeta_chl.statevars_new[state].V)
            inf =   np.array(alphabeta_chl.statevars_new[state].inf)
            tau =   np.array(alphabeta_chl.statevars_new[state].tau)

            #tauV =  np.array(zip(*alphabeta_chl.statevars[state]['tau'])[0])
            #tau =   np.array(zip(*alphabeta_chl.statevars[state]['tau'])[1])

            # Check the two voltage arrays are the same:
            #assert np.max((inf_v-tauV)**2) < 1.0

            alpha = inf/tau
            beta = (1 - alpha*tau) / tau


            if isinstance(ax1, QuantitiesAxis):

                ax1.setYUnit("")
                ax1.plot(inf_v * pq.mV, alpha * pq.s/pq.s, color=color)
                ax1.set_xlabel("Voltage")
                ax1.set_ylabel("Alpha")

                ax2.plot(inf_v * pq.mV, beta * pq.s/pq.s, color=color)
                ax2.set_xlabel("Voltage")
                ax2.set_ylabel("Beta")
                ax2.setYUnit("")

            else:

                ax1.plot(inf_v, alpha, color=color)
                ax1.set_xlabel("Voltage (mV)")
                ax1.set_ylabel("Alpha")

                ax2.plot(inf_v, beta, color=color)
                ax2.set_xlabel("Voltage (mV)")
                ax2.set_ylabel("Beta")





            return

            V = StdLimits.get_default_voltage_array().rescale("mV")

            alpha, beta = cls.getResolvedInfTauInterpolatedCurves(V, chl, state)


            ax1.plot(V, alpha, color="blue")
            ax1.set_xlabel("Voltage")
            ax1.set_ylabel("Alpha")

            ax2.plot(V, beta, color="blue")
            ax2.set_xlabel("Voltage")
            ax2.set_ylabel("Beta")
示例#2
0
 def PlotCurve(cls, ax, curve, chl, state, infpower=None, *args, **kwargs):
     
     V = StdLimits.getDefaultVoltageArray().rescale("mV")
     
     alpha,beta = chl.getAlphaBetaAtVoltage(V, state)
     inf,tau = InfTauCalculator.AlphaBetaToInfTau(alpha,beta)
     infpower = np.power(inf, infpower) if infpower else None
     plot_what_LUT = { 
                  Curve.Alpha :     ( alpha,    "Rate Constant", None ), 
                  Curve.Beta :      ( beta,     "Rate Constant", None ),
                  Curve.Inf :       ( inf,      "Steady-State",  None ),
                  Curve.InfPowered :( infpower, "Steady-State",  None ),
                  Curve.Tau :       ( tau,      "Time-Constant", "ms" ),
                  }
     plot_what, y_label, y_unit = plot_what_LUT[curve]
     
     #print kwargs
     
     if isinstance(ax, QuantitiesAxisNew):
         
         ax.plot(V,plot_what, *args,**kwargs)
         ax.set_xlabel("Voltage")
         ax.set_ylabel(y_label)
         
         if y_unit:
             ax.set_yunit( unit(y_unit) )
         
     else:
         ax.plot(V,plot_what, *args,**kwargs)
         ax.set_xlabel("Voltage (mV)")
         ax.set_ylabel(y_label)