[lsst-dm-stack-users] LsstSimMapper questions

Chris Walter chris.walter at duke.edu
Tue Aug 27 12:37:19 PDT 2013


Dear All,

I'm trying to build up CmdLineTasks from the most simple skeleton to something more complete and I have run into a few issues.  

The first is a small bug/issue.  At least with some tests I am running with PhoSim version 3.3.2 the program produces FITS files which have VERSION = none in the metadata.  This causes the line

if md.exists("VERSION") and md.getInt("VERSION") < 16952:

in lsstSimMapper.py to fail with a type error since although it is empty it the field still exists.  So fixing that manually for now; consider this very simple snippet of code:

----

import lsst.pex.config as pexConfig
import lsst.pipe.base as pipeBase

class ProcessTestConfig(pexConfig.Config):
    """Config for ProcessTest"""

class ProcessTestTask(pipeBase.CmdLineTask):
    ConfigClass = ProcessTestConfig
    _DefaultName = "processTest"

    def run(self, sensorRef):
        print "HELLO!"
    
ProcessTestTask.parseAndRun()


---------
This was stopping with:

AttributeError: 'LsstSimMapper' object has no attribute 'map_processTest_config'

I couldn't figure out what was going on at all here until I managed to get it to work by replacing 

_DefaultName = "processTest"

with 

_DefaultName = "processCcd"

as that is one of the example scripts that works.

Eventually I determined that rules for processCcd are hardcoded in the policy file in 

obs_lsstSim/7.1.2.0+2/policy/LsstSimMapper.paf

    processCcd_config: {
        template:      "config/processCcd.py"
        python:        "lsst.pipe.tasks.processCcd.ProcessCcdConfig"
        persistable:      "Config"
        storage:    "ConfigStorage"
        tables:        raw
        tables:        raw_skyTile
    }
    processCcd_metadata: {
        template:      "processCcd_metadata/v%(visit)d-f%(filter)s/R%(raft)s/S%(sensor)s.boost"
        python:        "lsst.daf.base.PropertySet"
        persistable:        "PropertySet"
        storage:    "BoostStorage"
        tables:        raw
        tables:        raw_skyTile
    }


If I edited the .paf file and replaced "Ccd" with "Test" in these entries my program worked.  I don't think the intention is that the base code (which may be write protected) needs to be edited for every commandline process someone writes, but I can't figure out how to change this in my commandline code itself.  It is in a policy file not a config object.  This page:

http://lsst-web.ncsa.illinois.edu/doxygen/x_masterDoxyDoc/pex_config.html

Says "lsst::pex::config was developed to provide additional features and remove some shortcomings. lsst::pex::policy is being replaced with lsst::pex::config in the LSST DMS codebase; to aid the transition a utility function is provided to convert a Config to a Policy."

and the examples of the command line tasks all use config not policy objects.  

Can anyone explain a bit better what is going on and what the proper way to setup this information is?

Thanks!

-Chris





More information about the dm-users mailing list