Save geometry in ang_lims
This commit is contained in:
parent
39b2af60ca
commit
e2220760f0
@ -34,10 +34,10 @@ def create():
|
|||||||
def _update_ang_lims(ang_lims):
|
def _update_ang_lims(ang_lims):
|
||||||
sttgamma_ti.value = " ".join(ang_lims["gamma"][:2])
|
sttgamma_ti.value = " ".join(ang_lims["gamma"][:2])
|
||||||
omega_ti.value = " ".join(ang_lims["omega"][:2])
|
omega_ti.value = " ".join(ang_lims["omega"][:2])
|
||||||
if len(ang_lims) == 3: # NB geom
|
if ang_lims["geom"] == "nb":
|
||||||
chinu_ti.value = " ".join(ang_lims["nu"][:2])
|
chinu_ti.value = " ".join(ang_lims["nu"][:2])
|
||||||
phi_ti.value = ""
|
phi_ti.value = ""
|
||||||
else: # len(ang_lims) == 4, BI geom
|
else: # ang_lims["geom"] == "bi"
|
||||||
chinu_ti.value = " ".join(ang_lims["chi"][:2])
|
chinu_ti.value = " ".join(ang_lims["chi"][:2])
|
||||||
phi_ti.value = " ".join(ang_lims["phi"][:2])
|
phi_ti.value = " ".join(ang_lims["phi"][:2])
|
||||||
|
|
||||||
|
@ -90,16 +90,20 @@ def get_zebra_default_cfl_file():
|
|||||||
|
|
||||||
def read_geom_file(fileobj):
|
def read_geom_file(fileobj):
|
||||||
ang_lims = dict()
|
ang_lims = dict()
|
||||||
# locate angular limits in .geom text file
|
|
||||||
for line in fileobj:
|
|
||||||
if line.startswith("ANG_LIMITS"):
|
|
||||||
break
|
|
||||||
|
|
||||||
# read angular limits
|
|
||||||
for line in fileobj:
|
for line in fileobj:
|
||||||
if "!" in line: # remove comments that start with ! sign
|
if "!" in line: # remove comments that start with ! sign
|
||||||
line, _ = line.split(sep="!", maxsplit=1)
|
line, _ = line.split(sep="!", maxsplit=1)
|
||||||
|
|
||||||
|
if line.startswith("GEOM"):
|
||||||
|
_, val = line.split(maxsplit=1)
|
||||||
|
if val.startswith("2"):
|
||||||
|
ang_lims["geom"] = "bi"
|
||||||
|
else: # val.startswith("3")
|
||||||
|
ang_lims["geom"] = "nb"
|
||||||
|
|
||||||
|
elif line.startswith("ANG_LIMITS"):
|
||||||
|
# read angular limits
|
||||||
|
for line in fileobj:
|
||||||
if not line or line.isspace():
|
if not line or line.isspace():
|
||||||
break
|
break
|
||||||
|
|
||||||
@ -110,10 +114,10 @@ def read_geom_file(fileobj):
|
|||||||
|
|
||||||
|
|
||||||
def export_geom_file(path, ang_lims, template=None):
|
def export_geom_file(path, ang_lims, template=None):
|
||||||
if "chi" in ang_lims: # BI geometry
|
if ang_lims["geom"] == "bi":
|
||||||
template_file = get_zebraBI_default_geom_file()
|
template_file = get_zebraBI_default_geom_file()
|
||||||
n_ang = 4
|
n_ang = 4
|
||||||
else: # NB geometry
|
else: # ang_lims["geom"] == "nb"
|
||||||
template_file = get_zebraNB_default_geom_file()
|
template_file = get_zebraNB_default_geom_file()
|
||||||
n_ang = 3
|
n_ang = 3
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user