##// END OF EJS Templates
small import bug
fperez -
Show More

The requested changes are too big and content was truncated. Show full diff

@@ -1,41 +1,43 b''
1 1 # -*- coding: utf-8 -*-
2 2 """
3 3 Extension for printing Numeric Arrays in flexible ways.
4 4 """
5 5
6 from Numeric import ArrayType
7
6 8 def num_display(self,arg):
7 9 """Display method for printing which treats Numeric arrays specially.
8 10 """
9 11
10 12 # Non-numpy variables are printed using the system default
11 13 if type(arg) != ArrayType:
12 14 self._display(arg)
13 15 return
14 16 # Otherwise, we do work.
15 17 format = __IPYTHON__.runtime_rc.numarray_print_format
16 18 print 'NumPy array, format:',format
17 19 # Here is where all the printing logic needs to be implemented
18 20 print arg # nothing yet :)
19 21
20 22
21 23 def magic_format(self,parameter_s=''):
22 24 """Specifies format of numerical output.
23 25
24 26 This command is similar to Ocave's format command.
25 27 """
26 28
27 29 valid_formats = ['long','short']
28 30
29 31 if parameter_s in valid_formats:
30 32 self.runtime_rc.numarray_print_format = parameter_s
31 33 print 'Numeric output format is now:',parameter_s
32 34 else:
33 35 print 'Invalid format:',parameter_s
34 36 print 'Valid formats:',valid_formats
35 37
36 38 # setup default format
37 39 __IPYTHON__.runtime_rc.numarray_print_format = 'long'
38 40
39 41 # Bind our new functions to the interpreter
40 42 __IPYTHON__.__class__.magic_format = magic_format
41 43 __IPYTHON__.hooks.display = num_display
1 NO CONTENT: modified file
The requested commit or file is too big and content was truncated. Show full diff
General Comments 0
You need to be logged in to leave comments. Login now