def main():
    # Init.
    logging.basicConfig(
        level=logging.DEBUG)  # TODO(alessio): INFO once debugged.
    parser = collect_data.InstanceArgumentsParser()
    parser.add_argument('-f',
                        '--filename_suffix',
                        help=('suffix of the exported file'))
    parser.description = ('Exports pre-computed APM module quality assessment '
                          'results into HTML tables')
    args = parser.parse_args()

    # Get the scores.
    src_path = collect_data.ConstructSrcPath(args)
    logging.debug(src_path)
    scores_data_frame = collect_data.FindScores(src_path, args)

    # Export.
    output_filepath = os.path.join(args.output_dir,
                                   _BuildOutputFilename(args.filename_suffix))
    exporter = export.HtmlExport(output_filepath)
    exporter.Export(scores_data_frame)

    logging.info('output file successfully written in %s', output_filepath)
    sys.exit(0)
Esempio n. 2
0
def InstanceArgumentsParser():
    """Arguments parser factory.
  """
    parser = collect_data.InstanceArgumentsParser()
    parser.description = (
        'Shows boxplot of given score for different values of selected'
        'parameters. Can be used to compare scores by audioproc_f flag')

    parser.add_argument('-v',
                        '--eval_score',
                        required=True,
                        help=('Score name for constructing boxplots'))

    parser.add_argument(
        '-n',
        '--config_dir',
        required=False,
        help=('path to the folder with the configuration files'),
        default='apm_configs')

    parser.add_argument('-z',
                        '--params_to_plot',
                        required=True,
                        nargs='+',
                        help=('audioproc_f parameter values'
                              'by which to group scores (no leading dash)'))

    return parser
def _InstanceArgumentsParser():
    """Arguments parser factory. Extends the arguments from 'collect_data'
  with a few extra for selecting what parameters to optimize for.
  """
    parser = collect_data.InstanceArgumentsParser()
    parser.description = (
        'Rudimentary optimization of a function over different parameter'
        'combinations.')

    parser.add_argument(
        '-n',
        '--config_dir',
        required=False,
        help=('path to the folder with the configuration files'),
        default='apm_configs')

    parser.add_argument('-p',
                        '--params',
                        required=True,
                        nargs='+',
                        help=('parameters to parse from the config files in'
                              'config_dir'))

    parser.add_argument(
        '-z',
        '--params_not_to_optimize',
        required=False,
        nargs='+',
        default=[],
        help=('parameters from `params` not to be optimized for'))

    return parser