;+ ; NAME: ; smei_sky_cleanedge_fov ; PURPOSE: ; Remove straylight from sky just outside edge ; of camera field of view ; CATEGORY: ; ucsd/camera/idl/stars ; CALLING SEQUENCE: PRO smei_sky_cleanedge_fov, $ eq_sky = eq_sky , $ np_sky = np_sky , $ sp_sky = sp_sky , $ time_map = time_map , $ fovx_map = fovx_map , $ degrees = degrees , $ silent = silent ; OPTIONAL INPUT PARAMETERS: ; /degrees if set then the angles in fovx_map are in ; degrees (default: radians) ; /silent controls informational messages ; ; eq_sky=eq_sky array[3600,1200]; type: float ; np_sky=np_sky array[ 800, 800]; type: float ; sp_sky=sp_sky array[ 800, 800]; type: float ; 2D hires sky maps: equatorial, north pole and ; south pole ; time_map=time_map array[720,360]; type: float ; fovx_map=fovx_map array[720,360]; type: float ; 2D lores skymaps: time and fovx angle ; OUTPUTS: ; eq_sky=eq_sky array[3600,1200]; type: float ; np_sky=np_sky array[ 800, 800]; type: float ; sp_sky=sp_sky array[ 800, 800]; type: float ; 2D hires sky maps: equatorial, north pole and ; south pole ; with the straylight contribution from sky ; just outside the fov removed ; OPTIONAL OUTPUT PARAMETERS: ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; InitVar, ToDegrees, ToRadians, IsType, destroyvar, gridgen ; AngleRange ; smei_sky_cleanedge_sample, smei_sky_cleanedge_median ; smei_sky_cleanedge_fix ; PROCEDURE: ; MODIFICATION HISTORY: ; APR-2007, Paul Hick (UCSD/CASS) ; MAY-2007, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Added check for number of valid lores element in time map. ; There should be at least two valid elements in time_sample ;- InitVar, silent , 0 InitVar, degrees , /key dpm = ToDegrees(degrees=degrees) rpm = ToRadians(degrees=degrees) ; A one-degree strip along the edge of the fov is used ; as sample sky brightness throughout the orbit. lo_edge = 29.0/dpm hi_edge = 30.0/dpm ; A 4% fraction of the sample sky brightness is ; subtracted at the outside edge of the fov, ; linearly dropping off to 0% at the inside edge ; 10 degrees into the fov. fraction = 0.04 inside_edge = 20/dpm outside_edge = 30/dpm ; The sample brightness is set up at time_step second ; intervals by taking the median for all skybin within ; +/- time_hbox seconds. time_step = 8 time_hbox = 60 ; Set up a time array with equal steps of time_step seconds ; bracketing the times in the time_map array time_sample = [min(time_map,/nan),max(time_map,/nan)] time_sample = [floor(time_sample[0]/time_step),ceil(time_sample[1]/time_step)] IF time_sample[0] EQ time_sample[1] THEN BEGIN message, /info, 'not enough valid bins along edge' RETURN ENDIF time_sample = gridgen( time_sample[1]-time_sample[0]+1, range=time_sample*time_step ) ;==================== ; Set up the sample sky brightness along the two edges of the fov ; by accumulating sky bins for the three main skymaps destroyvar, left_time, left_sky, right_edge, right_sky IF IsType(eq_sky, /defined) THEN $ ; Equatorial map smei_sky_cleanedge_sample , $ fovx_map , time_map , $ ; Lores direction cosine angle and time maps eq_sky[*,*,0], $ ; Hires sky map lo_edge , hi_edge , $ ; Inner and outer edge of strip used to make sample brightness left_time , left_sky , $ right_time , right_sky, $ mode = 'eq' IF IsType(np_sky, /defined) THEN $ ; Map of north pole smei_sky_cleanedge_sample , $ fovx_map , time_map , $ ; Lores direction cosine angle and time maps np_sky[*,*,0], $ ; Hires sky map lo_edge , hi_edge , $ ; Inner and outer edge of strip used to make sample brightness left_time , left_sky , $ right_time , right_sky, $ mode = 'np' IF IsType(sp_sky, /defined) THEN $ ; Map of south pole smei_sky_cleanedge_sample , $ fovx_map , time_map , $ ; Lores direction cosine angle and time maps sp_sky[*,*,0], $ ; Hires sky map lo_edge , hi_edge , $ ; Inner and outer edge of strip used to make sample brightness left_time , left_sky , $ right_time , right_sky, $ mode = 'sp' ; Done processing the three main skymaps. ; We now have the time and brightness for all bins in the ; hires sky maps inside the selected edge of the fov. ; These need to be reduced to two time series of sky ; brightnesses for the regular time sequence time_sample nsample = n_elements(time_sample) left_edge_present = IsType(left_time , /defined) right_edge_present = IsType(right_time, /defined) ; Left edge. IF left_edge_present THEN left_sample = $ smei_sky_cleanedge_median(left_time , left_sky , time_sample, time_hbox) ; Right edge IF right_edge_present THEN right_sample = $ smei_sky_cleanedge_median(right_time, right_sky, time_sample, time_hbox) ; Now remove the scattered light from the skymaps IF IsType(eq_sky, /defined) THEN $ ; Equatorial map smei_sky_cleanedge_fix , $ fovx_map , time_map , $ ; Lores direction cosine angle and time maps eq_sky , $ ; Hires sky map inside_edge , outside_edge , $ ; Inner and outer edge of band in need of fixing fraction , time_sample , $ left_sample , right_sample , $ mode = 'eq' IF IsType(np_sky, /defined) THEN $ ; Map of north pole smei_sky_cleanedge_fix , $ fovx_map , time_map , $ ; Lores direction cosine angle and time maps np_sky , $ ; Hires sky map inside_edge , outside_edge , $ ; Inner and outer edge of band in need of fixing fraction , time_sample , $ left_sample , right_sample , $ mode = 'np' IF IsType(sp_sky, /defined) THEN $ ; Map of south pole smei_sky_cleanedge_fix , $ fovx_map , time_map , $ ; Lores direction cosine angle and time maps sp_sky , $ ; Hires sky map inside_edge , outside_edge , $ ; Inner and outer edge of band in need of fixing fraction , time_sample , $ left_sample , right_sample , $ mode = 'sp' RETURN & END