Error parsing bp and cavity detectors
I've not checked since which commit this has broken, but I suspect it's as of !33 (merged) being merged since that changed a lot of parser stuff.
Anyway, here is a small example:
import finesse
finesse.configure(plotting=True)
model = finesse.Model()
model.parse(
"""
l L0 P=1
s s0 L0.p1 ITM.p1 L=1
m ITM R=0.9 T=0.1 Rc=-2.5
s CAV ITM.p2 ETM.p1 L=1
m ETM R=0.99 T=0.01 Rc=2.5
cav FP ITM.p2.o ITM.p2.i
#cp cav_w FP w
bp cav_w w ITM.p2.o
xaxis CAV.L lin 1 6 100
"""
)
out = model.run()
out.plot()
Which results in the following error (same when cp
line gets uncommented too):
Traceback (most recent call last):
File "/home/sam/Documents/phd/finesse_development/src/finesse/script/builder.py", line 134, in _build
statement = parser.ast.nodes[node_name]["statement"]
KeyError: 'statement'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "playground/homs/roc_scan_nomatrix.py", line 22, in <module>
"""
File "/home/sam/Documents/phd/finesse_development/src/finesse/model.py", line 1310, in parse
parse(text, model=self)
File "/home/sam/Documents/phd/finesse_development/src/finesse/script/__init__.py", line 26, in parse
return parser.parse(text, model=model)
File "/home/sam/Documents/phd/finesse_development/src/finesse/script/base.py", line 46, in parse
return self._build(self._parse(text), model, **kwargs)
File "/home/sam/Documents/phd/finesse_development/src/finesse/script/builder.py", line 140, in _build
raise KatReferenceError(node_name, model) from e
finesse.script.exceptions.KatReferenceError:
'w' does not exist in the model (trying to access 'None' in <finesse.model.Model object at 0x7fb3dbb734e0>)