コード例 #1
0
ファイル: processEimage.py プロジェクト: LSSTDESC/obs_lsstSim
 def _makeArgumentParser(cls):
     """Create an argument parser
     """
     parser = ArgumentParser(name=cls._DefaultName)
     parser.add_id_argument(
         name="--id",
         datasetType=pipeBase.ConfigDatasetType(name="isr.datasetType"),
         help="data IDs, e.g. --id visit=12345 ccd=1,2^0,3")
     return parser
コード例 #2
0
ファイル: processCcd.py プロジェクト: youtsumi/pipe_tasks
    def _makeArgumentParser(cls):
        """!Create and return an argument parser

        @param[in] cls      the class object
        @return the argument parser for this task.

        This override is used to delay making the data ref list until the dataset type is known;
        this is done in @ref parseAndRun.
        """
        parser = pipeBase.ArgumentParser(name=cls._DefaultName)
        parser.add_id_argument(name="--id",
                               datasetType=pipeBase.ConfigDatasetType(name="isr.datasetType"),
                               help="data IDs, e.g. --id visit=12345 ccd=1,2^0,3")
        return parser
コード例 #3
0
    def testConfigDatasetTypeNoFieldDefault(self):
        """Test ConfigDatasetType with a config field that has no default value"""
        name = "dsTypeNoDefault"
        ap = pipeBase.InputOnlyArgumentParser(name="argumentParser")
        dsType = pipeBase.ConfigDatasetType(name=name)

        ap.add_id_argument("--id", dsType, "help text")
        # neither the argument nor the config field has a default,
        # so the user must specify the argument (or specify doMakeDataRefList=False
        # and post-process the ID list)
        with self.assertRaises(RuntimeError):
            ap.parse_args(
                config=self.config,
                args=[DataPath,
                      "--id", "visit=2",
                      ],
            )
コード例 #4
0
    def testConfigDatasetTypeFieldDefault(self):
        """Test ConfigDatasetType with a config field that has a default value"""
        # default value for config field "dsType" is "calexp";
        # use a different value as the default for the ConfigDatasetType
        # so the test can tell the difference
        name = "dsType"
        ap = pipeBase.InputOnlyArgumentParser(name="argumentParser")
        dsType = pipeBase.ConfigDatasetType(name=name)

        ap.add_id_argument("--id", dsType, "help text")
        namespace = ap.parse_args(
            config=self.config,
            args=[DataPath,
                  "--id", "visit=2",
                  ],
        )
        self.assertEqual(namespace.id.datasetType, "calexp")  # default of config field dsType
        self.assertEqual(len(namespace.id.idList), 1)