9 parser = argparse.ArgumentParser(description=
"Converter from geometry dat file to json")
13 help=
"Input .dat file",
14 default=
"geometry.dat"
18 help=
"Output .json file",
20 default=
"geometry.json",
23 args = parser.parse_args()
26 with open(args.infile)
as f:
32 bec, ld, phi, eta, side, ID = l.split()[2:8]
33 data[ID] = {
"BEC" : bec,
"LayerDisk" : ld,
"PhiModule" : phi,
"EtaModule" : eta,
"Side" : side }
35 with open(args.outfile,
"w")
as f:
36 json.dump(data, f, indent = 4)