; used by: ; Get_FUV_2013_lab_calibration_v1 ; Get_UVIS_2015_calibration ; pro cg_get_uvis_cal_modifier, sctime, channel, specmod, wdir ; ; SET THIS PATH TO THE LOCATION OF THE CALIBRATION MODIFIER DATA FILES ; ;wdir_cal_mod = '/Users/holsclaw/Cassini/UVIS/data_file_lists/calibrations/' restore,wdir+'spica_variability4_data.sav' ; ; inputs: ; sctime: Cassini spacecraft time of an observation ; channel: 'EUV' or 'FUV' ; outputs: ; specmod: an vector (1024) of values to multiply by the interpolated lab calibration ; ; calibration modifier times ; sctime_mods = arr.desc.sctime_sec_start nfiles = n_elements(sctime_mods) ; ; determine where the present observation occurred relative to the flat-field modifiers ; ndx_gt = where( sctime_mods gt sctime, count_gt, complement=ndx_lt ) ; ; if all modifiers were obtained after the observation, then return an array of 1's ; if count_gt eq nfiles then begin ;print, '** ' print, '** This observation occurred prior to the calibration modifiers - no adjustment' ;print, '** ' specmod = fltarr(1024) + 1. endif ; ; if all modifiers were obtained before the observation, then use the last modifier ; if count_gt eq 0 then begin specmod = arr[-1].ratio endif ; ; if the observation occurred between two modifiers, then linearly interpolate between the two ; if (count_gt gt 0) and (count_gt lt nfiles) then begin specmod1 = arr[ndx_gt[0]-1].ratio specmod2 = arr[ndx_gt[0]].ratio m = (specmod2-specmod1)/double(sctime_mods[ndx_gt[0]]-sctime_mods[ndx_gt[0]-1]) specmod = m*(sctime-sctime_mods[ndx_gt[0]-1])+specmod1 print, '** The following calibration modifiers were used:' print, '** ', file_basename(arr[ndx_gt[0]-1].filename) print, '** ', file_basename(arr[ndx_gt[0]].filename) print, '** ' endif ;stop ; end