Multi-dimensional output data transposed
Whilst helping to debug Riccardo M's coupled cavity error signal issues, I discovered a problem with how 2+D data is stored.
Take the following example (detecting transmitted power from coupled cavity with common / differential length tunings):
ifo = finesse.Kat() ifo.parse(""" l L0 P=1 s s0 L0.p1 ITM.p1 m ITM R=0.99 T=0.01 s sc1 ITM.p2 CTM.p1 L=0.5 m CTM R=0.995 T=0.005 s sc2 CTM.p2 ETM.p1 L=0.5 m ETM R=0.99 T=0.01 phi=-&ITM.phi pd trns ETM.p2.o """) model = ifo.model analysis.x2axis( model.ITM.phi, -1, 1, 100, model.CTM.phi, -2, 2, 100, ).plot()
This gives the figure:
which is the transpose of what the result should be; see the Finesse 2 + PyKat version:
import pykat import matplotlib.pyplot as plt base = pykat.finesse.kat() base.verbose = False base.parse(""" l L0 1 0 n0 s s0 1 n0 nITM1 m ITM 0.99 0.01 0 nITM1 nITM2 s sc1 0.5 nITM2 nCTM1 m CTM 0.995 0.005 0 nCTM1 nCTM2 s sc2 0.5 nCTM2 nETM1 m ETM 0.99 0.01 0 nETM1 nETM2 pd trns nETM2 xaxis ITM phi lin -1 1 100 x2axis CTM phi lin -2 2 100 put ETM phi $mx1 """) out_pykat = base.run() plt.imshow(out_pykat['trns'], extent=[-1, 1, -2, 2], aspect='auto')
which gives the correct figure:
So essentially it looks like the
CTM detuning scan results are being stored in rows in the output matrix, whilst in PyKat they are stored in columns (i.e. the transpose of each other).
I'm not sure whether this is a general problem or case-specific yet though, as just transposing the output array in
ArraySolution.__getitem__ breaks lots of tests - maybe this transpose issue is corrected for somehow in the test script against Finesse 2 reference files? I've not looked into that yet.
Alternatively, maybe I'm just being stupid here and missing something...