`unparse` does not include `phase_level`
Summary
the value of phase_level
(and correspondingly the value of zero_k00
) is not included when users run unparse
. This missing useful
information if the user is using unparse
to debug. Additionally, if a user uses unparse
to save a katscript to file, the next time it is loaded in it will get the default phase level (3) rather than whatever the user value was, potentially changing results.
MWE
Behaviour with version 3.0a6.dev64+g3336a5a2
#original Gaussian model with phase level over-ridden to level 2 (zero_k00=False)
model = finesse.Model()
model.parse(
"""
l L0
m m1 R=0 T=1 Rc=1
link(L0,m1)
gauss qin L0.p1.o w0=1e-3 z=0
modes(maxtem=0)
"""
)
model.phase_level = 2
print(model.phase_level,model._settings.phase_config.zero_k00)
#unparse the model (as we would use to save the katscript to an external file)
#then re-parse it in as a new object
new_model = finesse.Model()
new_model.parse(model.unparse())
print(new_model.phase_level, new_model._settings.phase_config.zero_k00) #phase level is not retained by unparse
returns
regeneration of original KatScript for nonsingular commands not implemented yet
2 False
3 True
Edited by Anna G