예제 #1
0
    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
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")