Handle different number of angles for geoms
This commit is contained in:
parent
77d6f42e0d
commit
636badfba8
@ -32,7 +32,11 @@ 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])
|
||||||
chinu_ti.value = " ".join((ang_lims.get("chi") or ang_lims.get("nu"))[:2])
|
if len(ang_lims) == 3: # NB geom
|
||||||
|
chinu_ti.value = " ".join(ang_lims["nu"][:2])
|
||||||
|
phi_ti.value = ""
|
||||||
|
else: # len(ang_lims) == 4, BI geom
|
||||||
|
chinu_ti.value = " ".join(ang_lims["chi"][:2])
|
||||||
phi_ti.value = " ".join(ang_lims["phi"][:2])
|
phi_ti.value = " ".join(ang_lims["phi"][:2])
|
||||||
|
|
||||||
def geom_radiogroup_callback(_attr, _old, new):
|
def geom_radiogroup_callback(_attr, _old, new):
|
||||||
|
@ -76,15 +76,17 @@ def read_ang_limits(fileobj):
|
|||||||
def export_geom(path, ang_lims):
|
def export_geom(path, ang_lims):
|
||||||
if "chi" in ang_lims: # BI geometry
|
if "chi" in ang_lims: # BI geometry
|
||||||
default_file = get_zebraBI_default_geom_file()
|
default_file = get_zebraBI_default_geom_file()
|
||||||
|
n_ang = 4
|
||||||
else: # NB geometry
|
else: # NB geometry
|
||||||
default_file = get_zebraNB_default_geom_file()
|
default_file = get_zebraNB_default_geom_file()
|
||||||
|
n_ang = 3
|
||||||
|
|
||||||
with open(path, "w") as out_file:
|
with open(path, "w") as out_file:
|
||||||
for line in default_file:
|
for line in default_file:
|
||||||
out_file.write(line)
|
out_file.write(line)
|
||||||
|
|
||||||
if line.startswith("ANG_LIMITS"):
|
if line.startswith("ANG_LIMITS"):
|
||||||
for _ in range(4):
|
for _ in range(n_ang):
|
||||||
next_line = next(default_file)
|
next_line = next(default_file)
|
||||||
ang, _, _, _ = next_line.split()
|
ang, _, _, _ = next_line.split()
|
||||||
vals = ang_lims[ang.lower()]
|
vals = ang_lims[ang.lower()]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user