function eit_findcalgroup, date, dir, start_date = start_date, end_date = end_date ;+ ;NAME ; eit_findcalgroup ;PURPOSE ; finds an averages groups of calibration lamps taken within 24 hours ;INPUTS ; date = date of observation ; dir = search direction. dir>=0 : forward, dir<0 : backwards ;OUTPUTS ; returns an averaged calibration lamp ;KEYWORDS ; start_date = date of the first calibration lamp ; end_date = date of the last calibration lamp ;CREATION ; 18-May-2001. F. Auchere ;MODIFICATIONS ; 2-Jun-2001. F. Auchere : Completely re-written in order to use the new cal lamps data base ; 17-Sep-2001. F. Auchere : Bug fixed ; 11-Jul-2003. J. Newmark : Windows compatibility ;- list = eit_calgroups() delim = get_delim() t0 = double(utc2sec(anytim2utc('01-jan-1996 00:00:00'))) cal_start = strmid(list, 18, 20) cal_end = strmid(list, 41, 20) stcal = double(utc2sec(anytim2utc(cal_start))) - t0 etcal = double(utc2sec(anytim2utc(cal_end))) - t0 time = double(utc2sec(anytim2utc(date))) - t0 bake_on = double(utc2sec(anytim2utc((eit_bakeouts())[*, 0]))) - t0 bake_off = double(utc2sec(anytim2utc((eit_bakeouts())[*, 1]))) - t0 if dir ge 0 then begin cal = where((stcal-time) gt 0, ca) if ca ge 1 then begin cal = cal[0] next_bake = where((bake_on-time) ge 0, ba) if ba ge 1 then begin next_bake = next_bake[0] if bake_on[next_bake] lt etcal[cal] then begin bb = 0 cal = -1 endif endif endif endif else begin cal = where((etcal-time) lt 0, cb) if cb ge 1 then begin cal = cal[cb-1] previous_bake = where((bake_off-time) lt 0, bb) if bb ge 1 then begin previous_bake = previous_bake[bb-1] if bake_off[previous_bake] gt stcal[cal] then begin cb = 0 cal = -1 endif endif endif endelse if cal eq -1 then begin if keyword_set(start_date) then start_date = '' if keyword_set(end_date) then end_date = '' return, -1 endif else begin if keyword_set(start_date) then start_date = cal_start[cal] if keyword_set(end_date) then end_date = cal_end[cal] cal = readfits(getenv('SSWDB')+delim+'soho'+delim+'eit'+delim+'calibrate'+$ delim+strmid(list[cal], 0, 15), /silent) return, cal endelse end
Last revised: - Wed May 9 21:45:11 2007- F. Auchère