Revision: 6331
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6331&view=rev
Author:   fer_perez
Date:     2008-10-25 03:44:44 +0000 (Sat, 25 Oct 2008)

Log Message:
-----------
Updated skeletons and mkprob to report number of lines missing.

Modified Paths:
--------------
    trunk/py4science/examples/mkprob.py
    trunk/py4science/examples/skel/fft_imdenoise_skel.py
    trunk/py4science/examples/skel/qsort_skel.py
    trunk/py4science/examples/skel/quad_newton_skel.py
    trunk/py4science/examples/skel/trapezoid_skel.py

Modified: trunk/py4science/examples/mkprob.py
===================================================================
--- trunk/py4science/examples/mkprob.py 2008-10-25 03:37:12 UTC (rev 6330)
+++ trunk/py4science/examples/mkprob.py 2008-10-25 03:44:44 UTC (rev 6331)
@@ -91,9 +91,9 @@
             # Add the summary of 'raise' lines
 
             # flush counter of code (disabled, we report static summary)
-            #msg = '1 line' if del_lines==1 else ('%s lines' % del_lines)
-            #exc = exc_tpl % msg
-            exc = exc_tpl
+            msg = '1 line' if del_lines==1 else ('%s lines' % del_lines)
+            exc = exc_tpl % msg
+            #exc = exc_tpl
 
             # Use the last value of 'space'
             line = '%s%s' % (spaces[0],exc)
@@ -104,8 +104,8 @@
         return del_lines
 
     # used to report actual # of lines removed - disabled
-    #exc_tpl = "raise NotImplementedError('%s missing')\n"
-    exc_tpl = "raise NotImplementedError('insert missing code here')\n"
+    exc_tpl = "raise NotImplementedError('Original solution has %s')\n"    
+    #exc_tpl = "raise NotImplementedError('insert missing code here')\n"
 
     # states for state machine and other initialization
     normal,delete = 0,1
@@ -241,7 +241,7 @@
 
     clean = """
     first line
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
     second line
     """
 
@@ -279,12 +279,12 @@
     first line
     # Hint: remember that
     # idea we discussed before...
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 3 lines')
     second line:
-      raise NotImplementedError('insert missing code here')
+      raise NotImplementedError('Original solution has 2 lines')
     third line
 
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 2 lines')
     """
     cleaned = src2skel(srclines)
     yield str_match,cleaned,clean

Modified: trunk/py4science/examples/skel/fft_imdenoise_skel.py
===================================================================
--- trunk/py4science/examples/skel/fft_imdenoise_skel.py        2008-10-25 
03:37:12 UTC (rev 6330)
+++ trunk/py4science/examples/skel/fft_imdenoise_skel.py        2008-10-25 
03:44:44 UTC (rev 6331)
@@ -17,12 +17,12 @@
     # Compute the magnitude of the input F (call it mag).  Then, rescale mag by
     # amplify/maximum_of_mag.  Numpy arrays can be scaled in-place with ARR *=
     # number.  For the max of an array, look for its max method.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 2 lines')
     
     # Next, clip all values larger than one to one.  You can set all elements
     # of an array which satisfy a given condition with array indexing syntax:
     # ARR[ARR<VALUE] = NEWVALUE, for example.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
     # Display: this one already works, if you did everything right with mag
     plt.imshow(mag, plt.cm.Blues)
@@ -39,7 +39,7 @@
         # - extract all rows, all columns, 0-th plane to get the first
         # channel
         # - the resulting array should have 2 dimensions only
-        raise NotImplementedError('insert missing code here')
+        raise NotImplementedError('Original solution has 1 line')
         print "Image shape:",im.shape
     except:
         print "Could not open image."
@@ -48,7 +48,7 @@
     # Compute the 2d FFT of the input image
     # Hint: Look for a 2-d FFT in np.fft.
     # Note: call this variable 'F', which is the name we'll be using below.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
     # In the lines following, we'll make a copy of the original spectrum and
     # truncate coefficients.  NO immediate code is to be written right here.
@@ -58,25 +58,25 @@
 
     # Call ff a copy of the original transform.  Numpy arrays have a copy
     # method for this purpose.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
     # Set r and c to be the number of rows and columns of the array.
     # Hint: use the array's shape attribute.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
     # Set to zero all rows with indices between r*keep_fraction and
     # r*(1-keep_fraction):
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
     # Similarly with the columns:
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
     # Reconstruct the denoised image from the filtered spectrum, keep only the
     # real part for display.
     # Hint: There's an inverse 2d fft in the np.fft module as well (don't
     # forget that you only want the real part).
     # Call the result im_new, 
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
     
     # Show the results
     # The code below already works, if you did everything above right.

Modified: trunk/py4science/examples/skel/qsort_skel.py
===================================================================
--- trunk/py4science/examples/skel/qsort_skel.py        2008-10-25 03:37:12 UTC 
(rev 6330)
+++ trunk/py4science/examples/skel/qsort_skel.py        2008-10-25 03:44:44 UTC 
(rev 6331)
@@ -37,13 +37,13 @@
     """
 
     # Hint: remember that all recursive functions need an exit condition
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 2 lines')
 
     # Select pivot and apply recursively
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 3 lines')
 
     # Upon return, make sure to properly concatenate the output lists
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
 
 #-----------------------------------------------------------------------------

Modified: trunk/py4science/examples/skel/quad_newton_skel.py
===================================================================
--- trunk/py4science/examples/skel/quad_newton_skel.py  2008-10-25 03:37:12 UTC 
(rev 6330)
+++ trunk/py4science/examples/skel/quad_newton_skel.py  2008-10-25 03:44:44 UTC 
(rev 6331)
@@ -10,7 +10,7 @@
 # test input function
 def f(t):
     # f(t): t * sin^2(t)
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
 def g(t):
     "Exact form for g by integrating f(t)"
@@ -21,18 +21,18 @@
     "g(t) obtained by numerical integration"
     u = 0.25
     # Hint: use quad, see its return value carefully.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
 # main
 tguess = 10.0
 
 print '"Exact" solution (knowing the analytical form of the integral)'
-raise NotImplementedError('insert missing code here')
+raise NotImplementedError('Original solution has 1 line')
 print "t0, g(t0) =",t0,g(t0)
 
 print
 print "Solution using the numerical integration technique" 
-raise NotImplementedError('insert missing code here')
+raise NotImplementedError('Original solution has 1 line')
 print "t1, g(t1) =",t1,g(t1)
 
 print

Modified: trunk/py4science/examples/skel/trapezoid_skel.py
===================================================================
--- trunk/py4science/examples/skel/trapezoid_skel.py    2008-10-25 03:37:12 UTC 
(rev 6330)
+++ trunk/py4science/examples/skel/trapezoid_skel.py    2008-10-25 03:44:44 UTC 
(rev 6331)
@@ -20,13 +20,13 @@
     # 
     # Hint: if the two inputs have mismatched lengths or less than 2
     # elements, we raise ValueError with an explanatory message.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 4 lines')
 
     # Efficient application of trapezoid rule via numpy
     # 
     # Hint: think of using numpy slicing to compute the moving difference in
     # the basic trapezoid formula.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
 def trapzf(f,a,b,npts=100):
     """Simple trapezoid-based integrator.
@@ -48,20 +48,20 @@
     # what differences in timings result for long vectors x?
 
     # Generate an equally spaced grid to sample the function.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
     # For an equispaced grid, the x spacing can just be read off from the first
     # two points and factored out of the summation.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
     # Sample the input function at all values of x
     # 
     # Hint: you need to make an array out of the evaluations, and the python
     # builtin 'map' function can come in handy.
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
     # Compute the trapezoid rule sum for the final result
-    raise NotImplementedError('insert missing code here')
+    raise NotImplementedError('Original solution has 1 line')
 
 
 #-----------------------------------------------------------------------------


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to