# -*- coding: utf-8 -*-

try:
   import pyfits
except:
   from astropy.io import fits as pyfits
from numpy import *
from matplotlib.pyplot import *
import os
from matplotlib.colors import LogNorm

filename = "/data/1/2019-10-12/reduced/GRAVITY_PARALLEL_P2VM286_0050_p2vm.fits" # HIGH SPLIT
filename = "/data/1/2019-10-12/reduced/GRAVITY_PARALLEL_P2VM286_0063_p2vm.fits" # HIGH COMB

filename = "/data/1/2019-10-15/reduced/GRAVITY_PARALLEL_P2VM288_0044_p2vm.fits"

hdulist = pyfits.open(filename)
p2vm = hdulist['P2VM_SC'].data
transmission = p2vm["TRANSMISSION"]
shape = transmission.shape
transmission_im = transmission.reshape((shape[0]*shape[1],shape[2]))
coherence = p2vm["COHERENCE"]
shape = coherence.shape
coherence_im = coherence.reshape((shape[0]*shape[1],shape[2]))


figure("Transmission")
clf()
imshow(transmission_im, aspect='auto', vmin=0, vmax=4)#, norm=LogNorm())

figure("Coherence")
clf()
imshow(coherence_im, aspect='auto', vmin=0, vmax=6)#, norm=LogNorm())
