def computeVectorComponentsAtPoint(v,gs):
    N = len(gs)
    M = len(v)
    w = zeros(N,1)
    for i in range(0,N):
        value = 0.0
        for k in range(0,M):
            value += v[k]*gs[i][k]
        w[i] = value
    return w
Exemplo n.º 2
0
    def assertSimilarFreqs(self, observed, expected, pvalue=0.01, msg=None):
        """Fail if observed p is lower than pvalue"""
        if self._suite_pvalue:
            pvalue = self._suite_pvalue

        obs_ravel = ravel(asarray(observed))
        exp_ravel = ravel(asarray(expected))

        m = zeros((2, len(obs_ravel)))
        m[0, :] = obs_ravel
        m[1, :] = exp_ravel

        G, p = G_ind(m)

        if p > pvalue:
            return
        else:
            raise self.failureException, \
            (msg or 'p-value %s, G-test p %s' % (`pvalue`, `p`))
Exemplo n.º 3
0
-#    print "specjt importing from numpy"
-except:
-    from Numeric import zeros, multiarray
-#    print "specjt importing from Numeric"
-import Image, ImageTk, ImageDraw
+from numpy import zeros
+from numpy.core import multiarray
+from PIL import Image, ImageTk, ImageDraw
 from palettes import colormapblue, colormapgray0, colormapHot, \
      colormapAFMHot, colormapgray1, colormapLinrad, Colormap2Palette
 #import wsjt                         #Is this OK to do?
@@ -76,7 +72,7 @@
 ttot=0.0
 
 c=Canvas()
-a=zeros(225000,'s')
+a=zeros(225000,'uint16')
 im=Image.new('P',(750,300))
 line0=Image.new('P',(750,1))      #Image fragment for top line of waterfall
 draw=ImageDraw.Draw(im)
@@ -330,11 +326,14 @@
             except:
                 print "Images did not match, continuing anyway."
             for i in range(n):
-                line0.putdata(a[750*i:750*(i+1)])   #One row of pixels to line0
+                for j in range(0, 749):
+                    line0.putpixel((j,0), a[750*i+j])
                 im.paste(line0,(0,i))               #Paste in new top line
             nscroll=nscroll+n
         else:                                   #A scale factor has changed
-            im.putdata(a)                       #Compute whole new image
Exemplo n.º 4
0
--- WsprMod/specjt.py.orig	2014-12-15 21:51:30.000000000 -0500
+++ WsprMod/specjt.py	2014-12-15 21:54:38.000000000 -0500
@@ -34,10 +34,8 @@
 import tkinter.messagebox
 from . import w
 
-try:
-    from numpy.oldnumeric import zeros, multiarray
-except:
-    from Numeric import zeros, multiarray
+from numpy import zeros
+from numpy.core import multiarray
 import Image, ImageTk, ImageDraw
 from .palettes import colormapblue, colormapgray0, colormapHot, \
      colormapAFMHot, colormapgray1, colormapLinrad, Colormap2Palette
@@ -94,7 +92,7 @@
 ttot=0.0
 
 c=Canvas()
-a=zeros(225000,'s')
+##a=zeros(225000,'s')
 im=Image.new('P',(750,300))
 line0=Image.new('P',(750,1))      #Image fragment for top line of waterfall
 draw=ImageDraw.Draw(im)