## Can I read in data from a file and then plot it?

The Crates module provides data input and output routines for Python. It can be used to read in data from a file which can then be plotted - perhaps after manipulation - using ChIPS. The following code shows how the columns time, rate, and error can be plotted (after converting the time column from seconds to an offset in kiloseconds). In this example the input file is assumed to be a FITS binary table but ASCII tables can also be used.

# The following two lines are not needed when running ChIPS
# but are if the file is to be executed by python
from pycrates import *
from pychips.hlui import *

t = copy_colvals(cr, "time")
x = (t - t[0]) / 1e3
y = copy_colvals(cr,"rate")
dy = copy_colvals(cr,"error")