FUNCTION smei_cam2angle, runit, stheta=stheta, rtheta=rtheta, degrees=degrees ;+ ; NAME: ; smei_cam2angle ; PURPOSE: ; Get angles from unit vector in SMEI camera frame ; CATEGORY: ; camera/idl ; CALLING SEQUENCE: ; angle = smei_cam2angle(runit [,stheta=stheta, rtheta=rtheta]) ; INPUTS: ; runit array[3,n]; type: float or double ; x,y,z components of unit vector in UCSD camera frame ; OPTIONAL INPUT PARAMETERS: ; /stheta if set, then the direction cosine angles are returned ; this is the default if no keywords are specified. ; /rtheta if set, then the rotation angles from ; Buffington et al., SPIE 4853, 490, 2002. ; are returned ; OUTPUTS: ; angle array[2,n]; type: double ; requested theta-x and theta-y angles ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; InitVar, ToRadians ; SEE ALSO: ; PROCEDURE: ; /stheta set ; locations in the sky as direction cosine angles theta-x and ; These are the direction cosine angles required by Andy's formulae for ; mapping sky locations to CCD positions ('Defining the field of ; view for the SMEI cameras', A. Buffington, 11 July 2001.) ; !!! These are not the same as the theta-x, theta-y angles ; in Buffington et al., SPIE 4853, 490, 2002. ; /rtheta ; !!! These are the theta-x, theta-y angles ; in Buffington et al., SPIE 4853, 490, 2002. ; i.e. angles used in determining the performance of the baffle, ; incl. the glare. ; MODIFICATION HISTORY: ; MAR-2005, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ;- InitVar, stheta, /key InitVar, rtheta, /key IF NOT rtheta THEN stheta = 1 sz_3 = size(runit) nvec = n_elements(runit)/3 sz_2 = sz_3 sz_2[1] = 2 sz_2[sz_2[0]+2] = nvec*2 runit = reform(runit,3,nvec,/overwrite) xy = runit[ 0:1 ,*] zz = runit[[2,2],*] CASE 1 OF stheta: angle = atan(xy,sqrt(1-xy*xy)*(2*(zz GE 0)-1)) rtheta: angle = atan(xy,zz) ENDCASE angle = angle/ToRadians(degrees=degrees) runit = reform(runit,sz_3[1:sz_3[0]],/overwrite) angle = reform(angle,sz_2[1:sz_2[0]],/overwrite) RETURN, angle & END