Skip to content

Commit

Permalink
Fix RNG seed setting; Fix small spelling mistakes; Remove extra newli…
Browse files Browse the repository at this point in the history
…ne in audit round file
  • Loading branch information
Berj Chilingirian committed Sep 14, 2016
1 parent 23f4e30 commit 0722acb
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion aus_senate_audit/audit_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def record_selected_ballots(self, audit_stage, sample, quick):
f.write('\n'.join([ballot if quick else self.remove_preferences_from_ballot(ballot) for ballot in sample]) + '\n')
# Write the new ballots in the sample to the audit round file.
with open(self.get_file_path(AUDIT_ROUND_FILE_NAME.format(ROUND_DIR_NAME, audit_stage)), 'w') as f:
f.write('{}\n'.format(','.join(COLUMN_HEADERS + MATCH_HEADERS)) + '\n')
f.write('{}\n'.format(','.join(COLUMN_HEADERS + MATCH_HEADERS)))
f.write('\n'.join([ballot for ballot in sample]) + '\n')

def record_current_audit_round_match_records(self, match_records):
Expand Down
4 changes: 2 additions & 2 deletions aus_senate_audit/audits/bayesian_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def audit(election, seed, unpopular_freq_threshold, stage_counter=0, alpha=0.05,
print(
'Audit of {} election.\n'.format(election.get_type()),
' Election ID: {}\n'.format(election.get_election_id()),
' Canadidates: {}\n'.format(election.get_candidates()),
' Candidates: {}\n'.format(election.get_candidates()),
' Number of ballots cast: {}\n'.format(
election.get_num_cast_ballots(),
),
Expand Down Expand Up @@ -160,5 +160,5 @@ def audit(election, seed, unpopular_freq_threshold, stage_counter=0, alpha=0.05,
' {}'.format(candidate_to_ballots_map[cid]),
)

print('Elasped time: {} seconds.'.format(time() - start_time))
print('Elapsed time: {} seconds.'.format(time() - start_time))
return done
2 changes: 1 addition & 1 deletion aus_senate_audit/senate_election/real_senate_election.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, seed, state, data_file_path, max_ballots=None):
self._data = sc.get_data(input_cls, '', contest_config, **data_options)

# Build remaining ticket data structure from tickets and randomly shuffle for sampling.
for ticket, weight in self._data.tickets_for_count:
for ticket, weight in sorted(self._data.tickets_for_count):
self.add_ballot(ticket, weight)

# Get candidate data.
Expand Down

0 comments on commit 0722acb

Please sign in to comment.