#! /bin/bash

reffile=data/refdata/ref_makelc_e2e.fits
infile=data/refdata/ref_makelc_input.evt
outfile=makelc_e2e.fits

# run a simple makelc example
makelc \
  EvtFile=$infile \
  LightCurve=$outfile \
  TSTART=0. length=10 dt=0.01 \
  chatter=0

# did this finish successfully?
retval=$?
if [ $retval -ne 0 ]
then
  exit $retval
fi

# check if the files are similar enough
ftdiff $outfile $reffile reltol=1e-2
retval=$?

# cleanup
rm $outfile

exit $retval
