From 4ee1f6fb705c90d051a665cd8e7a39fa1678d917 Mon Sep 17 00:00:00 2001 From: Ivan Usov Date: Mon, 11 Apr 2022 16:04:10 +0200 Subject: [PATCH] Ignore comments in geom and cfl files --- pyzebra/sxtal_refgen.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pyzebra/sxtal_refgen.py b/pyzebra/sxtal_refgen.py index 9e2624f..2de5660 100644 --- a/pyzebra/sxtal_refgen.py +++ b/pyzebra/sxtal_refgen.py @@ -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", []