function gt_filt1, item, header=header, string=string, short=short, $ spaces=spaces, silent=silent ; ;+ ;NAME: ; gt_filt1 ;PURPOSE: ; To extract info of the Filter Wheel 1 from Hinode/XRT FITS headers. ; This function returns the value of the EC_FW1 tag and optionally ; convert into a string mnemonic. The EC_FW1_ tag (holds filter name ; string) is not used, but checked the consistency with its numeric ; expression (i.e. EC_FW1). ; ;CALLING SEQUENCE: ; print, gt_filt1() ;to list the nemonics ; filt1 = gt_filt1(index) ; filt1 = gt_filt1(index, /string) ; filt1 = gt_filt1(index, /short) ; filt1 = gt_filt1(indgen(6)+1) ;used with menu selection ; filt1 = gt_filt1(index, /space) ;put single space before string ; filt1 = gt_filt1(index, space=3) ;put 3 spaces ; ;INPUT: ; item - A Hinode/XRT FITS structure. It can be an array. If this ; value is not present, a help summary is printed on the ; filter names used. ;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. ; silent - If set, consistency check do not performed ; between EC_FW1 and EC_FW1_. ;OUTPUT: ; returns - The filter selected, 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: ; 18-Jan-2012 Aki Takeda - Modified version of GT_FILTA.PRO ; to work with Hinode/XRT FITS data. ;- ; header_array = ['Filter_Wheel_1', 'FW1'] conv2str = ['Open ', 'Al_poly ', 'C_poly ', 'Be_thin ', $ 'Be_med ', 'Al_med ', ' ???? '] ; 8 characters conv2short = ['Open', 'Apol', 'Cpol', 'Betn', $ 'Bemd', 'Almd', '????'] ; 4 Characters ; if (n_params(0) eq 0) then begin print, 'String Output for GT_FILT1' for i=0,6 do print, i, conv2str(i), conv2short(i), format='(i3, 2x, a8, 2x, a4)' return, '' end ; ;***** check input ***** siz = size(item) typ = siz( siz(0)+1 ) if (typ ne 8) then begin print,'gt_filt1: FITS header structures required.' out='' return, out endif else tags = tag_names(item) ; if (tags(0) ne 'SIMPLE') then begin print,'gt_filt1: FITS header structures required.' out='' return, out endif ; ;***** read tag values ***** if not tag_exist(item,'EC_FW1') then $ if tag_exist(item,'EC_FW1_') then begin out = item.EC_FW1_ print,'gt_filt1: EC_FW1 tag not found. String values returned.' return, out endif else begin print,'gt_filt1: EC_FW1 and EC_FW1_ tags not found.' out='' return, out endelse ; out = item.EC_FW1 ; as initial values ; if tag_exist(item,'EC_FW1') and tag_exist(item,'EC_FW1_') then begin fnum = item.EC_FW1 fstr = item.EC_FW1_ fstr2= gt_conv2str(out, conv2str,/string) for i=0,n_elements(fnum)-1 do begin chk=strpos(fstr2(i),fstr(i)) if (chk eq -1) and not keyword_set(silent) then $ print,'gt_filt1: Detect descrepancy at ', $ anytim(item(i).date_obs,/ecs,/trunc), $ '. EC_FW1: ', strtrim(string(item(i).EC_FW1),2), $ ', EC_FW1_: ',item(i).EC_FW1_ endfor endif ; out = gt_conv2str(out, conv2str, conv2short, header_array, header=header, $ string=string, short=short, spaces=spaces) ; return, out end