;+ ; NAME: ; smei_camera_gain ; PURPOSE: ; Returns the camera gain at specified time ; CATEGORY: ; camera/idl/sky ; CALLING SEQUENCE: FUNCTION smei_camera_gain, tt, $ camera = camera , $ zero_time = zero_time , $ zero_gain = zero_gain , $ delta_gain = delta_gain ; INPUTS: ; tt array[n]; type: time structure ; UT time ; OPTIONAL INPUTS: ; camera=camera scalar or array[n]; type: integer; default: 2 ; camera number, 0,1,2,3 ; camera=0 will always return gain=1.00 ; zero_time=zero_time ; array[1]; type: time structure; ; default: TimeSet(yr=2003,doy=0) ; Time origin for gain correction ; zero_gain=zero_gain ; array[4]; type: float; default: 1.0/[0.00,0.97,1.00,0.92] ; gains for "camera 0" and three cameras at time zero_time ; delta_gain=delta_gain ; array[4]; type: float; default: [0.00,-0.005,-0.01,-0.01] ; gain change per year for "camera 0" and three cameras ; OUTPUTS: ; gain array[n]; type: float ; gain correction at specified times ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; TimeSet, TimeOp, TimeUnit, InitVar ; PROCEDURE: ; The sensitivity of the cameras appears to be decreasing at a ; rate of about 1% per year. (But see next paragraph) ; ; JUL-2008: ; From looking at a timeseries of a patch of 31x31 skybins centered on the ; galactic center for the period 2003-2008 we found that the gain for ; camera 1 is decreasing by about 0.5%/year. For camera 2 the original ; number of 1%/year is still acceptable, but may actually be closer to ; 1.1%/year. For camera 3 the current 1%/year may be a bit large, but ; it is not clear by how much. ; ; NOV-2008: ; It was decided to set the gain decrease for camera 1 back to 0.1%/year. ; ; Andy set the time origin for the gain to 2003, doy 0 (NOT doy 1). ; So the time origin is at 2002 Dec 31, 0 UT. ; MODIFICATION HISTORY: ; JUL-2006, Jordan Vaughan, Paul Hick (UCSD/CASS) ; NOV-2007, Paul Hick (UCSD/CASS) ; zero_gain was defined wrong. The gain for camera 1 at zero_time ; is 1.0/0.97 (NOT 0.97); for camera 3 it is 1.0/0.92 (NOT 0.92). ; I.e., cameras 1 and 3 are MORE sensitive than camera 2; ; NOT less sensitive as originally coded. ; DEC-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Gain for camera 1 was set to 0.5% per year for a while. ; On Dec 1 the gain was set back to old value of 1% per year. ; Default tt is now the time origin zero_time (used to crash ; with undefined tt). ;- InitVar, camera , 2 InitVar, zero_time , TimeSet(yr=2003,doy=0) ; Time origin InitVar, zero_gain , 1.0/[1.00,0.97,1.00,0.92] ; Gain factors at time origin InitVar, delta_gain , [0.00,-0.01,-0.01,-0.01] ; Gain decrease (fraction per year) InitVar, tt, zero_time ; Calculate the time difference with zero_time in Julian years dt = TimeOp(/subtract,tt,zero_time,TimeUnit(/year)) dt = float(dt) RETURN, zero_gain[camera]+dt*delta_gain[camera] & END