Exemplo n.º 1
0
    def AddAdditionalPhaseOptions(self, parser, phase_group):
        """Add additional phase options which the simulator needs, but PinPlay doesn't use."""

        cmd_options.region_sim(parser, phase_group)
        cmd_options.whole_sim(parser, phase_group)
        cmd_options.pred_error(parser, phase_group)

        return
Exemplo n.º 2
0
    def AddAdditionalPhaseOptions(self, parser, phase_group):
        """
        Add additional phase options CBSP which SDE needs, but PinPlay doesn't use.

        @param parser      Optparse object
        @param phase_group Phase parser group where options are located

        @return No return value
        """

        cmd_options.lit_gen(parser, phase_group)
        cmd_options.region_sim(parser, phase_group)
        cmd_options.whole_sim(parser, phase_group)
        cmd_options.pred_error(parser, phase_group)
Exemplo n.º 3
0
    def ParseCommandLine(self):
        """Process command line arguments and do error checking."""

        version = '$Revision: 1.28 $'
        version = version.replace(' ', '')
        ver = version.replace(' $', '')
        us = '%prog sim_data_dir | options \nVersion: ' + ver
        desc = 'When run with only the argument \'sim_data_dir\', the script calculates the predicted '\
               'metric of interest from the simulator data file contained in this directory. '\
               'If any options are given, then only the actions defined by the options will be executed. '\
               '                                                            '\
               '                                                            '\
               'NOTE: Must specify both options \'--actual_metric\' and \'--predicted_metric\' '\
               'when using the option \'--pred_error\'.'

        # Command line options to control the tool's behavior.
        #
        util.CheckNonPrintChar(sys.argv)
        parser = optparse.OptionParser(usage=us, description=desc, version=ver)
        cmd_options.debug(parser)
        cmd_options.pred_error(parser, '')
        cmd_options.actual_metric(parser)
        cmd_options.pinplayhome(parser, '')
        cmd_options.predicted_metric(parser)
        cmd_options.verbose(parser)

        # Parse the command line options.
        #
        (options, args) = parser.parse_args()

        # Added method cbsp() to 'options' to check if running CBSP.
        #
        util.AddMethodcbsp(options)

        # Error if no arguments or options on command line.
        #
        if len(sys.argv) == 1:
            msg.PrintAndExit(
                'Give either the name of a directory containing\n'
                'simulator data files or one, or more, options on the command line.\n'
                'See \'-h\' for more info.')

        # Make sure all required options are given if user wants prediction
        # error.
        #
        if options.pred_error:
            if options.predicted_metric == '' or options.actual_metric == '':
                msg.PrintAndExit('Must give both \'--predicted_metric\' and '
                                 '\'--actual_metric\' with \'--pred_error\'.')

        predicted_dir = ''
        actual_dir = ''
        if len(args) == 1:
            # If there are only 2 arguments, assume just calculating predicted
            # metric.  Check to see if a valid directory name was given on the
            # command line.
            #
            dir_found = False
            for dir_name in args:
                if os.path.isdir(os.path.realpath(dir_name)):
                    dir_found = True
                    break
            if not dir_found:
                msg.PrintAndExit(
                    '\'' + sys.argv[1] + '\' is not a valid directory.\n'
                    'Give either the name of a directory containing simulator data files \n'
                    'or one, or more, options on the command line.\n'
                    'See \'-h\' for more info.')
            predicted_dir = os.path.realpath(dir_name)
        else:
            # Check directories given as arguments to options to make sure they exist.
            #
            if options.predicted_metric:
                predicted_dir = os.path.realpath(options.predicted_metric)
                if not os.path.isdir(predicted_dir):
                    msg.PrintAndExit('Predicted metric directory does not exist: ' + \
                        options.predicted_metric)
            if options.actual_metric:
                actual_dir = os.path.realpath(options.actual_metric)
                if not os.path.isdir(actual_dir):
                    msg.PrintAndExit('Actual metric directory does not exist: ' + \
                        options.actual_metric)

        # Set the global variables in config object from the options.  Thus, if the
        # user sets option 'pinplayhome' on the command line, it will be used when
        # determining which kit to use.
        #
        # import pdb;  pdb.set_trace()
        gv = config.GlobalVar()
        gv.SetGlobalVars(options)
        self.kit_obj = self.GetKit()

        return (predicted_dir, actual_dir, options)
Exemplo n.º 4
0
    def AddAdditionalPhaseOptions(self, parser, phase_group):
        """Add additional phase options which SDE needs, but PinPlay doesn't use."""

        region_sim(parser, phase_group)
        whole_sim(parser, phase_group)
        cmd_options.pred_error(parser, phase_group)