Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
This directory contains the python subroutines for postprocessing.
sourceme.sh now resents your $PYTHONPATH to include $PENCIL_HOME/python,
so you can just do

import pencil as pc

in your script or from your favorite python shell (ipython is a good one).

Once you've done so,

  ts = pc.read.ts()

reads the 'time_series.dat' file and

  var = pc.read.var()

returns an object with the entire f array as well as some handy constants.

Note that because python is C-indexed instead of fortran-indexed, and
matplotlib assumes [y, x] ordering for 2D plotting, the f array returned is in
the opposite order from how it is in pencil: var.f.shape will return
[nvar, nz, ny, nx].

-----------------------------------------------------------------------------

To get started with visualizing Pencil-Code data in Python:

1. Install the matplotlib library (a package often called
  python-matplotlib), which should install numpy as a dependency.
1a. You may also want to install ipython.
2. Initialize your PYTHONPATH environment variable by sourcing 'source ~/.bashrc'.
3. Load all of the Python pencil modules using 'import pencil as pc'
4. Load data using 'pc.read.ts()', etc.