Evaluate symbolic references in symbol table
Fixes: #628 (closed)
This mr adds a way to force evaluation of symbolics in a ModelElement.info()
table. I don't particularly understand the dof
command, so I am not sure whether this is what you would want.
Examples
Single parameter
import finesse
kat = finesse.Model()
kat.parse(
"""
m m1 R=0.99 T=0.01
m m2 R=m1.R T=m1.T
"""
)
print(kat.m1.R)
print(kat.m2.R)
kat.m2.R.eval_string = True # new attribute added in this MR to Parameter class
print(kat.m2.R)
Output
0.99
m1.R
0.99
Info table
import finesse
kat = finesse.Model()
kat.parse(
"""
m m1 R=0.99 T=0.01
m m2 R=0.991 T=0.009
# degrees of freedom
dof dof1 m1.phi +1
dof dof2 m2.phi +1
"""
)
print(kat.m1.info())
print(kat.m1.info(eval_refs=True))
Outputs
Mirror m1
Parameters:
┌─────────────────────────────────────────────────────────┬─────────────────┐
│ Description │ Value │
╞═════════════════════════════════════════════════════════╪═════════════════╡
│ Reflectivity │ 0.99 │
├─────────────────────────────────────────────────────────┼─────────────────┤
│ Transmission │ 0.01 │
├─────────────────────────────────────────────────────────┼─────────────────┤
│ Loss │ 0.0 │
├─────────────────────────────────────────────────────────┼─────────────────┤
│ Microscopic tuning (360 degrees = 1 default wavelength) │ dof1.DC degrees │
├─────────────────────────────────────────────────────────┼─────────────────┤
│ Radius of curvature (x) │ inf m │
├─────────────────────────────────────────────────────────┼─────────────────┤
│ Radius of curvature (y) │ inf m │
├─────────────────────────────────────────────────────────┼─────────────────┤
│ Yaw misalignment │ 0.0 radians │
├─────────────────────────────────────────────────────────┼─────────────────┤
│ Pitch misalignment │ 0.0 radians │
├─────────────────────────────────────────────────────────┼─────────────────┤
│ Misaligns mirror reflection (R=0 when True) │ False │
└─────────────────────────────────────────────────────────┴─────────────────┘
Mirror m1
Parameters:
┌─────────────────────────────────────────────────────────┬─────────────┐
│ Description │ Value │
╞═════════════════════════════════════════════════════════╪═════════════╡
│ Reflectivity │ 0.99 │
├─────────────────────────────────────────────────────────┼─────────────┤
│ Transmission │ 0.01 │
├─────────────────────────────────────────────────────────┼─────────────┤
│ Loss │ 0.0 │
├─────────────────────────────────────────────────────────┼─────────────┤
│ Microscopic tuning (360 degrees = 1 default wavelength) │ 0.0 degrees │
├─────────────────────────────────────────────────────────┼─────────────┤
│ Radius of curvature (x) │ inf m │
├─────────────────────────────────────────────────────────┼─────────────┤
│ Radius of curvature (y) │ inf m │
├─────────────────────────────────────────────────────────┼─────────────┤
│ Yaw misalignment │ 0.0 radians │
├─────────────────────────────────────────────────────────┼─────────────┤
│ Pitch misalignment │ 0.0 radians │
├─────────────────────────────────────────────────────────┼─────────────┤
│ Misaligns mirror reflection (R=0 when True) │ False │
└─────────────────────────────────────────────────────────┴─────────────┘
Edited by Miron van der Kolk