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


Python Pgplot.plot2d方法代码示例

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


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

示例1: greyscale

# 需要导入模块: import Pgplot [as 别名]
# 或者: from Pgplot import plot2d [as 别名]
 def greyscale(self, array2d, **kwargs):
     """
     greyscale(array2d, **kwargs):
         Plot a 2D array as a greyscale image using the same scalings
             as in prepfold.
     """
     # Use the same scaling as in prepfold_plot.c
     global_max = Num.maximum.reduce(Num.maximum.reduce(array2d))
     min_parts = Num.minimum.reduce(array2d, 1)
     array2d = (array2d-min_parts[:,Num.newaxis])/Num.fabs(global_max)
     Pgplot.plot2d(array2d, image='antigrey', **kwargs)
开发者ID:zhuww,项目名称:ubc_AI,代码行数:13,代码来源:prepfold.py

示例2: show_ffdot_plane

# 需要导入模块: import Pgplot [as 别名]
# 或者: from Pgplot import plot2d [as 别名]
def show_ffdot_plane(data, r, z, dr = 0.125, dz = 0.5,
                     numr = 300, numz = 300, T = None, 
                     contours = None, title = None, 
                     image = "astro", device = "/XWIN", norm = 1.0):
   """
   show_ffdot_plane(data, r, z):
       Show a color plot of the F-Fdot plane centered on the point 'r', 'z'.
   """
   ffdp = ffdot_plane(data, r, dr, numr, z, dz, numz)
   ffdpow = spectralpower(ffdp.ravel())
   ffdpow.shape = (numz, numr)
   startbin = int(r - (numr * dr) / 2)
   startz = int(z - (numz * dz) / 2)
   x = np.arange(numr, dtype="d") * dr + startbin
   y = np.arange(numz, dtype="d") * dz + startz
   highpt = np.argmax(ffdpow.ravel())
   hir = highpt % numr
   hiz = highpt / numr
   print ""
   print "Fourier Freqs from ", min(x), "to", max(x), "."
   print "Fourier Fdots from ", min(y), "to", max(y), "."
   print "Maximum normalized power is ", ffdpow[hiz][hir]
   print "The max value is located at:  r =", startbin + hir * dr, \
         "  z =", startz + hiz * dz
   print ""
   if not T:
      Pgplot.plot2d(ffdpow, x, y, labx = "Fourier Frequency (bins)", \
                    laby = "Fourier Frequency Derivative", \
                    title = title, image = image, \
                    contours = contours, device = device)
   else:
      Pgplot.plot2d(ffdpow, x/T, y/(T**2.0), labx = "Frequency (hz)", \
                    laby = "Frequency Derivative (Hz/sec)", \
                    rangex2 = [x[0], x[-1]], rangey2 = [y[0], y[-1]], \
                    labx2 = "Fourier Frequency", \
                    laby2 = "Fourier Frequency Derivative", \
                    title = title, image = image, \
                    contours = contours, device = device)
开发者ID:kernsuite-debian,项目名称:presto,代码行数:40,代码来源:__init__.py

示例3: argmax

# 需要导入模块: import Pgplot [as 别名]
# 或者: from Pgplot import plot2d [as 别名]
 maxarg = argmax(spectralpower(ffd.flat))
 rind = maxarg % numr
 zind = maxarg / numr
 peakr = (rind * dr + int(tryr - (numr * dr) / 2.0))
 peakz = (zind * dz + tryz - (numz * dz) / 2.0)
 peakpow = ffd[zind][rind].real**2 + \
           ffd[zind][rind].imag**2
 if showplots:
     xvals = arange(numr, typecode="d") * dr + \
             int(tryr - (numr * dr) / 2.0)
     yvals = arange(numz, typecode="d") * dz + \
             tryz - (numz * dz) / 2.0
     ffdpow = spectralpower(ffd.flat)
     ffdpow.shape = (numz, numr)
     Pgplot.plot2d(ffdpow, xvals, yvals, \
                   labx="Fourier Freq (bins)", \
                   laby="Fourier Freq Deriv", \
                   image="astro")
     Pgplot.closeplot()
 if debugout:
     print 'peakr = %11.5f  peakz = %11.5f' % \
           (peakr, peakz)
 if (peakpow < 0.2):
     pows[ct] = peakpow
     rmax = peakr
     zmax = peakz
 else:
     [pows[ct], rmax, zmax, rd] = \
                maximize_rz(data, peakr, peakz, \
                            norm=1.0)
 if debugout:
     print 'max_r = %11.5f  max_z = %11.5f' % \
开发者ID:ChrisLaidler,项目名称:presto,代码行数:34,代码来源:monte_ffdot.py


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