;+ ; NAME: ; smei_sky_cleanedge_median ; PURPOSE: ; Converts the data for sky bins in a one-degree strip ; of sky along the left or right edge of the fov ; (collected by href=smei_sky_cleanedge_sample) into ; a time series at times time_sample ; CATEGORY: ; camera/idl/toolbox ; CALLING SEQUENCE: FUNCTION smei_sky_cleanedge_median, time, sky, time_sample, time_hbox ; INPUTS: ; time array[n]; type: float ; times (as seconds since start of orbit) ; for sky bins along left edge of fov. ; sky array[n]; type: float ; sky brightness for sky bins along left ; edge of fov. ; These arrays are output from href=smei_sky_cleanedge_sample= ; time_sample array[m]; type: float ; equal-step array of times covering ; entire orbit. ; OUTPUTS: ; sky_sample array[m]; type: float ; sky brightness at times time_sample ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; BadValue ; PROCEDURE: ; The sky_sample values are the median of all skybins ; within time_hbox seconds of time_sample. ; If no sky bins are present then sky_sample is set to ; BadValue(0.0). ; MODIFICATION HISTORY: ; APR-2007, Paul Hick (UCSD/CASS) ; OCT-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Changed loop variable from short to long integer ;- tmp = sort(time) ; Sort on time time = time[tmp] ; Sorted times sky = sky [tmp] ; Matching sky brightnesses ;twin,/show,/tl,xysize=[600,600] ;plotcurve, left_time, left_sky < 500, psym=1, xstyle=1 ; Collect all skybins within time_hbox of each of the ; times in time_sample and calculate the median. nsample = n_elements(time_sample) sky_sample = replicate(BadValue(0.0), nsample) FOR i=0L,nsample-1 DO BEGIN t = time_sample[i] n = where( t-time_hbox LT time AND time LT t+time_hbox AND finite(sky) ) IF n[0] NE -1 THEN sky_sample[i] = median(sky[n]) ENDFOR ;whatis, left_sample ;twin,/show,/tr,xysize=[600,600] ;plotcurve, time_sample, left_sample, psym=1, xstyle=1 RETURN, sky_sample & END