コード例 #1
0
    def anim():
        global f, dim
        while f <= frames:
            if (not read.check_vertices(ff, polyhedron, N, celltype,
                                        f)) or f == frames:
                if args.save:
                    print("All done.")
                    exit(0)
                f = args.begin
                print("Looping!")
            newdim, newcenters, newshapes, iteration = read.read_vertices(
                ff, polyhedron, N, celltype, f)
            if not args.notext:
                itertext.set(text="%08i" % iteration)
            if args.show_only > 0:
                newshapes = newshapes[:N * args.show_only]
            if partial_cell:
                for i in range(N):
                    if (newcenters[i, 0] < args.xmin
                            or newcenters[i, 0] > args.xmax
                            or newcenters[i, 1] < args.ymin
                            or newcenters[i, 1] > args.ymax
                            or newcenters[i, 2] < args.zmin
                            or newcenters[i, 2] > args.zmax):
                        newshapes[i] = zeros_like(newshapes[i])

            shapes[:] = newshapes.reshape((nvertices, 3))
            src.update()
            if partial_cell:
                newdim[0] = min(dim[0], args.xmax)
                newdim[1] = min(dim[1], args.ymax)
                newdim[2] = min(dim[2], args.zmax)
            if newdim[0] != dim[0]:
                dim = newdim
                cell = mlab.outline(extent=[0, dim[0], 0, dim[1], 0, dim[2]],
                                    color=(0, 0, 0),
                                    line_width=3)
            # fixme : yield screws things up even when args.hide == True
            # if not args.hide:
            # yield
            if args.save:
                print(("saving figs/anim/%s-%4.2f-%s-%i-%i.png" %
                       (celltype, ff, polyhedron, N, f)))
                figure.scene.save("figs/anim/%s-%4.2f-%s-%i-%i.png" %
                                  (celltype, ff, polyhedron, N, f))
            f += args.skip
コード例 #2
0
ファイル: animate_polyhedra.py プロジェクト: droundy/deft
  def anim():
    global f, dim
    while f <= frames:
      if (not read.check_vertices(ff, polyhedron, N, celltype, f)) or f == frames:
        if args.save:
          print("All done.")
          exit(0)
        f = args.begin
        print("Looping!")
      newdim, newcenters, newshapes, iteration = read.read_vertices(ff, polyhedron, N, celltype, f)
      if not args.notext:
        itertext.set(text="%08i" %iteration)
      if args.show_only>0:
        newshapes = newshapes[:N*args.show_only]
      if partial_cell:
        for i in xrange(N):
          if (newcenters[i,0] < args.xmin or newcenters[i,0] > args.xmax or
              newcenters[i,1] < args.ymin or newcenters[i,1] > args.ymax or
              newcenters[i,2] < args.zmin or newcenters[i,2] > args.zmax):
            newshapes[i] = zeros_like(newshapes[i])

      shapes[:] = newshapes.reshape((nvertices, 3))
      src.update()
      if partial_cell:
        newdim[0] = min(dim[0], args.xmax)
        newdim[1] = min(dim[1], args.ymax)
        newdim[2] = min(dim[2], args.zmax)
      if newdim[0] != dim[0]:
        dim = newdim
        cell = mlab.outline(extent=[0, dim[0], 0, dim[1], 0, dim[2]], color=(0,0,0), line_width=3)
      # fixme : yield screws things up even when args.hide == True
      # if not args.hide:
        # yield
      if args.save:
        print("saving figs/anim/%s-%4.2f-%s-%i-%i.png" %(celltype, ff, polyhedron, N, f))
        figure.scene.save("figs/anim/%s-%4.2f-%s-%i-%i.png" %(celltype, ff, polyhedron, N, f))
      f += args.skip
コード例 #3
0
        partial_cell = False
    else:
        partial_cell = True

    # ------------------------------------------------------------------------------
    # Inital plot setup
    # ------------------------------------------------------------------------------
    figure = mlab.figure(bgcolor=(1, 1, 1),
                         fgcolor=(0, 0, 0),
                         size=(1024, 768))

    if args.one_frame > -100:
        f = args.one_frame
    else:
        f = args.begin
    dim, centers, shape_array, iteration = read.read_vertices(
        ff, polyhedron, N, celltype, f)
    if partial_cell:
        for i in range(N):
            if (centers[i, 0] < args.xmin or centers[i, 0] > args.xmax
                    or centers[i, 1] < args.ymin or centers[i, 1] > args.ymax
                    or centers[i, 2] < args.zmin or centers[i, 2] > args.zmax):
                shape_array[i] = zeros_like(shape_array[i])
    if args.shiftx > 0:
        for i in range(len(centers)):
            val = args.shiftx
            centers[i, 0] += val
            if centers[i, 0] > dim[0]:
                centers[i, 0] -= dim[0]
                val -= dim[0]
            shape_array[i, :, 0] += val
コード例 #4
0
ファイル: animate_polyhedra.py プロジェクト: droundy/deft
  if (args.xmin == 0 and args.xmax == 1000 and args.ymin == 0 and args.ymax == 1000 and
      args.zmin == 0 and args.zmax == 1000):
    partial_cell = False
  else: partial_cell = True


  # ------------------------------------------------------------------------------
  # Inital plot setup
  # ------------------------------------------------------------------------------
  figure = mlab.figure(bgcolor=(1,1,1), fgcolor=(0,0,0), size=(1024,768))

  if args.one_frame > -100:
    f = args.one_frame
  else:
    f = args.begin
  dim, centers, shape_array, iteration = read.read_vertices(ff, polyhedron, N, celltype, f)
  if partial_cell:
    for i in xrange(N):
      if (centers[i,0] < args.xmin or centers[i,0] > args.xmax or
          centers[i,1] < args.ymin or centers[i,1] > args.ymax or
          centers[i,2] < args.zmin or centers[i,2] > args.zmax):
        shape_array[i] = zeros_like(shape_array[i])
  if args.shiftx > 0:
    for i in xrange(len(centers)):
      val = args.shiftx
      centers[i,0] += val
      if centers[i,0] > dim[0]:
        centers[i,0] -= dim[0]
        val -= dim[0]
      shape_array[i,:,0] += val