PRO leg_to_multi, prefix_in ; Reads in the toga list of gratings and outputs ; a list in multi format ; --- revisions --- ; 5/19/98 dd Modified to correctly calculate the vertices for ; an LEG rhombical cross-section. ;------------------ TAB = STRING(9B) OPENR, leg_unit, prefix_in + '_whs.txt', /GET lines = STRARR(1000) il = 0 while NOT(EOF(leg_unit)) do begin line_in ='' READF, leg_unit, line_in lines(il) = line_in print, lines(il) il = il+1 end CLOSE, leg_unit FREE_LUN, leg_unit lines = lines(0:il-1) OPENW, leg_unit, prefix_in + '_multi.txt', /GET amp_fact = 0.809 ; support structure effect weight = 1./FLOAT(n_elements(lines)) period = 0.9912 for il=0,n_elements(lines)-1 do begin pieces = STR_SEP(lines(il),TAB) h_str = pieces(3) height = 0.0 READS, h_str, height w_str = pieces(4) width = 0.0 READS, w_str, width s_str = pieces(5) slope = 0.0 READS, s_str, slope ; 5/19/98 dd ; 0.5 factor added here because the LEG bars are shaped like: ; ; ------------- ; / | \ ; / height \ ; \ | / ; \ | / ; ------------- --> X (width direction) ; ; so 1/2 of the height determines the "transition" region ; X size. ; x1 = (0.5*height * TAN(!DTOR*(90.0-slope)))/period y1 = height x2 = width/period y2 = height x3 = x1 + x2 y3 = 0.0 vertex_str = STRING(x1,FORMAT='(F8.6)') + TAB + $ STRING(y1,FORMAT='(F8.6)') + TAB + $ STRING(x2,FORMAT='(F8.6)') + TAB + $ STRING(y2,FORMAT='(F8.6)') + TAB + $ STRING(x3,FORMAT='(F8.6)') + TAB + $ STRING(y3,FORMAT='(F8.6)') printf, leg_unit, pieces(0) + TAB + pieces(1) + TAB + $ STRING(weight,FORMAT='(F8.6)') + TAB + $ STRING(amp_fact,FORMAT='(F8.6)') + TAB + $ '0.0' + TAB + '0.0' + TAB + '0.0' + TAB + '3' + TAB + $ vertex_str end CLOSE, leg_unit FREE_LUN, leg_unit RETURN END