Ignore comments in geom and cfl files

This commit is contained in:
usov_i 2022-04-11 16:04:10 +02:00
parent fbce5de7b9
commit 4ee1f6fb70

View File

@ -97,6 +97,9 @@ def read_geom_file(fileobj):
# read angular limits
for line in fileobj:
if "!" in line: # remove comments that start with ! sign
line, _ = line.split(sep="!", maxsplit=1)
if not line or line.isspace():
break
@ -162,6 +165,9 @@ def read_cfl_file(fileobj):
params = {"SPGR": None, "CELL": None, "WAVE": None, "UBMAT": None, "HLIM": None, "SRANG": None}
param_names = tuple(params)
for line in fileobj:
if "!" in line: # remove comments that start with ! sign
line, _ = line.split(sep="!", maxsplit=1)
if line.startswith(param_names):
if line.startswith("UBMAT"): # next 3 lines contain the matrix
param, val = "UBMAT", []