Пример #1
0
def test_4_easy():
    """ Generate election 4-easy using syn2 then run audit on it with OpenAuditTool.
    """
    with warnings.catch_warnings(record=True):
        # Generate election from object storing pseudo command-line arguments.
        e = OpenAuditTool.Election()
        syn_args = Args()
        syn_args.election_dirname = '4-easy'
        syn_args.syn_type = '2'
        cli_syn.dispatch(e, syn_args)

        # Audit election
        e = OpenAuditTool.Election()
        OpenAuditTool_args = Args()
        OpenAuditTool_args.election_dirname = '4-easy'
        OpenAuditTool_args.election_name = '4-easy'
        OpenAuditTool_args.elections_root = './elections'
        OpenAuditTool_args.set_audit_seed = 42
        OpenAuditTool_args.read_election_spec = False
        OpenAuditTool_args.read_reported = False
        OpenAuditTool_args.make_audit_orders = False
        OpenAuditTool_args.read_audited = False
        OpenAuditTool_args.audit = True
        OpenAuditTool_args.pause = False

        # added for new planner code:
        OpenAuditTool_args.num_winners = 2
        OpenAuditTool_args.max_num_it = 100
        OpenAuditTool_args.sample_by_size = False
        OpenAuditTool_args.use_discrete_rm = False
        OpenAuditTool_args.pick_county_func = "round_robin"
        cli_OpenAuditTool.dispatch(e, OpenAuditTool_args)
Пример #2
0
def irv_edge(election_dirname, config_dirname=None):
    """ Generate election 8-irv1 using syn2 then run audit on it with OpenAuditTool.
    """
    with warnings.catch_warnings(record=True):
        # Generate election from object storing pseudo command-line arguments.
        e = OpenAuditTool.Election()
        syn_args = Args()
        syn_args.election_dirname = election_dirname
        syn_args.config_dirname = config_dirname
        syn_args.syn_type = '3'
        cli_syn.dispatch(e, syn_args)

        # Audit election
        e = OpenAuditTool.Election()
        OpenAuditTool_args = Args()
        OpenAuditTool_args.election_dirname = election_dirname
        OpenAuditTool_args.election_name = election_dirname
        OpenAuditTool_args.elections_root = './elections'
        OpenAuditTool_args.set_audit_seed = int(time.clock() * 100000)
        OpenAuditTool_args.read_election_spec = False
        OpenAuditTool_args.read_reported = False
        OpenAuditTool_args.make_audit_orders = False
        OpenAuditTool_args.read_audited = False
        OpenAuditTool_args.audit = True
        OpenAuditTool_args.pause = False

        # added for new planner code:
        OpenAuditTool_args.num_winners = 1
        OpenAuditTool_args.max_num_it = 100
        OpenAuditTool_args.sample_by_size = False
        OpenAuditTool_args.use_discrete_rm = False
        OpenAuditTool_args.pick_county_func = "round_robin"
        cli_OpenAuditTool.dispatch(e, OpenAuditTool_args)
Пример #3
0
def test_4_easy():
    """ Generate election 4-easy using syn2 then run audit on it with OpenAuditTool.
    """
    with warnings.catch_warnings(record=True):
        # Generate election from object storing pseudo command-line arguments.
        e = OpenAuditTool.Election()
        syn_args = Args()
        syn_args.election_dirname = '4-easy'
        syn_args.syn_type = '2'
        cli_syn.dispatch(e, syn_args)

        # Audit election
        e = OpenAuditTool.Election()
        OpenAuditTool_args = Args()
        OpenAuditTool_args.election_dirname = '4-easy'
        OpenAuditTool_args.election_name = '4-easy'
        OpenAuditTool_args.elections_root = './elections'
        OpenAuditTool_args.set_audit_seed = 42
        OpenAuditTool_args.read_election_spec = False
        OpenAuditTool_args.read_reported = False
        OpenAuditTool_args.make_audit_orders = False
        OpenAuditTool_args.read_audited = False
        OpenAuditTool_args.audit = True
        OpenAuditTool_args.pause = False
        cli_OpenAuditTool.dispatch(e, OpenAuditTool_args)
Пример #4
0
def main():
    logger.info("OpenAuditTool.py -- Bayesian audit support program.")

    utils.start_datetime_string = utils.datetime_string()
    logger.info("Starting date-time: %s", utils.start_datetime_string)

    args = cli_OpenAuditTool.parse_args()
    e = Election()
    try:
        cli_OpenAuditTool.dispatch(e, args)
    finally:
        pass