32def create_mapping0(fname):
33 golden_modules = []
34 module_file = open(fname, 'r')
35 module_data = module_file.read()
36 module_lines = module_data.splitlines()
37
38 for modules in module_lines:
39 modulename = ""
40 modules = modules.split()
41 if len(modules) != 0:
42 if modules[0] == "else" and modules[1] == "if":
43 geographicalID = modules[2].
split(
'"')
44 modulename = geographicalID[1]
45 elif modules[0] == "if":
46 geographicalID = modules[1].
split(
'"')
47 modulename = geographicalID[1]
48 if modulename:
49 golden_modules.append(modulename)
50
51 golden_hash = []
52 for modules in module_lines:
53 modulehash = ""
54 goldens = modules.split('=')
55 modules = modules.split()
56 if len(modules) != 0:
57 if modules[0] == "else" and modules[1] == "if":
58 golden_hashID =
" : " + goldens[3].
split(
';')[0]
60 golden_layer = goldens[5].
split(
';')[0].
strip()
63 modulehash = golden_hashID + " " + golden_bec + "," + golden_layer + "," + golden_phi + "," + golden_eta
64 elif modules[0] == "if":
65 golden_hashIds = modules[4].
split(
';')[0]
66 golden_bec = modules[5].
split(
'=')[1].
split(
';')[0]
67 golden_layer = modules[6].
split(
'=')[1].
split(
';')[0]
68 golden_phi = modules[8].
split(
';')[0]
70 if len(golden_hashIds) == 1:
71 golden_hashID = " : " + golden_hashIds
72 elif len(golden_hashIds) == 2:
73 golden_hashID = " : " + golden_hashIds
74 elif len(golden_hashIds) == 3:
75 golden_hashID = " : " + golden_hashIds
76 elif len(golden_hashIds) == 4:
77 golden_hashID = " : " + golden_hashIds
78 modulehash = golden_hashID + " " + golden_bec + "," + golden_layer + "," + golden_phi + "," + golden_eta
79 if modulehash:
80 golden_hash.append(modulehash)
81 return dict(zip(golden_modules, golden_hash))
82
83
84
85
86
87