function gt_pfi_ffi, item, header=header, string=string, short=short, spaces=spaces, $ ffi=ffi, true_ffi=true_ffi ; ;+ ;NAME: ; gt_pfi_ffi ;PURPOSE: ; To extract the word corresponding to the observing region and optionally ; return a string variable for that item. ;CALLING SEQUENCE: ; x = gt_pfi_ffi(roadmap) ; x = gt_pfi_ffi(index) ; x = gt_pfi_ffi(index.sxt, /space) ;put single space before string ; x = gt_pfi_ffi(index, space=3) ;put 3 spaces ;METHOD: ; The input can be a structure or a scalar. The structure can ; be the index, or roadmap, or observing log. ;INPUT: ; item - A structure or scalar. It can be an array. ;OPTIONAL INPUT: ; string - If present, return the string mnemonic (long notation) ; short - If present, return the short string mnemonic ; spaces - If present, place that many spaces before the output ; string. ; ffi - If set, return a 1 if the image is an FFI and return ; a 0 if it is a PFI (PFI strip or observing region). ; true_ffi- If set, return a 1 if the image is an FFI and return ; a 0 if it is a PFI (PFI strip or observing region). ; This option will also check if it is an FFI strip ; or if it is a PFI which was extracted from an FFI. ;OUTPUT: ; returns - The observing region, a integer value or a string ; value depending on the switches used. It is a vector ; if the input is a vector ;OPTIONAL OUTPUT: ; header - A string that describes the item that was selected ; to be used in listing headers. ;HISTORY: ; Written 13-Nov-91 by M.Morrison ; 23-Nov-92 (MDM) - Added /FFI option ; 16-Aug-93 (MDM) - Added /TRUE_FFI option ; 04-Jun-2009 (Aki Takeda) - modified to accept FITS headers. ;- ; header_array = ['Image ', 'Img'] conv2str = ['PFI-Raw', 'FFI ', 'PFI-OR ', 'FFI-Pat'] conv2short = ['PFI', 'FFI', 'PFI', 'FFI'] ffi_lookup = [0, 1, 0, 1] ; if (n_params(0) eq 0) then begin print, 'String Output for GET_PFI_FFI' for i=0,3 do print, i, ' ', conv2str(i), ' ', conv2short(i) return, '' end ; siz = size(item) typ = siz( siz(0)+1 ) if (typ eq 8) then begin ;Check to see if an index was passed (which has the tag nested) ;or a roadmap or observing log entry was passed ; tags = tag_names(item) ; if (tags(0) eq 'GEN') then out = item.sxt.pfi_ffi $ ; else out = item.pfi_ffi case 1 of ; (4-Jun-2009) (tag_exist(item,'GEN',/top)) : out = item.sxt.pfi_ffi (tag_exist(item,'SIMPLE',/top)) : out = byte(item.pfi_ffi) ; (tag_exist(item,'SIMPLE',/top)) : out = mask(item.pfi_ffi,0,2) else : out = item.pfi_ffi endcase ; end else begin out = item end ; ;---- If the item passed is byte type, then assume that it is a ; raw telemetered value and the item's bits need to be extracted siz = size(out) typ = siz( siz(0)+1 ) if (typ eq 1) then out = mask(out, 0, 2) if (keyword_set(ffi) or keyword_set(true_ffi)) then out = ffi_lookup(out) if (keyword_set(true_ffi)) then begin ; nlin = gt_shape(item, /y) nlin_full = 1024 / 2.^gt_res(item) ss = where(nlin ne nlin_full) if (ss(0) ne -1) then out(ss) = 0 ;not a full FFI ;;ffi_extracted = 0 ;;if (his_exist(index0)) then if (total(index0.his.corner_ext) ne 0) then ffi_extracted = 1 ;PFI taken out of FFI ;;ffi_strip = ((index0.sxt.corner_cmd(1) ne 0) or (index0.sxt.shape_cmd(1) ne 1024/npix)) end ; out = gt_conv2str(out, conv2str, conv2short, header_array, header=header, $ string=string, short=short, spaces=spaces, fmt=fmt) ; return, out end