;+
; Get scan information structure from the appropriate I/O object.
; This uses !g.line to determine which I/O object to get the
; information from, unless keep is set, in which case it gets it from
; the keep file.
;
; The fields in the returned structure are:
;
; - SCAN, the scan number, long integer
;
- SUBSCAN, the sub-scan number, long integer
;
- PROCEDURE, the procedure name, string
;
- N_INTEGRATION, the number of integrations, long integer
;
- N_FEEDS, the number of feeds, long integer
;
- N_IFS, the number of IFs, long integer
;
- N_SWITCHING_STATES, the number of switching states, long
; integer
;
;
; @param scan {in}{required}{type=integer} Scan number to get
; information on.
;
; @keyword keep {in}{optional}{type=boolean} If set, the scan
; information comes from the keep file.
;
; @returns Scan information structure. Returns -1 on error.
;
; @version $Id: scan_info.pro,v 1.3 2005/04/20 16:27:41 jbraatz Exp $
;-
FUNCTION scan_info, scan, keep=keep
compile_opt idl2
if (n_elements(scan) eq 0) then begin
message, 'The scan number is required', /info
return, -1
endif
catch, error_status
if (error_status ne 0) then begin
; the only way this should happen is if the
; requested scan wasn't found
message, 'That scan was not found', /info
return, -1
endif
result = -1
if (keyword_set(keep)) then begin
if (!g.lineoutio->is_data_loaded()) then begin
result = !g.lineoutio->get_scan_info(scan)
endif else begin
message, 'There is no data in the keep file',/info
endelse
endif else begin
if (!g.line) then begin
if (!g.lineio->is_data_loaded()) then begin
result = !g.lineio->get_scan_info(scan)
endif else begin
message, 'There is no data in the line file', /info
endelse
endif else begin
if (!g.contio->is_data_loaded()) then begin
result = !g.contio->get_scan_info(scan)
endif else begin
message, 'There is no data in the continuum file', /info
endelse
endelse
endelse
return, result
END