pro read_mariska, raster, lambda, image, trace_image, dir = dir, file = file
;
; reads Mariska's EIS simulated data.
; The raster position is given as input, and wavelength scale and 
; data for that raster position is output. 
; dir (directory where data are located) is optional
; trace_image is the original trace image from which the eis data where constructed
;
; Filename is optional
;
; 02.10.2002 Oivind Wikstol.
;
  if n_params() ne 4 then begin
    print,'usage: read_mariska, raster, lambda, image, trace_image, dir = dir, file = file'
    return
  endif

  if n_elements(dir) eq 0 then $
    dir = '/mn/arcturus/u1/oivindw/solarb/data/eis/trace_sim/'
  if n_elements(file) eq 0 then file = 'deta01.dat'

    trace_image = fltarr(512, 512)
    openu, lu, dir+'trace_image.dat', /get_lun
    readu, lu, trace_image
    close, lu

  openr, lu, dir+file, /get_lun
  data =  assoc(lu,uintarr(2048,512))
  
  image = data[raster]

  ; Determine which detector the data are from: 
  ; This assumes a file naming convention where the 4th caracter in the 
  ; file name is teh detector
  detector = strupcase(strmid(file, 3, 1))

  lambda = eis_testdat_wave(det = detector)
  close,lu

end
