	FUNCTION SENSOR_CALIB, MAGNITUDE, BITS, PY
;+
; Project     :	SOHO - CDS
;
; Name        :	SENSOR_CALIB
;
; Purpose     :	Calibrate sun sensor telemetry
;
; Category    :	Class4, Telemetry, Instrument
;
; Explanation :	Puts the magnitude and bits part of the sun sensor data back
;		together again, and runs it through the calibration procedure.
;
; Syntax      :	Result = SENSOR_CALIB( MAGNITUDE, BITS, PY)
;
; Examples    :	A = READCDSFITS('s3300r00.fits')
;		PITCH = SENSOR_CALIB(A.PITCHDATA(W), A.PTCHBITSDATA(W), 0)
;
; Inputs      :	MAGNITUDE = The magnitude of the sun sensor pitch or yaw data.
;		BITS	  = The other bits of the sun sensor pitch or yaw data
;			    word.
;		PY	  = Either 0 for pitch or 1 for yaw.
;
; Opt. Inputs :	None.
;
; Outputs     :	The result of the function is the calibrated sun sensor data.
;
; Opt. Outputs:	None.
;
; Keywords    :	None.
;
; Calls       :	TM_CALIB
;
; Common      :	None.
;
; Restrictions:	None.
;
; Side effects:	None.
;
; Prev. Hist. :	None.
;
; History     :	Version 1, 23-Aug-1996, William Thompson, GSFC
;
; Contact     :	WTHOMPSON
;-
;
	ON_ERROR, 2
;
	IF N_PARAMS() NE 3 THEN MESSAGE,	$
		'Syntax:  Result = SENSOR_CALIB( MAGNITUDE, BITS, PY )'
;
	SENSOR = ISHFT(FIX(BITS),12) OR MAGNITUDE
	CASE PY OF
		0: RETURN, TM_CALIB('BKMFPIT', SENSOR)
		1: RETURN, TM_CALIB('BKMFYAW', SENSOR)
		ELSE:  MESSAGE, 'PY must be either 0 (pitch) or 1 (yaw)'
	ENDCASE
	END
