;+
; NAME:
;           eis_pixel_to_wavelength
;
; PROJECT:
;           SolarB EIS
;
; PURPOSE:
;           Function to calculate the properties of a line window - defined
;           by a central wavelength. These include;
;               p0   - central pixel
;               p1   - lower pixel node
;               p2   - upper pixel node
;               ccd  - 1/2 if CCD1 or CCD2
;               quad -
;               w1   -
;               w2   -
;
; CATEGORY:
;           EIS Technical Planning
;
; INPUTS:
;           line  - an "eis_line" structure
;           width - window width
;           slit_ind  - index of the EIS slit (0-1", 1-250", 2-2", 3-40")
;
; HISTORY:
;          V0 Written by: John Rainnie, RAL
;               j.rainnie@rl.ac.uk (Dec 2005)
;          v0.2 added SLIT_IND input, Peter Young, 12-Jan-2007
;          v0.3 JAR 02-Dec-2008
;               Added TIME keyword
;
;-
;______________________________________________________________________________
FUNCTION eis_pixel_to_wavelength , pixel , ccd, slit_ind , time = time

; Convert wavelengths to pixels
coeffs = eis_get_ccd_translation(slit_ind , time = time)



IF (ccd EQ 1) THEN BEGIN        ; Short-wavelength

    a0 = coeffs[0].a0
    a1 = coeffs[0].a1
    a2 = coeffs[0].a2

    new_pixel = pixel + 50.


ENDIF ELSE BEGIN

    a0 = coeffs[1].a0
    a1 = coeffs[1].a1
    a2 = coeffs[1].a2

    new_pixel = pixel + 2198.


ENDELSE


    wave      = a0 + (a1 * new_pixel) + (a2 * new_pixel^2)

RETURN , wave


END
