-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest_sph.py
More file actions
executable file
·53 lines (47 loc) · 1.6 KB
/
Copy pathtest_sph.py
File metadata and controls
executable file
·53 lines (47 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python2.7
import conquest_stm.plot as plot
__author__ = 'Johan G. McQuillan'
__email__ = 'johan.mcquillan.13@ucl.ac.uk'
lMax = 4
print '3-DIMENSIONAL SPHERICAL HARMONICS'
print ' Enter \'q\' to quit'
quitting = False
while not quitting:
gotL = False
while not gotL and not quitting:
lString = raw_input('Enter Degree, l = ')
if lString == 'q':
quitting = True
else:
try:
l = int(lString)
if l > lMax or l < 0:
raise ValueError
else:
gotL = True
except ValueError:
print 'l must be between an integer between 0 and {} inclusive'.format(lMax)
if not quitting:
if l == 0:
m = 0
else:
gotM = False
while not gotM and not quitting:
if l == 0:
m = 0
else:
mString = raw_input('Enter Order, m = ')
if mString == 'q':
quitting = True
else:
try:
m = int(mString)
if m > l or m < -l:
raise ValueError
else:
gotM = True
except ValueError:
print 'm must be and integer {} and {} inclusive'.format(-l, +l)
if not quitting:
print 'Showing Spherical Harmonic for l={} and m={}'.format(l, m)
plot.plot_sph_3d(l, m)