Spelling utilities

This commit is contained in:
Emilia Allison 2024-10-22 16:21:00 -05:00
parent 2a6ced1251
commit 63925ec0ba
Signed by: emilia
GPG Key ID: 05D5D1107E5100A1
6 changed files with 374 additions and 0 deletions

65
sample_inputs/E.csv Executable file
View File

@ -0,0 +1,65 @@
SrcWell,DestWell,XferVol
A1,A1,2.5
A2,A2,2.5
B1,B1,2.5
B2,B2,2.5
C1,C1,2.5
C2,C2,2.5
D1,D1,2.5
D2,D2,2.5
E1,E1,2.5
E2,E2,2.5
F1,F1,2.5
F2,F2,2.5
G1,G1,2.5
G2,G2,2.5
H1,H1,2.5
H2,H2,2.5
A6,A1,2.5
A7,A2,2.5
B6,B1,2.5
B7,B2,2.5
C6,C1,2.5
C7,C2,2.5
D6,D1,2.5
D7,D2,2.5
E6,E1,2.5
E7,E2,2.5
F6,F1,2.5
F7,F2,2.5
G6,G1,2.5
G7,G2,2.5
H6,H1,2.5
H7,H2,2.5
A11,A1,2.5
A12,A2,2.5
B11,B1,2.5
B12,B2,2.5
C11,C1,2.5
C12,C2,2.5
D11,D1,2.5
D12,D2,2.5
E11,E1,2.5
E12,E2,2.5
F11,F1,2.5
F12,F2,2.5
G11,G1,2.5
G12,G2,2.5
H11,H1,2.5
H12,H2,2.5
G3,A1,2.5
G4,A2,2.5
G5,A3,2.5
G6,A4,2.5
G7,A5,2.5
G8,A6,2.5
G9,A7,2.5
G10,A8,2.5
H3,B1,2.5
H4,B2,2.5
H5,B3,2.5
H6,B4,2.5
H7,B5,2.5
H8,B6,2.5
H9,B7,2.5
H10,B8,2.5
1 SrcWell DestWell XferVol
2 A1 A1 2.5
3 A2 A2 2.5
4 B1 B1 2.5
5 B2 B2 2.5
6 C1 C1 2.5
7 C2 C2 2.5
8 D1 D1 2.5
9 D2 D2 2.5
10 E1 E1 2.5
11 E2 E2 2.5
12 F1 F1 2.5
13 F2 F2 2.5
14 G1 G1 2.5
15 G2 G2 2.5
16 H1 H1 2.5
17 H2 H2 2.5
18 A6 A1 2.5
19 A7 A2 2.5
20 B6 B1 2.5
21 B7 B2 2.5
22 C6 C1 2.5
23 C7 C2 2.5
24 D6 D1 2.5
25 D7 D2 2.5
26 E6 E1 2.5
27 E7 E2 2.5
28 F6 F1 2.5
29 F7 F2 2.5
30 G6 G1 2.5
31 G7 G2 2.5
32 H6 H1 2.5
33 H7 H2 2.5
34 A11 A1 2.5
35 A12 A2 2.5
36 B11 B1 2.5
37 B12 B2 2.5
38 C11 C1 2.5
39 C12 C2 2.5
40 D11 D1 2.5
41 D12 D2 2.5
42 E11 E1 2.5
43 E12 E2 2.5
44 F11 F1 2.5
45 F12 F2 2.5
46 G11 G1 2.5
47 G12 G2 2.5
48 H11 H1 2.5
49 H12 H2 2.5
50 G3 A1 2.5
51 G4 A2 2.5
52 G5 A3 2.5
53 G6 A4 2.5
54 G7 A5 2.5
55 G8 A6 2.5
56 G9 A7 2.5
57 G10 A8 2.5
58 H3 B1 2.5
59 H4 B2 2.5
60 H5 B3 2.5
61 H6 B4 2.5
62 H7 B5 2.5
63 H8 B6 2.5
64 H9 B7 2.5
65 H10 B8 2.5

57
sample_inputs/H.csv Executable file
View File

@ -0,0 +1,57 @@
SrcWell,DestWell,XferVol
A1,A1,2.5
A2,A2,2.5
A3,A3,2.5
A4,A4,2.5
A5,A5,2.5
A6,A6,2.5
A7,A7,2.5
A8,A8,2.5
A9,A9,2.5
A10,A10,2.5
A11,A11,2.5
A12,A12,2.5
B1,B1,2.5
B2,B2,2.5
B3,B3,2.5
B4,B4,2.5
B5,B5,2.5
B6,B6,2.5
B7,B7,2.5
B8,B8,2.5
B9,B9,2.5
B10,B10,2.5
B11,B11,2.5
B12,B12,2.5
G1,A1,2.5
G2,A2,2.5
G3,A3,2.5
G4,A4,2.5
G5,A5,2.5
G6,A6,2.5
G7,A7,2.5
G8,A8,2.5
G9,A9,2.5
G10,A10,2.5
G11,A11,2.5
G12,A12,2.5
H1,B1,2.5
H2,B2,2.5
H3,B3,2.5
H4,B4,2.5
H5,B5,2.5
H6,B6,2.5
H7,B7,2.5
H8,B8,2.5
H9,B9,2.5
H10,B10,2.5
H11,B11,2.5
H12,B12,2.5
C6,A1,2.5
C7,A2,2.5
D6,B1,2.5
D7,B2,2.5
E6,C1,2.5
E7,C2,2.5
F6,D1,2.5
F7,D2,2.5
1 SrcWell DestWell XferVol
2 A1 A1 2.5
3 A2 A2 2.5
4 A3 A3 2.5
5 A4 A4 2.5
6 A5 A5 2.5
7 A6 A6 2.5
8 A7 A7 2.5
9 A8 A8 2.5
10 A9 A9 2.5
11 A10 A10 2.5
12 A11 A11 2.5
13 A12 A12 2.5
14 B1 B1 2.5
15 B2 B2 2.5
16 B3 B3 2.5
17 B4 B4 2.5
18 B5 B5 2.5
19 B6 B6 2.5
20 B7 B7 2.5
21 B8 B8 2.5
22 B9 B9 2.5
23 B10 B10 2.5
24 B11 B11 2.5
25 B12 B12 2.5
26 G1 A1 2.5
27 G2 A2 2.5
28 G3 A3 2.5
29 G4 A4 2.5
30 G5 A5 2.5
31 G6 A6 2.5
32 G7 A7 2.5
33 G8 A8 2.5
34 G9 A9 2.5
35 G10 A10 2.5
36 G11 A11 2.5
37 G12 A12 2.5
38 H1 B1 2.5
39 H2 B2 2.5
40 H3 B3 2.5
41 H4 B4 2.5
42 H5 B5 2.5
43 H6 B6 2.5
44 H7 B7 2.5
45 H8 B8 2.5
46 H9 B9 2.5
47 H10 B10 2.5
48 H11 B11 2.5
49 H12 B12 2.5
50 C6 A1 2.5
51 C7 A2 2.5
52 D6 B1 2.5
53 D7 B2 2.5
54 E6 C1 2.5
55 E7 C2 2.5
56 F6 D1 2.5
57 F7 D2 2.5

65
sample_inputs/O.csv Executable file
View File

@ -0,0 +1,65 @@
SrcWell,DestWell,XferVol
A1,A1,2.5
A2,A2,2.5
B1,B1,2.5
B2,B2,2.5
C1,C1,2.5
C2,C2,2.5
D1,D1,2.5
D2,D2,2.5
E1,E1,2.5
E2,E2,2.5
F1,F1,2.5
F2,F2,2.5
G1,G1,2.5
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G8 A8 2.5
10 G9 A9 2.5
11 G10 A10 2.5
12 G11 A11 2.5
13 G12 A12 2.5
14 H1 B1 2.5
15 H2 B2 2.5
16 H3 B3 2.5
17 H4 B4 2.5
18 H5 B5 2.5
19 H6 B6 2.5
20 H7 B7 2.5
21 H8 B8 2.5
22 H9 B9 2.5
23 H10 B10 2.5
24 H11 B11 2.5
25 H12 B12 2.5
26 A1 A1 2.5
27 A2 A2 2.5
28 B1 B1 2.5
29 B2 B2 2.5
30 C1 C1 2.5
31 C2 C2 2.5
32 D1 D1 2.5
33 D2 D2 2.5
34 E1 E1 2.5
35 E2 E2 2.5
36 F1 F1 2.5
37 F2 F2 2.5
38 A3 A1 2.5
39 A4 A2 2.5
40 B3 B1 2.5
41 B4 B2 2.5
42 C5 A1 2.5
43 C6 A2 2.5
44 D5 B1 2.5
45 D6 B2 2.5
46 E5 C1 2.5
47 E6 C2 2.5
48 F5 D1 2.5
49 F6 D2 2.5
50 B7 A1 2.5
51 B8 A2 2.5
52 B9 A3 2.5
53 B10 A4 2.5
54 B11 A5 2.5
55 B12 A6 2.5
56 C7 B1 2.5
57 C8 B2 2.5
58 C9 B3 2.5
59 C10 B4 2.5
60 C11 B5 2.5
61 C12 B6 2.5

61
sample_inputs/S.csv Executable file
View File

@ -0,0 +1,61 @@
SrcWell,DestWell,XferVol
A1,A1,2.5
A2,A2,2.5
B1,B1,2.5
B2,B2,2.5
C1,C1,2.5
C2,C2,2.5
D1,D1,2.5
D2,D2,2.5
E1,E1,2.5
E2,E2,2.5
F1,F1,2.5
F2,F2,2.5
G1,G1,2.5
G2,G2,2.5
H1,H1,2.5
H2,H2,2.5
A6,A1,2.5
A7,A2,2.5
B6,B1,2.5
B7,B2,2.5
C6,C1,2.5
C7,C2,2.5
D6,D1,2.5
D7,D2,2.5
E6,E1,2.5
E7,E2,2.5
F6,F1,2.5
F7,F2,2.5
G6,G1,2.5
G7,G2,2.5
H6,H1,2.5
H7,H2,2.5
A11,A1,2.5
A12,A2,2.5
B11,B1,2.5
B12,B2,2.5
C11,C1,2.5
C12,C2,2.5
D11,D1,2.5
D12,D2,2.5
E11,E1,2.5
E12,E2,2.5
F11,F1,2.5
F12,F2,2.5
G11,G1,2.5
G12,G2,2.5
H11,H1,2.5
H12,H2,2.5
G3,A1,2.5
G4,A2,2.5
G5,A3,2.5
H3,B1,2.5
H4,B2,2.5
H5,B3,2.5
A8,A1,2.5
A9,A2,2.5
A10,A3,2.5
B8,B1,2.5
B9,B2,2.5
B10,B3,2.5
1 SrcWell DestWell XferVol
2 A1 A1 2.5
3 A2 A2 2.5
4 B1 B1 2.5
5 B2 B2 2.5
6 C1 C1 2.5
7 C2 C2 2.5
8 D1 D1 2.5
9 D2 D2 2.5
10 E1 E1 2.5
11 E2 E2 2.5
12 F1 F1 2.5
13 F2 F2 2.5
14 G1 G1 2.5
15 G2 G2 2.5
16 H1 H1 2.5
17 H2 H2 2.5
18 A6 A1 2.5
19 A7 A2 2.5
20 B6 B1 2.5
21 B7 B2 2.5
22 C6 C1 2.5
23 C7 C2 2.5
24 D6 D1 2.5
25 D7 D2 2.5
26 E6 E1 2.5
27 E7 E2 2.5
28 F6 F1 2.5
29 F7 F2 2.5
30 G6 G1 2.5
31 G7 G2 2.5
32 H6 H1 2.5
33 H7 H2 2.5
34 A11 A1 2.5
35 A12 A2 2.5
36 B11 B1 2.5
37 B12 B2 2.5
38 C11 C1 2.5
39 C12 C2 2.5
40 D11 D1 2.5
41 D12 D2 2.5
42 E11 E1 2.5
43 E12 E2 2.5
44 F11 F1 2.5
45 F12 F2 2.5
46 G11 G1 2.5
47 G12 G2 2.5
48 H11 H1 2.5
49 H12 H2 2.5
50 G3 A1 2.5
51 G4 A2 2.5
52 G5 A3 2.5
53 H3 B1 2.5
54 H4 B2 2.5
55 H5 B3 2.5
56 A8 A1 2.5
57 A9 A2 2.5
58 A10 A3 2.5
59 B8 B1 2.5
60 B9 B2 2.5
61 B10 B3 2.5

View File

@ -0,0 +1,65 @@
import json
from sys import argv
from os import path, kill
from dataclasses import dataclass
@dataclass(frozen=True)
class Location:
row: int
col: int
def main():
input_file = argv[1]
output_file = argv[2]
if not test_file(input_file):
print("Input file does not exist")
kill(1)
if test_file(output_file):
print("Output file already exists")
kill(1)
locations = read_input_csv_to_wells(input_file)
json_obj = tubes_to_tubes_json(locations)
with open(output_file, 'w') as file:
json.dump(json_obj, file)
def read_input_csv_to_wells(p: str) -> [Location]:
with open(p, 'r') as file:
lines = file.readlines()
# Assume 96w format only
def get_first_col(line): return line.split(',')[0]
def get_row(x): return ord(x.upper()) - 64
def get_row_col(line: str) -> Location:
col = get_first_col(line)[1:]
row = get_row(get_first_col(line)[0])
return Location(row, int(col))
return list(set([get_row_col(line) for line in lines[1:]]))
def tubes_to_tubes_json(i: [Location]) -> dict:
target_positions_list = []
for tube in i:
target_positions_list.append((tube.row - 1) * 12
+ tube.col)
output_obj = {}
output_obj["TargetPositions"] = [{"PositionIndex": p}
for p in target_positions_list]
return output_obj
def test_file(p: str) -> bool:
return path.exists(p) and path.isfile(p)
if __name__ == "__main__":
main()