1 """
2 Supplementary or auxiliary Functions
3 """
4 import scipy.special
5
6
7
8
9 interface_pickradius = 3
10 roughness_pickradius = 5
11 flatlayer_pickradius = 5
12 slopelayer_pickradius = 10
13 splinelayer_pickradius = 5
14
15
16 interface_color = 'black'
17 roughness_color = 'black'
18 disable_color = 'gray'
19 active_color = 'red'
20 rho_color = 'black'
21 mu_color = 'green'
22 phi_color = 'blue'
23 theta_color = 'orange'
24 title_color = 'red'
25
26
27
29 """
30 Show error message
31 """
32 import wx
33 msg = wx.MessageDialog(parent, msg, title, wx.ICON_ERROR|wx.OK)
34 msg.ShowModal()
35
36
37
39 """
40 Show Warning message
41 """
42 import wx
43 msg = wx.MessageDialog(parent, msg, title, wx.ICON_WARNING|wx.OK)
44 msg.ShowModal()
45
46
47
49 """
50 Translate the string into float, and check it.
51 """
52 try:
53 val = float(s)
54 except:
55 val = 1.0
56 msg="%s can't change to float"%(s)
57 raise ValueError(msg)
58
59 return val
60
61
63 """
64 Make a second axes overlay ax
65 (or the current axes if ax is None) sharing the xaxis.
66
67 The ticks for ax2 will be placed on the right,
68 and the ax2 instance is returned. See examples/two_scales.py
69
70 Warning: This is a function to simulate the pylab.twinx in WX
71 """
72 if ax == None:
73 return None
74
75 ax2 = ax.figure.add_axes( ax.get_position(), sharex=ax, frameon=False )
76 ax2.yaxis.tick_right()
77 ax2.yaxis.set_label_position('right')
78 ax.yaxis.tick_left()
79
80 return ax2
81
82
92
93
94
96 """
97 Translate a obj parameter into "string" format
98 """
99 if hasattr(f,'build'):
100 return f.build()
101 else:
102 return f
103
104
105
119