Exemple #1
0
 def setUp(self):
     policy = pexPolicy.Policy("tests/SuprimeCam_Geom.paf")
     geomPolicy = cameraGeomUtils.getGeomPolicy(policy)
     self.camera = cameraGeomUtils.makeCamera(geomPolicy)
     coeffs = list(COEFFS)
     coeffs.reverse(
     )  # NumPy's poly1d wants coeffs in descending order of powers
     coeffs.append(
         0.0)  # NumPy's poly1d goes all the way down to zeroth power
     self.config = pipConfig.Config()
     distConfig = pipConfig.Config()
     distConfig['coeffs'] = coeffs
     distConfig['actualToIdeal'] = True
     distConfig['step'] = 10.0
     self.config['radial'] = distConfig
Exemple #2
0
    def __init__(self, *args, **kwargs):
        optparse.OptionParser.__init__(self, *args, **kwargs)
        self.add_option("-I",
                        "--instrument",
                        type="string",
                        action="callback",
                        callback=optInstrument,
                        help="Instrument name (specify first!)")
        self.add_option("-D",
                        "--define",
                        type="string",
                        nargs=2,
                        action="callback",
                        callback=optConfigDefinition,
                        help="Configuration definition (single value)")
        self.add_option("-O",
                        "--override",
                        type="string",
                        action="callback",
                        callback=optConfigOverride,
                        help="Configuration override file")
        self.add_option("--output",
                        dest="output",
                        type="string",
                        action="callback",
                        callback=optConfigRoot,
                        help="Output root directory")
        self.add_option("--data",
                        dest="data",
                        type="string",
                        action="callback",
                        callback=optConfigRoot,
                        help="Data root directory")
        self.add_option("--calib",
                        dest="calib",
                        type="string",
                        action="callback",
                        callback=optConfigRoot,
                        help="Calibration root directory")
        self.add_option("--debug",
                        dest="debug",
                        default=False,
                        action="callback",
                        callback=optConfigDebug,
                        help="Debugging output?")
        self.add_option("--timer",
                        dest="timer",
                        default=False,
                        action="callback",
                        callback=optConfigTimer,
                        help="Timer for functions?")
        self.add_option("--log",
                        dest="log",
                        type="string",
                        default=None,
                        help="Logging destination")

        self.set_default('config', pipConfig.Config())
        return
Exemple #3
0
def getConfig(overrideFile=None):
    """Return a proper config object, maybe given the name of policy file with an additional set of overrides"""
    
    default = os.path.join(os.getenv("PIPETTE_DIR"), "policy", "ProcessCcdDictionary.paf")
    overrides = os.path.join(os.getenv("PIPETTE_DIR"), "policy", "megacam.paf")
    config = pipConfig.configuration(default, overrides)
    if overrideFile:
        config.merge(pipConfig.Config(overrideFile))

    return config
Exemple #4
0
    def __init__(self, config, allowNonfinite=True):
        """Initialisation

        @param config Configuration specifying format styles
        @param allowNonfinite Boolean indicating whether non-finite values should be written as NaN
        """
        if not isinstance(config, pipConfig.Config):
            config = pipConfig.Config(config)
        self.config = config
        self.allowNonfinite = allowNonfinite
        return
Exemple #5
0
 def setUp(self):
     self.config = pipConfig.Config("tests/test_config.paf")
     self.truth = {
         'integer': 1,
         'float': 3.21,
         'truth': True,
         'falsehood': False,
         'string': 'this is a string',
         'policy': {
             'subpolicy': True
         },
         'array': [
             1,
             2,
             3,
             4,
             5,
         ],
     }
Exemple #6
0
def optConfigRoot(option, opt, value, parser):
    if not parser.values.config.has_key('roots'):
        parser.values.config['roots'] = pipConfig.Config()
    root = parser.values.config['roots']
    root[option.dest] = value
    return
Exemple #7
0
def optConfigOverride(option, opt, value, parser):
    override = pipConfig.Config(value)
    parser.values.config.merge(override)
    return
Exemple #8
0
def optInstrument(option, opt, value, parser):
    policy = os.path.join(os.getenv("PIPETTE_DIR"), "policy", value + ".paf")
    override = pipConfig.Config(policy)
    parser.values.config.merge(override)
    return