pro WPLBTREE, basis,Depth,stree, st ;+ ; NAME: ; WPLBTREE ; ; PURPOSE: ; This procedure displays basis tree with decorated branch lengths ; ; CATEGORY: ; Wavelets. ; ; CALLING SEQUENCE: ; WPLBTREE, btree,Depth,stree,st ; ; INPUTS: ; basis = basis tree (e.g. output of BestBasis) ; Depth = max depth of tree ; stree = stat tree of pkt table ; st = signal title ; ; OUTPUTS: ; A plot of tree with height of each branch proportional ; to improvement in cost function obtained by splitting. ; ; ; MODIFICATION HISTORY: ; Written by: Amara Graps November, 1995 ;Translated from MatLab Wavelab routine: plotbasistree.m ;- ;Color of text strings IF !p.background EQ 0 THEN cl = 255 ELSE cl = 0 stack = FLTARR(2^Depth+1, 6) k = 1 stack(k-1, *) = TRANSPOSE([0,0,.5,0,.5,1.]) ; [ d b x y w h ] ; ; get information about splitting costs and tree height ; maxheight = WTREEHGT(stree,Depth,height) ; WLCKAXES, [0, 1, (-maxheight-1), 1] titlestr = 'Basis Tree: ' + STRCOMPRESS(st, /remove_all) xtitle = 'Frequency Domain Splits' ytitle = 'Entropy Drop' first= 'true' ; WHILE (k GT 0) DO BEGIN d = stack(k-1,0) b = stack(k-1,1) x = stack(k-1,2) y = stack(k-1,3) w = stack(k-1,4) h = stack(k-1,5) k=k-1 IF ((basis(WNODE(d,b)-1) EQ 0) ) THEN BEGIN ; terminal node CASE first OF 'true': BEGIN PLOT, [(x-w/10.), (x+w/10.)], [y , y ], $ title = titlestr, xtitle = xtitle, ytitle = ytitle,$ /noerase, color = cl first = 'false' END ELSE: OPLOT, [(x-w/10.), (x+w/10.)], [y , y ] , color = cl ENDCASE ENDIF ELSE BEGIN OPLOT,[(x-w/2.), (x+w/2.)],[y , y ], color = cl h = MAX([height(WNODE(d,b)-1), maxheight/Depth/10.] ) OPLOT, [(x-w/2.) , (x-w/2.)],[y ,(y-h) ], color = cl k = k+1 stack(k-1, *) = TRANSPOSE([(d+1), (2.*b) , (x-w/2.) ,(y-h) , (w/2.) , h]) OPLOT, [(x+w/2.), (x+w/2.)] , [y , (y-h) ], color = cl k = k+1 stack(k-1,*) = TRANSPOSE([(d+1), (2.*b+1) , (x+w/2.) , (y-h) , (w/2.) , h]) END ;else END ;while WULKAXES ; ; Algorithm Source: WaveLab Version 0.600 ; WaveLab WWW site: http://playfair.stanford.edu/ ; WaveLab Questions? e-mail wavelab@playfair.stanford.edu ; END ;of procedure WPLBTREE ;***************************************************