##// END OF EJS Templates
Add numpy profile and update scipy one to conform to np/sp conventions.
Fernando Perez -
Show More
@@ -0,0 +1,24 b''
1 """ IPython 'numpy' profile, to preload NumPy.
2
3 This profile loads the math/cmath modules as well as all of numpy.
4
5 It exposes numpy via the 'np' shorthand as well for convenience.
6 """
7
8 import IPython.ipapi
9 import ipy_defaults
10
11 def main():
12 ip = IPython.ipapi.get()
13
14 try:
15 ip.ex("import math,cmath")
16 ip.ex("import numpy")
17 ip.ex("import numpy as np")
18
19 ip.ex("from numpy import *")
20
21 except ImportError:
22 print "Unable to start NumPy profile, is numpy installed?"
23
24 main()
@@ -1,25 +1,29 b''
1 """ IPython 'sci' profile
1 """ IPython 'scipy' profile, preloads NumPy and SciPy.
2 2
3 Replaces the old scipy profile.
3 This profile loads the math/cmath modules as well as all of numpy and scipy.
4 4
5 It exposes numpy and scipy via the 'np' and 'sp' shorthands as well for
6 convenience.
5 7 """
6 8
7
8 9 import IPython.ipapi
9 10 import ipy_defaults
10 11
11 12 def main():
12 13 ip = IPython.ipapi.get()
13 14
14 15 try:
16 ip.ex("import math,cmath")
15 17 ip.ex("import numpy")
16 18 ip.ex("import scipy")
17 19
20 ip.ex("import numpy as np")
21 ip.ex("import scipy as sp")
22
18 23 ip.ex("from numpy import *")
19 24 ip.ex("from scipy import *")
20 print "SciPy profile successfully loaded."
21 except ImportError:
22 print "Unable to start scipy profile, are scipy and numpy installed?"
23 25
26 except ImportError:
27 print "Unable to start scipy profile, are numpy and scipy installed?"
24 28
25 29 main()
General Comments 0
You need to be logged in to leave comments. Login now