Pan-Tasks regularly runs:

	p0tool -pendingimfile

which returns a list of imfiles which are pending for phase 0 processing.
Imfiles are characterised by: exp_id, class_id, uri

For each imfile, we run:

	phase0imfile.pl <expId> <classId> <uri>

"phase0imfile.pl" is a helper script that runs ppStats on the imfile,
pulling out interesting qualities:

	ra, dec, exptime, background, stdev, image type, ...

It then pushes these qualities into the database using:

	p0tool -updateimfile -ra $ra -dec $dec -exptime $expTime ... [etc]

"p0tool -updateimfile" ticks off the imfile as having been processed
through phase 0.




Pan-Tasks regularly runs:

	p0tool -pendingexp

which returns a list of exposures which are pending for phase 0 processing,
i.e., all imfiles within have been processed.  The exposures are characterised
by an expid.

For each exposure, we run:

	phase0exp.pl <expId>

"phase0exp.pl" is a helper script that pulls out the qualities for each component
imfile of that exposure (which are stored in the database) using: 

	p0tool -rawimfiles -expid $expId

For those, it checks that the values are consistent across the
components, and also decides if the exposure is a detrend or science
exposure.  The results are uploaded to the database using:

	p0tool -updateexp -expid -ra $ra -dec $dec -exptime $expTime ... [-detrend]

"p0tool -updateexp" ticks off the exposure as having been processed
through phase 0, and moves it over for phase 1 (or phase 2)
processing.
