annotate toolboxes/FullBNT-1.0.7/bnt/examples/dynamic/mk_ps_from_clqs.m @ 0:e9a9cd732c1e tip

first hg version after svn
author wolffd
date Tue, 10 Feb 2015 15:05:51 +0000
parents
children
rev   line source
wolffd@0 1 function mk_ps_from_clqs(dbn, T, cliques, dir)
wolffd@0 2
wolffd@0 3 % Draw multiple copies of the DBN,
wolffd@0 4 % and indicate the nodes in each clique by shading the nodes.
wolffd@0 5 % Generate a series of color postscript files,
wolffd@0 6 % or, if dir=[], displays them to the screen and pauses.
wolffd@0 7
wolffd@0 8 if isempty(dir)
wolffd@0 9 print_to_file = 0;
wolffd@0 10 else
wolffd@0 11 print_to_file = 1;
wolffd@0 12 end
wolffd@0 13
wolffd@0 14 if print_to_file, cd(dir), end
wolffd@0 15 flip = 1;
wolffd@0 16 clf;
wolffd@0 17 [dummyx, dummyy, h] = draw_dbn(dbn.intra, dbn.inter, flip, T, -1);
wolffd@0 18
wolffd@0 19 C = length(cliques);
wolffd@0 20
wolffd@0 21 % nodes = [];
wolffd@0 22 % for i=1:C
wolffd@0 23 % cl = cliques{i};
wolffd@0 24 % nodes = [nodes cl(:)'];
wolffd@0 25 % end
wolffd@0 26 %nodes = unique(nodes);
wolffd@0 27 ss = length(dbn.intra);
wolffd@0 28 nodes = 1:(ss*T);
wolffd@0 29
wolffd@0 30 for c=1:C
wolffd@0 31 for i=cliques{c}
wolffd@0 32 set(h(i,2), 'facecolor', 'r');
wolffd@0 33 end
wolffd@0 34 rest = mysetdiff(nodes, cliques{c});
wolffd@0 35 for i=rest
wolffd@0 36 set(h(i,2), 'facecolor', 'w');
wolffd@0 37 end
wolffd@0 38 if print_to_file
wolffd@0 39 print(gcf, '-depsc', sprintf('clq%d.ps', c))
wolffd@0 40 else
wolffd@0 41 disp(['clique ' num2str(c) ' = ' num2str(cliques{c}) '; hit key for next'])
wolffd@0 42 pause
wolffd@0 43 end
wolffd@0 44 end