;+
; NAME:
;       EIS_AUX__DEFINE
;
; PURPOSE:
;       Defines the class EIS_AUX, the class for auxiliary
;       objects for EIS data. The EIS_AUX class inherits the HW_AUX
;       superclass. For a complete description of the contents of the
;       instance data of the AUX objects, see HW_AUX__DEFINE. The
;       EIS_AUX class has no self defined parameters other than the
;       ones inhereted from HW_AUX. All methods are also inhereted,
;       except the init-method, that fill the instance data with the
;       EIS specific contents.
;
; CATEGORY:
;       Hansteen/Wikstol Data analysis SW
;
; CALLING SEQUENCE:
;         eis_aux = obj_new('eis_aux'). The init method is
;         automatically run when the object is declared, and all the
;         objects parameters are set there.
;
; INPUTS:
;       None
;
; KEYWORD PARAMETERS:
;
; OUTPUTS:
;       See HW_AUX__DEFINE for a description of the object's instance
;       data.
;
; CALLS:
;
; COMMON BLOCKS:
;
; PROCEDURE:
;       Defines the EIS_AUX object and fille the parameters (instance
;       data) of the object in the init-method.
;
; RESTRICTIONS:
;
; MODIFICATION HISTORY:
;       XX-Aug-2001: Viggo Hansteen
;       01-Oct-2001: Oivind Wikstol - Added documentation.
;       02-Sep-2002: Oivind Wikstol - Modified structure of menu system
;       20-Apr-2004: Oivind Wikstol - Added funtions to change wavl. 
;                                     scale [pix/Angstr.]
;       17-Nov-2006: Viggo Hansteen - Added filename parameter to init method.
;       10-Feb-2007: Viggo Hansteen - Added help mehtods.
;       17-Jan-2008: A. Gardini     - Added the moments' units.
;        4-Jul-2008: A. Gardini     - Added HELP and INIT_AUX_METHODS.
;       23-Sep-2008: A. Gardini     - Added error variable names and units.
;
; $Id: eis_aux__define.pro 405 2010-07-04 11:21:38Z viggoh $
;-
function eis_aux::init,filename
  self->init_aux_methods ; initialization of the help method
  self.help=obj_new('hw_help')
  if n_elements(filename) eq 0 then filename=''
  self.filename=filename
  filename=strsplit(filename,path_sep(),/extract)
  self.title=filename[n_elements(filename)-1]
  self.variablename=['Intensity', 'Velocity','Line width',$
                     'Int. error', 'Vel. error']
  self.units=['erg/cm!e2!N/s/sr', 'km/s', ' (FWHM)  m'+string(197b),$
              'erg/cm!e2!N/s/sr', 'km/s']
  self.wscale='pixels'
;  self.wscale=string("305B)
  self->setxytitle,wscale=self.wscale
;  self.xytitle=['Wavelength [pixels]', 'Slit pos. [pixels]', 'Raster pos. [pixels]', 'Time [seconds]']
  self.menu.naction=5
  self.menu.action=['Zoom','Average along wavelength', 'Average along slit',$
                    'Average along raster posistion', 'Average in Time']
  self.menu.nmode=5
  self.menu.mode=['Detector        ', $
                  'Browser         ', $
                  'Spectroheliogram', $
                  'Whisker         ', $
                  'Intensity map   ']
  self.menu.nparams=4
  self.menu.xtitle='Packet number'
  self.menu.params=['Fine Mirror Position', 'Main Sequence Count', $
                     'MHC exposure duration', 'MHC fine mirror strain gauge']
  self.menu.ytitle=self.params
  return,1
end

pro eis_aux::cleanup
  obj_destroy,self.help
end

pro eis_aux::display_methods,init=init
  if n_elements(init) eq 1 then return
  self.help->display_methods
  return
end

pro eis_aux::display_all,init=init
  if n_elements(init) eq 1 then return
  self.help->display_all
  return
end

pro eis_aux::setwscale, scale,init=init
  if n_elements(init) eq 1 then return
  self.wscale = strtrim(scale,2)
  return
end

function eis_aux::getwscale,init=init
  if n_elements(init) eq 1 then return,-1
  return, self.wscale
end

pro eis_aux::setxytitle, wscale=wscale, sscale=sscale,init=init
  if n_elements(init) eq 1 then return
  if n_elements(wscale) eq 0 then wscale='pixels'
  if n_elements(sscale) eq 0 then begin
    slitscale='pixels'
    rasterscale='step nr'
  endif else begin
    slitscale=sscale
    rasterscale=sscale
  endelse
  self.xytitle[0] = 'Wavelength ['+strtrim(wscale,2)+']'
  self.xytitle[1] = 'Slit pos ['+strtrim(slitscale,2)+']'
  self.xytitle[2] = 'Raster pos ['+strtrim(rasterscale,2)+']'
  self.xytitle[3] = 'Time [sec]'
  return
end

function eis_aux::getnparams,init=init
  if n_elements(init) eq 1 then return,-1
  return, self.nparams
end

function eis_aux::getparams,init=init
  if n_elements(init) eq 1 then return,-1
  return, self.params
end

function eis_aux::getunit,init=init
  if n_elements(init) eq 1 then return,-1
  return, self.units
end

function eis_aux::getfilename,init=init
  if n_elements(init) eq 1 then return,-1
  return, self.filename
end

pro eis_aux::help
  help,self,/obj
  return
end

pro eis_aux::init_aux_methods

  self->init_hw_aux_methods
  self->display_methods,/init
  self->display_all,/init
  self->setwscale,/init
  a=self->getwscale(/init)
  self->setxytitle,/init
  a=self->getnparams(/init)
  a=self->getparams(/init)
  a=self->getunit(/init)
  a=self->getfilename(/init)

  return
end

pro eis_aux__define
  nitem=10
  struct={eis_aux, $
          nparams:0, $
          wscale:'',$
          params:strarr(nitem), $
          filename:' ',$
          units:strarr(nitem), $
          inherits hw_aux}
end
