In [ ]:
## usual preamble
from cubical import param_db
import numpy as np
from pylab import *
%matplotlib inline

In [ ]:
db = param_db.load('D147-LO-NOIFS-NOPOL-4M5S.MS/gains-field-0')
print db.names()

In [ ]:
G = db['G:gain']
ax = G.ax
time, freq = G.grid[ax.time], G.grid[ax.freq]             # grid info
antennas = [ant for ant in G.grid[ax.ant] if G.is_slice_valid(ant=ant,corr1=0,corr2=0)]
corrs = G.grid[ax.corr1]

In [ ]:
figure(figsize=(20,2*len(antennas)))
S = slice(0,50)
for iant, ant in enumerate(antennas):
    for ic,(c1,c2) in enumerate([(0,0),(1,1),(0,1),(1,0)]):
        g, (t,f) = G.get_slice(ant=ant,corr1=c1,corr2=c2)
        if g is None:
            continue
        subplot(len(antennas),8,iant*8 + ic*2 + 1)
        imshow(abs(g[S]))
        title("{}:{}{} ampl".format(ant,c1,c2))
        if ic != 0:
            yticks([])
        if iant != len(antennas)-1:
            xticks([])
        subplot(len(antennas),8,iant*8 + ic*2 + 2)
        imshow(np.angle(g[S]))
        title("{}:{}{} phase".format(ant,c1,c2))
        yticks([])
        if iant != len(antennas)-1:
            xticks([])