-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathultracoldUB.py
60 lines (48 loc) · 1.34 KB
/
ultracoldUB.py
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
54
55
56
57
58
59
60
import sys
import subprocess
from contextlib import contextmanager
import os
@contextmanager
def cd(newdir):
prevdir = os.getcwd()
os.chdir(os.path.expanduser(newdir))
try:
yield
finally:
os.chdir(prevdir)
while True:
print("\nChoose one case:")
print("\t(1) Wavepacket dispersion")
print("\t(2) Dark solitons")
print("\t(3) Bright solitons")
print("Or type 'q' to quit.")
case = raw_input(" > ")
try:
int(case)
except ValueError:
try:
str(case)
except ValueError:
continue
else:
if case == "q" or case == "Q":
sys.exit("End of program")
else:
print("Not an available option.")
continue
else:
if int(case) == 1:
print("Wavepacket dispersion")
with cd('./Wavepackdisper'):
os.system('python gpe_fft_ts_WP_v1.py')
elif int(case) == 2:
print("Dark solitons")
with cd('./darksolitons'):
os.system('python gpe_fft_ts_DS_v1.py')
elif int(case) == 3:
print("Bright solitons")
with cd('./brightsolitons'):
os.system('python gpe_bright_solitons.py')
else:
print("Number must be 1, 2 or 3.")
continue