#! /usr/bin/env python
from __future__ import print_function, division
import numpy as np
from scipy.interpolate import InterpolatedUnivariateSpline as splineFunc

"""using WFC3 focus data to calculate the focus for tinytim modeling
"""
def exposureFocus(MJD0):
    """
    the function
    """
    focus = -0.24
    MJD, focus = np.loadtxt('focus.dat', usecols = (0, 5), unpack = True)
    import matplotlib.pyplot as plt
    spline = splineFunc(MJD, focus)
    newMJD = np.linspace(min(MJD), max(MJD), 100*len(MJD))
    newFocus = spline(newMJD)
    plt.plot(MJD, focus, '+')
    plt.plot(newMJD, newFocus)
    
if __name__ == '__main__':
    exposureFocus(0)