-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen-fake-data.py
38 lines (33 loc) · 1.22 KB
/
gen-fake-data.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import sys
import random
def get_array_indices_matching_given_val(arr, val):
return [i for i, arr_val in enumerate(arr) if arr_val == val]
def assign_random_reviewer_among_min_count(counts):
min_count = min(counts)
indices = get_array_indices_matching_given_val(counts, min_count)
index = random.choice(indices)
counts[index] += 1 # this person's review count just went up by one
return index
def get_reviewers(n_papers, n_people, fname):
with open(fname, 'w') as f:
line = 'Submission ID,Withdrawn,Primary,Secondary,Second Secondary\n'
f.write(line)
counts = [0 for i in range(n_people)]
for i in range(n_papers):
r1 = assign_random_reviewer_among_min_count(counts)
r2 = assign_random_reviewer_among_min_count(counts)
line = f'p{i},False,r{r1},r{r2},\n'
f.write(line)
print(f'wrote {fname} with reviewer counts: {counts}')
def main():
n_papers = 1000
n_people = 100
fname = 'fake-data.csv'
if len(sys.argv) > 1:
n_papers = int(sys.argv[1])
if len(sys.argv) > 2:
n_people = int(sys.argv[2])
if len(sys.argv) > 3:
fname = sys.argv[3]
get_reviewers(n_papers, n_people, fname)
main()