Since the stack documentation and tutorials are incomplete and in transition, I'm putting the things I've learned about using the stack here.  Please feel free to add your own "tips and tricks". DN.

Enable DEBUG log level for a particular subtask

Use  --show to list the subtasks of a CmdLineTask

processCcdDecam.py /home/afausti/bulge/input --show tasks



then use the --loglevel to set the DEBUG log level when executing the task

processCcdDecam.py /home/afausti/bulge/input/ --output /home/afausti/bulge/output --id visit=0205484 ccdnum=1 --loglevel processCcdDecam.calibrate.astrometry=DEBUG

NOTE: the --show does not include the CmdLineTak as part of the subtask name (in this case processCcdDecam)  but it must be included in  --loglevel (as above)

 

Using afw tables

Once you have an afwTable loaded, such as the source table produced by processCcd

>>> import lsst.afw.table as afwTable
>>> import lsst.daf.persistence as dafPersist
>>> butler = dafPersist.Butler("/data/lsst/decam/redux/cp/cosmos/")
>>> sourceCat = butler.get('src',visit=177341,ccdnum=31)

You can access the data in the file by using the column name

>>> print sourceCat["slot_Centroid_x"]
[    7.    84.   582. ...,  1764.  1964.  1331.]

You can also modify any of the individual values

>>> sourceCat["slot_Centroid_x"][0:10] += 10.0

or all the values

>>> sourceCat["slot_Centroid_x"][:] += 10.0

Here's how to get the full schema and all the column names,

>>> sourceCat.getSchema()
Schema(
    (Field['L'](name="id", doc="unique ID"), Key<L>(offset=0, nElements=1)),
    (Field['Angle'](name="coord_ra", doc="position in ra/dec"), Key<Angle>(offset=8, nElements=1)),

.... many more lines ...

You can also use the "get()" method with the column names,

>>> sourceCat.get("slot_Centroid_x")
array([    7.,    84.,   582., ...,  1764.,  1964.,  1331.])
>>> sourceCat.get("slot_Centroid_x")[0]
7.0

There are many different pixel centroid values in the source tables (e.g., deblend_psfCenter_x/y, base_GaussianCentroid_x/y, base_NaiveCentroid_x/y, base_SdssCentroid_x/y).  The "official" one that is used by the stack routines is "slot_Centroid_x/y" which is actually a link to another field (most of the time "base_SdssCentroid_x/y").

Some other useful columns are "coord_ra", "coord_dec" (NOTE these are in RADIANS), "slot_PsfFlux" (also a link to another column), "slot_Shape_xx/xy/yy" (another link).