;+
; Project     : SOHO - CDS     
;                   
; Name        : GET_QCM
;               
; Purpose     : Retrieve CDS QCM parameters statistics.
;               
; Explanation : Reads QCM parameters log and returns them in a structure.
;               
; Use         : IDL> get_qcm, qcm
;
; Inputs      : None
;               
; Opt. Inputs : None
;
; Outputs     : None
;               
; Opt. Outputs: None
;               
; Keywords    : SHORT - if used, the frequency conversion is for short
;                       accumulations
;
; Calls       : None
;
; Common      : None
;               
; Restrictions: Requires $CDS_ENG_DATA
;               
; Side effects: 
;               
; Category    : Telemetry
;               
; Prev. Hist. : None
;
; Written     : C D Pike, RAL, 13-Nov-95
;               
; Modified    : Include frequency conversion.   CDP, 20-Nov-95
;
; Version     : Version 2, 20-Nov-95
;-            

pro get_qcm, cds_qcm_log, short=short

;
;  initialise the return variable
;
cds_qcm_log = 0

;     
;  has the correct evar been defined
;                                    
if getenv('CDS_ENG_DATA') eq '' then begin
   bell
   print,'$CDS_ENG_DATA is not defined.'
   qcm = 0
   return
endif

;
;  read the QCM parameters log data
;
if file_exist(concat_dir('$CDS_ENG_DATA','qcm_log')) then begin
   restore,concat_dir('$CDS_ENG_DATA','qcm_log')
endif else begin
   bell
   print,concat_dir('$CDS_ENG_DATA','qcm_log')
   print,'QCM log file does not exist.'
   return
endelse

;
;  convert the frequency values
;
if not keyword_set(short) then begin
   cds_qcm_log.freq = long(float(cds_qcm_log.freq)/33.554)
endif else begin
   cds_qcm_log.freq = long(float(cds_qcm_log.freq)/2.097)
endelse

end

