; $Id$
;
; Create the minima depth plot

; Read data

read_tab, 'minima-p.dat', 0, dp
read_tab, 'minima-s.dat', 0, ds

t = dp[0,*] - 2454416.5D0

dmagp = dp[4,*]-dp[6,*]
dmagp_lo = dmagp+dp[5,*]
dmagp_hi = dmagp-dp[5,*]

dmags = ds[4,*]-ds[6,*]+0.04
dmags_lo = dmags+ds[5,*]
dmags_hi = dmags-ds[5,*]

; Do the plot

xs = 8.5
ys = 5.2

SET_PLOT, 'ps'
DEVICE, FILENAME='fig_minima.eps', /ENCAPSULATED, $
        XSIZE=xs, YSIZE=ys

!P.CHARSIZE=0.8
!P.FONT=0

common tick_formats, tick_format_x, tick_format_y, tick_format_z

tick_format_x = '(I0)'
tick_format_y = '(F5.3)'

x_0 = 1000
y_0 = 900

dx = 7000
dy = 4000

setwin, dx, dy, x_0, y_0, 250

USERSYM, [0,1,0,-1,0], [-1,0,1,0,-1], /FILL

PLOT, t, dmagp, $
      XRANGE=[0,23], $
      YRANGE=[0.071,0.061], $
      XSTYLE=1, YSTYLE=1, $
      XTICKFORMAT='fonttick', YTICKFORMAT='fonttick', $
      XTITLE='xt', $
      YTITLE='yt', $
      PSYM=-8
ERRPLOT, t, dmagp_lo, dmagp_hi

USERSYM, [0,1,0,-1,0], [-1,0,1,0,-1]

OPLOT, t[0:6], dmags[0:6], PSYM=-4
ERRPLOT, t[0:6], dmags_lo[0:6], dmags_hi[0:6]

OPLOT, t[8:16], dmags[8:16], PSYM=-4
ERRPLOT, t[8:16], dmags_lo[8:16], dmags_hi[8:16]

DEVICE, /CLOSE

; Fix up axis labels

latexify, 'fig_minima.eps', $
          ['xt','yt'], $
          ['$t$ (HJD) - 2454416.5', '$\Delta m_{\rm p},\quad \Delta m_{\rm s}+0.04$ (mag)'], [0.9,0.9], width=xs
