FUNCTION smei_camera, fov_struct, degrees=degrees, $ camera = camera, $ nsize = nsize, $ center = center, $ optical_axis = optical_axis, $ fov_size = fov_size, $ fov_tosky = fov_tosky, $ fov_toccd = fov_toccd, $ get_nsize = get_nsize, $ get_center = get_center, $ get_optical_axis = get_optical_axis, $ get_fov_size = get_fov_size, $ get_fov_limits = get_fov_limits, $ get_quaternion = get_quaternion, $ get_fov_tosky = get_fov_tosky, $ get_fov_toccd = get_fov_toccd, $ get_structure = get_structure ;+ ; NAME: ; smei_camera ; PURPOSE: ; Defines parameters for the SMEI fov ; CATEGORY: ; SMEI ; CALLING SEQUENCE: ; R = smei_camera(/get_center) ; INPUTS: ; nsize = nsize array[2]; type: long integer; default:[1280,360] ; CCD frame size (pixels) ; center= center array[2]; type: float; default: [631.65, 1233.03] ; x- and y-coordinate of center of field of view arc ; optical_axis array[2]; type: float; default: [-89.5 (deg), 1179.50 (pix)] ; azimuth and radius of optical axis ; identifies the location of the optical axis relative ; to the fov center in terms of polar coordinates. By ; default. The optical axis is near azimuth 270 ; (vertically below the center) at ~ 1200 pixels ; distance. ; fov_size array[2,2]; type: float: default:[30 (deg), 42.5 (pix)]#[-1,1] ; the size of the SMEI fov in polar coordinates ; The fov is ~ 60 degrees in azimuth by 85 pixels ; in the radial direction, and is centered on the ; optical axis. ; quaternion array[4]; type: double: default ; quaternion describing orientation of cameras ; relative to the spacecraft structure. ; fov_tosky array[2,2] type: float ; scaling from CCD coordinates to sky coordinates ; fov_toccd ; ; OPTIONAL INPUT PARAMETERS: ; /get_nsize retrieve frame size ; /get_center retrieve center of field of view arc ; /get_optical_axis retrieve optical axis coordinates ; /get_fov_size retrieve field of view size ; /get_fov_limits retrieve limits of field of view ; /get_quaternion retrieve camera quaternions ; /get_fov_tosky retrieve CCD-to-sky transformation constants ; /get_fov_toccd ; ; /get_structure retrieve structure containing all field of view information ; ; /degrees if set then all angles (input and output) is in degrees ; (default: radians) ; OUTPUTS: ; Output depends on the keyword selection. ; If /get_fov_limits is set the limits of the field of view are returned: ; ; R array[2,2]; type: float ; limiting values in azimuth and radius of the fov ; in the form [[angle1,radius1],[angle2,radius2]]. ; Angle1 and angle2 are in radians between [-!pi,+!pi]. ; The fov runs counterclockwise from 'angle1' to 'angle2'. ; ; If /get_structure is set then a structure is returned containing all ; field of view information: ; ; R array[1]; type: structure ; {SMEI_fov, $ ; camera : camera, ; nsize : nsize, ; center : center, ; axis : optical_axis, ; size : fov_size, ; limits : fov_limits, ; quaternion : quaternion, ; tosky : fov_tosky, ; radial_profile: ptr to radial_profile} ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; ToRadians, ToDegrees, IsType, InitVar, CombineRotations ; SEE ALSO: ; smei_orient_test ; PROCEDURE: ; Default values are used unless other values are specified as input arguments ; The fov limits are calculated from the location of the optical axis and ; the size of the field of view. ; MODIFICATION HISTORY: ; FEB-2000, Paul Hick (UCSD/CASS) ; MAR-2003, Paul Hick (UCSD/CASS) ; Added numbers for flight cameras. ; JAN-2004, Paul Hick (UCSD/CASS) ; Added camera values from Aarons indexing program. These used the center ; values from Andys memo, and camera quaternions obtained by trial-and-error. ; These numbers are now the default. ; FEB-2008, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Update camera quaternions with values used by the Fortran ; SMEI programs. Presumably these are the best we have. ;- rpm = ToRadians(degrees=degrees) dpm = ToDegrees(degrees=degrees) ; Don't remember where these values came from ;def_optical_axis = [-!pi/2/rpm,1200.0] ;def_fov_size = [ !pi/3/rpm, 102.0] ;def_center = [630,1303] ; The values for camera 0 derive from the TMO observations from April/May 2000. ; The width and radius of the optical center were defined by determining ; the radii were the adu/pixel dropped to 2000 (about half of maximum). ; The azimuth of the optical axis puts the fov at equal distance from ; left and right edge of the CCD. ; nsize int array[2]; [nx, ny], # pixels expected for frame in ; engineering (1x1 binning) mode ; center flt array[2]; [px, py], pixel coord for center of polar ; transformation for pixels in fov ; optical axis flt array[2]; [rr, phi], polar coordinates relative to ; 'center' (rr in pixels, angle phi) ; This is the location on the CCD that maps to the optical ; axis (thetax=thetay=0) ; (i.e. the z-axis in the camera coordinate frame) ; fov_size flt array[2]; [dr,dphi], radial and azimuthal extent of ; effective field of view (dr in pixels) ; quaternion dbl array[4]; quaternion [qx,qy,qz,q0] for orientation of ; cameras relative to spacecraft structure. ; This quaternion rotates the UCSD camera frame to the HAFB ; spacecraft frame. (The quaternion in the frame headers ; rotates from ECI frame (=J2000 equatorial coordinates) ; to HAFB spacecraft frame) CASE IsType(fov_struct, /struct) OF 0: BEGIN IF IsType(fov_struct, /generic_int) THEN camera = fov_struct InitVar, camera, 0 def_camera = camera def_nsize = [1272L,256L]+([ [8L,44L], [0L,0L], [0L,0L], [0L,0L] ])[*,camera] ; Set this to 1 to use the Hanscom values. hanscom = 0 CASE hanscom OF 0: BEGIN ; These should be numbers consistent with Aarons indexing program def_center = [630L,1240L]+([ [0d0,51.38d0], [3d0, 1.1d0], [-2.3d0, -1.9d0], [6.7d0, 3.9d0] ])[*,camera] def_axis = [-90d0/dpm,1190d0]+([ [0.5d0/dpm,-10.5d0], [0d0/dpm,3.5d0], [0d0/dpm,-1.5d0], [0d0/dpm,8.5d0] ])[*,camera] def_fov_size = [[-30d0/dpm,-42.5],[30d0/dpm,42.5]]+([ [0/dpm,0,0/dpm,0], [0/dpm,0,0/dpm,0], [0/dpm,0,0/dpm,0], [0/dpm,0,0/dpm,0] ])[*,camera] ; Camera 1 Euler angles [ -28.5, 70.40,-21.50] ; Camera 2 Euler angles ( -86.1, 59.05, -6.75) ; Camera 3 Euler angles [-143.3, 63.43, -0.42] ; 0.5*[-1,-1,-1,1]: UCSD camera frame --> HAFB camera frame ; Combine with : HAFB camera frame --> HAFB spacecraft frame def_quaternion = CombineRotations(/quaternion, 0.5d0*[-1,-1,-1,1], $ ([ [ 0d0, 0d0, 0d0, 1d0], $ ;[0.46770600d0, 0.84823600d0, 0.07246120d0,-0.23768900d0], $ ;[0.01703810d0, 0.96205300d0, 0.04764030d0,-0.26813100d0], $ ;[0.43728600d0,-0.86946200d0,-0.10625900d0, 0.20378100d0]])[*,camera]) [0.46796080d0, 0.84822450d0, 0.07155320d0,-0.23750370d0], $ [0.01748647d0, 0.96205384d0, 0.04594647d0,-0.26839441d0], $ [0.43708150d0,-0.86946470d0,-0.10603300d0, 0.20432280d0]])[*,camera]) END 1: BEGIN def_center = [625L,1233L]+([ [6.65d0,0.03d0], [6.96653d0, 8.6218d0], [0.78564d0, 8.4524d0], [2.96738d0, 4.6987d0] ])[*,camera] def_axis = [-90d0/dpm,1180d0]+([ [0.5d0/dpm,-0.5d0], [0d0/dpm,0.0089d0], [0d0/dpm,-0.1269d0], [0d0/dpm,-1.3462d0] ])[*,camera] def_fov_size = [[-30d0/dpm,-42.5],[30d0/dpm,42.5]]+([ [0/dpm,15,0/dpm,15], [0/dpm,15,0/dpm,15], [0/dpm,15,0/dpm,15], [0/dpm,15,0/dpm,15] ])[*,camera] def_quaternion = CombineRotations(0.5d0*[-1,-1,-1,1], $ ([ [ 0d0, 0d0, 0d0, 1d0], $ [ 0.468077390d0, 0.84666176d0, 0.067758569d0, -0.24387742d0], $ [ 0.017651734d0, 0.96032546d0, 0.045705368d0, -0.27454405d0], $ [-0.438703820d0, 0.86674816d0, 0.104518840d0, -0.21298450d0]])[*,camera], /quaternion) END ENDCASE END 1: BEGIN def_camera = fov_struct.camera def_nsize = fov_struct.nsize def_center = fov_struct.center def_axis = fov_struct.axis def_fov_size = fov_struct.size def_quaternion = fov_struct.quaternion END ENDCASE ; From ray-tracing the radial coordinate maps to a sky angle according to: ; (these results are specific to the TMO data ???) ; ; R-R(axis) = a * Angle + b * Angle^2 ; a = -18.106 pix/degree; b = 0.1712 pix/degree^2 ; ; with R in pixels and Angle in degrees, i.e. positive Angle corresponds ; to smallar radius R. Inverting the relation: ; ; Angle = 1/a * (R-R[axis]) * (1 - b/a^2 * (R-R[axis]) ) ;a = -18.106 * dpm ;b = 0.17120 * dpm*dpm a = -18.0226 * dpm b = 0.1664 * dpm*dpm def_fov_toccd = [[1.0, a], [0.0, b]] ; ?????????????????????? def_fov_tosky = [[1.0,1/a], [0.0,-b/(a*a)]] InitVar, camera , def_camera InitVar, nsize , def_nsize InitVar, center , def_center InitVar, optical_axis , def_axis InitVar, fov_size , def_fov_size InitVar, quaternion , def_quaternion InitVar, fov_tosky , def_fov_tosky InitVar, fov_toccd , def_fov_toccd fov_limits = optical_axis#[1,1]+fov_size InitVar, get_camera , /key InitVar, get_nsize , /key InitVar, get_center , /key InitVar, get_optical_axis, /key InitVar, get_fov_size , /key InitVar, get_fov_limits , /key InitVar, get_quaternion , /key InitVar, get_fov_tosky , /key InitVar, get_fov_toccd , /key InitVar, get_structure , /key CASE 1 OF get_camera : ret = camera get_nsize : ret = nsize get_center : ret = center get_optical_axis: ret = optical_axis get_fov_size : ret = fov_size get_fov_limits : ret = fov_limits get_quaternion : ret = quaternion get_fov_tosky : ret = fov_tosky get_fov_toccd : ret = fov_toccd ELSE : ret = {SMEI_camera_fov, camera:camera, nsize:nsize, center:center, axis:optical_axis, $ size:fov_size, limits:fov_limits, quaternion: quaternion} ;, $ ;tosky:fov_tosky, toccd:fov_toccd, radial_profile:ptr_new(/allocate_heap)} ENDCASE RETURN, ret & END