function gt_percentover, item, header=header, string=string, spaces=spaces ; ;+ ;NAME: ; gt_percentover ;PURPOSE: ; To extract and scale the word which tells how many of the pixels were ; over the saturation threshold. ;CALLING SEQUENCE: ; p = gt_percentover(index) ; p = gt_percentover(roadmap, /str) ;INPUT: ; item - The input must be a structure. The structure can ; be the index, or roadmap, or observing log. ;OPTIONAL INPUT: ; string - If present, return the string format ; spaces - If present, place that many spaces before the output ; string. ;OUTPUT: ; returns - The percent of the image which was saturated ;OPTIONAL OUTPUT: ; header - A string that describes the item that was selected ; to be used in listing headers. ;HISTORY: ; Written 28-Oct-93 by M.Morrison ; 29-May-2009 (Aki Takeda) modified to accept FITS header. ;- ; header_array = ['%Img', '???'] ; siz = size(item) typ = siz( siz(0)+1 ) if (typ eq 8) then begin ; tags = tag_names(item) ; (29-May-2009) case 1 of ; (29-May-2009) (tag_exist(item,'GEN',/top)) : out = item.sxt.percentover (tag_exist(item,'SIMPLE',/top)) : out = item.percento else : out = item.percentover endcase end else begin print, 'GT_PERCENTD: Input must be a structure' out = 0 end ; out = fix(out/255.*100+0.5) ;scale to percentage ; fmt = '(i3, "%")' out = gt_conv2str(out, conv2str, conv2short, header_array, header=header, $ string=string, short=short, spaces=spaces, fmt=fmt) ; if (n_elements(out) eq 1) then out = out(0) ;turn it into a scalar return, out end