Exemplo n.º 1
0
def yCos(parm, r=0):
    """
    parm: (amp,freq,phase,mean)
    amp * N.sin(freq*r + phase(deg)) + mean
    r:    degree (not radian!!)
    """
    a, b, c, d = parm
    r = U.deg2rad(r)
    c = U.deg2rad(c)
    return a * N.cos(b * r + c) + d
Exemplo n.º 2
0
def yCos(parm, r=0):
    """
    parm: (amp,freq,phase,mean)
    amp * N.sin(freq*r + phase(deg)) + mean
    r:    degree (not radian!!)
    """
    a, b, c, d = parm
    r = U.deg2rad(r)
    c = U.deg2rad(c)
    return  a * N.cos(b*r + c) + d
Exemplo n.º 3
0
    def zoomToAll(self):
        if self.m_nImgs < 1:
            return

        posA=N.array(self.m_imgPosArr)
        sizA=N.array(self.m_imgSizeArr)
        a=N.array([N.minimum.reduce(posA),
                   N.maximum.reduce(posA+sizA),
                   ])
        from Priithon.all import U

        MC = N.array([0.5, 0.5]) # mosaic viewer's center (0.5, 0.5)
        a -= MC
        hypot = N.array((N.hypot(a[0][0], a[0][1]),
                         N.hypot(a[1][0], a[1][1])))
        theta = N.array((N.arctan2(a[0][1], a[0][0]),
                         N.arctan2(a[1][1], a[1][0]))) # radians
        phi = theta + U.deg2rad(self.m_rot)
        mimXY = N.array((hypot[0]*N.cos(phi[0]), hypot[0]*N.sin(phi[0])))
        maxXY = N.array((hypot[1]*N.cos(phi[1]), hypot[1]*N.sin(phi[1])))
        a = N.array((mimXY, maxXY))
        a.sort(0)
        if self.m_aspectRatio == -1:
            a = N.array(([a[0][0],-a[1][1]],[a[1][0],-a[0][1]]))

        self.zoomToRect(x0=a[0][0], y0=a[0][1],
                        x1=a[-1][0],y1=a[-1][1])