Changeset 846
- Timestamp:
- 11/25/15 13:41:25 (6 months ago)
- Location:
- mystic/mystic
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
mystic/mystic/scripts.py
r841 r846 12 12 __all__ = ['model_plotter','log_reader'] 13 13 14 from mpl_toolkits.mplot3d import axes3d15 import matplotlib.pyplot as plt16 from matplotlib import cm17 18 from mystic.munge import read_history19 from mystic.munge import raw_to_support, read_raw_file, read_trajectories20 21 14 # globals 22 15 __quit = False … … 31 24 """ 32 25 try: # if it's a logfile, it might be multi-id 26 from mystic.munge import read_trajectories 33 27 step, param, cost = read_trajectories(source) 34 28 except: # it's not a logfile, so read and return 29 from mystic.munge import read_history 35 30 param, cost = read_history(source) 36 31 return [param],[cost] … … 52 47 53 48 # convert to support format 49 from mystic.munge import raw_to_support 54 50 for i in range(len(params)): 55 51 params[i], costs[i] = raw_to_support(params[i], costs[i]) … … 157 153 if figure is provided, plot to an existing figure 158 154 """ 155 import matplotlib.pyplot as plt 159 156 if not figure: figure = plt.figure() 160 157 ax = figure.gca() … … 188 185 if figure is provided, plot to an existing figure 189 186 """ 187 import matplotlib.pyplot as plt 188 from mpl_toolkits.mplot3d import axes3d 190 189 if not figure: figure = plt.figure() 191 190 … … 242 241 #XXX: need to 'correct' the z-axis (or provide easy conversion) 243 242 243 import matplotlib.pyplot as plt 244 244 fig = plt.figure() 245 245 ax = fig.gca() … … 263 263 """ 264 264 import numpy 265 from matplotlib import cm 265 266 266 267 if y is None: … … 280 281 #XXX: need to 'correct' the z-axis (or provide easy conversion) 281 282 283 import matplotlib.pyplot as plt 284 from mpl_toolkits.mplot3d import axes3d 282 285 fig = plt.figure() 283 286 if surface and fill is None: # 'hidden' option; full 3D surface plot … … 665 668 fig = _draw_trajectory(_x,_y,_c, style=style, scale=scale, shift=shift, figure=fig) 666 669 670 import matplotlib.pyplot as plt 671 from mpl_toolkits.mplot3d import axes3d 667 672 # add labels to the axes 668 673 if surface: kwds = {'projection':'3d'} # 3D … … 844 849 try: 845 850 instance = instance if instance else filename 851 from mystic.munge import read_trajectories 846 852 step, param, cost = read_trajectories(instance) 847 853 except SyntaxError: 854 from mystic.munge import read_raw_file 848 855 read_raw_file(filename) 849 856 msg = "incompatible file format, try 'support_convergence.py'" … … 896 903 #print "conv = %s" % conv 897 904 905 import matplotlib.pyplot as plt 898 906 fig = plt.figure() 899 907 -
mystic/mystic/support.py
r838 r846 12 12 'hypercube_scenario', 'best_dimensions', 'swap'] 13 13 14 from mpl_toolkits.mplot3d import Axes3D as _Axes3D 15 from matplotlib.axes import subplot_class_factory 16 Subplot3D = subplot_class_factory(_Axes3D) 17 18 from mpl_toolkits.mplot3d import axes3d 19 import matplotlib.pyplot as plt 20 from matplotlib import cm 21 22 from mystic.munge import read_history 23 from mystic.munge import raw_to_support, read_trajectories 24 from mystic.tools import factor, flatten 14 # from mpl_toolkits.mplot3d import axes3d 25 15 26 16 # globals … … 31 21 def best_dimensions(n): 32 22 "get the 'best' dimensions (n x m) for arranging plots" 23 from mystic.tools import factor 33 24 allfactors = list(factor(n)) 34 25 from numpy import product … … 393 384 if instance is None: 394 385 instance = parsed_args[0] 386 from mystic.munge import read_history 395 387 params, cost = read_history(instance) 396 388 … … 455 447 dim1,dim2 = best_dimensions(plots + j) 456 448 449 import matplotlib.pyplot as plt 457 450 fig = plt.figure() 458 451 ax1 = fig.add_subplot(dim1,dim2,1) … … 648 641 if instance is None: 649 642 instance = parsed_args[0] 643 from mystic.munge import read_history 650 644 params, _cost = read_history(instance) 651 645 # would be nice to use meta = ['wx','wx2','x','x2','wy',...] … … 737 731 738 732 # correctly bound the first plot. there must be at least one plot 733 import matplotlib.pyplot as plt 734 from mpl_toolkits.mplot3d import Axes3D as _Axes3D 735 from matplotlib.axes import subplot_class_factory 736 Subplot3D = subplot_class_factory(_Axes3D) 739 737 fig = plt.figure() 740 738 ax1 = Subplot3D(fig, dim1,dim2,1) … … 787 785 #steps = [[0,1],[1,2],[2,3],[3,4,5,6,7,8]] or similar 788 786 if flatten: 787 from mystic.tools import flatten 789 788 steps = [list(flatten(steps))] 790 789 … … 944 943 if instance is None: 945 944 instance = parsed_args[0] 945 from mystic.munge import read_history 946 946 params, _cost = read_history(instance) 947 947 # would be nice to use meta = ['wx','wx2','x','x2','wy',...] … … 1043 1043 1044 1044 # correctly bound the first plot. there must be at least one plot 1045 import matplotlib.pyplot as plt 1046 from mpl_toolkits.mplot3d import Axes3D as _Axes3D 1047 from matplotlib.axes import subplot_class_factory 1048 Subplot3D = subplot_class_factory(_Axes3D) 1045 1049 fig = plt.figure() 1046 1050 ax1 = Subplot3D(fig, dim1,dim2,1) … … 1095 1099 #steps = [[0],[1],[3],[8]] or similar 1096 1100 if flatten: 1101 from mystic.tools import flatten 1097 1102 steps = [list(flatten(steps))] 1098 1103 … … 1290 1295 if instance is None: 1291 1296 instance = parsed_args[0] 1297 from mystic.munge import read_history 1292 1298 params, _cost = read_history(instance) 1293 1299 # would be nice to use meta = ['wx','wx2','x','x2','wy',...] … … 1469 1475 1470 1476 # correctly bound the first plot. there must be at least one plot 1477 import matplotlib.pyplot as plt 1478 from mpl_toolkits.mplot3d import Axes3D as _Axes3D 1479 from matplotlib.axes import subplot_class_factory 1480 Subplot3D = subplot_class_factory(_Axes3D) 1471 1481 fig = plt.figure() 1472 1482 if _2D:
Note: See TracChangeset
for help on using the changeset viewer.