def main(args):
    system = args.input
    print('Solving system in file %s' % system)
    a = xppy.run(system, verbose=True)
    desc = a.getDesc()
    data = a.getRawData()

    tvec = a[:, desc['time']]
    if not args.no_subplots:
        ax = plt.subplot(111)

    i = 0
    for k in desc:
        if type(desc[k]) == int:
            if k in ['t', 'time']:
                continue
            if args.no_subplots:
                ax = plt.subplot(data.shape[1] - 1, 1, i + 1)
                i += 1
            ax.plot(tvec, data[:, desc[k]], label=k)
            ax.legend()

    outfile = args.output or '%s.png' % args.input
    plt.savefig(outfile)
    print('Saved to %s' % outfile)
def main( args ):
    system = args.input
    print( 'Solving system in file %s' % system )
    a = xppy.run( system, verbose = True )
    desc = a.getDesc( )
    data = a.getRawData( )

    tvec = a[:,desc['time']]
    if not args.no_subplots:
        ax = plt.subplot(111)

    i = 0
    for k in desc:
        if type(desc[k]) == int:
            if k in [ 't', 'time' ]:
                continue
            if args.no_subplots:
                ax = plt.subplot( data.shape[1] - 1, 1, i + 1 )
                i += 1
            ax.plot( tvec, data[:,desc[k]], label = k )
            ax.legend( )

    outfile = args.output or '%s.png' % args.input
    plt.savefig( outfile )
    print( 'Saved to %s' % outfile )
    def run( self ):
        """
        """
        # init the xppy object
        xppy.createTmp( self.ode )

        # run it
        self.out = xppy.run( )

        # omit first time axis in self.dim
        nx, ny = self.out.getRawData().shape
        self.tmax = nx - 1  # total number of steps/iterations
        self.dim = ny - 1
Exemple #4
0
def run_file():
	squareBurst=xppy.run(odefile)
	return squareBurst
Exemple #5
0
# coding: utf-8
import xppy
xppy.set_cmd('/PATH_TO_XPPAUT/')
subHopf = xppy.run('SOME_ODE_FILE.ode')
subHopf.getDesc()
sHData = subHopf.getRawData()
sHData.shape
from xppy.utils import plot
plot.plotLC(subHopf.getRawData())
plot.pl.show()
import xppy
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

#ode_file = 'lorenz96.ode'; color='b'
#ode_file = 'lorenz96v2.ode'; color='r'

# Lorenz 84
ode_file = 'lorenz84.ode'; color='b'

# init the xppy object
xppy.createTmp( ode_file )

# run it
out = xppy.run( )# ode_file )
# equivalent to xpp continue

pars = xppy.parse.readOdePars(ode_file, False, True, False)

ts = list( out[0] )
xs = list( out[1] )
ys = list( out[2] )
zs = list( out[3] )

# first, 3d
fig = plt.figure( 1 )
ax = fig.gca(projection='3d')
ax.plot( xs, ys, zs, color=color, marker='o' )#, lw=3, alpha=0.8)
ax.set_xlabel("X")
ax.set_ylabel("Y")
ax.set_zlabel("Z")
Exemple #7
0
"""
This file demonstrates how to modify an ode file and plot the output.
"""

from shutil import copyfile
import os
import matplotlib.pyplot as plt

import xppy

# run ode file, collect data (see ex1.py)
out1 = xppy.run('simple.ode')
dat1 = out1.getRawData()
desc1 = out1.getDesc()

t1 = dat1[:,desc1['t']]
u1 = dat1[:,desc1['u']]
v1 = dat1[:,desc1['v']]

# this feature is unimplemented, but you can hack around it.

# get this list by running
# readOdePars(ode_file)
# modify the entry you want.
# Let's change q from 1 to 10.
# and u from .2 to -.2
inputdat = [['par', 'q', '10'],
            ['init', 'u', '-.2'],
            ['init', 'v', '.5'],
            ['@', 'dt', '.01'],
            ['@', 'total', '100']]
Exemple #8
0
import xppy
import pylab
import numpy

ode_file = 'Lab5.ode'
plot_ext = 'ps'

pylab.cla()

for vp0 in [ -60, -50, -30, -10, 0 ]:
  xppy.createTmp(ode_file)

  params = [
    ['par', 'g_ampa', 0.000],
    ['par', 'g_nmda', 0.038],
    ['par', 'g_gaba', 0.000],
    ['par', 'g_gabb', 0.000],
    ['par', 'g_dep', 0.000],
    ['par', 'mg', 1],
    ['par', 'ip', 35],
    ['par', 'vp0', vp0],
    ['@', 'total', 1000],
  ]
  xppy.changeOde(params)
  o = xppy.run()
  pylab.plot(o['vpost'], o['i_nmda'], '-', label='NMDA')

pylab.show()

Exemple #9
0
# coding: utf-8
import xppy
xppy.set_cmd('/PATH_TO_XPPAUT/')
subHopf=xppy.run('SOME_ODE_FILE.ode')
subHopf.getDesc()
sHData=subHopf.getRawData()
sHData.shape
from xppy.utils import plot
plot.plotLC(subHopf.getRawData())
plot.pl.show()