NoiseProjectionSolution plotting interface
The noise projection example posted on the chat recently by @daniel-brown throws an error when run via the CLI:
l l1 P=0.1
bs bs1 R=0.01 T=0.99
readout_dc pd1
amplifier G -10M
butter A 4 lowpass 70
link(l1, bs1, pd1, G, A, l1.amp)
# out of loop witness sensor
readout_dc witness
link(bs1, witness)
noise laser_amp l1.amp.i 1m/&fsig
noise amplifier G.p2.o &G.gain*(0.2m/&fsig + 0.0001u*&fsig**2)
noise pd1_dark_noise pd1.DC.o 0.33n
noise_projection(
geomspace(1m, 10M, 1000),
witness.DC,
scaling=l1.amp
)
$ kat3 tmp.kat
Solution:
- Solution Tree
○ loop - NoiseProjectionSolution
Traceback (most recent call last):
File "/home/sean/Workspace/env/conda/envs/finesse3/bin/kat3", line 33, in <module>
sys.exit(load_entry_point('finesse', 'console_scripts', 'kat3')())
File "/home/sean/.local/lib/python3.9/site-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/home/sean/.local/lib/python3.9/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/home/sean/.local/lib/python3.9/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/sean/.local/lib/python3.9/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/sean/.local/lib/python3.9/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/sean/.local/lib/python3.9/site-packages/click/decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/sean/Workspace/Repositories/finesse3/src/finesse/cli/model.py", line 64, in run
solution.plot(show=plot)
TypeError: plot() got an unexpected keyword argument 'show'
This is caused by NoiseProjectionSolution.plot
not supporting the same signature as other solutions.
Perhaps we should have a Plottable
mixin for solutions that defines a common interface that all plot methods should share (with at least a show
argument, and maybe some other common ones), and solutions can override this to add their own specific stuff if they like?