# -*- 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_FLAT286_0057_flat.fits" # HIGH COMB
filename = "/data/1/2019-10-12/reduced/GRAVITY_PARALLEL_FLAT286_0044_flat.fits" # HIGH SPLIT
filename = "/data/1/2019-10-14/reduced/GRAVITY_PARALLEL_FLAT287_0018_flat.fits" # HIGH SPLIT
filename = "/data/1/2019-10-15/reduced/GRAVITY_PARALLEL_FLAT288_0038_flat.fits"
filename = "/data/1/2019-10-15/reduced/GRAVITY_PARALLEL_FLAT288_0051_flat.fits"
filename = "/data/1/2019-10-15/reduced/GRAVITY_PARALLEL_FLAT288_0002_flat.fits"

hdulist = pyfits.open(filename)
profile = hdulist['PROFILE_PARAMS'].data
centery = profile["CENTERY"].T
width = profile["WIDTH"].T
flat = hdulist['IMAGING_DATA_SC'].data[0]

figure("flat")
clf()
imshow(flat, cmap="gray", norm=LogNorm())
plot(centery)

figure("centerY")
clf()
plot(centery)

figure("width")
clf()
plot(width)
