コード例 #1
0
def dispatch(e, args):

    e.election_dirname = ids.filename_safe(args.election_dirname)

    e.election_name = args.election_name

    OpenAuditTool.ELECTIONS_ROOT = args.elections_root

    if args.set_audit_seed != None:
        audit.set_audit_seed(e, args.set_audit_seed)

    if args.read_election_spec:
        logger.info("read_election_spec")
        election_spec.read_election_spec(e)

    elif args.read_reported:
        logger.info("read_reported")
        election_spec.read_election_spec(e)
        reported.read_reported(e)

    elif args.make_audit_orders:
        logger.info("make_audit_orders")
        audit_orders.compute_audit_orders(e)

    elif args.read_audited:
        logger.info("read_audited--NO-OP-TBD")

    elif args.audit:
        election_spec.read_election_spec(e)
        reported.read_reported(e)
        audit.audit(e, args)
コード例 #2
0
ファイル: syn2.py プロジェクト: ron-rivest/2017-bayes-audit
def generate_syn_type_2(e, args):

    synpar = copy.copy(args)
    rows = read_syn2_csv(e, synpar)
    process_spec(e, synpar, rows)
    e.audit_seed = 1
    synpar.RandomState = np.random.RandomState(e.audit_seed)
    shuffle_votes(e, synpar)
    audit_orders.compute_audit_orders(e)

    # generate_audit(e, synpar)

    debug = False
    if debug:
        for key in sorted(vars(e)):
            print(key)
            print("    ", vars(e)[key])

    write_csv.write_csv(e)
コード例 #3
0
ファイル: syn3.py プロジェクト: Dovermore/audit-lab
def generate_syn_type_3(e, args):

    synpar = copy.copy(args)
    meta_rows = read_meta_csv(e, synpar)
    actual_rows = read_vote_csv(e, synpar, False)
    reported_rows = read_vote_csv(e, synpar, True)
    process_spec(e, synpar, meta_rows, actual_rows, reported_rows)
    e.audit_seed = int(time.clock() * 100000)
    synpar.RandomState = np.random.RandomState(e.audit_seed)
    # synpar.RandomState = np.random.RandomState()
    print(f"seed for RandomState: {e.audit_seed}")
    shuffle_votes(e, synpar)
    audit_orders.compute_audit_orders(e)

    debug = False
    if debug:
        for key in sorted(vars(e)):
            logger.info(key)
            logger.info("    ", vars(e)[key])

    csv_writers.write_csv(e)
コード例 #4
0
def dispatch(e, args):
    e.election_dirname = ids.filename_safe(args.election_dirname)

    e.election_name = args.election_name

    e.num_winners = int(args.num_winners)
    e.max_num_it = int(args.max_num_it)
    e.sample_by_size = args.sample_by_size
    e.use_discrete_rm = args.use_discrete_rm
    e.pick_county_func = args.pick_county_func

    OpenAuditTool.ELECTIONS_ROOT = args.elections_root

    if args.set_audit_seed != None:
        audit.set_audit_seed(e, args.set_audit_seed)

    if args.read_election_spec:
        logger.info("read_election_spec")
        election_spec.read_election_spec(e)

    elif args.read_reported:
        logger.info("read_reported")
        election_spec.read_election_spec(e)
        reported.read_reported(e)

    elif args.make_audit_orders:
        logger.info("make_audit_orders")
        audit_orders.compute_audit_orders(e)

    elif args.read_audited:
        logger.info("read_audited--NO-OP-TBD")

    elif args.audit:
        election_spec.read_election_spec(e)
        reported.read_reported(e)
        audit.audit(e, args)
コード例 #5
0
ファイル: syn1.py プロジェクト: michaeljets/audit-lab
def generate_audit_orders(e, synpar):

    audit_orders.compute_audit_orders(e)