当前位置: 首页>>代码示例>>Python>>正文


Python Surface.new方法代码示例

本文整理汇总了Python中surface.Surface.new方法的典型用法代码示例。如果您正苦于以下问题:Python Surface.new方法的具体用法?Python Surface.new怎么用?Python Surface.new使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在surface.Surface的用法示例。


在下文中一共展示了Surface.new方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: demo

# 需要导入模块: from surface import Surface [as 别名]
# 或者: from surface.Surface import new [as 别名]
def demo () :
#  vsf = 0.
#  c = 1
    s = 1000.
    kmax = 25
    lmax = 35
    # The following computations define an interesting 3d surface.
    xr = multiply.outer (
       arange (1, kmax + 1, dtype = Float), ones (lmax, Float))
    yr = multiply.outer (
       ones (kmax, Float), arange (1, lmax + 1, dtype = Float))
    zt = 5. + xr + .2 * rand (kmax, lmax)   # ranf (xr)
    rt = 100. + yr + .2 * rand (kmax, lmax)   # ranf (yr)
    z = s * (rt + zt)
    z = z + .02 * z * rand (kmax, lmax)   # ranf (z)
    ut = rt / sqrt (rt ** 2 + zt ** 2)
    vt = zt / sqrt (rt ** 2 + zt ** 2)
    ireg =  multiply.outer ( ones (kmax), ones (lmax))
    ireg [0:1, 0:lmax] = 0
    ireg [0:kmax, 0:1] = 0
    ireg [1:15, 7:12] = 2
    ireg [1:15, 12:lmax] = 3
    ireg [3:7, 3:7] = 0
    freg = ireg + .2 * (1. - rand (kmax, lmax))  # ranf (ireg))
    freg = array (freg, Float)
    #rt [4:6, 4:6] = -1.e8
    z [3:10, 3:12] = z [3:10, 3:12] * .9
    z [5, 5] = z [5, 5] * .9
    z [17:22, 15:18] = z [17:22, 15:18] * 1.2
    z [16, 16] = z [16, 16] * 1.1

    s1 = Surface (z = z, mask = "max", opt_3d = ["wm", "i3"])
    g1 = Graph3d ( s1 , titles = "Surface with contour lines",
                   xyequal = 1., hardcopy = "talk.ps",
                   theta = 45., phi = 10., roll = 0.)
    g1.plot ( )
    paws ( )
    s1.set (opt_3d = ["wm", "f3"])
    g1.change (titles = "Flat mode")
    g1.plot ()
    paws ()
    s1.set (opt_3d = ["wm", "s3"])
    g1.change (titles = "Smooth mode")
    g1.plot ()
    paws ()
    s1.new (x = xr, y = yr, z = z - z [kmax/2, lmax/2],
            mask = "max", opt_3d = ["wm" , "i3"])
    s11 = sslice (s1, Plane (array ( [0., 0., 1.]), array ( [0., 0., 0.])))
    g1.replace (1, s11)
## g1.change ( titles = "Part of surface above xy plane", phi = 30.,
##          y_factor = 2.0,
##          axis_limits = [[0., 0.],[0., 0.], [0., 100000.]])
    g1.change ( titles = "Part of surface above xy plane",
             y_factor = 2.0,
             axis_limits = [[0., 0.],[0., 0.], [0., 100000.]])
    g1.plot ( )
    paws ( )
    s1.set (opt_3d = ["wm", "f3"])
    s11 = sslice (s1, Plane (array ( [0., 0., 1.]), array ( [0., 0., 0.])))
    g1.replace (1, s11)
    g1.change (titles = "Flat mode")
    g1.plot ()
    paws ()
    s1.set (opt_3d = ["wm", "s3"])
    s11 = sslice (s1, Plane (array ( [0., 0., 1.]), array ( [0., 0., 0.])))
    g1.replace (1, s11)
    g1.change (titles = "Smooth mode")
    g1.plot ()
    paws ()
    s1.set (z = z, c = freg, opt_3d = ["wm", "s4"])
## s1 = Surface (x = xr, y = yr, z = z, c = freg, opt_3d = ["wm", "s4"])
    g1.replace (1, s1)
    g1.change ( titles = "Surface colored by mesh values", phi = 20.,
            xyequal = 1,
            axis_limits = [[0., 0.], [0., 0.], [0., 0.], [0., 0.]])
    g1.plot ( )
    paws ( )
    xr1 = zeros ( (16, 7), Float)
    yr1 = zeros ( (16, 7), Float)
    z1 = zeros ( (16, 7), Float)
    zs1 = zeros ( (16, 7), Float)
    for i in range (16) :
        for j in range (7) :
            xr1 [i, j] = xr [i, j+6]
            yr1 [i, j] = yr [i, j+6]
            z1 [i, j] = z [i, j+6]
            zs1 [i, j] = freg [i, j+6]
    s1.set (x = xr1, y = yr1, z = z1, c = zs1)
    g1.change ( titles = "Region 2 colored by mesh values", phi = 10.)
    g1.plot ( )
    paws ( )
    s1.new (x = xr1, y = yr1, z = z1, opt_3d = ["wm", "s3"], mask = "max")
    g1.change ( titles = "Region 2 with mesh and contours", phi = 10.)
    g1.plot ( )
    paws ()
    s1.set (opt_3d = "s3")
    g1.change ( titles = "Region 2 with contours alone")
    g1.plot ()
    paws ( )
    zs1 = zeros ( (16, lmax - 7), Float)
#.........这里部分代码省略.........
开发者ID:mbentz80,项目名称:jzigbeercp,代码行数:103,代码来源:surftest3d.py


注:本文中的surface.Surface.new方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。